Commit Graph

1916 Commits

Author SHA1 Message Date
Neil Brown
a416f7dac9 Fixed the occam type-checker to work with the new channel-ends, adding direction specifiers where necessary
In actual parameters (checking against the formal type), abbreviations (checking against the inferred/specified destination type), and inputs (including inside ALTs) and outputs, direction specifiers are automatically added where needed.  With all the other changes, this seems to compile all the occam 2 cgtests, and cgtest87 (which tests directions) as well as Adam's tests so I'm fairly confident that it was the right thing to do.
2009-01-20 17:30:17 +00:00
Neil Brown
4d692c8897 Fixed the occam and Rain parsers to work with the new channel-ends
For now, I have fixed the occam parser so that it allows 1 or more direction specifiers after channel names.  So c?? is valid, and should end up being equivalent to c?, but this may need altering later.
2009-01-20 17:28:57 +00:00
Neil Brown
de80ab467e Fixed the common Types module to work with the new channel-ends 2009-01-20 17:27:37 +00:00
Neil Brown
336c5abe3c Fixed the ShowCode module to work with the new channel-ends 2009-01-20 17:27:10 +00:00
Neil Brown
541f7c1421 Turned the Chan type into a Chan type for full channels and a ChanEnd type for the directed ends
This is the first patch in the series of many that implement this change throughout Tock.

Fixes #70.
2009-01-20 17:25:19 +00:00
Neil Brown
2137be190b Added a PassMaker function for use when something should only be used with occam and the CCSP backend 2009-01-20 17:24:01 +00:00
Neil Brown
8487af3b4c Added some functions to the C++ support header to aid turning an array of channels into an array of channel-ends 2009-01-20 17:23:10 +00:00
Neil Brown
ee856a0d39 Made the usage checking check if a name was marked by a SHARED pragma before issuing an error 2009-01-19 15:11:42 +00:00
Neil Brown
8a36f6e96f Added support for parsing pragmas, for now just handling the SHARED pragma 2009-01-19 15:11:09 +00:00
Neil Brown
f612b99a49 Added a map of name attributes (ready for things like PRAGMA SHARED) to the CompState
This should possibly (and could in future) be combined into NameDef and the main csNames map
2009-01-19 15:10:05 +00:00
Neil Brown
d3fc6a1a90 Made the size of INT vary between 16-,32- and 64-bit platforms
Fixes #37.  The change itself was very easy, but the main problem was to then go and change everything in GenerateCTest that had been written using A.Int as a test type.
2009-01-18 20:10:19 +00:00
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