Commit Graph

1562 Commits

Author SHA1 Message Date
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
Adam Sampson
a2a15cab64 Split include file expansion out into a separate pass.
The order of initial passes is now:
  lex -> preprocess -> structure -> expand-include -> parse
which means that #IFing out structurally-invalid code (like inline VALOF) now
works.  This also cleans up the preprocessor code a bit.
2008-02-29 15:01:19 +00:00
Adam Sampson
d7fbd93816 Add some tests for structureOccam. 2008-02-29 14:08:57 +00:00
Adam Sampson
2f407fc2cd Pass CFLAGS/CXXFLAGS/CPPFLAGS/LDFLAGS through into Tock's built-in options. 2008-02-29 11:16:35 +00:00
Adam Sampson
cbcccae96c Don't clobber CFLAGS/CPPFLAGS while configuring. 2008-02-29 11:09:18 +00:00
Adam Sampson
c8b6be34e1 Implement comparisons in preprocessor expressions.
This brings Tock's conditional compilation facilities up to par with occ21.
2008-02-29 00:23:49 +00:00
Adam Sampson
a5fd73130a Use Parsec to parse #DEFINE directives.
This is much neater, and I'll need most of the code to implement comparisons anyway.
2008-02-28 23:47:06 +00:00
Neil Brown
6d4f1dd702 Added labels to all the top-level tests that didn't have one 2008-02-28 16:11:01 +00:00
Neil Brown
cb8327451d Added the ability to apply a filter to which HUnit tests you run 2008-02-28 16:08:36 +00:00
Neil Brown
b3458ec541 Corrected the pointer indirection for records inside records 2008-02-28 16:08:06 +00:00
Neil Brown
62e45a8909 Added a missed new C/C++ test to the list of tests to run 2008-02-28 15:33:08 +00:00
Neil Brown
d73f2f509c Added some template types to one of the uses of tockArrayView to please the C++ compiler, and adjusted the tests accordingly 2008-02-28 15:32:26 +00:00
Adam Sampson
8f2575819b Initial implementation of the occam-pi preprocessor.
This implements #DEFINE, #UNDEF, #IF, #ELSE and #ENDIF, macro expansion with
##, and TRUE, FALSE, AND, OR, NOT and DEFINED within #IF expressions, with the
same semantics as occ21.

The macro COMPILER.TOCK is always defined by default, so you can now say things
like "#IF NOT DEFINED (COMPILER.TOCK) ... #ENDIF".
2008-02-28 20:27:30 +00:00
Adam Sampson
62b9c9b105 Prefix pass test output with the pass name ++ ": " consistently. 2008-02-28 16:51:53 +00:00
Adam Sampson
06ad1e5e06 Clean up the documentation hack a bit.
We now postprocess all the generated HTML using M4, so we can hide the SVG
images behind macros (and we can now use images inside the main documentation
too).
2008-02-28 14:43:53 +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
0ecb7146e4 Fixed the implementation of REM for floating point types 2008-02-27 20:56:13 +00:00
Neil Brown
8da136a3b6 Added the -v flag when compiling the cgtests, so that I have something to look at 2008-02-27 20:35:26 +00:00
Neil Brown
a4424ee82d Fixed a few dependencies in the pass lists relating to functions 2008-02-27 20:05:47 +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
46de1956b3 Corrected the pulling up of SEQ replicator counts to descend properly into nested functions 2008-02-27 19:58:09 +00:00
Neil Brown
86c17fed99 Added a pass for pulling up the replicator counts in SEQs so that the count is constant for the whole loop 2008-02-27 19:33:44 +00:00
Neil Brown
7206d45af3 Toned down the amount of suffixes generated for C/C++ integer literals 2008-02-27 18:56:36 +00:00
Neil Brown
63730b5aff Adjusted the tests for record definitions in the C/C++ backends to use the new function in the dictionary for them 2008-02-27 18:56:09 +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
cfc3577c21 Fixed the pre-condition of flattenAssign to include the types being resolved 2008-02-27 18:24:33 +00:00
Neil Brown
1afea6c62c Fixed underlyingType not recursing properly into the inner types in arrays 2008-02-27 18:23:53 +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
b0fac1f82a Made sure that definitions are only pulled up after protocol inputs have been flattened 2008-02-27 17:20:52 +00:00
Neil Brown
af7a15b4df Changed testTransformProtocolInput so that it does transform protocol inputs in ALT guards 2008-02-27 17:20:19 +00:00
Neil Brown
9b521c9b07 Added tests for testing that testTransformProtocolInput transformed protocol inputs in ALTs 2008-02-27 17:19:47 +00:00
Neil Brown
5c7bb1296b Altered transformProtocolInput to only bother flattening inputs with more than one item 2008-02-27 17:01:19 +00:00
Neil Brown
9b570996ca Added a pass to flatten protocol inputs down into multiple sequential input statements 2008-02-27 16:45:27 +00:00
Neil Brown
018951ef40 Fixed the shift behaviour by moving it out into functions like the add and subtract operations already were 2008-02-27 15:13:11 +00:00
Neil Brown
40bb883497 Fixed the printf specifiers on float and double items for printing errors 2008-02-27 15:09:27 +00:00
Neil Brown
9712df4458 Added a type annotation (esp. for signed types) for hex literals in the C/C++ backends 2008-02-27 14:00:54 +00:00
Neil Brown
245e4536bc Fixed signed hexed values in the constant folder 2008-02-27 14:00:28 +00:00
Neil Brown
93a3c81255 Fixed the right-shift in the constant folding to be an unsigned (logical, non sign-extending) shift 2008-02-27 12:45:29 +00:00