Skip to content

Commit 85d89e0

Browse files
committed
---
yaml --- r: 273667 b: refs/heads/beta c: 13bfd5c h: refs/heads/master i: 273665: 138a661 273663: 1e1e71c
1 parent 53d4996 commit 85d89e0

File tree

5 files changed

+28
-34
lines changed

5 files changed

+28
-34
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: e011ae5ea9c48d71772c054771ead2d0f053c8c7
26+
refs/heads/beta: 13bfd5c0b7b57b3e90be5c3e738b8c9426055433
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/bootstrap/build/native.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,7 @@ pub fn llvm(build: &Build, target: &str) {
3939

4040
let _ = fs::remove_dir_all(&dst.join("build"));
4141
t!(fs::create_dir_all(&dst.join("build")));
42-
let mut assertions = if build.config.llvm_assertions {"ON"} else {"OFF"};
43-
44-
// Disable LLVM assertions on ARM compilers until #32360 is fixed
45-
if target.contains("arm") && target.contains("gnu") {
46-
assertions = "OFF";
47-
}
42+
let assertions = if build.config.llvm_assertions {"ON"} else {"OFF"};
4843

4944
// http://llvm.org/docs/CMake.html
5045
let mut cfg = cmake::Config::new(build.src.join("src/llvm"));

branches/beta/src/librustc_llvm/lib.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -964,9 +964,10 @@ extern {
964964
pub fn LLVMAddFunctionAttrStringValue(Fn: ValueRef, index: c_uint,
965965
Name: *const c_char,
966966
Value: *const c_char);
967+
pub fn LLVMRemoveFunctionAttributes(Fn: ValueRef, index: c_uint, attr: uint64_t);
967968
pub fn LLVMRemoveFunctionAttrString(Fn: ValueRef, index: c_uint, Name: *const c_char);
968-
pub fn LLVMGetFunctionAttr(Fn: ValueRef) -> c_ulonglong;
969-
pub fn LLVMRemoveFunctionAttr(Fn: ValueRef, val: c_ulonglong);
969+
pub fn LLVMGetFunctionAttr(Fn: ValueRef) -> c_uint;
970+
pub fn LLVMRemoveFunctionAttr(Fn: ValueRef, val: c_uint);
970971

971972
/* Operations on parameters */
972973
pub fn LLVMCountParams(Fn: ValueRef) -> c_uint;
@@ -2184,6 +2185,13 @@ pub fn SetFunctionAttribute(fn_: ValueRef, attr: Attribute) {
21842185
}
21852186
}
21862187

2188+
pub fn RemoveFunctionAttributes(fn_: ValueRef, attr: Attribute) {
2189+
unsafe {
2190+
LLVMRemoveFunctionAttributes(fn_, FunctionIndex as c_uint,
2191+
attr.bits() as uint64_t)
2192+
}
2193+
}
2194+
21872195
/* Memory-managed interface to target data. */
21882196

21892197
pub struct TargetData {

branches/beta/src/librustc_trans/trans/attributes.rs

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010
//! Set and unset common attributes on LLVM values.
1111
12-
use libc::{c_uint, c_ulonglong};
12+
use libc::c_uint;
1313
use llvm::{self, ValueRef};
1414
use session::config::NoDebugInfo;
1515
pub use syntax::attr::InlineAttr;
@@ -28,9 +28,7 @@ pub fn inline(val: ValueRef, inline: InlineAttr) {
2828
let attr = llvm::Attribute::InlineHint |
2929
llvm::Attribute::AlwaysInline |
3030
llvm::Attribute::NoInline;
31-
unsafe {
32-
llvm::LLVMRemoveFunctionAttr(val, attr.bits() as c_ulonglong)
33-
}
31+
llvm::RemoveFunctionAttributes(val, attr)
3432
},
3533
};
3634
}
@@ -41,25 +39,15 @@ pub fn emit_uwtable(val: ValueRef, emit: bool) {
4139
if emit {
4240
llvm::SetFunctionAttribute(val, llvm::Attribute::UWTable);
4341
} else {
44-
unsafe {
45-
llvm::LLVMRemoveFunctionAttr(
46-
val,
47-
llvm::Attribute::UWTable.bits() as c_ulonglong,
48-
);
49-
}
42+
llvm::RemoveFunctionAttributes(val, llvm::Attribute::UWTable);
5043
}
5144
}
5245

5346
/// Tell LLVM whether the function can or cannot unwind.
5447
#[inline]
5548
pub fn unwind(val: ValueRef, can_unwind: bool) {
5649
if can_unwind {
57-
unsafe {
58-
llvm::LLVMRemoveFunctionAttr(
59-
val,
60-
llvm::Attribute::NoUnwind.bits() as c_ulonglong,
61-
);
62-
}
50+
llvm::RemoveFunctionAttributes(val, llvm::Attribute::NoUnwind);
6351
} else {
6452
llvm::SetFunctionAttribute(val, llvm::Attribute::NoUnwind);
6553
}
@@ -72,12 +60,7 @@ pub fn set_optimize_for_size(val: ValueRef, optimize: bool) {
7260
if optimize {
7361
llvm::SetFunctionAttribute(val, llvm::Attribute::OptimizeForSize);
7462
} else {
75-
unsafe {
76-
llvm::LLVMRemoveFunctionAttr(
77-
val,
78-
llvm::Attribute::OptimizeForSize.bits() as c_ulonglong,
79-
);
80-
}
63+
llvm::RemoveFunctionAttributes(val, llvm::Attribute::OptimizeForSize);
8164
}
8265
}
8366

@@ -87,9 +70,7 @@ pub fn naked(val: ValueRef, is_naked: bool) {
8770
if is_naked {
8871
llvm::SetFunctionAttribute(val, llvm::Attribute::Naked);
8972
} else {
90-
unsafe {
91-
llvm::LLVMRemoveFunctionAttr(val, llvm::Attribute::Naked.bits() as c_ulonglong);
92-
}
73+
llvm::RemoveFunctionAttributes(val, llvm::Attribute::Naked);
9374
}
9475
}
9576

branches/beta/src/rustllvm/RustWrapper.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,16 @@ extern "C" void LLVMAddFunctionAttrStringValue(LLVMValueRef Fn, unsigned index,
151151
F->addAttributes(index, AttributeSet::get(F->getContext(), index, B));
152152
}
153153

154+
extern "C" void LLVMRemoveFunctionAttributes(LLVMValueRef Fn, unsigned index, uint64_t Val) {
155+
Function *A = unwrap<Function>(Fn);
156+
const AttributeSet PAL = A->getAttributes();
157+
AttrBuilder B(Val);
158+
const AttributeSet PALnew =
159+
PAL.removeAttributes(A->getContext(), index,
160+
AttributeSet::get(A->getContext(), index, B));
161+
A->setAttributes(PALnew);
162+
}
163+
154164
extern "C" void LLVMRemoveFunctionAttrString(LLVMValueRef fn, unsigned index, const char *Name) {
155165
Function *f = unwrap<Function>(fn);
156166
LLVMContext &C = f->getContext();

0 commit comments

Comments
 (0)