Commit Graph

147 Commits

Author SHA1 Message Date
Neil Brown
8f767ff0d4 Made all the imports of Data.Generics have an import list
This makes sure that we catch all leftover instances of using SYB to do generic operations that we should be using Polyplate for instead.  Most modules should only import Data, and possibly Typeable.
2009-04-09 15:36:37 +00:00
Neil Brown
d49c7fad4a Fixed all the modules in the backends directory to work with the new Pass system 2008-12-14 18:32:34 +00:00
Neil Brown
debdef4f4f Fixed the generation of directed channels for the C++ backend 2009-04-08 19:14:29 +00:00
Neil Brown
41d52320de Corrected the C++ backend to obey csHasMain, and stop generating duplicate definitions for externally-originating classes 2009-04-08 16:45:51 +00:00
Neil Brown
5a7f68a44f Removed some of the old C generation functions, and added a new one (genFunctionCall) to get the C++ backend compiling again 2009-04-08 16:07:01 +00:00
Neil Brown
6d6d26d5d6 Fixed the backends to work with the new system (mainly removing unnecessary code) 2009-04-05 23:06:47 +00:00
Neil Brown
e457d82f0c Changed FUNCTIONs and PROCs to have optional bodies, and put all the externals into the AST (without bodies)
This may seem like an odd change, but it simplifies the logic a lot.  I kept having problems with passes not operating on externals (e.g. functions-to-procs, adding array sizes, constant folding in array dimensions) and adding a special case every time to also process the externals was getting silly.

Putting the externals in the AST therefore made sense, but I didn't want to just add dummy bodies as this would cause them to throw up errors (e.g. in the type-checking for functions).  So I turned the bodies into a Maybe type, and that has worked out well.

I also stopped storing the formals in csExternals (since they are now in csNames, and the tree), which streamlined that nicely, and stopped me having to keep them up to date.
2009-04-04 14:56:35 +00:00
Neil Brown
dbc1b461a4 Made makeNonce use the munged meta-tag, to stop wrapper PROCs from different files having name clashes at link-time 2009-04-02 20:02:11 +00:00
Neil Brown
e28bff5a50 Added code to put static before every identifier that is not being exported, to avoid collisions between occam files 2009-04-01 19:50:15 +00:00
Neil Brown
a1d9fcdff2 Fixed a bug in the C types for arrays of channel-ends 2009-04-01 19:25:19 +00:00
Neil Brown
db9b8e9d91 Changed where we generate the .inc file from being in the backend, to being a pass just after type-checking
We need to generate the externals after we've inferred channel directions, but before we do further work (like adding _sizes parameters and so on).
2009-04-01 16:54:07 +00:00
Neil Brown
219bfd9ce1 Modified the C backend so that it will put the forward declarations into a header file and include that 2009-04-01 14:35:47 +00:00
Neil Brown
e9730bfe1e Got the C++ backend working again, on the cgtests at least 2009-04-01 15:25:18 +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
298ba6465a Removed genSizeSuffix and turned most uses of it into calls to genDynamicDim 2009-03-31 09:29:55 +00:00
Neil Brown
45b22472c3 Changed the rest of tock to reflect the changes to the Is constructor 2009-03-24 23:57:24 +00:00
Neil Brown
0fc7266c29 Fixed various things to do with abbreviating sizes arrays, and corrected array assignment and the mobile type for Bool 2009-03-22 22:32:56 +00:00
Neil Brown
8492dc03d4 Introduced a ShareMode in the AST, and used it in the channel attributes (rather than Bool) 2009-03-22 22:29:39 +00:00
Neil Brown
12b3c4cd89 Added a pass (and adjusted the backends) to deal with the move-in move-out semantics of mobiles
Also known as communication semantics, I think.  The pass adds an extra channel parameter per mobile (perhaps in future this could be a single extra channel?) that is used to send back the mobile value, and hacked the backend so that the communications to receive these mobiles are done in the right place (after the processes have been run, but before waiting on the barrier for them to complete).

