Commit Graph

210 Commits

Author SHA1 Message Date
Adam Sampson
b21f020862 Make SimplifyExprs compute the type of the variable it declares.
This lets you say things like:
  VAL []INT xs IS [i = 0 FOR 20 | i]:
and have it figure out that the type of xs is really [20]INT.

This also cleans up the code a very small amount.
2008-03-17 18:33:04 +00:00
Adam Sampson
ca230be268 Use Prop.agg_typesDone rather than listing its members. 2008-03-17 15:47:29 +00:00
Adam Sampson
5156626ab0 Remove the identifyParProcs pass.
All it did was to make a list of the Procs generated by parsToProcs, so
parsToProcs may as well just do the same job itself.

The reason I'd made it a separate pass originally was that I wanted to
optimise out the wrapper when the child of a Par was already a ProcCall.
That optimisation isn't going to be possible any more with the new CCSP,
since wrappers have to fetch their arguments in a different way from
ordinary Procs.
2008-03-14 14:53:05 +00:00
Neil Brown
c1f0ff92c9 Corrected the transformation of AFTER for the BYTE type 2008-03-09 16:26:50 +00:00
Neil Brown
5c43172e46 Added an annotation to array subscripts to indicate whether they should have a run-time check added or not 2008-03-09 14:30:19 +00:00
Neil Brown
ba75f5b06c Removed the initialiser expression on the Declaration item in the AST 2008-03-09 00:23:13 +00:00
Neil Brown
f0fceb5aee Stopped array literals being pulled up out of record literals in C++, now that the array handling has been changed 2008-03-07 15:48:24 +00:00
Neil Brown
08d02bfb17 Changed the behaviour of assignment for records
Previously, assignments of records were directly flattened into assignment of each of the fields.  Now, we instead generate a copy_<recordname> inline procedure for each record definition, and compile code that uses that (for C++, we could even make this an operator= implementation later on).  This allows us to re-use the proc later in the C/C++ backends if needed.
2008-02-29 16:36:47 +00:00
Neil Brown
9ab6cbc0b4 Changed the pullUp function to behave differently for C than C++ (pulling up of array literals inside record literals) 2008-02-29 03:05:52 +00:00
Neil Brown
6d4f1dd702 Added labels to all the top-level tests that didn't have one 2008-02-28 16:11:01 +00:00
Neil Brown
a4424ee82d Fixed a few dependencies in the pass lists relating to functions 2008-02-27 20:05:47 +00:00
Neil Brown
46de1956b3 Corrected the pulling up of SEQ replicator counts to descend properly into nested functions 2008-02-27 19:58:09 +00:00
Neil Brown
86c17fed99 Added a pass for pulling up the replicator counts in SEQs so that the count is constant for the whole loop 2008-02-27 19:33:44 +00:00
Neil Brown
cfc3577c21 Fixed the pre-condition of flattenAssign to include the types being resolved 2008-02-27 18:24:33 +00:00
Neil Brown
b0fac1f82a Made sure that definitions are only pulled up after protocol inputs have been flattened 2008-02-27 17:20:52 +00:00
Neil Brown
af7a15b4df Changed testTransformProtocolInput so that it does transform protocol inputs in ALT guards 2008-02-27 17:20:19 +00:00
Neil Brown
9b521c9b07 Added tests for testing that testTransformProtocolInput transformed protocol inputs in ALTs 2008-02-27 17:19:47 +00:00
Neil Brown
5c7bb1296b Altered transformProtocolInput to only bother flattening inputs with more than one item 2008-02-27 17:01:19 +00:00
Neil Brown
9b570996ca Added a pass to flatten protocol inputs down into multiple sequential input statements 2008-02-27 16:45:27 +00:00
Neil Brown
5dbf7fea7a Changed functionsToProcs to work on the new style of function, and made sure parallel assignment isn't removed first 2008-02-25 22:05:53 +00:00
Neil Brown
f9625ce495 Adjusted the tests for functionsToProcs to include the new style of functions 2008-02-25 22:02:21 +00:00
Neil Brown
1edaacae89 Altered the AST to allow a function to be either an ExpressionList (classical occam) or a Process (Rain/proposed new occam) 2008-02-24 19:29:31 +00:00
Neil Brown
74f3cb7fc2 Removed the export of "m" in TestUtils, instead moving the definition to each module that uses it (less confusing that way) 2008-02-24 18:55:44 +00:00
Neil Brown
5d9e2d8e33 Changed rntState so that it "nulls" the bodies of procs and functions first 2008-02-24 15:54:18 +00:00
Neil Brown
147d799563 Changed the replaceNames function so that it doesn't use everywhere 2008-02-23 18:34:02 +00:00
Neil Brown
2e6718ac50 Changed all the lists of passes to add pre- and post- properties 2008-02-19 09:43:40 +00:00
Neil Brown
3ce0eaf452 Made the first adjustment to the Pass system, ready to introduce properties and a dependency graph. For now passes are still executed in list order 2008-02-16 10:19:14 +00:00
Neil Brown
750612629b Corrected a bug caused by making Structured parameterised, where removeNesting only descended into Structureds the same type as the outer-most Structured (typically A.AST) 2008-02-08 12:11:35 +00:00
Neil Brown
3cb4e80749 Fixed a monomorphism restriction warning in the Unnest module 2008-02-05 22:53:37 +00:00
Neil Brown
acd57d74de Changed the A.Structured type to be parameterised
This patch is actually an amalgam of multiple (already large) patches.  Those patches conflicted (parameterised Structured vs. changes to usage checking and FlowGraph) and encountered a nasty bug in darcs 1 involving exponential time (see http://wiki.darcs.net/DarcsWiki/ConflictsFAQ for more details).  Reasoning that half an hour (of 100% CPU use) was too long to apply patches, I opted to re-record the parameterised Structured changes as this new large patch.  Here are the commit messages originally used for the patches (which, as mentioned, were already large patches):

A gigantic patch switching all the non-test modules over to using parameterised A.Structured
Changed the FlowGraph module again to handle any sort of Structured you want to pass to it (mainly for testing)
A further gigantic patch changing all the tests to work with the new parameterised Structured
Fixed a nasty bug involving functions being named incorrectly inside transformInputCase
Added a hand-written instance of Data for Structured that allows us to use ext1M properly
Fixed a few warnings in the code
2008-02-05 19:40:27 +00:00
Neil Brown
edc3a7e910 Removed the die function (that has no source position) and as far as possible replaced all its uses with dieP and a valid position 2008-01-28 17:21:13 +00:00
Neil Brown
efc69a97cf Moved all the modules related to usage-checking into a new checks directory 2008-01-28 12:25:00 +00:00
Neil Brown
9cd2da3b0e A large change to alter RainUsageCheck to use the code in UsageCheck
Previously there was near-duplicate code in UsageCheck adapted from RainUsageCheck.  This patch removed the duplicate code on the RainUsageCheck side, and resulting in changing the rest of the module (and its corresponding test module) to use the new UsageCheck version of the code.  The net effect is to almost completely unify the passes in RainUsageCheck (which aren't really Rain-specific anyway), UsageCheck and ArrayUsageCheck.
2008-01-27 23:53:42 +00:00
Neil Brown
060c26da84 Added to the export list of UsageCheck 2008-01-27 23:52:06 +00:00
Neil Brown
ad7b4e9736 Began trying to fix the customVarCompare function in UsageCheck 2008-01-27 23:51:49 +00:00
Neil Brown
668ed9531e Fiddled with the Show/showCode capabilities of the newtype Var in UsageCheck 2008-01-27 23:51:16 +00:00
Neil Brown
1cc731a7d8 Changed a little code to use the more appropriate fromMaybe function rather than maybe 2008-01-27 18:37:02 +00:00
Neil Brown
349d3c5811 Merged makeEquations with makeReplicatedEquations and adjusted the tests accordingly 2008-01-27 16:53:07 +00:00
Neil Brown
7276c3cc4a Added proper support for sequential items in non-replicated PARs in the array usage checking 2008-01-27 01:43:42 +00:00
Neil Brown
d37253d2af Improved the error message given by ArrayUsageCheck 2008-01-26 22:57:01 +00:00
Neil Brown
127cdea242 Overhauled the ArrayUsageCheck system to label the resulting problems with the expressions of the two array indexes involved in each problem, and changed the tests accordingly 2008-01-26 22:16:42 +00:00
Neil Brown
7e7395d47f Added test names to some of the tests in ArrayUsageCheckTest 2008-01-26 21:55:02 +00:00
Neil Brown
bdda623d7e Added types to all the cases where the monomorhpism restriction applied 2008-01-26 20:51:11 +00:00
Neil Brown
741a01de5a Removed various tab characters and replaced them with spaces 2008-01-26 19:38:24 +00:00
Neil Brown
ff37613498 Fixed the code so that each PAR groups properly (by edge identifier) but the tests still fail 2008-01-25 18:12:32 +00:00
Neil Brown
8a39eb597c Removed an old comment in ArrayUsageCheck 2008-01-25 17:54:35 +00:00
Neil Brown
90bc9b7033 Implemented checkPar using a graph search, and removed the need for giving it a start node 2008-01-25 17:36:16 +00:00
Neil Brown
f46cabdb22 Cannibalised code from the RainUsageCheck module to implement the labelling functions in the UsageCheck module 2008-01-25 16:34:54 +00:00
Neil Brown
64a9292b75 Moved customVarCompare from ArrayUsageCheck to UsageCheck and used it to derive Ord for the Var type 2008-01-25 16:34:18 +00:00
Neil Brown
c2c761ab7d Added an export list to the UsageCheck module 2008-01-25 16:33:57 +00:00