Skip to content

Commit 1afaf0b

Browse files
committed
set attributes on invoke instructions too
also removes the unused `FastInvoke` wrapper, as it's never actually going to be used (we can't *partially* switch to `fastcc`, and this is only used for Rust functions)
1 parent 22b6f74 commit 1afaf0b

File tree

3 files changed

+18
-29
lines changed

3 files changed

+18
-29
lines changed

src/librustc/middle/trans/base.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,8 @@ pub fn invoke(bcx: @mut Block, llfn: ValueRef, llargs: ~[ValueRef],
926926
llfn,
927927
llargs,
928928
normal_bcx.llbb,
929-
get_landing_pad(bcx));
929+
get_landing_pad(bcx),
930+
attributes);
930931
return (llresult, normal_bcx);
931932
} else {
932933
unsafe {

src/librustc/middle/trans/build.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ pub fn Invoke(cx: @mut Block,
109109
Fn: ValueRef,
110110
Args: &[ValueRef],
111111
Then: BasicBlockRef,
112-
Catch: BasicBlockRef)
112+
Catch: BasicBlockRef,
113+
attributes: &[(uint, lib::llvm::Attribute)])
113114
-> ValueRef {
114115
if cx.unreachable {
115116
return C_null(Type::i8());
@@ -119,15 +120,7 @@ pub fn Invoke(cx: @mut Block,
119120
debug!("Invoke(%s with arguments (%s))",
120121
cx.val_to_str(Fn),
121122
Args.map(|a| cx.val_to_str(*a)).connect(", "));
122-
B(cx).invoke(Fn, Args, Then, Catch)
123-
}
124-
125-
pub fn FastInvoke(cx: @mut Block, Fn: ValueRef, Args: &[ValueRef],
126-
Then: BasicBlockRef, Catch: BasicBlockRef) {
127-
if cx.unreachable { return; }
128-
check_not_terminated(cx);
129-
terminate(cx, "FastInvoke");
130-
B(cx).fast_invoke(Fn, Args, Then, Catch);
123+
B(cx).invoke(Fn, Args, Then, Catch, attributes)
131124
}
132125

133126
pub fn Unreachable(cx: @mut Block) {

src/librustc/middle/trans/builder.rs

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -154,30 +154,25 @@ impl Builder {
154154
llfn: ValueRef,
155155
args: &[ValueRef],
156156
then: BasicBlockRef,
157-
catch: BasicBlockRef)
157+
catch: BasicBlockRef,
158+
attributes: &[(uint, lib::llvm::Attribute)])
158159
-> ValueRef {
159160
self.count_insn("invoke");
160161
unsafe {
161-
llvm::LLVMBuildInvoke(self.llbuilder,
162-
llfn,
163-
vec::raw::to_ptr(args),
164-
args.len() as c_uint,
165-
then,
166-
catch,
167-
noname())
162+
let v = llvm::LLVMBuildInvoke(self.llbuilder,
163+
llfn,
164+
vec::raw::to_ptr(args),
165+
args.len() as c_uint,
166+
then,
167+
catch,
168+
noname());
169+
for &(idx, attr) in attributes.iter() {
170+
llvm::LLVMAddInstrAttribute(v, idx as c_uint, attr as c_uint);
171+
}
172+
v
168173
}
169174
}
170175

171-
pub fn fast_invoke(&self,
172-
llfn: ValueRef,
173-
args: &[ValueRef],
174-
then: BasicBlockRef,
175-
catch: BasicBlockRef) {
176-
self.count_insn("fastinvoke");
177-
let v = self.invoke(llfn, args, then, catch);
178-
lib::llvm::SetInstructionCallConv(v, lib::llvm::FastCallConv);
179-
}
180-
181176
pub fn unreachable(&self) {
182177
self.count_insn("unreachable");
183178
unsafe {

0 commit comments

Comments
 (0)