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
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
c733ac2cff
Fixed the C++ backends so that it continues to declare timer variables, even though the C backend doesn't any more
2008-03-09 12:48:26 +00:00
Neil Brown
ba75f5b06c
Removed the initialiser expression on the Declaration item in the AST
2008-03-09 00:23:13 +00:00
Adam Sampson
f8d4efa0e9
Go back to generating Time variables for timers.
...
This is for two reasons: first, the C++CSP backend still needs them, and
second, the way I'd done the removal wasn't correct; since you can have arrays
of them, abbreviate them, etc., they need to be stripped out by an earlier
pass so that other passes don't try to operate upon them.
2008-03-09 11:57:43 +00:00
Adam Sampson
35538cda36
Resolve conflicts.
...
This simplifies the formals/actuals stuff enough that most of it can probably
go away (once it's made to work again).
2008-03-08 17:18:22 +00:00
Neil Brown
ba9ac70d7c
Changed the C and C++ backends to write directly to the output file, to save building up the strings in memory
2008-03-08 14:10:05 +00:00
Neil Brown
c87581e490
Tidied up the export list for the GenerateC module
2008-03-08 14:03:10 +00:00
Neil Brown
5197435b2c
Removed a lot of old comments and support code relating to the way arrays used to be handled in the C++ backend
2008-03-08 13:52:50 +00:00
Neil Brown
e1fd001322
Fixed a bug relating to not initialising C channel arrays properly (an over-enthusiastic trimming earlier)
2008-03-08 13:42:36 +00:00
Neil Brown
10effbf8f5
Corrected most of the tests for the C/C++ backends to reflect the recent changes to array handling
2008-03-08 13:19:06 +00:00
Neil Brown
126dcdb4bb
Removed all the unnecessary stuff from the C backend that used to be there for array sizes
2008-03-08 12:36:38 +00:00
Neil Brown
66a7ae9b58
Refactored the C backend, removed the abbrevVariable and genSlice functions
2008-03-08 11:55:56 +00:00
Neil Brown
3c070f035c
Removed the code for initialising members - it is unneeded, and will no longer work until the ensuing _sizes declaration
2008-03-08 00:09:28 +00:00
Neil Brown
a4646f88fa
Removed the C++ version of genDeclaration, deferring instead to the C version
2008-03-08 00:08:19 +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
24ddcf6f0d
Changed chansToAny to use the makeGeneric pass structure
2008-03-07 23:32:00 +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
5a42b7eb0c
Corrected a test for abbreviating array variables
2008-03-07 15:52:05 +00:00
Neil Brown
fdef3b1924
Corrected genVariable to obey checkValid when working out the types for array slices
2008-03-07 15:51:27 +00:00
Neil Brown
ffc4594604
Removed some more unneeded code from GenerateCPPCSP, deferring to the C implementation
2008-03-07 15:49:09 +00:00
Neil Brown
8d411184c1
Corrected the size of array slices
2008-03-07 10:00:02 +00:00
Neil Brown
6106fc13a1
Removed a leftover suffix involved in declaring channel arrays
2008-03-06 21:04:11 +00:00
Neil Brown
4c1f2a1930
Adjusted the C++ (a lot) and C (a little) backends to reflect array _sizes changes, and added the new array passes to the overall pass list
...
Now that I have begun moving all the _sizes stuff forward into proper compiler passes, much of the code for handling arrays in the backends is going to become redundant:
- The tockArrayView class should eventually disappear; now that _sizes are pulled forward, there's no advantage of having this extra class (compared to just doing C and C++ arrays in the same, C-based, style)
- The declaration and use of the _sizes array everywhere should go, now that it is inserted in an earlier pass
I haven't removed as much as I should from the C backend; I am wary to touch it when Adam is about to move it over to the new CIF anyway
2008-03-06 19:08:38 +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
a9692f884a
Added a constructor to record types to help build record literals (especially those that contain array literals)
2008-02-29 16:44:00 +00:00
Neil Brown
8518860cd3
Fixed the handling of Is abbreviations (declaring array sizes)
2008-03-06 17:52:26 +00:00
Neil Brown
bf17347ba2
Added some tests for IsExpr with a statically sized array
2008-03-06 17:51:28 +00:00
Neil Brown
c21fee44d4
Added test for adding sizes to an Is array abbreviation
2008-03-06 17:50:19 +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
264149ef3f
Added some more tests for dynamically sized arrays
2008-03-06 01:49:33 +00:00
Neil Brown
70a207fe6c
Implemented the addSizesActualParameters pass
2008-03-05 23:40:17 +00:00
Neil Brown
8b3edc90ce
Added some limited tests for the addSizesActualParameters pass
2008-03-05 23:39:54 +00:00
Neil Brown
6a5d84ffcd
Implemented the addSizesFormalParameters pass
2008-03-05 22:10:21 +00:00
Neil Brown
3481a3f51d
Finished the tests for the addSizesFormalParameters pass
2008-03-05 22:09:51 +00:00
Neil Brown
6c629b33f7
Added a few types in BackendPassesTest to remove a monomorphism restriction warning
2008-03-05 21:04:42 +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
6a784bffd9
Switch the tests for declareSizesArray to be QuickCheck tests rather than HUnit tests
2008-03-05 16:35:37 +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
30f1b6ecab
Added tests for the declaring of _sizes arrays for record fields
2008-03-04 15:22:03 +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
2f7539bcdb
Convert the C backend to the new CIF API (mostly).
...
Most of this is mechanical: changing function names, and carrying the "wptr"
argument around. I've made the code for computing Expressions from Structureds
a bit more generic too.
The only complex bit is the handling of PAR processes, which I'm not very happy
with at the moment; they used to use the normal C calling convention, but now
you need to pack the arguments into the workspace. I'm handling this at the
moment by generating wrapper functions that do the unpacking, but it would be
better in the future to make the wrapper PROCs that we already generate have
the right interface.
This won't work for programs that use any of the top-level channels yet, since
there are no handlers for them.
2008-03-07 17:50:10 +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
Adam Sampson
8aabb0c98e
Add a missing fold marker.
2008-03-07 17:02:03 +00:00
Neil Brown
20f7666044
Refactored cgenArraySubscript ready to add support for static dimensions
2008-03-01 20:39:45 +00:00
Neil Brown
60daa07b93
Renamed one of the array functions in the function table to be clearer
2008-03-01 20:22:34 +00:00
Neil Brown
01ac2ef21d
Fixed an odd monomorphism restriction warning
2008-03-01 20:13:11 +00:00
Adam Sampson
50967cba95
Split the common C99/C++ support code out into a separate header.
...
Or, rather, add a new CIF-specific header, so tock_support.h is now the common
code and each of the backends has its own. This means some of the conditional
stuff can go away.
2008-03-05 16:54:29 +00:00
Adam Sampson
aff90d8d45
Some initial shuffling to get Tock working with the new CIF.
...
This changes the TLP code to use CCSP's stand-alone mode, and gets rid of the
old KRoC wrapper stuff. It also changes occam_stop everywhere in order to pass
the number of arguments (since ExternalCallN needs that now), and cleans up the
interaction with the C++ backend a bit.
2008-03-05 16:21:20 +00:00
Neil Brown
49585a1922
Added a constructor to record types to help build record literals (especially those that contain array literals)
2008-02-29 16:44:00 +00:00
Neil Brown
24dc839cfb
Added helper functions for PLUS, MINUS and TIMES to help constrain the result types and prevent surprising integer promotions
2008-02-29 00:20: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
b3458ec541
Corrected the pointer indirection for records inside records
2008-02-28 16:08:06 +00:00
Neil Brown
62e45a8909
Added a missed new C/C++ test to the list of tests to run
2008-02-28 15:33:08 +00:00
Neil Brown
d73f2f509c
Added some template types to one of the uses of tockArrayView to please the C++ compiler, and adjusted the tests accordingly
2008-02-28 15:32:26 +00:00
Adam Sampson
8d06c3d180
Various tweaks to the Haddock comments to get it building with 0.8 again.
2008-02-28 14:20:34 +00:00
Neil Brown
7206d45af3
Toned down the amount of suffixes generated for C/C++ integer literals
2008-02-27 18:56:36 +00:00
Neil Brown
63730b5aff
Adjusted the tests for record definitions in the C/C++ backends to use the new function in the dictionary for them
2008-02-27 18:56:09 +00:00
Neil Brown
9ab4563a2c
Moved the definition of record types into the forward declarations
2008-02-27 18:25:14 +00:00
Neil Brown
018951ef40
Fixed the shift behaviour by moving it out into functions like the add and subtract operations already were
2008-02-27 15:13:11 +00:00
Neil Brown
9712df4458
Added a type annotation (esp. for signed types) for hex literals in the C/C++ backends
2008-02-27 14:00:54 +00:00
Neil Brown
9d1c170b34
Added a size suffix to the code generated for C/C++ integer and real literals (where needed)
2008-02-26 18:09:21 +00:00
Neil Brown
0f437dcf0e
Fixed the behaviour of the right-shift operator to match how it should work in occam
2008-02-26 17:20:29 +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
feabd450f0
Fixed a conflict between the prolifing-related changes and the dependence graph
2008-02-24 11:23:29 +00:00