]> Joshua Wise's Git repositories - snipe.git/commitdiff
Remove sizes from temps.
authorJoshua Wise <jwise@andrew.cmu.edu>
Mon, 5 Jul 2010 06:30:41 +0000 (02:30 -0400)
committerJoshua Wise <jwise@andrew.cmu.edu>
Mon, 5 Jul 2010 06:30:41 +0000 (02:30 -0400)
codegen/blarg.sml
trans/temp.sml
trans/tree.sml
trans/treeutils.sml

index e482813a9c14e0c297c30af56173754c3cae5398..797ab3e1c5b9a83919aa9723054b850b0020a42d 100644 (file)
@@ -168,7 +168,7 @@ struct
                                  end)
   
   fun pp_oper (REG r) = "%" ^ (regname r)
-    | pp_oper (TEMP t) = (Temp.name t) ^ (Temp.sfx (Temp.size t))
+    | pp_oper (TEMP t) = (Temp.name t)
     | pp_oper (STACKARG i) = "arg#"^Int.toString i
   
   fun pp_insn pr (MOVLIT (d, w)) = "\tmov"^pr^" "^(pp_oper d)^", #"^(Word.toString w)^"\n"
index bd311c4a08176cb88b0b8175029a31d1d078e549..68de49ca392630b8259d892fa5d374aff3a7a0ff 100644 (file)
@@ -8,58 +8,28 @@
 signature TEMP = 
 sig
   type temp
-  datatype size = Byte | Word | Long | Quad
 
   val reset : unit -> unit           (* resets temp numbering *)
-  val new : string -> size -> temp   (* returns a unique new temp *)
+  val new : string -> temp           (* returns a unique new temp *)
   val name : temp -> string          (* returns the name of a temp *)
-  val size : temp -> size            (* returns the size of a temp *)
   val compare : temp * temp -> order (* comparison function *)
   val eq : temp * temp -> bool
-  val cmpsize : size * size -> order
-  val sfx : size -> string
-  val sts : int -> size
 end
 
 structure Temp :> TEMP = 
 struct
-  datatype size = Byte | Word | Long | Quad
-  type temp = int * string * size
+  type temp = int * string
 
   local
     val counter = ref 1
   in
     (* warning: calling reset() may jeopardize uniqueness of temps! *)
     fun reset () = ( counter := 1 )
-    fun new str size = (!counter, str, size) before ( counter := !counter + 1 )
+    fun new str = (!counter, str) before ( counter := !counter + 1 )
   end
 
-  fun sfx Byte = "b"
-    | sfx Word = "w"
-    | sfx Long = "l"
-    | sfx Quad = "q"
-
-  fun name (t,s, sz) = "+t" ^ Int.toString t ^ "[" ^ s ^ "]" ^ sfx sz
-  fun size (t, s, sz) = sz
-  fun compare ((t1,_,_),(t2,_,_)) = Int.compare (t1,t2)
-
-  fun eq ((t1,_,_), (t2,_,_)) = t1 = t2
-
-  fun cmpsize (Quad,Quad) = EQUAL
-    | cmpsize (Quad,_) = GREATER
-    | cmpsize (_,Quad) = LESS
-    | cmpsize (Long,Long) = EQUAL
-    | cmpsize (Long,_) = GREATER
-    | cmpsize (_,Long) = LESS
-    | cmpsize (Word,Word) = EQUAL
-    | cmpsize (Word,_) = GREATER
-    | cmpsize (_,Word) = LESS
-    | cmpsize (Byte,Byte) = EQUAL
-
-  fun sts 8 = Quad
-    | sts 4 = Long
-    | sts 2 = Word
-    | sts 1 = Byte
-    | sts _ = raise ErrorMsg.InternalError "Temp.sts: invalid size"
+  fun name (t,s) = "+t" ^ Int.toString t ^ "[" ^ s ^ "]"
+  fun compare ((t1,_),(t2,_)) = Int.compare (t1,t2)
 
+  fun eq ((t1,_), (t2,_)) = t1 = t2
 end
index dbd0efc335dbd8b57deafab808daac8f536700b2..2111fc19f666758fa1680f3c211e509438935564 100644 (file)
@@ -17,18 +17,18 @@ sig
   datatype exp = 
       CONST of Word32.word
     | TEMP of Temp.temp
-    | ARG of Blarg * Temp.size (* I am j4cbo *)
+    | ARG of Blarg (* I am j4cbo *)
     | BINOP of binop * exp * exp
     | UNOP of unop * exp
