Commit Graph

384 Commits

Author SHA1 Message Date
Neil Brown
c19039e90e Added the definitions of most of the intrinsics from the occam 2.1 manual (but not yet the implementations) 2009-01-25 18:54:57 +00:00
Neil Brown
7337978dcf Added many more intrinsics to the list of occam intrinsics 2009-01-23 19:19:36 +00:00
Neil Brown
c2aaf2fcf7 Provided more helpful errors in the test harness when something is wrong 2009-01-23 14:42:46 +00:00
Neil Brown
d806931fbf Revamped the TestHarness framework to allow multiple substitutions in a test prologue 2009-01-20 23:43:07 +00:00
Neil Brown
9145c993ea Fixed the constant folding to use a type for Int based on the compilation target rather than just assuming Int32
However, it is possible that there will still be a problem if the C and C++ compiler have different int sizes, because the constant folding has to know the type at compile time, and thus we have to arbitrarily choose to use the C version.  In future, we could perhaps swap all Ints for the appropriate substiution (e.g. Int64) at run-time, based on the flags and prior knowledge about C/C++ int sizes
2009-01-23 15:50:06 +00:00
Neil Brown
2a8ee9a420 Fixed a bug in the constant folding, where anything divided by -1 was being evaluated to zero 2009-01-23 15:48:39 +00:00
Neil Brown
de80ab467e Fixed the common Types module to work with the new channel-ends 2009-01-20 17:27:37 +00:00
Neil Brown
336c5abe3c Fixed the ShowCode module to work with the new channel-ends 2009-01-20 17:27:10 +00:00
Neil Brown
ee62c604fc Renamed our permutations function to permutation to avoid a conflict with a new GHC 6.10 function 2008-11-28 11:28:39 +00:00
Neil Brown
09e0e46ec2 Added some comments to my changes to GenericUtils 2008-11-25 18:06:14 +00:00
Neil Brown
0e7a6c5b98 Added a NameSource field for NameDef that indicates where a name comes from 2008-11-25 17:36:42 +00:00
Neil Brown
e117422c31 Added a couple more tests for checkUnusedVar which has revealed two bugs
One of these bugs is that array variables are counted as unused when they are used subscripted.  I think that should be solved when we flip back to the listify approach.

The second bug is more interesting, as it is triggered only in a certain arrangement with an IF.  It's either a bug in the flow-graph building or in the varsTouchedAfter code.
2008-11-20 15:06:36 +00:00
Neil Brown
5f01f12d43 Adjusted testOccamPassWarn to enable all warnings when testing a pass 2008-11-20 14:20:36 +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
f88c671cf7 Added a set of enabled warnings to CompState 2008-11-20 13:17:05 +00:00
Neil Brown
38374320a3 Moved the remainder of the checkInitVar tests over to the new system 2008-11-19 17:25:02 +00:00
Neil Brown
3b57d43eb6 Moved more of the checkInitVar tests to the new system 2008-11-19 17:08:17 +00:00
Neil Brown
810c798dac Added some copies of the checkInitVar tests that use the new occam EDSL testing instead of the old method 2008-11-19 16:53:13 +00:00
Neil Brown
f4ff507543 Moved wrapProcSeq into the TestUtils module 2008-11-19 16:09:31 +00:00
Neil Brown
e5ed7e07b7 Fixed the apply function, which (mainly due to having the wrong type signature, but also its use of extTransformRoute) was not as polymorphic as it should have been, which was breaking the traversal (I think it would only work on one Structured type) 2008-11-14 15:30:02 +00:00
Neil Brown
0d486f108f Added a value to indicate what type a warning is (to support future configurability) and streamlined the warning functions 2008-11-13 15:36:22 +00:00
Neil Brown
2a15f4ef5f Filled in all the gaps such that the CheckTest tests now run (including some debug output, for now)
One of the tests fails at the moment because the specification node has two entries associated with it in the flowgraph.  One is the scope-in and one is the scope-out.  I think the analysis is currently picking the scope-out node and looking beyond that, where -- surprise, surprise -- the variable is not used again.  So I need some easy way of telling the flow analyses which of the two nodes I want to start from, in this case and other ones where I also add two nodes related to the same point in the AST.
2008-11-12 16:54:00 +00:00
Neil Brown
98122211ad Got all the new analysis stuff compiling, but with several parts unimplemented 2008-11-12 12:34:32 +00:00
Neil Brown
dc030acabe Changed the FlowGraph stuff to use the new Route type (that includes identifiers) rather than the bare functions as it used to 2008-11-10 14:01:30 +00:00
Neil Brown
d0e2cd7b03 Finally wrestled the Haskell typechecker into submission to add my CheckFramework and its monads, which will hopefully do all that I need 2008-11-08 00:00:09 +00:00
Neil Brown
d6b102838a Added a Route data type that packages up the routing function and an identifier (to provide equality) 2008-11-07 10:08:16 +00:00
Neil Brown
d12b2178de Added an augmented version of Adam's gmapMFor that uses the same generics techniques, but also gives a route to the node to the transformation function 2008-11-06 18:32:35 +00:00
Neil Brown
bfacb526fb Converted one of the tests for pullRepCounts to use the new mechanism, which in turn exposed that the pass was not altering the definition in the state (which it may as well) 2008-11-16 18:25:53 +00:00
Neil Brown
771297632d Finished converting all the cases in testInputCase to use the new occam EDSL 2008-11-16 16:57:52 +00:00
Neil Brown
9ac861ac93 Fixed the map ordering problem by matching against any permutation 2008-11-16 13:06:08 +00:00
Neil Brown
f2bac46655 Added a testPatternMatchOneOf function to check that something matches at least one of a list of given patterns 2008-11-16 13:03:28 +00:00
Neil Brown
6f54b89b38 Added a permutations function to the Utils module 2008-11-16 13:03:04 +00:00
Neil Brown
559ba83c28 Developed the occam EDSL further, adding support for input CASE statements, more type-classes to allow easier use and various other improvements 2008-11-16 12:21:22 +00:00
Neil Brown
02a28b7585 Made testOccamPass more general, so that it does not have to be applied at the top-level 2008-11-15 20:13:33 +00:00
Neil Brown
a570f2eff3 Renamed the variables in the occam EDSL to be less likely to clash in other modules 2008-11-15 20:11:52 +00:00
Neil Brown
f4d9c791ef Simplified the occam EDSL by removing the unnecessary monad in favour of plain lists, and added a way to separate expected output from input 2008-11-15 20:06:47 +00:00
Neil Brown
7764ed9326 Added a module for easily knocking up fragments of occam code to test, but need to remove some of the extravagance in the design (including an unnecessary monad) 2008-11-15 19:29:56 +00:00
Neil Brown
192ccd4e2c Extended the type unification for Rain to support type-checking things that are being poisoned (which could be either end of a channel) 2008-09-12 14:40:04 +00:00
Adam Sampson
87848ad7db Make the TypeSet representation a bit smarter.
It used to just be the list of target type keys. It's now a map from
all possible type keys to a precomputed hit/through/miss decision for
them. gmapMFor can therefore dig into "through" types without needing
to (fail to) apply the generic function first.

