Neil Brown
5167535766
Got a messy version of applyAccum to compile, but now need to wire it up and test it
2008-11-23 12:48:15 +00:00
Neil Brown
0275615f5e
Generalised CheckOptFlowM to have the accumulation mechanism, but left it largely unused for now
2008-11-21 21:04:10 +00:00
Neil Brown
373214efb5
Renamed the forAnyAST functions to indicate their top-down nature and refactored doTree/apply slightly
2008-11-21 20:32:04 +00:00
Neil Brown
40318ac152
Changed checkUnusedVar to an incredibly slow version using "fastListify"
...
The problem is that it runs fastListify on a name's scope for every node it encounters, so something like O(M*N). This needs fixing, obviously.
2008-11-21 19:23:37 +00:00
Neil Brown
d529d78846
Added a slightly hacky fastListify function built on top of applyDepthM
2008-11-21 18:54:23 +00:00
Neil Brown
ae7557d623
Corrected a bug in varsTouchedAfter that was related to flowAlgorithm and was causing the odd bug in checkUnusedVar
2008-11-20 15:39:28 +00:00
Neil Brown
be6c57ce5b
Corrected some of my documentation of flowAlgorithm that has repeatedly confused me ever since I wrote it
2008-11-20 15:39:06 +00:00
Neil Brown
e117422c31
Added a couple more tests for checkUnusedVar which has revealed two bugs
...
One of these bugs is that array variables are counted as unused when they are used subscripted. I think that should be solved when we flip back to the listify approach.
The second bug is more interesting, as it is triggered only in a certain arrangement with an IF. It's either a bug in the flow-graph building or in the varsTouchedAfter code.
2008-11-20 15:06:36 +00:00
Neil Brown
5f9bd6b829
Fixed checkUnusedVar to also remove the unused variable from the compiler state
2008-11-20 14:31:29 +00:00
Neil Brown
f60eee19d5
Added some MonadState instances to allow access to the compiler state in the CheckOptM and similar monads
2008-11-20 14:31:16 +00:00
Neil Brown
432d98eaee
Swapped testUnusedVar over to the new occam EDSL, which revealed a flaw in the pass that it was not removing the names from the state
2008-11-20 14:21:36 +00:00
Neil Brown
5f01f12d43
Adjusted testOccamPassWarn to enable all warnings when testing a pass
2008-11-20 14:20:36 +00:00
Neil Brown
558ceec4c2
Wired up the enabling and disabling of warnings
2008-11-20 14:17:11 +00:00
Neil Brown
6cbdc0e13b
Finally merged the list of warnings into CompState rather than having its own StateT monad
2008-11-20 13:35:44 +00:00
Neil Brown
a455676fa9
Added all the necessary command-line options for enabling and disabling warnings in the Main module
2008-11-20 13:26:45 +00:00
Neil Brown
f88c671cf7
Added a set of enabled warnings to CompState
2008-11-20 13:17:05 +00:00
Neil Brown
53240825dd
Changed checkInitVar to use the new CheckFramework stuff, and forAnyFlow (it still passes all its tests)
2008-11-20 13:02:38 +00:00
Neil Brown
0733eb6c11
Added a CheckOptFlowM monad, and a few functions for working with this monad (scanning each node of the AST in turn)
2008-11-20 13:01:48 +00:00
Neil Brown
3638e7b974
Renamed CheckOptM' (which was always a bad name) to CheckOptASTM
2008-11-19 18:24:04 +00:00
Neil Brown
38374320a3
Moved the remainder of the checkInitVar tests over to the new system
2008-11-19 17:25:02 +00:00
Neil Brown
3b57d43eb6
Moved more of the checkInitVar tests to the new system
2008-11-19 17:08:17 +00:00
Neil Brown
810c798dac
Added some copies of the checkInitVar tests that use the new occam EDSL testing instead of the old method
2008-11-19 16:53:13 +00:00
Neil Brown
f4ff507543
Moved wrapProcSeq into the TestUtils module
2008-11-19 16:09:31 +00:00
Neil Brown
3b166490f1
Commented out the debugging output in the check framework and tests
2008-11-19 16:04:25 +00:00
Neil Brown
d81810e506
Tidied up some of the code in the CheckFramework module
2008-11-15 00:23:45 +00:00
Neil Brown
5e909affbb
Corrected the traversal mechanism to continually iterate the function until a fixpoint is reached (indicated by an Either mechanism, rather than an equality test, since the user must substitute explicitly)
2008-11-15 00:04:51 +00:00
Neil Brown
0340fae4ad
Simplified the monad, modification and restart mechanism to both modify the state and modify in place
2008-11-14 23:20:43 +00:00
Neil Brown
fec7510f3a
Stopped warning about the _sizes variables being unused (but do remove them)
2008-11-14 19:30:11 +00:00
Neil Brown
bf2409d311
Got the unused variables pass working, but only by restarting from the root of the AST every time, rather than by navigating to the right spot
2008-11-14 19:23:12 +00:00
Neil Brown
c055b35d68
Simplified the code slightly, since I was wrapping some things in a Maybe that didn't really need to be
2008-11-14 16:45:50 +00:00
Neil Brown
e5ed7e07b7
Fixed the apply function, which (mainly due to having the wrong type signature, but also its use of extTransformRoute) was not as polymorphic as it should have been, which was breaking the traversal (I think it would only work on one Structured type)
2008-11-14 15:30:02 +00:00
Neil Brown
9be287f157
Fixed the C++CSP backend's use of channels (this fixes occam but probably breaks Rain, but I can come back to it later)
2008-11-13 21:00:56 +00:00
Neil Brown
377233b4b0
Switched checkUnusedVar over to use forAnyASTStruct
2008-11-13 20:12:45 +00:00
Neil Brown
16a2be40b4
Made the doTree and similar functions more polymorphic, and added forAnyASTStruct
2008-11-13 20:10:43 +00:00
Neil Brown
048bd26be3
Moved the holding of the route out from RestartT (which now just deals with restarting) and into CheckOptM' (which was previously a fairly needless wrapper)
2008-11-13 19:59:41 +00:00
Neil Brown
594cb6faf3
Changed from giving a full Route as the restart point to just the identifier, since that's all we were using anyway
2008-11-13 19:16:26 +00:00
Neil Brown
6f5c007f18
Fixed the problem, which was that I didn't really want a continuation for restarting, I just wanted to apply the original function at the same point, so I'd been needlessly complicating things
2008-11-13 18:28:47 +00:00
Neil Brown
046ac4a75b
Added a testcase (triple directly nested unused vars) that is failing, presumably due to not restarting the search at the right point
2008-11-13 18:08:36 +00:00
Neil Brown
265181d3c3
Moved all of the sub-functions of forAnyAST to the top-level
2008-11-13 16:43:01 +00:00
Neil Brown
6fc4ac9550
Added a warning when we removed an unused variable
2008-11-13 15:37:02 +00:00
Neil Brown
0d486f108f
Added a value to indicate what type a warning is (to support future configurability) and streamlined the warning functions
2008-11-13 15:36:22 +00:00
Neil Brown
95f6ef2889
Slightly refactored (and commented) the checks framework
2008-11-13 14:55:55 +00:00
Neil Brown
cd41124003
Added another test for unused variables
2008-11-13 14:55:37 +00:00
Neil Brown
713011534f
Corrected the nodes searched during the flow analysis
...
I was searching starting at the current node, but I actually should have started at the terminal node connected to the current node as I need to process all the nodes ahead of me -- but in a backwards flow
2008-11-13 13:02:46 +00:00
Neil Brown
1cf9dfff0e
Implemented getDecl, although it returns a name for all specifications (including typedefs and processes)
2008-11-13 13:02:09 +00:00
Neil Brown
2673ace2d5
Changed the lambda in checkUnusedVar to be an inner function, now that I've removed my code that used to ignore pattern-match failures
2008-11-13 13:01:22 +00:00
Neil Brown
01caa4d9f5
Improved the cached analysis stuff to work with nodes better, allowing the programmer to specify a test for the node label so that the right node is picked based on the route identifier
2008-11-12 18:51:05 +00:00
Neil Brown
44e2699089
Improved the Show instance for UsageLabel
2008-11-12 18:50:25 +00:00
Neil Brown
2a15f4ef5f
Filled in all the gaps such that the CheckTest tests now run (including some debug output, for now)
...
One of the tests fails at the moment because the specification node has two entries associated with it in the flowgraph. One is the scope-in and one is the scope-out. I think the analysis is currently picking the scope-out node and looking beyond that, where -- surprise, surprise -- the variable is not used again. So I need some easy way of telling the flow analyses which of the two nodes I want to start from, in this case and other ones where I also add two nodes related to the same point in the AST.
2008-11-12 16:54:00 +00:00
Neil Brown
76cfb4d8f5
Added route-identifiers for blank AST modifiers in the flow graph
2008-11-12 16:47:15 +00:00