summary refs log tree commit diff
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-01-05 15:59:22 -0500
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-01-05 15:59:22 -0500
commit2bbff83d4026c1c97e9b881266478b4398455814 (patch)
tree76f5f21eb5416ca2a1512d5b38d2da4f31e20d32
parent85ffed1369f526d23a538085bb1ac6318835e9a3 (diff)
downloadroux-2bbff83d4026c1c97e9b881266478b4398455814.tar.gz
quick fix in loc2 for constants
-rw-r--r--lo.ml10
1 files changed, 8 insertions, 2 deletions
diff --git a/lo.ml b/lo.ml
index 0f50c97..369a66d 100644
--- a/lo.ml
+++ b/lo.ml
@@ -176,8 +176,14 @@ let regalloc nr p l =
   let loc2 i =
     try List.assoc i !locs
     with Not_found ->
-      if free () = [] then LSpl (setspill i)
-      else LReg (alloc hints.(i) i) in
+      match p.(i) with
+      | ICon k -> setloc i (LCon k); LCon k
+      | _ ->
+        (* Here, we just want to avoid using the
+           same register we used for the first
+           operand. *)
+        if free () = [] then LSpl (setspill i)
+        else LReg (alloc hints.(i) i) in
 
   (* Find a register for a destination. *)
   let dst i =