Commit Graph

125 Commits

Author SHA1 Message Date
Neil Brown
c8b724d2be Merged the latest set of changes from the trunk into the Polyplate branch
I also added the import list to all the Data.Generics imports in the tests (as I did for the other modules recently)
2009-04-10 20:38:29 +00:00
Neil Brown
ba2f62114a Fixed the C tests to compile again after the most recent changes 2009-04-01 19:58:47 +00:00
Neil Brown
e91c075bcf Fixed up a lot of the failing tests
I changed a little bit of the code, but mainly the tests.  Several of the remaining failures are actually real failures, so I need to dig through the rest carefully.  A lot are failing because the C++ backend is broken.
2009-04-01 11:49:37 +00:00
Neil Brown
56e5b8da8e A mega-patch that gets tocktest compiling again
However, around a quarter of the tests currently fail...
2009-03-31 17:56:56 +00:00
Neil Brown
e0bec17672 Fixed the tests enough to get them to compile, but a lot fail 2009-03-21 23:05:11 +00:00
Neil Brown
936dc29fde Fixed some of the tests, and added another testcase for array passing, based on one of Carl's examples 2009-03-20 12:59:16 +00:00
Neil Brown
56cd7d73c4 Changed the channel-output code generation so that it knows the desired type being sent 2009-03-20 11:37:52 +00:00
Neil Brown
6afbb80e9f Fixed some of the test modules to work with the new array literals and constructors 2009-02-03 11:19:21 +00:00
Neil Brown
3e8273f4f6 Adjusted the C backend to work with the new step count 2009-01-28 23:51:19 +00:00
Neil Brown
91f004a197 Realised that with channel-ends for C++CSP, I want to use AltChanin everywhere, not Chanin 2009-01-23 18:10:51 +00:00
Neil Brown
1f4796e07f Fixed all the tests to reflect the new channel-end system, such that they all pass again
This is the last patch (for now) of the set implementing the new channel-end system
2009-01-20 17:41:44 +00:00
Neil Brown
d3fc6a1a90 Made the size of INT vary between 16-,32- and 64-bit platforms
Fixes #37.  The change itself was very easy, but the main problem was to then go and change everything in GenerateCTest that had been written using A.Int as a test type.
2009-01-18 20:10:19 +00:00
Neil Brown
24f646f5b8 Changed if statements so that they generate a simpler if when no specs are involved
Fixes #16.  If there are no Spec or ProcThen items in an if, a much simpler if (without gotos or similar) is generated.
2009-01-18 19:33:01 +00:00
Neil Brown
536d0b19a6 Fixed all the failing C++CSP tests for input and output so that they now pass 2009-01-17 22:20:52 +00:00
Neil Brown
0e7a6c5b98 Added a NameSource field for NameDef that indicates where a name comes from 2008-11-25 17:36:42 +00:00
Neil Brown
6cbdc0e13b Finally merged the list of warnings into CompState rather than having its own StateT monad 2008-11-20 13:35:44 +00:00
Adam Sampson
ad875bd477 Fix abbreviation of channel ends in the C backend.
I'm pretty sure this test used to fail and got fixed, but I think the
test was fixed to match the incorrect code rather than the other way
around. What it's testing is the abbreviation of a channel end as an
identically-typed channel end, which (since they're both pointers)
should look something like:

Channel *c;
Channel *d = c;

Instead it was generating "d = &c", which broke cgtest87.

The change made to GenerateC to fix this feels a bit awkward to me --
it's very simple, but it's yet another special case in genVariableAM.
All of the genVariable code could really use reworking (again),
perhaps to use some internal representation of the C expression...
2008-06-09 21:19:01 +00:00
Neil Brown
41ff60cb78 Removed the Rep constructor from Structured and instead added a Rep constructor to SpecType
This way, all replicators are declared like other names, and their scope is considered replicated.  This simplifies the code a little.

Fixes #55
2008-06-04 17:00:43 +00:00
Adam Sampson
36e7353ee7 Take NameType out of NameDef.
NameType is only really needed in the parser, so this takes it out of
NameDef, meaning that later passes defining names no longer need to
set an arbitrary NameType for them. The parser gets slightly more
complicated (because some productions now have to return a SpecType
and a NameType too), but lots of other code gets simpler.

The code that removed free names was the only thing outside the parser
using NameType, and it now makes a more sensible decision based on the
SpecType. Since unscoped names previously didn't have a SpecType at
all, I've added an Unscoped constructor to it and arranged matters
such that unscoped names now get a proper entry in csNames.

Fixes #61.
2008-06-02 10:13:14 +00:00
Neil Brown
3aecc9be3f Quickly fixed an old broken GenerateC test for lists 2008-06-01 17:29:36 +00:00
Adam Sampson
8b3eba594d Add SubscriptCheck field to SubscriptFromFor etc.
This makes it possible to mark a slice as not needing runtime
checking, which is immediately useful for _sizes arrays.

This fixes cgtest03, which was previously failing to compile because
the _sizes array for one of the constants in it contained a runtime
check and thus wasn't itself constant. I've added a testcase file for
the relevant bit of code.
2008-05-26 17:36:26 +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
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
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
2d0d6463d5 Removed the handling of the old Rain Wait/GetTime items from the backends 2008-03-24 15:08:05 +00:00
Neil Brown
c68aa42277 Added a sub-type to Timers, to support multiple types 2008-03-23 22:20:16 +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
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
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
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
668983f1e5 Adjusted the tests for the new type of genArraySubscript 2008-03-09 16:20:06 +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
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
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
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
60daa07b93 Renamed one of the array functions in the function table to be clearer 2008-03-01 20:22:34 +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