cgtest83 now compiles, runs and passes without a segfault.
2009-03-22 18:28:42 +00:00
Neil Brown
bbabef868c Moved the comma-related helper functions to the GenerateCBased module 2009-03-20 19:24:20 +00:00
Neil Brown
e4bed22b7e Various fixes to the C++ backend to at least get it compiling (not tested it much yet) 2009-03-21 23:04:25 +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
2dd8867c91 Removed C++CSP's mobile stuff so that I only have one unified system to deal with for now 2009-02-27 17:04:11 +00:00
Neil Brown
cd1b409f96 Removed cppremoveSpec, since it was doing the same as cremoveSpec 2009-02-27 10:49:45 +00:00
Neil Brown
d0d5cf6779 Fixed the C++ backend where I was trying to be too clever with the sizes 2009-02-11 14:19:34 +00:00
Neil Brown
14df1e09b7 Corrected some problems caused by moving the direction specifiers up to the whole array (the array wasn't then being pulled up) 2009-02-10 00:28:45 +00:00
Neil Brown
3458a9197a Adjusted the backends and transformations module to match the new array literal changes 2009-02-01 21:53:17 +00:00
Neil Brown
8a28d765e7 Implemented recursive procs
This works fine in the C++ backend, not tested with the C backend yet
2009-01-29 00:43:24 +00:00
Neil Brown
a4f0e85c72 Fixed a bug involving abbreviation of arrays of channels into arrays of channel-ends in the C++ backend
The array for the channel-ends was not being allocated storage, so the array (a pointer to some random location) was being written to and causing a seg-fault
2009-01-28 23:16:31 +00:00
Neil Brown
0b2708b2ed Fixed a few small things related to generating intrinsic calls in the C and C++ backends 2009-01-25 20:43:39 +00:00
Neil Brown
0189ba3793 Began implementing the occam intrinsics (some of them, at least) in the C support header 2009-01-23 19:20:26 +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
7457d894f8 Tweaked the C and C++ backends to take the replacement for Int from the TypeSizes module rather than calculate it locally 2009-01-23 15:52:28 +00:00
Neil Brown
492091030d Fixed the C and C++ backends to work with the new channel-end system 2009-01-20 17:41:25 +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
9be287f157 Fixed the C++CSP backend's use of channels (this fixes occam but probably breaks Rain, but I can come back to it later) 2008-11-13 21:00:56 +00:00
Neil Brown
4e582d8c3a Quickly added poison to the C++ backend 2008-09-12 21:05:11 +00:00
Neil Brown
cfbdfc555e Fixed a discrepancy between the C and C++ backends over generating the code for replicators 2008-06-04 18:53:42 +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
Neil Brown
ba66cce89f Moved all the remaining pass information to be with the passes themselves, and adjusted the tests accordingly
All the passes now have their information (name, pre-requisites and post- properties) stored at the point where the pass is declared, which means the pass lists are just a simple list of pass functions.

The main consequence of this change was that the tests had to be changed.  Now, instead of taking a "pass applied to data" item (type: PassM b), they take both the pass (type: Pass) and source data (type: b), and apply them later.  This was the decision that involved the simplest changes to the existing tests (simply unbracketing the application of the pass to the source).  I also had to include a few old-style versions though (testPass', testPassShouldFail') for where the functions were being used to test things that weren't actually passes (mainly StructureOccam).

Fixes #48
2008-06-02 14:31:19 +00:00
Adam Sampson
6debf9292f Rework Traversal, and convert all passes to use it.
This changes the Traversal API to the one that I've been working on in
the Polyplate branch, but implemented in terms of Data. The
performance isn't as good as the Polyplate version, but the code is a
lot simpler because it doesn't need all the type constraints (and it
doesn't make GHC struggle).

This also reworks all the passes in Tock to use the new API, including
those that previously used makeGeneric (which I've now removed) or
everywhereM. Most of the passes are simpler because of this, and I
suspect it's fixed a few subtle bugs resulting from missing recursion
in makeGeneric code.

I haven't yet profiled this, but subjectively it seems about the same
as the old Traversal (and thus faster for all the passes that didn't
yet use it).
2008-05-25 20:13:57 +00:00
Neil Brown
0627ff2b4f Changed the Rain TLP interface to use lists for output streams as I'd originally intended 2008-05-21 00:20:29 +00:00
Neil Brown
89c25e3f6c Added a type-class for retrieving the (AST) type of things
This patch hides all the old typeOfExpression, typeOfName, typeOfVariable, etc, and unifies them into a single type-class with an "astTypeOf" function.  The type-class is currently named Typed, but that can easily be changed (it's only explicitly referred to in the Types module).  The patch is essentially the type-class with a giant find-and-replace on the other modules.
2008-05-17 11:41:52 +00:00
Neil Brown
3daf82d318 Merged Alternative and AlternativeCond into a single Alternative item that always has a pre-condition 2008-04-03 14:52:37 +00:00
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