Commit Graph

1299 Commits

Author SHA1 Message Date
Neil Brown
3d823fb1b5 Fixed the handling of actual array parameters to include array variables inside ActualExpression 2008-03-06 17:34:54 +00:00
Neil Brown
807b219a39 Implemented adding array sizes for Is abbreviations 2008-03-06 15:25:05 +00:00
Neil Brown
edefe7be9f Added a progress message just before the backend is entered 2008-03-06 15:23:31 +00:00
Neil Brown
a9c2643ad4 Fixed some horribly exponential speculative recursion in one of the passes 2008-03-06 14:20:21 +00:00
Neil Brown
60c7a2dde3 Added a preliminary pass-list for the work on flattening arrays 2008-03-06 09:59:18 +00:00
Neil Brown
a2106a98e7 Fixed some incorrect recursion in the pass for declaring array _sizes 2008-03-06 01:50:01 +00:00
Neil Brown
264149ef3f Added some more tests for dynamically sized arrays 2008-03-06 01:49:33 +00:00
Neil Brown
70a207fe6c Implemented the addSizesActualParameters pass 2008-03-05 23:40:17 +00:00
Neil Brown
8b3edc90ce Added some limited tests for the addSizesActualParameters pass 2008-03-05 23:39:54 +00:00
Neil Brown
6a5d84ffcd Implemented the addSizesFormalParameters pass 2008-03-05 22:10:21 +00:00
Neil Brown
3481a3f51d Finished the tests for the addSizesFormalParameters pass 2008-03-05 22:09:51 +00:00
Neil Brown
6c629b33f7 Added a few types in BackendPassesTest to remove a monomorphism restriction warning 2008-03-05 21:04:42 +00:00
Neil Brown
1fef1e64ed Added the beginnings of testing for adding _sizes parameters to PROC definitions (formals) 2008-03-05 17:31:14 +00:00
Neil Brown
9ad4552232 Moved the error message for occam_stop into the StopException for C++, rather than printing it directly 2008-03-05 17:12:01 +00:00
Neil Brown
6a784bffd9 Switch the tests for declareSizesArray to be QuickCheck tests rather than HUnit tests 2008-03-05 16:35:37 +00:00
Neil Brown
256ce80ccb Moved all the testPass* functions into the TestMonad, using unsafePerformIO for running them inside QuickCheck 2008-03-05 16:06:14 +00:00
Neil Brown
d02b771572 Tidied up the type of handleDirective to make it easier to use 2008-03-05 16:05:21 +00:00
Neil Brown
03eab6c142 Fixed some typing relating to QuickCheck and the TestMonad to avoid type ambiguities in future 2008-03-05 16:04:30 +00:00
Neil Brown
2ea7c37abe Added the implementation of declaring _sizes arrays for record fields 2008-03-04 15:22:24 +00:00
Neil Brown
30f1b6ecab Added tests for the declaring of _sizes arrays for record fields 2008-03-04 15:22:03 +00:00
Neil Brown
41303eb993 Altered the code and the tests for declareSizesArray to approach what it should be doing 2008-03-03 17:50:57 +00:00
Neil Brown
81ea069707 Added a dummy implementation of a new pass, declareSizesArray, and the tests for it 2008-03-03 15:02:07 +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
Adam Sampson
87a1c39411 Fix recursion in identifyParProcs that broke testcases/par.occ.
It wasn't looking for PROC definitions inside Specs. This is a good example of
a pass that really wants a trimmed "everywhere"/"contexts" rather than explicit
recursion.
2008-03-07 17:28:30 +00:00
Adam Sampson
8aabb0c98e Add a missing fold marker. 2008-03-07 17:02:03 +00:00
Adam Sampson
337527a544 Remove obsolete comment -- Structured is parametric now. 2008-03-07 14:42:46 +00:00
Neil Brown
20f7666044 Refactored cgenArraySubscript ready to add support for static dimensions 2008-03-01 20:39:45 +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
01ac2ef21d Fixed an odd monomorphism restriction warning 2008-03-01 20:13:11 +00:00
Adam Sampson
50967cba95 Split the common C99/C++ support code out into a separate header.
Or, rather, add a new CIF-specific header, so tock_support.h is now the common
code and each of the backends has its own. This means some of the conditional
stuff can go away.
2008-03-05 16:54:29 +00:00
Adam Sampson
bb419d28b7 Move the headers into their own directory, and install them.
This should make it possible to use Tock from outside its own source directory.
2008-03-05 16:43:15 +00:00
Adam Sampson
a621daac9f Make the backend a variable in cgtests.mk. 2008-03-05 16:30:06 +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
10d17f4b23 Remove a chunk of dead code from the C support header. 2008-03-04 14:05:55 +00:00
Adam Sampson
d2c0fd674e Rework the code for getting errors through the parser.
This used to work by adding a magic prefix to the error message, but it appears
that doesn't work with the GHC 6.6 version of Parsec. It now searches for a
magic substring anywhere in the error message.

It uses // as a delimeter rather than \0 now, since including nulls in Strings
causes problems -- for example, putStr "a\0b" will only print "a".
2008-03-04 12:52:25 +00:00
Adam Sampson
7ec6566495 Return sensible Meta from ParseOccam failures.
This means we get the nice annotated source display on a parser failure --
although we still get not-very-useful descriptions of errors sometimes...
2008-03-04 11:59:13 +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
Adam Sampson
58f0775411 Add a checkout target to cgtests.mk. 2008-02-29 21:46:45 +00:00
Neil Brown
49585a1922 Added a constructor to record types to help build record literals (especially those that contain array literals) 2008-02-29 16:44:00 +00:00
Neil Brown
08d02bfb17 Changed the behaviour of assignment for records
Previously, assignments of records were directly flattened into assignment of each of the fields.  Now, we instead generate a copy_<recordname> inline procedure for each record definition, and compile code that uses that (for C++, we could even make this an operator= implementation later on).  This allows us to re-use the proc later in the C/C++ backends if needed.
2008-02-29 16:36:47 +00:00
Neil Brown
f5022228ba Fixed typeOfSpec to use the recorded type rather than trying to dig it out of the inner expression/variable 2008-02-29 16:33:33 +00:00
Neil Brown
9ab6cbc0b4 Changed the pullUp function to behave differently for C than C++ (pulling up of array literals inside record literals) 2008-02-29 03:05:52 +00:00
Neil Brown
55ed3e9984 Fixed the shift helper functions to work for int 2008-02-29 03:05:36 +00:00
Neil Brown
79b5e8edb0 Fixed the signed/unsigned comparison warnings in the shift helper functions 2008-02-29 00:28:31 +00:00
Neil Brown
24dc839cfb Added helper functions for PLUS, MINUS and TIMES to help constrain the result types and prevent surprising integer promotions 2008-02-29 00:20:52 +00:00
Neil Brown
2ca965ebf0 Added a missing definition of the lshift/rshift C helper functions for bytes (uint8_t) 2008-02-28 16:55:41 +00:00
Neil Brown
1e92333778 Added a try to fix the parsing of BYTESIN with a not obviously constant array dimension 2008-02-28 16:55:11 +00:00
Adam Sampson
6456dad42e Add cgtests.mk, which builds the cgtests using GNU make.
This may go away, or it may end up as a replacement for compile-cgtests.
2008-02-29 17:13:19 +00:00
Adam Sampson
d021edbd48 Add some reserved words that show up in ASM blocks. 2008-02-29 17:11:17 +00:00