112 |
else () |
else () |
113 |
| _ => raise Can'tMerge |
| _ => raise Can'tMerge |
114 |
val _ = if mustPreceed CFG (i,j) then raise Can'tMerge else () |
val _ = if mustPreceed CFG (i,j) then raise Can'tMerge else () |
115 |
val CFG.BLOCK{data=d2,name=n2,insns=i2,annotations=a2,...} = |
val CFG.BLOCK{data=d2,insns=i2,annotations=a2,...} = |
116 |
#node_info cfg j |
#node_info cfg j |
117 |
val _ = case !d2 of [] => () | _ => raise Can'tMerge |
val _ = case !d2 of [] => () | _ => raise Can'tMerge |
118 |
val CFG.BLOCK{data=d1,name=n1,insns=i1,annotations=a1,...} = |
val CFG.BLOCK{data=d1,insns=i1,annotations=a1,...} = |
119 |
#node_info cfg i |
#node_info cfg i |
120 |
(* If the two blocks have different names then don't merge them *) |
(* If both blocks have annotations then don't merge them *) |
121 |
val _ = if CFG.B.==(n1,n2) then () else raise Can'tMerge |
val _ = case (!a1, !a2) of |
122 |
|
(_::_, _::_) => raise Can'tMerge |
123 |
|
| _ => () |
124 |
val insns1 = case !i1 of |
val insns1 = case !i1 of |
125 |
[] => [] |
[] => [] |
126 |
| insns as jmp::rest => |
| insns as jmp::rest => |
194 |
| SOME _ => true) |
| SOME _ => true) |
195 |
val insns = ref(if jump then [P.jump(labelOf CFG j)] else []) |
val insns = ref(if jump then [P.jump(labelOf CFG j)] else []) |
196 |
val node = |
val node = |
197 |
CFG.BLOCK{id=k, kind=kind, name=CFG.B.default, |
CFG.BLOCK{id=k, kind=kind, |
198 |
freq= ref(!w), data=ref [], labels = ref [], |
freq= ref(!w), data=ref [], labels = ref [], |
199 |
insns=insns, annotations=ref []} |
insns=insns, annotations=ref []} |
200 |
val kind = if jump then CFG.JUMP else CFG.FALLSTHRU |
val kind = if jump then CFG.JUMP else CFG.FALLSTHRU |