Adam Sampson
1977e7880b
Move evalIntExpression into EvalConstants, now that Types doesn't need it.
...
It now uses the full expression evaluator rather than the literal-only version.
2008-04-06 13:31:37 +00:00
Adam Sampson
3283b7db41
Remove the Type/AbbrevMode information from Actual*.
...
It's redundant, since you can always compute them from the variable, and it
makes the code that deals with actuals rather cleaner.
On the other hand, it slightly complicates some of the tests, because any names
you use in an Actual need to be defined...
2008-03-26 18:16:09 +00:00
Neil Brown
cbbafffbd2
Changed Rain to use the new timer type rather than things like the GetTime statement
2008-03-24 13:50:14 +00:00
Neil Brown
0ed18c933f
Fixed pullUp to not pull up list expressions
...
This patch looks like I removed the wrong line above, but it was identical to the line I actually removed, so the patch is fine, it just looks odd.
2008-03-23 11:49:42 +00:00
Neil Brown
dd7b0268b2
Added a new property (functionTypesChecked) to help fix the pass ordering
2008-03-23 00:09:01 +00:00
Neil Brown
4e9a00a5b7
Added support for for-each replicators to the freeNamesIn function
2008-03-23 00:08:48 +00:00
Adam Sampson
e23a12c71d
Don't resolve user types until after type checking.
...
This is important -- a user type defined as INT in occam must not be treated
the same as INT when typechecking.
2008-03-22 00:12:54 +00:00
Adam Sampson
9cea36257e
Make functionsToProcs depend on expressionTypesChecked.
...
I think in general typechecking needs to happen before any other pass runs,
else the user's likely to get rather confusing error messages.
2008-03-22 00:04:53 +00:00
Neil Brown
f7141bda6f
Corrected transformConstr0
2008-03-21 20:02:33 +00:00
Neil Brown
14e375247c
Added an error message to transformConstr for when the type is not supported
2008-03-21 19:32:07 +00:00
Neil Brown
cfccd38c51
Changed transformConstr to transform list-typed array constructors to build up a list rather than subscripting it
2008-03-21 19:22:29 +00:00
Neil Brown
a1daf15576
Pulled up list expressions in a similar way to array expressions
2008-03-21 19:21:46 +00:00
Neil Brown
da5801ad03
Refactored transformConstr to pull out some of its working into helper functions
2008-03-21 19:13:54 +00:00
Neil Brown
ebef4aaedf
Fixed array constructors by adding an occam pass to figure out their type early on, and also corrected the ordering of the later passes
2008-03-21 18:23:42 +00:00
Neil Brown
b496912c51
Fixed conflicts with Adam's dimension changes
2008-03-19 17:49:32 +00:00
Neil Brown
e2f5d18169
Added a case in pullRepCountSeq for ForEach replicators
2008-03-19 17:15:14 +00:00
Neil Brown
722499b05d
Adjusted the test for transformConstr to work properly with the new array constructor type
2008-03-19 13:29:02 +00:00
Neil Brown
db0467f1ca
Adjusted the rain passes to use the new array constructor type, and weaned a few of them off everywhereM
2008-03-19 13:24:15 +00:00
Neil Brown
cb819d142a
Altered transformConstr to handle array constructors with types in them
2008-03-19 13:23:20 +00:00
Adam Sampson
52d72647ae
Fix the transformConstr0 test by defining x.
2008-03-20 11:23:45 +00:00
Adam Sampson
b1416bb0cf
Change A.Dimension to take an Expression, not an Int.
...
This touches an awful lot of code, but cgtest07/17 (arrays and retyping) pass.
This is useful because there are going to be places in the future where we'll
want to represent dimensions that are known at runtime but not at compile time
-- for example, mobile allocations, or dynamically-sized arrays. It simplifies
the code in a number of places.
However, we do now need to be careful that expressions containing variables do
not leak into the State, since they won't be affected by later passes.
Two caveats (marked as FIXMEs in the source):
- Retypes checking in the occam parser is disabled, since the plan is to move
it out to a pass anyway.
- There's some (now very obvious) duplication, particularly in the backend, of
bits of code that construct expressions for the total size of an array
(either in bytes or elements); this should be moved to a couple of helper
functions that everything can use.
2008-03-18 16:45:38 +00:00
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