From 2bbff83d4026c1c97e9b881266478b4398455814 Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Mon, 5 Jan 2015 15:59:22 -0500 Subject: quick fix in loc2 for constants --- lo.ml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lo.ml') 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 = -- cgit 1.4.1