Commit Graph

102 Commits

Author SHA1 Message Date
Adam Sampson
17da4db956 Make genActual(s) use the correct abbreviation mode. 2008-04-01 13:16:23 +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
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
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
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
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
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
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
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
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
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
24ddcf6f0d Changed chansToAny to use the makeGeneric pass structure 2008-03-07 23:32:00 +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
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
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
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
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
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
Neil Brown
9ab4563a2c Moved the definition of record types into the forward declarations 2008-02-27 18:25:14 +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
2e6718ac50 Changed all the lists of passes to add pre- and post- properties 2008-02-19 09:43:40 +00:00
Neil Brown
360abc195e Moved the enabling/disabling of passes based on CompState from PassList to the point of the declaration of the passes 2008-02-16 11:09:25 +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
7e7625385d Pulled out various types and definitions from GenerateC into a common module, GenerateCBased 2008-02-08 01:08:42 +00:00
Neil Brown
a143fb75ef Changed all the C/C++ backend functions to stop passing round GenOps everywhere; they now all properly pull it from the monad 2008-02-08 01:01:44 +00:00
Neil Brown
df832b450d Changed the C/C++ backends to read GenOps from a reader-monad rather than passing the ops around (rough draft) 2008-02-08 00:33:44 +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
7433e49d49 Added support for List types to the C and C++ backend, in genType at least 2007-10-27 11:24:24 +00:00
Neil Brown
7f59eec189 Changed the C and C++ backends (and tests) to handle declarations with initialisers properly 2007-10-25 00:27:12 +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
83f654a273 Implemented the code for ClearMobile in the C and C++ backends 2007-10-24 20:54:37 +00:00
Neil Brown
dd86b240b5 Implemented (most of the needed) support for AllocMobile in the C and C++ backends 2007-10-24 19:32:58 +00:00
Neil Brown
9f78582391 Added support for mobile types to the genType functions in the C and C++ backends 2007-10-21 14:37:05 +00:00
Neil Brown
12191cb36a Changed the C and C++ backends to take in a Structured rather than a Process as the top-level item 2007-10-17 13:25:21 +00:00
Neil Brown
30b7cc686b Doubled the stack size for C++CSP processes, in order to get cg test 08 passing 2007-10-14 13:25:31 +00:00
Neil Brown
0fc7ceaf68 Fixed an issue where the size in counted array inputs in C++ was not being correctly calculated 2007-10-14 11:09:35 +00:00
Neil Brown
c19ae03116 Added a pass that changes all C++CSP channels to be of type tockSendableArrayOfBytes, so that the channels can be retyped into each other 2007-10-14 10:28:43 +00:00
Neil Brown
3c101bae19 Removed my old cgmap function, in favour of the identical library function mapM_ 2007-10-14 00:14:19 +00:00
Neil Brown
fd74473b9b Removed a big load of unused code from the C++ code generation, that was related to the old way of handling protocols 2007-10-14 00:08:13 +00:00