]> git.lizzy.rs Git - rust.git/commitdiff
Add a workaround for 8199 for now
authorAlex Crichton <alex@alexcrichton.com>
Thu, 1 Aug 2013 22:47:09 +0000 (15:47 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Sun, 4 Aug 2013 17:58:23 +0000 (10:58 -0700)
src/librustc/lib/llvm.rs
src/librustc/middle/trans/base.rs

index 5ec439ce386c5433e86812a8b3396cd4e23ba6f7..40fe9bd5fc6a10965d751879af0071ecc4e0c567 100644 (file)
@@ -87,6 +87,8 @@ pub enum Attribute {
     NonLazyBindAttribute = 1 << 31,
 
     // Not added to LLVM yet, so may need to stay updated if LLVM changes.
+    // FIXME(#8199): if this changes, be sure to change the relevant constant
+    //               down below
     FixedStackSegment = 1 << 41,
 }
 
@@ -2116,6 +2118,17 @@ pub fn SetFunctionAttribute(Fn: ValueRef, attr: Attribute) {
         llvm::LLVMAddFunctionAttr(Fn, lower as c_uint, upper as c_uint);
     }
 }
+
+// FIXME(#8199): this shouldn't require this hackery. On i686
+//               (FixedStackSegment as u64) will return 0 instead of 1 << 41.
+//               Furthermore, if we use a match of any sort then an LLVM
+//               assertion is generated!
+pub fn SetFixedStackSegmentAttribute(Fn: ValueRef) {
+        let attr = 1u64 << 41;
+        let lower = attr & 0xffffffff;
+        let upper = (attr >> 32) & 0xffffffff;
+        llvm::LLVMAddFunctionAttr(Fn, lower as c_uint, upper as c_uint);
+}
 /* Memory-managed object interface to type handles. */
 
 pub struct TypeNames {
index e727907f88e74453458d4d83a6d86dc27e09a847..fc39af095b79c9a1dea95f31d789d7190ce4c2fb 100644 (file)
@@ -456,7 +456,7 @@ pub fn set_always_inline(f: ValueRef) {
 }
 
 pub fn set_fixed_stack_segment(f: ValueRef) {
-    lib::llvm::SetFunctionAttribute(f, lib::llvm::FixedStackSegment)
+    lib::llvm::SetFixedStackSegmentAttribute(f);
 }
 
 pub fn set_glue_inlining(f: ValueRef, t: ty::t) {