-    | CALL of Ast.ident * (exp * Temp.size) list * Temp.size
-    | MEMORY of exp * Temp.size
+    | CALL of Ast.ident * exp list
+    | MEMORY of exp
     | ALLOC of exp
     | COND of exp * exp * exp
     | STMVAR of stm list * exp
     | NULLPTR
   and stm =
       MOVE of exp * exp
-    | RETURN of exp * Temp.size
+    | RETURN of exp
     | EFFECT of exp
     | LABEL of Label.label
     | JUMPIFN of exp * Label.label
@@ -49,18 +49,18 @@ struct
   datatype exp = 
       CONST of Word32.word
     | TEMP of Temp.temp
-    | ARG of Blarg * Temp.size (* I am j4cbo *)
+    | ARG of Blarg (* I am j4cbo *)
     | BINOP of binop * exp * exp
     | UNOP of unop * exp
-    | CALL of Ast.ident * (exp * Temp.size) list * Temp.size
-    | MEMORY of exp * Temp.size
+    | CALL of Ast.ident * exp list
+    | MEMORY of exp
     | ALLOC of exp
     | COND of exp * exp * exp
     | STMVAR of stm list * exp
     | NULLPTR
   and stm =
       MOVE of exp * exp
-    | RETURN of exp * Temp.size
+    | RETURN of exp
     | EFFECT of exp
     | LABEL of Label.label
     | JUMPIFN of exp * Label.label
index b5217b0b4bdb7a350cc6dd2c59b653fbdddeac82..ec6be4d40e3de9e9ee50eed92304ecb0224318a5 100644 (file)
@@ -33,7 +33,7 @@ struct
     | effect (T.NULLPTR) = false
 
   fun effect_stm (T.MOVE (e1,e2)) = effect e1 orelse effect e2
-    | effect_stm (T.RETURN (e1,e2)) = effect e1 orelse effect e1
+    | effect_stm (T.RETURN (e1)) = effect e1
     | effect_stm (T.EFFECT e) = effect e
     | effect_stm (T.JUMPIFN (e,_)) = effect e
     | effect_stm _ = false
@@ -68,14 +68,14 @@ struct
 
     fun pp_exp (T.CONST(x)) = Word32Signed.toString x
       | pp_exp (T.TEMP(t)) = Temp.name t
-      | pp_exp (T.ARG(n, sz)) = "arg#"^Int.toString n
+      | pp_exp (T.ARG(n)) = "arg#"^Int.toString n
       | pp_exp (T.BINOP (binop, e1, e2)) =
          "(" ^ pp_exp e1 ^ " " ^ pp_binop binop ^ " " ^ pp_exp e2 ^ ")"
       | pp_exp (T.UNOP (unop, e1)) =
           pp_unop unop ^ "(" ^ pp_exp e1 ^ ")"
-      | pp_exp (T.CALL (f, l, sz)) =
-          Symbol.name f ^ "(" ^ (String.concatWith ", " (List.map (fn (e, _) => pp_exp e) l)) ^ ")"
-      | pp_exp (T.MEMORY (exp, sz)) = "M(" ^ Temp.sfx sz ^ ")[" ^ pp_exp exp ^ "]"
+      | pp_exp (T.CALL (f, l)) =
+          Symbol.name f ^ "(" ^ (String.concatWith ", " (List.map (fn e => pp_exp e) l)) ^ ")"
+      | pp_exp (T.MEMORY (exp)) = "M[" ^ pp_exp exp ^ "]"
       | pp_exp (T.ALLOC(e)) = "NEW(" ^ pp_exp e ^ ")"
       | pp_exp (T.COND(c,e1,e2)) = "(" ^ pp_exp c ^ ") ? (" ^ pp_exp e1 ^ ") : (" ^ pp_exp e2 ^ ")"
       | pp_exp (T.STMVAR(sl,v)) = "({" ^ (foldr (fn (st,s) => (pp_stm st) ^ "; " ^ s) "" sl) ^ (pp_exp v) ^ "})"
@@ -83,7 +83,7 @@ struct
 
     and pp_stm (T.MOVE (e1,e2)) =
          pp_exp e1 ^ "  <--  " ^ pp_exp e2
-      | pp_stm (T.RETURN (e, sz)) =
+      | pp_stm (T.RETURN (e)) =
          "return " ^ pp_exp e
       | pp_stm (T.EFFECT e) = pp_exp e
       | pp_stm (T.LABEL l) =
This page took 0.035139 seconds and 4 git commands to generate.