Neil Brown
24f646f5b8
Changed if statements so that they generate a simpler if when no specs are involved
...
Fixes #16 . If there are no Spec or ProcThen items in an if, a much simpler if (without gotos or similar) is generated.
2009-01-18 19:33:01 +00:00
Neil Brown
949c88bb75
Added support for the canonicalisation of simple Expressions
...
This seems to have fixed a couple more normal tests, and goes towards fixing the randomly failing quickcheck test (but that test is not fixed, yet)
2009-01-18 00:20:14 +00:00
Neil Brown
536d0b19a6
Fixed all the failing C++CSP tests for input and output so that they now pass
2009-01-17 22:20:52 +00:00
Neil Brown
8174e86366
Made the usage checking on PARs for plain variables ignore the variables declared inside the branches of that PAR
2009-01-17 19:05:31 +00:00
Neil Brown
d9cfa9135d
Made sure that timer variables are always considered read-only when passed around
...
This fixes a usage checking problem in cgtest08 where the variable would be considered written-to in parallel because it was passed twice in parallel (and not marked as a VAL abbrev)
2009-01-17 16:25:08 +00:00
Neil Brown
6f22d8a573
Stopped the pulling up of fully-resolved array expressions where one of the subscripts is a slice
...
This was causing a problem in the C/C++ backends, where the slice function call was having _sizes appended to it. So now we pull up anything that results in an array, or is a slice.
2009-01-15 22:44:11 +00:00
Neil Brown
dd57fdccbd
Made a small change to sort multiplied expressions into order during flattening in the usage checking
...
This makes sure that y*x and x*y are both flattened into x*y, but doesn't yet solve the problem of (x*y)*z vs (y*z)*x
2009-01-15 22:18:27 +00:00
Neil Brown
f7e05c2714
Made sure that the usage checking on plain variables checks anything that doesn't have a replicator in it
...
This means that things like a[0][0] are once again covered by the plain variable check, which means that some more tests now pass.
2009-01-15 21:37:28 +00:00
Neil Brown
9d1dfb7f5f
Stopped arrays being pulled up when all the indices have been supplied
2009-01-15 21:36:05 +00:00
Neil Brown
9105a95508
Added the debug printing of the usage checking problems to be solved
2009-01-15 21:03:04 +00:00
Neil Brown
e6d9a88e14
Changed the CSM constraint on the various messages to CSMR
2009-01-15 21:00:27 +00:00
Neil Brown
0a98db5295
Changed pshow on CompState (which caused errors) to plain show, by adding a Show instance to CompState
2009-01-15 20:59:37 +00:00
Neil Brown
e20671e44f
Fixed a couple more array usage tests
2009-01-15 19:37:37 +00:00
Neil Brown
de153283a3
Stopped duplicate background knowledge being added in the equation generation, thus fixing some tests
2009-01-15 18:39:08 +00:00
Neil Brown
155714abcb
Changed the ArrayUsageCheckTest module to supply background knowledge about the replicators to the equation generation
2009-01-15 18:38:13 +00:00
Neil Brown
46a1cc311f
Moved a couple of fields related to Rain type checking out of CompState and into a temporary StateT monad for the appropriate pass
2008-12-02 20:59:26 +00:00
Neil Brown
80c99d3bd7
Fixed another use of Map.lookup in the tests
2008-11-28 11:38:29 +00:00
Neil Brown
b48129d4e5
Fixed some uses of Map.lookup that used the old system of it working with any monad (in GHC 6.10, it's always Maybe)
2008-11-28 11:38:06 +00:00
Neil Brown
ee62c604fc
Renamed our permutations function to permutation to avoid a conflict with a new GHC 6.10 function
2008-11-28 11:28:39 +00:00
Neil Brown
09e0e46ec2
Added some comments to my changes to GenericUtils
2008-11-25 18:06:14 +00:00
Neil Brown
77b75e3134
Fixed a couple of outdated comments by checkUnusedVar
2008-11-25 17:43:16 +00:00
Neil Brown
ce03f2ca27
Fixed the nasty hack of checking for _sizes by checking the new NameSource field instead
...
To avoid problems with removing _sizes variables, we simply don't remove any nonce variables.
2008-11-25 17:42:00 +00:00
Neil Brown
0e7a6c5b98
Added a NameSource field for NameDef that indicates where a name comes from
2008-11-25 17:36:42 +00:00
Neil Brown
7fdef8f75a
Added the checkUnusedVar check to the standard pass list
2008-11-25 17:36:23 +00:00
Neil Brown
393bb75eb4
Corrected the accum stuff to rebuild after substitute is called
2008-11-24 10:47:00 +00:00
Neil Brown
5bb528fbc3
Changed from using monoid (which always concatenated) to using prepending, but I'm not sure it's any faster
2008-11-24 10:41:30 +00:00
Neil Brown
4af8845142
Changed checkUnusedVar to use the new forAnyASTStructBottomUpAccum function
2008-11-24 10:30:30 +00:00
Neil Brown
0eab9a216d
Got the forAnyASTStructBottomUpAccum function working properly, but I think list concatenation is a bit slow
2008-11-24 10:29:38 +00:00
Neil Brown
140eda94ee
Shifted some instances for CheckOptASTM to the more general CheckOptASTM'
2008-11-24 10:26:08 +00:00
Neil Brown
c79a1ca94c
Added a missing header include in tock_support.h that the newer GCC complains about
2008-11-23 19:44:37 +00:00
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