Debian Codegraph @

lib/mlrisc-lib/MLRISC/SSA/ssa-ccp.sml

raw
1 (*
2 * Conditional Constant Propagation
3 *)
4 functor SSACCP(CCP : SSA_CONDITIONAL_CONSTANT_PROPAGATION) : SSA_OPTIMIZATION =
5 struct
6 structure SSA = CCP.SSA
7 structure CF = CCP.CF
8 structure A = Array
9
10 type flowgraph = SSA.ssa
11
12 val name = "conditional constant propagation"
13
14 fun error msg = MLRiscErrorMsg.error("SSACCP",msg)
15
16 fun run SSA =
17 let val valueMap = CCP.condConstProp SSA
18 val defSiteTbl = SSA.defSiteTbl SSA
19 val showVal = SSA.showVal SSA
20 val showOp = SSA.showOp SSA
21 val showVN = CF.showVN SSA
22 in A.appi (fn (v,vn) =>
23 if vn <> CF.bot andalso vn <> CF.top then
24 (let val i = A.sub(defSiteTbl,v)
25 in print(showVal v^" "^showOp i^" = "^showVN vn^"\n")
26 end
27 )
28 else ())
29 (valueMap, 0, NONE);
30 SSA
31 end
32 end