- fun gengraph x =
- let
- val igraph' = canonicalize (List.concat (List.map proc_one x))
- in
- foldr
- (fn ((a,l),b) => case a
- of X.REG(_) => b
- | X.TEMP(t) => (t,l)::b
- | _ => raise ErrorMsg.InternalError "Non-live register type found in igraph"
+ fun gengraph (preds, lives) : graph * Temp.temp list =
+ (LiveMap.foldri
+ (fn (ln, predlist, map) =>
+ let
+ val ismove = Liveness.ismove predlist
+ in
+ List.foldr
+ (fn (oper, map) =>
+ List.foldr
+ (fn (ln', map) =>
+ let
+ val liveat = valOf (LiveMap.find (lives, ln'))
+ val liveat =
+ if not ismove
+ then liveat
+ else OperSet.difference
+ (liveat,
+ OperSet.addList (OperSet.empty, Liveness.uses predlist))
+ in
+ OperSet.foldr
+ (fn (oper', map) => add_interfere map (oper, oper'))
+ map
+ liveat
+ end)
+ map
+ (Liveness.succs predlist))
+ map
+ (Liveness.defs predlist)
+ end