Commit Graph

89 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
e61a23855a Fixed all the conflicts while merging into the Polyplate branch 2009-04-09 11:01:39 +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
e462da4a76 Added a system for specifying implicitly-used modules on the command-line
An implicitly used module is equivalent to a #USE directive before the first line of the main file.  This, combined with changes in occbuild, are my current way of implementing the automatic use of the forall module in occam.
2009-04-10 19:26:22 +00:00
Neil Brown
ae61b22355 Corrected the C++ compilation commands, and gave the header a different extension 2009-04-08 16:45:08 +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
f8103c1d2d Added a library path to the set of Tock directories 2009-04-04 15:57:50 +00:00
Neil Brown
df21bf23ae Added a command-line option to print the include path
I'm not totally clear yet if the include path is or should be different to the module path, but I think it will become clear as I get KRoC compiling.
2009-04-04 13:45:22 +00:00
Neil Brown
d595b73f28 Added a command-line option to print out the module directory 2009-04-04 12:30:09 +00:00
Neil Brown
18f37a0d96 Made it easier to print out a plain String after processing the command-line options 2009-04-04 12:27:56 +00:00
Neil Brown
38ffed2bda Stopped the .o file being removed after compilation when the -c flag was given 2009-04-03 16:52:16 +00:00
Neil Brown
427938039c Implemented a search path for Tock (for #INCLUDE and #USE directives) 2009-04-03 16:51:00 +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
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
098c4e5ef4 Added -c as an alternative for --no-main 2009-04-02 18:15:02 +00:00
Neil Brown
0e31e98bb2 Made Tock draw in the post-analysis object files when linking 2009-04-02 18:14:40 +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
8153cfc659 Added code for full compilation mode to include the relevant C files from occam #USE directives, and link to the relevant object files 2009-04-01 18:32:39 +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
abce001bab Added a command line option to indicate that there is no main PROC 2009-04-01 15:29:22 +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
6e66cf7521 Added a command-line option to change how much stack the unknown functions are given 2009-03-26 22:49:38 +00:00
Neil Brown
95d7144c7b Added the ability to specify linker flags separately from C compilation flags 2009-03-26 22:36:13 +00:00
Neil Brown
09093cff12 Added the ability to print out HTML-highlighted lexed occam
This falls a bit outside the compiler's remit, but it will be the same code to print out the lexed occam without highlighting, which I plan to use for doing libraries with Tock in a bit.
2009-03-26 22:34:34 +00:00
Neil Brown
633a3dbbc5 Quickly added a command line option to allow you to specify flags to pass to the C/C++ compiler 2009-03-25 22:35:49 +00:00
Neil Brown
5ffea3f78e Added a lex mode to Tock that shows how a program was lexed 2009-03-24 18:18:55 +00:00
Neil Brown
1343954c2f Added an option to automatically run indent on C/C++ source before running GCC
This option is very handy when debugging the C/C++ output of Tock when GCC gives a compiler error.
2009-03-21 18:25:09 +00:00
Neil Brown
b970b9df33 Added command line options for occam 2 mobility, and turned it off by default 2009-03-19 11:38:48 +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
Neil Brown
a455676fa9 Added all the necessary command-line options for enabling and disabling warnings in the Main module 2008-11-20 13:26:45 +00:00
Neil Brown
0746219984 Added support for recording terminator nodes (as well as root nodes) while building the flow graph 2008-05-30 17:15:52 +00:00
Neil Brown
90986ea97b Added a backend that prints out the AST as source (rather than dumping the raw AST) 2008-05-17 22:20:38 +00:00
Neil Brown
7d65db43c0 Changed TestHarness to support Rain test files as well as occam 2008-05-17 13:13:52 +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
463ddc636b Changed the running of the PassM monad to use the new mechanism 2008-03-10 15:19:50 +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
Neil Brown
5e70e70d95 Added support for automatically inducing the output file from the input file for full compile mode (filename minus extension) 2008-03-25 11:46:10 +00:00
Neil Brown
273aeead4e Added the code to guess the frontend based on the file extension (.occ/.rain) 2008-03-21 14:46:28 +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
a123981a74 Changed the running of the PassM monad to use the new mechanism 2008-03-10 15:19:50 +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
edefe7be9f Added a progress message just before the backend is entered 2008-03-06 15:23:31 +00:00
Adam Sampson
aff90d8d45 Some initial shuffling to get Tock working with the new CIF.
This changes the TLP code to use CCSP's stand-alone mode, and gets rid of the
old KRoC wrapper stuff. It also changes occam_stop everywhere in order to pass
the number of arguments (since ExternalCallN needs that now), and cleans up the
interaction with the C++ backend a bit.
2008-03-05 16:21:20 +00:00
Adam Sampson
168628576d Rework how temporary files are named.
The temporary files used during compilation are now just the output name with
an appropriate extension added (so when compiling to cgtest02, it'll produce
cgtest02.cpp, etc.). This is what GCC and KRoC do; it keeps the temp files with
the binaries that were produced from them, and avoids having to pick a sensible
directory to put randomly-named temp files in.
2008-02-29 22:53:45 +00:00
Adam Sampson
d048a0ef71 Clean up Main.hs.
This particular file was badly in need of some love, being some of the first
code I wrote on Tock, and thus being a mix of my early style, my late style,
and Neil's style. I've cleaned it up quite a bit, fixing whitespace damage and
dodgy indentation, and making sure lists are alphabetised.
2008-02-29 22:06:37 +00:00
Neil Brown
4a0d199406 Fixed the keep temporaries thing so that it still keeps them when the compilation succeeds, not just when it dies 2008-02-27 19:58:32 +00:00
Neil Brown
eef0ac53e0 Added a flag to the compiler to tell let it to not delete the temporary files it used 2008-02-27 18:23:22 +00:00
Neil Brown
062cd0415a Added a simple (-h/--help) option for printing the Tock help 2008-02-24 12:15:39 +00:00
Neil Brown
6d9534f9b9 Made running the properties configurable by a --sanity-check command-line option 2008-02-24 12:15:02 +00:00