-(* colorizer
- * Gathers tiberium, fires rockets
+(* L2 compiler
+ * colorizer
* colors a graph and returns a list of nodes with associated colors
- * Author: Chris Lu <czl@andrew>
+ * Author: Joshua Wise <jwise@andrew.cmu.edu>
+ * Author: Chris Lu <czl@andrew.cmu.edu>
*)
signature COLORIZER =
sig
- type tiberium = Temp.temp list
+ type temps = Temp.temp list
type colorlist = (Temp.temp * int) list
type igraph = (Temp.temp * x86.oper list) list
- val colorize : tiberium -> igraph -> colorlist
+ val colorize : temps -> igraph -> colorlist
end
structure Colorizer :> COLORIZER =
struct
- type tiberium = Temp.temp list
+ type temps = Temp.temp list
type colorlist = (Temp.temp * int) list
type igraph = (Temp.temp * x86.oper list) list
@ (List.map
(fn X.REG X.EAX => 0
| X.REG X.EDX => 3
+ | X.REG X.ECX => 2
| _ => raise ErrorMsg.InternalError "Bad kind of specreg")
fixeds)
(* Greedy-colorize -- pick the lowest number that isn't used by a neighbor *)
else i
val newcolor = greedy 0 ints
- val () = print (" Assigned color "^(Int.toString newcolor)^" to temp "^(Temp.name temp)^"\n")
+ (* val () = print (" Assigned color "^(Int.toString newcolor)^" to temp "^(Temp.name temp)^"\n") *)
in
(temp, (greedy 0 ints)) :: regs
end
- (* val colorize : tiberium -> igraph -> colorlist
+ (* val colorize : temps -> igraph -> colorlist
* colorizes a graph given the graph representation and the order in which to color
* nodes, returns a list of nodes numbered with their respective color *)
fun colorize order graph = foldl (color_single graph) nil order