Commit Graph

49 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
47d565a3b9 Changed records to always use their original name in the C code
This fixes the problem with PROCs complaining that one munged version of the record name was not the same as another.

This will cause problems if two different record definitions for the same name are visible in the same file.
2009-04-12 13:06:49 +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
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
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
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
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
854a1fca50 Fixed various things in the C backend and made genVariable more flexible, for functions that want to specify the C type desired 2009-03-22 14:49:35 +00:00
Neil Brown
2fc327287a Fixed various conflicts in the backends directory while merging one of my branches 2009-03-21 23:43:04 +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
1044a94730 Changed most of the rest of Tock (except some tests) to understand the new record attributes 2009-03-20 15:18:29 +00:00
Neil Brown
defca6e34d Started simplifying some of the C backend in light of the new changes, and made a few fixes
The first few cgtests (at least) now pass with the new system in the C backend.
2009-03-21 22:59:25 +00:00
Neil Brown
ca207f7291 Quickly implemented the first version of a revamp of the genVariable code in the C backend
Surprisingly, the generated code seems to be compiled by GCC without warnings.  Array subscripts are currently unimplemented (a star, i.e. equivalent of subscript 0) is used wherever there should be a subscript.

The new mechanism is based on working out the C type of the original variable/abbrev-mode, the C type of the desired variable/abbrev-mode, and works out how many *s or &s to insert to coerce it to the right type.
2009-03-21 18:43:32 +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
65875f523f Added mobile cloning rather than using dereferencing to copy mobiles 2009-03-19 16:47:31 +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
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
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
4e582d8c3a Quickly added poison to the C++ backend 2008-09-12 21:05:11 +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
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
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
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
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
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
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
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
6abda39ee2 Fixed a couple of uses of the PassM monad that depended on the old mechanism 2008-03-10 15:19:28 +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
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
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
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
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
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
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
e3e9e912f2 Added a read-only version of CSM, named CSMR 2008-02-08 11:17:50 +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