about summary refs log tree commit diff
path: root/src/boot
diff options
context:
space:
mode:
authorGraydon Hoare <graydon@mozilla.com>2010-08-26 14:32:47 -0700
committerGraydon Hoare <graydon@mozilla.com>2010-08-26 14:32:47 -0700
commitee04c0236c731a1ca3f3a885c16bce5e1ae0a72d (patch)
treeac20ca26193a815f62ca70cf90f27fd15daa0e62 /src/boot
parentc3c3e03649130d3f4d7f92f01e92d7903f9d9da3 (diff)
downloadrust-ee04c0236c731a1ca3f3a885c16bce5e1ae0a72d.tar.gz
rust-ee04c0236c731a1ca3f3a885c16bce5e1ae0a72d.zip
Add check to catch bug underlying issue #152. Fix will take longer.
Diffstat (limited to 'src/boot')
-rw-r--r--src/boot/be/ra.ml15
1 files changed, 14 insertions, 1 deletions
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)
 
 ;;