Commit Graph

87 Commits

Author SHA1 Message Date
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
bbdb429498 Changed transformWaitFor (and its tests) to transform the new InputTimerFor into InputTimerAfter 2008-03-24 15:09:05 +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
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
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
Adam Sampson
006559271d Declare size arrays before the corresponding real arrays.
This is because we sometimes need the size array while initialising the real
array -- for example, if we're initialising a 2D array of channels.
2008-03-12 15:14:00 +00:00
Neil Brown
35b1ffdc51 Added a new pass to turn all array slices into the full FromFor form 2008-03-09 16:15:24 +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
3f02caba7c Changed the handling of retypes with arrays to handle source items with unknown size 2008-03-08 00:06:35 +00:00
Neil Brown
5ae8aca68e Fixed the sizes of retyping a multi-dimensional array 2008-03-07 22:46:39 +00:00
Neil Brown
8d44077891 Refactored and enhanced the declareSizesArray pass 2008-03-07 15:54:10 +00:00
Neil Brown
8d411184c1 Corrected the size of array slices 2008-03-07 10:00:02 +00:00
Neil Brown
a751531b4e Added some comments in declareSizesArray and renamed a variable to be clearer 2008-03-06 19:08:09 +00:00
Neil Brown
588381ee06 Fixed declareArraySizes to also use the size of an array element in its calculations for resizing 2008-03-06 18:40:20 +00:00
Neil Brown
0d638c690a Added some support for declaring sizes for retypes abbreviations (so far, only where the sizes are known at compile-time) 2008-03-06 18:30:29 +00:00
Neil Brown
41eda81ee7 Added some comments to declareSizesArray 2008-03-06 18:23:02 +00:00
Neil Brown
c3e1a32909 Rearranged declareSizesArray to easily support IsExpr 2008-03-06 18:03:49 +00:00
Neil Brown
8518860cd3 Fixed the handling of Is abbreviations (declaring array sizes) 2008-03-06 17:52:26 +00:00
Neil Brown
3d823fb1b5 Fixed the handling of actual array parameters to include array variables inside ActualExpression 2008-03-06 17:34:54 +00:00
Neil Brown
807b219a39 Implemented adding array sizes for Is abbreviations 2008-03-06 15:25:05 +00:00
Neil Brown
a9c2643ad4 Fixed some horribly exponential speculative recursion in one of the passes 2008-03-06 14:20:21 +00:00
Neil Brown
60c7a2dde3 Added a preliminary pass-list for the work on flattening arrays 2008-03-06 09:59:18 +00:00
Neil Brown
a2106a98e7 Fixed some incorrect recursion in the pass for declaring array _sizes 2008-03-06 01:50:01 +00:00
Neil Brown
70a207fe6c Implemented the addSizesActualParameters pass 2008-03-05 23:40:17 +00:00
Neil Brown
6a5d84ffcd Implemented the addSizesFormalParameters pass 2008-03-05 22:10:21 +00:00
Neil Brown
1fef1e64ed Added the beginnings of testing for adding _sizes parameters to PROC definitions (formals) 2008-03-05 17:31:14 +00:00
Neil Brown
2ea7c37abe Added the implementation of declaring _sizes arrays for record fields 2008-03-04 15:22:24 +00:00
Neil Brown
41303eb993 Altered the code and the tests for declareSizesArray to approach what it should be doing 2008-03-03 17:50:57 +00:00
Neil Brown
81ea069707 Added a dummy implementation of a new pass, declareSizesArray, and the tests for it 2008-03-03 15:02:07 +00:00
Adam Sampson
87a1c39411 Fix recursion in identifyParProcs that broke testcases/par.occ.
It wasn't looking for PROC definitions inside Specs. This is a good example of
a pass that really wants a trimmed "everywhere"/"contexts" rather than explicit
recursion.
2008-03-07 17:28:30 +00:00
Neil Brown
feabd450f0 Fixed a conflict between the prolifing-related changes and the dependence graph 2008-02-24 11:23:29 +00:00
Neil Brown
635f7bf1b0 Changed the backend passes in BackendPasses to not use the everywhere(M) function 2008-02-23 18:33:16 +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
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
6b95827cab Added an optional initialiser-expression to Declaration in the AST, and changed the rest of the code accordingly 2007-10-24 23:50:00 +00:00
Neil Brown
8d95b65f00 Added support for the new AlternativeWait guards to the C backend
This was not as straightforward as the C++ backend.  CIF has no capability for supporting waiting *for* a specified time as an ALT guard; only waiting until (AFTER, in occam) a specified time.  This is further complicated by the fact that when you disable an ALT timer guard in CIF, you have to be able to supply the timeout value that you waited on in the enable sequence.

Therefore, I added a pass that transforms all WaitFor guards into WaitUntil guards, by declaring nonce time variables, getting the time, and adding on the delay that we want to wait for; these actions occur just before the ALT.

This new pass is in the new BackendPasses module, into which I also moved the identifyParProcs pass.  I also wrote tests for my new pass that live in the new BackendPassesTest module.
2007-09-27 11:48:04 +00:00