This makes less difference than I was expecting: it shaves the time
for cgtest24 from 2m30 down to 2m15.
2008-06-11 12:05:39 +00:00
Adam Sampson
62a0873d3d Implement channel direction decorators.
This is mostly straightforward: modify the parser to allow direction
decorators in the right places, and extend the type checker to match.
There's some slight awkwardness in that some of the Types functions
have to perform the same checks as the type checker (e.g. directing a
non-channel), so I've tidied up their error messages a bit.

At the backend, I've just added a little pass to strip out all the
DirectedVariables, since the other backend passes don't handle them
gracefully. From the occam/C point of view this is fine, but I'm not
sure if it's going to cause problems for C++.
2008-06-09 21:35:20 +00:00
Adam Sampson
19484ec72e Show channel attributes in occam code. 2008-06-09 12:36:26 +00:00
Neil Brown
b603b43b57 Added a subOne function (the dual of addOne) to the Types module 2008-06-06 10:43:30 +00:00
Neil Brown
d75bca3c0d Added a couple of new helper functions to the Utils module 2008-06-05 23:09:46 +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
ba66cce89f Moved all the remaining pass information to be with the passes themselves, and adjusted the tests accordingly
All the passes now have their information (name, pre-requisites and post- properties) stored at the point where the pass is declared, which means the pass lists are just a simple list of pass functions.

The main consequence of this change was that the tests had to be changed.  Now, instead of taking a "pass applied to data" item (type: PassM b), they take both the pass (type: Pass) and source data (type: b), and apply them later.  This was the decision that involved the simplest changes to the existing tests (simply unbracketing the application of the pass to the source).  I also had to include a few old-style versions though (testPass', testPassShouldFail') for where the functions were being used to test things that weren't actually passes (mainly StructureOccam).

Fixes #48
2008-06-02 14:31:19 +00:00
Neil Brown
59e0922263 Added a new operator to Utils (>.>, the flipped version of <.<) 2008-06-02 14:09:33 +00:00
Adam Sampson
36e7353ee7 Take NameType out of NameDef.
NameType is only really needed in the parser, so this takes it out of
NameDef, meaning that later passes defining names no longer need to
set an arbitrary NameType for them. The parser gets slightly more
complicated (because some productions now have to return a SpecType
and a NameType too), but lots of other code gets simpler.

The code that removed free names was the only thing outside the parser
using NameType, and it now makes a more sensible decision based on the
SpecType. Since unscoped names previously didn't have a SpecType at
all, I've added an Unscoped constructor to it and arranged matters
such that unscoped names now get a proper entry in csNames.

Fixes #61.
2008-06-02 10:13:14 +00:00
Neil Brown
4e6b166696 Fixed implicit mobility to work in the (C++, at least) backend 2008-06-01 19:46:32 +00:00
Neil Brown
e66ce1f810 Added a line to ShowCode for dereferenced variables 2008-06-01 19:25:33 +00:00
Neil Brown
969c04d42b Improved the Rain support in ShowCode a little 2008-06-01 17:58:40 +00:00