Commit Graph

2049 Commits

Author SHA1 Message Date
Neil Brown
b08ac42547 Augmented the flow graph building to store in each node a list of the names defined at that point 2009-02-08 18:41:30 +00:00
Neil Brown
3da315497a Tidied up the flow graph stuff a little by changing the quintuple state into a record type 2009-02-08 18:17:57 +00:00
Neil Brown
a29197bcab Fixed the usage checking to handle the new test cases
This is two changes.  The first drills down through the BK, adding everything relevant (this helps deal with abbreviations of replicators).  The second is that checkPlainVarUsage now only checks non-array variables, and leaves all the array variables to checkArrayUsage, to prevent false alarms where array accesses with an abbreviation of a replicator were being handled by checkPlainVarUsage instead of checkArrayUsage.  The only downside of all the changes is that multidimensional array accesses (they only worked with all constants before) are now no longer handled.
2009-02-08 17:26:23 +00:00
Neil Brown
ed39f449d9 Improved the formatting when usage check problems and solutions are displayed 2009-02-08 17:12:28 +00:00
Neil Brown
9c4b8e8df1 Changed tocktest so you can pass it -v options for use with the automatic tests 2009-02-08 16:33:53 +00:00
Neil Brown
1c1860ce7e Added lots of new tests for parallel replicators with BK, all of which fail 2009-02-08 16:06:15 +00:00
Neil Brown
c73b307057 Fixed up checkPlainVarUsage to work with the fixed findRepSolutions function
Now all the usage check tests pass, except a couple which fail for other reasons (<> not supported, and the one with twin replicators fails)
2009-02-07 19:14:18 +00:00
Neil Brown
3701154a1b Fixed findRepSolutions to work properly
Previously, it was taking one lot of BK at a time, then checking to see if i and i' could overlap (i.e. i and i' were the array indexes to check), which of course they never could.  It now takes a list of BK to pair up against each other, and asks if 0 can overlap with 0, which it can as long as there is a solution to the replicators.
2009-02-07 19:07:10 +00:00
Neil Brown
fdae05c3f3 Added a helper function for better formatting a series of usage check problems when printing them out 2009-02-07 18:47:31 +00:00
Neil Brown
091acfa848 Added a new helper function to Utils for joining pairs of lists with pairs of lists 2009-02-07 18:45:56 +00:00
Neil Brown
d8b722df89 Added a show instance for BackgroundKnowledge that helps when debugging 2009-02-07 18:45:21 +00:00
Neil Brown
6d8c195c22 Discovered that the problem with my latest test was that strictly less/more than were not being converted into BK (now fixed) 2009-02-05 16:42:50 +00:00
Neil Brown
571815c571 Added another test which shows a problem with the usage checking 2009-02-05 16:27:57 +00:00
Neil Brown
2120a294ed Changed the checking for plain var usage so that if there is a problem in a replicated PAR, it checks for a solution to the replicators to see if that problem can actually ever occur
One remaining problem is that if the BK is different between the two plain var uses being checked, that is currently not dealt with correctly
2009-02-05 16:07:38 +00:00
Neil Brown
95d25c3dbc Moved various functions from the where clause of checkArrayUsage up to the top level 2009-02-05 15:59:09 +00:00
Neil Brown
56a10b403f Added a new function, filterMapByKey, to the Utils module 2009-02-05 15:52:43 +00:00
Neil Brown
2ecd91e36f Changed the array usage checking to always include equations involving replicators
This allows us to check situations like this:

PAR i = 0 FOR 10
  IF
    i = 0
      a[10] := 3
    TRUE
      a[i] := 3

Previously this would have been flagged unsafe (because 10 can overlap with 10 between the replicated branches).

