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)
This commit is contained in:
Daniel Micay 2013-09-16 18:30:59 -04:00
parent 22b6f7481f
commit 1afaf0b308
3 changed files with 18 additions and 29 deletions

View File

@ -926,7 +926,8 @@ pub fn invoke(bcx: @mut Block, llfn: ValueRef, llargs: ~[ValueRef],
llfn,
llargs,
normal_bcx.llbb,
get_landing_pad(bcx));
get_landing_pad(bcx),
attributes);
return (llresult, normal_bcx);
} else {
unsafe {

View File

@ -109,7 +109,8 @@ pub fn Invoke(cx: @mut Block,
Fn: ValueRef,
Args: &[ValueRef],
Then: BasicBlockRef,
Catch: BasicBlockRef)
Catch: BasicBlockRef,
attributes: &[(uint, lib::llvm::Attribute)])
-> ValueRef {
if cx.unreachable {
return C_null(Type::i8());
@ -119,15 +120,7 @@ pub fn Invoke(cx: @mut Block,
debug!("Invoke(%s with arguments (%s))",
cx.val_to_str(Fn),
Args.map(|a| cx.val_to_str(*a)).connect(", "));
B(cx).invoke(Fn, Args, Then, Catch)
}
pub fn FastInvoke(cx: @mut Block, Fn: ValueRef, Args: &[ValueRef],
Then: BasicBlockRef, Catch: BasicBlockRef) {
if cx.unreachable { return; }
check_not_terminated(cx);
terminate(cx, "FastInvoke");
B(cx).fast_invoke(Fn, Args, Then, Catch);
B(cx).invoke(Fn, Args, Then, Catch, attributes)
}
pub fn Unreachable(cx: @mut Block) {

View File

@ -154,30 +154,25 @@ impl Builder {
llfn: ValueRef,
args: &[ValueRef],
then: BasicBlockRef,
catch: BasicBlockRef)
catch: BasicBlockRef,
attributes: &[(uint, lib::llvm::Attribute)])
-> ValueRef {
self.count_insn("invoke");
unsafe {
llvm::LLVMBuildInvoke(self.llbuilder,
llfn,
vec::raw::to_ptr(args),
args.len() as c_uint,
then,
catch,
noname())
let v = llvm::LLVMBuildInvoke(self.llbuilder,
llfn,
vec::raw::to_ptr(args),
args.len() as c_uint,
then,
catch,
noname());
for &(idx, attr) in attributes.iter() {
llvm::LLVMAddInstrAttribute(v, idx as c_uint, attr as c_uint);
}
v
}
}
pub fn fast_invoke(&self,
llfn: ValueRef,
args: &[ValueRef],
then: BasicBlockRef,
catch: BasicBlockRef) {
self.count_insn("fastinvoke");
let v = self.invoke(llfn, args, then, catch);
lib::llvm::SetInstructionCallConv(v, lib::llvm::FastCallConv);
}
pub fn unreachable(&self) {
self.count_insn("unreachable");
unsafe {