val getInstrsAndFrameList = Main.getInstrsAndFrameList local val n = ref 0 fun dispListContents(list) = (print(Int.toString(!n) ^ ": "); app (fn i => print(Main.makestring(i) ^ " ")) list; print "\n"; n := !n + 1) fun dispSetContents(set) = dispListContents(Liveness.Set.listItems(set)) fun dispTable dispFunc control table = let val fgNodes = Graph.nodes(control) fun takeFromTable node = valOf(Graph.Table.look(table,node)) val itemsList = map takeFromTable fgNodes in (n := 0; app dispFunc itemsList) end fun showDefUse defOrUse filename = let val (instrs,_) = hd(getInstrsAndFrameList filename) val (Flow.FGRAPH graphBody,_) = MakeGraph.instrs2graph instrs val control = #control(graphBody) val duTable = defOrUse(graphBody) in dispTable dispListContents control duTable end fun showInOut idx filename = (* idx=#1 -> inTable, idx=#2 -> outTable *) let val (instrs,_) = hd(getInstrsAndFrameList filename) val (graph as Flow.FGRAPH{control,...},_) = MakeGraph.instrs2graph instrs (* Liveness.calcLiveness returns (inTable, outTable) *) val ioTable = idx(Liveness.calcLiveness graph) in dispTable dispSetContents control ioTable end in val showDef = showDefUse #def val showUse = showDefUse #use val showIn = showInOut #1 val showOut = showInOut #2 end