But with this change, the equations on the replicators (including: i'>=i+1, i = 0, i' = 0) are included alongside 10=10, so there is no solution over all because the replicator equations prevent a solution (i.e. the 10 can't be used twice in parallel).
2009-02-05 15:47:41 +00:00
Neil Brown
f1cc74e88e Made sure that background knowledge is mirrored to primed replicators where needed in the background knowledge
Previously, constraints on a replicator from BK (such as i >= 3) were not being mirrored to the other copy of the replicator (so the constraint i' >= 3 was not added, which was causing problems)
2009-02-05 14:54:43 +00:00
Neil Brown
42fa9b12e2 Added a lot more testcases related to background knowledge in usage checking 2009-02-05 14:53:42 +00:00
Neil Brown
0cbe5de96c Added a few more tests to help make sure I don't break anything 2009-02-04 13:08:11 +00:00
Neil Brown
3915afc079 Made checkParAssignUsage and checkProcCallArgsUsage use background knowledge by making them work primarily from the flow graph 2009-02-04 12:24:16 +00:00
Neil Brown
d6530051ab Added another usage check tests 2009-02-04 11:54:50 +00:00
Neil Brown
979eec927a Added a pass that removes replicators with a count of 0, and turns replicators with a count of 1 into non-replicated things (with the appropriate abbreviation) 2009-02-04 11:30:57 +00:00
Neil Brown
6f607972e6 Added some more usage check tests, primarily for non-array variables used in odd ways in replicated PARs 2009-02-04 09:37:28 +00:00
Neil Brown
cf79df4164 Fixed a couple of missing lines in the usage checker for intrinsic function calls 2009-02-03 13:46:26 +00:00
Neil Brown
359763380e Fixed the test for the transformConstr pass 2009-02-03 12:37:32 +00:00
Neil Brown
78606faaae Reintroduced the transformRangeRep pass, and fixed the transformEachRange pass (along with fixing the relevant tests) 2009-02-03 12:31:54 +00:00
Neil Brown
41cca68e4e Simplified the Rain parser by reintroducing a RangeLiteral item that will get replaced by an early pass 2009-02-03 12:24:10 +00:00
Neil Brown
bb6937433f Fixed the TestUtils module by removing some of the old range stuff 2009-02-03 11:52:12 +00:00
Neil Brown
6afbb80e9f Fixed some of the test modules to work with the new array literals and constructors 2009-02-03 11:19:21 +00:00
Neil Brown
502c61b01e Fixed the expansion of array literals to be more like it used to be
All the usual cgtests now compile and run
2009-02-02 23:51:57 +00:00
Neil Brown
0bffd42cad Fixed a missing case (an empty array) in one of the occam passes 2009-02-02 23:51:37 +00:00
Neil Brown
ec1341849d Added a ShowOccam instance for A.Dimension 2009-02-02 23:51:15 +00:00
Neil Brown
bf365ee41a Fixed the pass that turns array constructors into replicated loops so that it handles nested array constructors and inner-procthens properly
cgtest80 now compiles and passes
2009-02-02 18:27:38 +00:00
Neil Brown
4b3090b66a Fixed the fixConstructorTypes pass to work properly and put it back into the pass list (having removed it earlier today) 2009-02-02 18:27:04 +00:00
Neil Brown
1cde2bd959 Added a few useful error messages in the C backend 2009-02-02 18:26:12 +00:00
Neil Brown
96934c871d Changed the transformation of array constructors so that it also pulls out all the specs that were pulled up to be just inside them 2009-02-02 17:36:14 +00:00
Neil Brown
ebf8ae2d83 Added a pull up context just inside the replicators for array constructors 2009-02-02 17:35:46 +00:00
Neil Brown
51acf8abb5 Made sure to change the abbreviation for VAL array things that are now being assigned to via a loop as initialisation 2009-02-02 17:34:44 +00:00
Neil Brown
88d6136dcf Stopped the expansion of inner array literals into subscripted elements
This expansion was causing a big blow-up in the code, as things like:

VAL [2][1]INT as IS [[0,1]]

were getting transformed into:

VAL [2]INT n0 IS [0,1]:
VAL [2]INT n1 IS [0,1]:
VAL [2]INT n2 IS [n0[0], n1[1]]:
VAL [2][1]INT as IS [n2]:

Or something similar -- the inner arrays were pulled up into multiple definitions that were then subscripted, because the first pull-up did this:

VAL [2]INT n2 IS [[0,1][0], [0,1][1]]:

and then the inner arrays got pulled up again, separately.  The change hasn't immediately broken anything, but I haven't fully tested it yet
2009-02-02 17:30:39 +00:00
Neil Brown
40b9a8b76b Fixed the generated PROCs for copying records not having their definition recorded 2009-02-02 17:23:28 +00:00
Neil Brown
460ee36247 Fixed the pulling up of array constructors into initialisers
Previously, this was only pulling up constructors that contained single elements, and not constructors that contained multiple elements
2009-02-02 16:17:00 +00:00
Neil Brown
1591940996 Removed the fixConstructorTypes pass for now
This pass was responsible for screwing up the types of all arrays after type inference, and the compiler seems to work fine without it
2009-02-02 16:07:47 +00:00
Neil Brown
cbeeef486e Fixed the C backend putting too many braces in array literals, and removed some old comments 2009-02-01 22:27:43 +00:00
Neil Brown
80a3eba49a Had the first attempt at correcting the occam passes to work with the new array literals 2009-02-01 21:54:51 +00:00
Neil Brown
7d185fd72a Adjusted the Rain passes to cope with the new array literals 2009-02-01 21:54:32 +00:00
Neil Brown
46394b8c34 Fixed the occam and Rain parsers to work with the new system for array literals 2009-02-01 21:54:02 +00:00
Neil Brown
3458a9197a Adjusted the backends and transformations module to match the new array literal changes 2009-02-01 21:53:17 +00:00
Neil Brown
8de2dbca88 Adjusted the modules in common to match the new array constructor change 2009-02-01 21:52:13 +00:00
Neil Brown
957699313f Combined ArrayLiteral and ListLiteral into ArrayListLiteral, and dispensed with ArrayConstr in favour of having array literals as Structured Expression that can contain replicators 2009-02-01 21:50:39 +00:00