Remove unnecessary LLVMRustPersonalityFn binding
LLVM Core C bindings provide this function for all the versions back to what we support (3.7), and helps to avoid this unnecessary builder->function transition every time. Also a negative diff.
This commit is contained in:
parent
07fe04c1e2
commit
1363cdaec9
4 changed files with 5 additions and 11 deletions
|
@ -804,7 +804,7 @@ extern "C" {
|
||||||
Name: *const c_char)
|
Name: *const c_char)
|
||||||
-> ValueRef;
|
-> ValueRef;
|
||||||
pub fn LLVMRustAddHandler(CatchSwitch: ValueRef, Handler: BasicBlockRef);
|
pub fn LLVMRustAddHandler(CatchSwitch: ValueRef, Handler: BasicBlockRef);
|
||||||
pub fn LLVMRustSetPersonalityFn(B: BuilderRef, Pers: ValueRef);
|
pub fn LLVMSetPersonalityFn(Func: ValueRef, Pers: ValueRef);
|
||||||
|
|
||||||
// Add a case to the switch instruction
|
// Add a case to the switch instruction
|
||||||
pub fn LLVMAddCase(Switch: ValueRef, OnVal: ValueRef, Dest: BasicBlockRef);
|
pub fn LLVMAddCase(Switch: ValueRef, OnVal: ValueRef, Dest: BasicBlockRef);
|
||||||
|
|
|
@ -1107,7 +1107,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||||
|
|
||||||
pub fn set_personality_fn(&self, personality: ValueRef) {
|
pub fn set_personality_fn(&self, personality: ValueRef) {
|
||||||
unsafe {
|
unsafe {
|
||||||
llvm::LLVMRustSetPersonalityFn(self.llbuilder, personality);
|
llvm::LLVMSetPersonalityFn(self.llfn(), personality);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -319,7 +319,9 @@ pub fn trans_mir<'a, 'tcx: 'a>(
|
||||||
mircx.cleanup_kinds.iter_enumerated().map(|(bb, cleanup_kind)| {
|
mircx.cleanup_kinds.iter_enumerated().map(|(bb, cleanup_kind)| {
|
||||||
if let CleanupKind::Funclet = *cleanup_kind {
|
if let CleanupKind::Funclet = *cleanup_kind {
|
||||||
let bcx = mircx.get_builder(bb);
|
let bcx = mircx.get_builder(bb);
|
||||||
bcx.set_personality_fn(mircx.ccx.eh_personality());
|
unsafe {
|
||||||
|
llvm::LLVMSetPersonalityFn(mircx.llfn, mircx.ccx.eh_personality());
|
||||||
|
}
|
||||||
if base::wants_msvc_seh(ccx.sess()) {
|
if base::wants_msvc_seh(ccx.sess()) {
|
||||||
return Some(Funclet::new(bcx.cleanup_pad(None, &[])));
|
return Some(Funclet::new(bcx.cleanup_pad(None, &[])));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1082,14 +1082,6 @@ extern "C" void LLVMRustAddHandler(LLVMValueRef CatchSwitchRef,
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void LLVMRustSetPersonalityFn(LLVMBuilderRef B,
|
|
||||||
LLVMValueRef Personality) {
|
|
||||||
#if LLVM_VERSION_GE(3, 8)
|
|
||||||
unwrap(B)->GetInsertBlock()->getParent()->setPersonalityFn(
|
|
||||||
cast<Function>(unwrap(Personality)));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#if LLVM_VERSION_GE(3, 8)
|
#if LLVM_VERSION_GE(3, 8)
|
||||||
extern "C" OperandBundleDef *LLVMRustBuildOperandBundleDef(const char *Name,
|
extern "C" OperandBundleDef *LLVMRustBuildOperandBundleDef(const char *Name,
|
||||||
LLVMValueRef *Inputs,
|
LLVMValueRef *Inputs,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue