qbe

Internal scc patchset buffer for QBE
Log | Files | Refs | README | LICENSE

commit 2bbff83d4026c1c97e9b881266478b4398455814
parent 85ffed1369f526d23a538085bb1ac6318835e9a3
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date:   Mon,  5 Jan 2015 15:59:22 -0500

quick fix in loc2 for constants

Diffstat:
Mlo.ml | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git 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 =