]> Joshua Wise's Git repositories - snipe.git/blobdiff - codegen/coloring.sml
Initial import of l2c
[snipe.git] / codegen / coloring.sml
index e1c2bcd1045f73bf535bc30ae1a689a54039ba06..eeca849b5d10a68ef91e0079a374ba4545dffb8b 100644 (file)
@@ -1,21 +1,22 @@
-(* 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
   
@@ -58,6 +59,7 @@ struct
         @ (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 *)
@@ -67,12 +69,12 @@ struct
           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
This page took 0.025391 seconds and 4 git commands to generate.