Commit Graph

257 Commits

Author SHA1 Message Date
Adam Sampson
17702401fa Rewrite AnalyseAsm's parser.
It now just uses "words" and regular pattern matches rather than regular
expressions. The resulting code is quite a bit simpler, and goes much faster.

I've added some unit tests for it too.
2008-04-05 22:05:17 +00:00
Neil Brown
4ef1ff7196 Changed to a state monad for warnings, and added a runPassM function to remove duplicate code for running passes 2008-04-03 12:21:59 +00:00
Neil Brown
cba72045d7 Added a missing base case for transformActualVariable, when a subscripted variable is passed to a procedure 2008-04-03 11:24:47 +00:00
Neil Brown
20843f70a4 Corrected all the tests to use the new PassM monad 2008-03-10 17:07:48 +00:00
Neil Brown
d66fb79796 Fixed some unused module import warnings, now that PassM is not build of monad transformers 2008-03-10 17:19:45 +00:00
Adam Sampson
17da4db956 Make genActual(s) use the correct abbreviation mode. 2008-04-01 13:16:23 +00:00
Adam Sampson
40bf42e5ea Remove obsolete CGenCall instance. 2008-03-29 23:24:50 +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
986a4acb2b Added support for a StreamReader (to support the input channel from stdin) to the C++CSP backend 2008-03-24 23:46:05 +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
2d0d6463d5 Removed the handling of the old Rain Wait/GetTime items from the backends 2008-03-24 15:08:05 +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
c68aa42277 Added a sub-type to Timers, to support multiple types 2008-03-23 22:20:16 +00:00
Neil Brown
fc4cac736b Added the helper functions for adding and subtracting Times in C++CSP 2008-03-23 13:29:22 +00:00
Neil Brown
cc6dce5ead Tidied up the export/import lists for GenerateC and GenerateCPPCSP 2008-03-23 12:40:06 +00:00
Neil Brown
bc7e682119 Added a Concat operator for lists, and added support for it (and list assignment) to the backends 2008-03-21 19:20:15 +00:00
Neil Brown
80ffc87f94 Added a newline at the end of the generated C++ files 2008-03-21 18:47:09 +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
839d92546b Altered the backends to support lists and foreach loops over lists (at least in the C++ part) 2008-03-19 17:20:52 +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
1124bb5a44 Use either Alt or TimerAlt as appropriate. 2008-03-15 15:15:21 +00:00
Adam Sampson
54668d3ba2 Implement the RESCHEDULE intrinsic. 2008-03-15 11:00:11 +00:00
Adam Sampson
4a68dda2b5 Clean up the generation of wrapper Procs for Pars.
Procs that are in csParProcs are now generated with the correct calling
convention directly, rather than having a second wrapper function generated
around them.
2008-03-14 22:01:59 +00:00
Adam Sampson
9c2a6b6656 Handle both addl and subl for stack increases.
GCC seems to very occasionally generate addl -N rather than subl N.

Also don't allow subl -N any more -- if it's adjusting the stack pointer back
up, that doesn't mean it's going to use any less of the stack...
2008-03-14 22:00:36 +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
3996a1379b Update BackendPassesTest to match my last _sizes change. 2008-03-13 10:52:23 +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
Adam Sampson
88af6a29d2 Abstract CCSP setup into a function, and set up terminal properly.
If stdin is in use, it'll now be put into non-canonical mode. This is almost
the same as libkrocif's behaviour, except I've set VTIME to 0, since I don't
think there's a good reason to have a terminal read complete if no characters
are available.

This also sets CCSP's branding to "Tock", so error messages now start "Tock: ".
2008-03-12 14:38:58 +00:00
Adam Sampson
f2d3280cee Abstract killing TLP channel handlers out into a function. 2008-03-12 10:47:19 +00:00
Adam Sampson
8880413128 Use TimerAlt rather than Alt.
It really ought to pick the right one depending on whether there are any timer
guards.
2008-03-11 18:52:35 +00:00
Adam Sampson
7eaab68f04 Implement TLP output channels using a CIF helper process.
Input channels will be similar, but are stubbed out for now.
2008-03-11 18:47:48 +00:00
Adam Sampson
882d0c002a Remove debugging code. 2008-03-11 17:43:54 +00:00
Neil Brown
c778ff0031 Fixed some unused module import warnings, now that PassM is not build of monad transformers 2008-03-10 17:19:45 +00:00
Neil Brown
9f18b348e8 Corrected all the tests to use the new PassM monad 2008-03-10 17:07:48 +00:00
Neil Brown
6abda39ee2 Fixed a couple of uses of the PassM monad that depended on the old mechanism 2008-03-10 15:19:28 +00:00
Adam Sampson
8aae275895 Fix ALT enabling in the C backend. 2008-03-10 11:38:25 +00:00
Neil Brown
0b93e67ca3 Fixed the last load of backend tests, for specs and actuals 2008-03-09 19:32:09 +00:00
Neil Brown
9b2f6b9e2b Updated a couple of the retypes-sizes tests for the backend 2008-03-09 19:23:46 +00:00
Neil Brown
9533fa9926 Reversed the effect of an earlier patch (to put timers back in the C++ backend) now that I've seen Adam's patch that fixes it anyway 2008-03-09 19:04:34 +00:00
Neil Brown
76aeabe747 Fixed genRetypesSizes to work properly again with arrays with a non-fixed dimension (oops) 2008-03-09 18:54:37 +00:00
Neil Brown
f8cd341cd8 Fixed the tests for array slicing 2008-03-09 18:21:16 +00:00
Neil Brown
e90ea48baa Fixed the test for genOverArray, to test arrays with fixed and unknown dimensions 2008-03-09 17:26:37 +00:00
Neil Brown
7dc379cb86 Fixed a test relating to initialising channel arrays 2008-03-09 17:25:50 +00:00
Neil Brown
3189c066b5 Fixed genRetypeSizes and its associated tests in light of the new array sizes passes 2008-03-09 16:58:05 +00:00
Neil Brown
dd14f6b62a Fixed one of the tests for declareSizesArray that had not been updated 2008-03-09 16:57:38 +00:00
Neil Brown
668983f1e5 Adjusted the tests for the new type of genArraySubscript 2008-03-09 16:20:06 +00:00
Neil Brown
0265063250 Re-added the index checking for array slices in the backend 2008-03-09 16:19:01 +00:00
Neil Brown
3d1945b517 Changed the code handling SizeVariable to output the size as an integer if it is known 2008-03-09 16:18:13 +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