Commit Graph

378 Commits

Author SHA1 Message Date
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
Neil Brown
155f58c174 Fixed the Rain parser tests with respect to the new type inference 2008-06-01 16:48:15 +00:00
Neil Brown
c4702a7f6e Added a new helper function, eitherToMaybe in Utils 2008-05-30 17:14:28 +00:00
Neil Brown
01e702acb2 Changed to print out the error context (based on the meta tag) on stderr instead of stdout 2008-05-30 16:40:21 +00:00
Adam Sampson
8b3eba594d Add SubscriptCheck field to SubscriptFromFor etc.
This makes it possible to mark a slice as not needing runtime
checking, which is immediately useful for _sizes arrays.

This fixes cgtest03, which was previously failing to compile because
the _sizes array for one of the constants in it contained a runtime
check and thus wasn't itself constant. I've added a testcase file for
the relevant bit of code.
2008-05-26 17:36:26 +00:00
Adam Sampson
6debf9292f Rework Traversal, and convert all passes to use it.
This changes the Traversal API to the one that I've been working on in
the Polyplate branch, but implemented in terms of Data. The
performance isn't as good as the Polyplate version, but the code is a
lot simpler because it doesn't need all the type constraints (and it
doesn't make GHC struggle).

This also reworks all the passes in Tock to use the new API, including
those that previously used makeGeneric (which I've now removed) or
everywhereM. Most of the passes are simpler because of this, and I
suspect it's fixed a few subtle bugs resulting from missing recursion
in makeGeneric code.

I haven't yet profiled this, but subjectively it seems about the same
as the old Traversal (and thus faster for all the passes that didn't
yet use it).
2008-05-25 20:13:57 +00:00
Neil Brown
d044b51335 Renamed ndType to ndSpecType, as per Trac ticket #59 2008-05-21 13:38:51 +00:00