92 |
F.LET (assign as [x], |
F.LET (assign as [x], |
93 |
F.SWITCH(name as F.VAR(y), conds, handles, default), cont) => |
F.SWITCH(name as F.VAR(y), conds, handles, default), cont) => |
94 |
let val (newCont, nextVariables) = inside cont |
let val (newCont, nextVariables) = inside cont |
|
in |
|
|
let |
|
95 |
val optHandles = map (inCase nextVariables) handles |
val optHandles = map (inCase nextVariables) handles |
96 |
val optDefault = inDefault nextVariables default |
val optDefault = inDefault nextVariables default |
97 |
in |
in |
108 |
optDefault |
optDefault |
109 |
), |
), |
110 |
newCont), |
newCont), |
111 |
nextVariables) |
nextVariables)) |
112 |
) else ( |
else ( |
113 |
(*optimize*) |
(*optimize*) |
114 |
I.add nextVariables (y, true); |
I.add nextVariables (y, true); |
115 |
let val newFunID = (mklv()) |
let val newFunID = (mklv()) |
117 |
val optimized = |
val optimized = |
118 |
F.FIX |
F.FIX |
119 |
( |
( |
120 |
({ |
[({ |
121 |
inline = F.IH_ALWAYS, |
inline = F.IH_MAYBE(1, [2]), |
122 |
known = true, (*?*) |
known = true, (*?*) |
123 |
cconv = F.CC_FUN LtyKernel.FF_FIXED, |
cconv = F.CC_FUN LtyKernel.FF_FIXED, |
124 |
isrec = NONE |
isrec = NONE |
125 |
}, |
}, |
126 |
newFunID, (x, getLty (F.VAR x))::nil, newCont)::nil, |
newFunID, [(x, getLty (F.VAR x))], newCont)], |
127 |
F.SWITCH(name, |
F.SWITCH(name, |
128 |
conds, |
conds, |
129 |
map (putFunInCase newFunction) handles, |
map (putFunInCase newFunction) handles, |
130 |
putFunInDefault newFunction default |
putFunInDefault newFunction default)) |
|
) |
|
|
) |
|
131 |
in |
in |
132 |
(optimized, nextVariables) |
(optimized, nextVariables) |
133 |
end |
end) |
|
) |
|
|
end |
|
134 |
end |
end |
135 |
| F.LET (vars, exp, block) => |
| F.LET (vars, exp, block) => |
136 |
let val (optExpr, varExpr) = inside exp |
let val (optExpr, varExpr) = inside exp |