From ee04c0236c731a1ca3f3a885c16bce5e1ae0a72d Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Thu, 26 Aug 2010 14:32:47 -0700 Subject: [PATCH] Add check to catch bug underlying issue #152. Fix will take longer. --- src/boot/be/ra.ml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/boot/be/ra.ml b/src/boot/be/ra.ml index 3da474b4255..244bfcc4645 100644 --- a/src/boot/be/ra.ml +++ b/src/boot/be/ra.ml @@ -563,7 +563,20 @@ let reg_alloc let clobbers = cx.ctxt_abi.Abi.abi_clobbers quad in let used = quad_used_vregs quad in let defined = quad_defined_vregs quad in + + let vreg_constrs v = (v, Bits.to_list (vreg_constraints.(v))) in + let used_constrs = List.map vreg_constrs used in + let constrs_collide (v1,c1) = + if List.length c1 <> 1 + then false + else + List.exists + (fun (v2,c2) -> if v1 = v2 then false else c1 = c2) + used_constrs + in begin + if List.exists constrs_collide used_constrs + then raise (Ra_error ("over-constrained vregs")); if List.exists (fun def -> List.mem def clobbers) defined then raise (Ra_error ("clobber and defined sets overlap")); iflog cx @@ -629,7 +642,7 @@ let reg_alloc with Ra_error s -> - Session.fail sess "RA Error: %s" s; + Session.fail sess "RA error: %s\n" s; (quads, 0) ;;