Commit Graph

458 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
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
e61a23855a Fixed all the conflicts while merging into the Polyplate branch 2009-04-09 11:01:39 +00:00
Neil Brown
c69ea8815d Merged in the latest changes from the trunk into the Polyplate branch 2009-02-03 13:14:07 +00:00
Neil Brown
5a10e94c6a Fixed various conflicts between the Polyplate branch and the latest changes in the trunk 2009-01-28 15:48:08 +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
9403f4d68b Filled in more expressions and corrected the generation of byte literals by borrowing code from the C backend 2008-11-27 09:25:34 +00:00
Neil Brown
ce86ec2337 Changed genMissing so that it generates a run-time error in the generated code 2008-11-27 09:25:07 +00:00
Neil Brown
e79ccf1b46 Fixed it so that names beginning with an upper-case letter are prefixed by an underscore in the CHP backend 2008-11-27 09:24:31 +00:00
Neil Brown
769ed4f3ca Filled in a little more of the CHP backend 2008-11-26 20:39:51 +00:00
Neil Brown
70d7b941cc Added support for more types and some expressions (mainly array stuff) 2008-11-26 18:47:32 +00:00
Neil Brown
ab8fd2434c Made all the missing stuff call genMissing 2008-11-26 15:51:21 +00:00
Neil Brown
d962126fed Added the framework for variable declarations 2008-11-26 15:47:22 +00:00
Neil Brown
d7c61a70c0 Fixed some indentation issues and added markers for things that are missing 2008-11-26 15:37:49 +00:00
Neil Brown
5d0391c98d Fixed it so that processes at the top-level are not inside let bindings 2008-11-26 15:28:36 +00:00
Neil Brown
caff6ae702 Added some more types, and import declarations 2008-11-26 15:27:16 +00:00
Neil Brown
b3c1a6f13b Filled out the very basics of a CHP backend, enough to get some proc headers 2008-11-26 15:11:51 +00:00
Neil Brown
e3c426e870 Added full-compile support for the CHP backend 2008-11-26 12:48:48 +00:00
Neil Brown
78716a2727 Added a CHP backend option to Tock 2008-11-26 12:24:21 +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
7a7eefa33e Changed inline items to always be static
I'm not sure if this is a valid thing to do, but it solved a problem with the occam libraries where multiple occam files were including an inline FUNCTION from an include file, and this was causing problems at link time.
2009-04-12 13:02:58 +00:00
Neil Brown
ddbec737f2 Got all the tests compiling again after recent changes
For some reason, the usage check tests are now very slow to run (perhaps because of all the operator definitions added to each one?), which needs further investigation.
2009-04-10 19:29:40 +00:00
Neil Brown
2308c6571c Fixed assignment of arrays to work when dimensions are missing (helps with the initialisers for mobile allocations) 2009-04-09 17:09:50 +00:00
Neil Brown
98ffb74505 Corrected cgenVariableWithAM to work properly (and be a little cleaner) for generating VariableSizes 2009-04-09 17:09:23 +00:00
Neil Brown
f58c8fc2e8 Fixed lots of issues in declare array sizes so that it works properly with various nested mobiles 2009-04-09 17:08:42 +00:00
Neil Brown
a400b3e4f6 Added a pass to pull up values used as initialisers in mobile allocations 2009-04-09 17:08:27 +00:00
Neil Brown
229f2197af Turned findMeta into a member of a FindMeta type-class 2009-04-09 11:13:37 +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
49d6e2aaaf Reworked how the stack sizes are recorded and merged together
The previous method, using the C preprocessor was both nasty, and crazily resource-intensive.  The new method stores stack size information in files that are read in and processed by the compiler when it comes time to link.
2009-04-07 16:03:52 +00:00
Neil Brown
7bd4e3d309 Added functions to the list of things that need stack sizes, even if they are external
I think this is not quite right, but for now it fixes stack sizes not being generated for any non-inlined standard operators.
2009-04-07 15:42:37 +00:00
Neil Brown
c4f625b1ba Overhauled the support headers to add most of the missing occam operators as inline functions 2009-04-06 00:56:06 +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
172e331a9c Made sure that constants pulled up into sizes arrays are resolved into integers, rather than still referring to named constants 2009-04-04 15:23:40 +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
923b9700d8 Stopped fixed-sizes being added for TOCKEXTERNAL PROCs 2009-04-04 13:44:56 +00:00
Neil Brown
03bfe593cb Fixed a bug in determining the sizes for RETYPES 2009-04-04 12:31:25 +00:00
Neil Brown
b9cbcf0902 Added the intrinsic CAUSEERROR 2009-04-03 15:14:24 +00:00
Neil Brown
b803b1ec91 Reworked how stack sizes are calculated, and changed how we use them in the build process
Now that we support separate compilation, some of the stack sizes for PROCs depend on the stack sizes of other PROCs that were compiled in different files.  We can't just assume the default 512 bytes for these "foreign" PROCs, because that often won't be enough.  So instead, we must make the stack sizes for the current PROCs depend on (i.e. use in the calculation) the stack sizes of the foreign PROCs.

This dependence adds some issues though.  We cannot declare in one C file a const int that depends on the value of an extern const int from another C file (not valid C, it seems).  So instead, we move all the stack size declarations to header files, and use #includes and the preprocessor to make sure that the stack sizes are statically determined.

This in turn simplifies the build process in some ways.  These headers only need to be compiled by the .occ file that has the main process, by including them all into a C file and compiling that as before.  It means that each .occ file only has one .o file resulting (plus two C headers*, and a .inc file) so linking is a bit less confusing.

* I am keeping the two C headers for now, rather than appending the sizes one to the normal header, because I'm not entirely sure whether having one header that the C file depends on may trigger a recompilation that we don't want in some build systems.  I can always merge them later if that's not a valid worry.
2009-04-03 12:24:53 +00:00
Neil Brown
9bf32e339d Made sure that the names printed in TOCKEXTERNAL pragmas are fully munged (and thus equivalent to the exact C function name) 2009-04-03 12:22:19 +00:00
Neil Brown
ca332a0925 Changed the asm-analysis to only generate stack-sizes for PROCs, and not non-PROCs or external PROCs
This just about works, but it allocates the usual 512 bytes for all external PROCs being called, rather than using the actual stack_size for those external PROCs (this causes popcorn to overflow the stack if left with the default 512 bytes)
2009-04-02 20:04:21 +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
b76676eca8 Fixed a few more missing-static problems 2009-04-02 19:33:09 +00:00
Neil Brown
f5e0288ad0 Added an error message for a backend pass that should never be needed -- but just was 2009-04-02 17:18:34 +00:00
Neil Brown
4ea3357129 Rolling back earlier patch, the header should come after the declarations, now that records are not in the headers 2009-04-02 16:51:11 +00:00
Neil Brown
aa2b31718a Moved the header inclusion to be before forward declarations, as often the latter use the former 2009-04-02 15:51:34 +00:00
Neil Brown
350057c314 Made sure that non-top-level specs still have forward declarations in the .c file (and not in the .h file) 2009-04-02 15:43:49 +00:00
Neil Brown
f69030df34 Changed the names of generated tock files to have ".tock" before the extension
This helps avoid collisions with pre-existing files, especially .inc files (but also .c and .h)
2009-04-02 15:40:39 +00:00
Neil Brown
ea14f568fa Removed genProcName
Everything that used it has now switched back to genName, as we don't need this occam_ prefix with the new name munging stuff from earlier patches.
2009-04-02 15:39:19 +00:00