Newer
Older
(* Time-stamp: <modified the 02/10/2014 (at 10:52) by Erwan Jahier> *)
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
Expand nodes:
------------
if n is a node defined as follows
node n(x,y) returns(a,b);
var v1,v2;
let
v1 = x+y;
v2 = x*y;
a = v1*x;
b = v2*y;
tel
equations such as :
o1,o2 = n(i1, i2);
becomes
h1 = i1+i2;
h2 = i1*i2;
o1 = h1*i1;
o2 = h2*i2;
where h1 and h2 are fresh local vars
In other terms, we need to
- create a fresh local var for each local var of n
- take all the equations of n, and substitute
- the inputs parameters by intput args
- the outputs parameters by lhs list
- the local vars by the fresh local var names
nb : to simplify, for equations like
f.a = n(t[1], 3);
we first create fresh vars for "f.a", "t[1]", and "3"
_v1 = t[1];
_v2 = 3;
f.a = _v3;
_v3 = n(_v1,_v2);
and then we apply the transformation
Expand assertions:
-----------------
In order to deal with assertions on nodes, i.e., of the form
assert (n(i1,i2));
we first transform it into
assert_var = n(i1,i2);
assert(assert_var);
where assert_var is a fresh bool local var, and we apply the transformation
on the first equation.
*)
(** nb : it performs no fixpoint, so nested calls won't be expanded
entirely unless L2lSplit.doit has been call before.
I could remove that restriction by adding a fixpoint somewhere,
but is it worth bothering ?
the first arf is the list of node to not expand
val doit : Lic.node_key list -> LicPrg.t -> LicPrg.t