Use existing llvm methods, instead of rust wrappers for:
LLVMRustBuildCleanupPad -> LLVMBuildCleanupPad LLVMRustBuildCleanupRet -> LLVMBuildCleanupRet LLVMRustBuildCatchPad -> LLVMBuildCatchPad LLVMRustBuildCatchRet -> LLVMBuildCatchRet LLVMRustBuildCatchSwitch -> LLVMBuildCatchSwitch
This commit is contained in:
parent
076116bb4c
commit
cc77ae07a9
@ -1001,11 +1001,11 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
|
||||
fn cleanup_pad(&mut self, parent: Option<&'ll Value>, args: &[&'ll Value]) -> Funclet<'ll> {
|
||||
let name = cstr!("cleanuppad");
|
||||
let ret = unsafe {
|
||||
llvm::LLVMRustBuildCleanupPad(
|
||||
llvm::LLVMBuildCleanupPad(
|
||||
self.llbuilder,
|
||||
parent,
|
||||
args.len() as c_uint,
|
||||
args.as_ptr(),
|
||||
args.len() as c_uint,
|
||||
name.as_ptr(),
|
||||
)
|
||||
};
|
||||
@ -1014,7 +1014,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
|
||||
|
||||
fn cleanup_ret(&mut self, funclet: &Funclet<'ll>, unwind: Option<&'ll BasicBlock>) {
|
||||
unsafe {
|
||||
llvm::LLVMRustBuildCleanupRet(self.llbuilder, funclet.cleanuppad(), unwind)
|
||||
llvm::LLVMBuildCleanupRet(self.llbuilder, funclet.cleanuppad(), unwind)
|
||||
.expect("LLVM does not have support for cleanupret");
|
||||
}
|
||||
}
|
||||
@ -1022,11 +1022,11 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
|
||||
fn catch_pad(&mut self, parent: &'ll Value, args: &[&'ll Value]) -> Funclet<'ll> {
|
||||
let name = cstr!("catchpad");
|
||||
let ret = unsafe {
|
||||
llvm::LLVMRustBuildCatchPad(
|
||||
llvm::LLVMBuildCatchPad(
|
||||
self.llbuilder,
|
||||
parent,
|
||||
args.len() as c_uint,
|
||||
args.as_ptr(),
|
||||
args.len() as c_uint,
|
||||
name.as_ptr(),
|
||||
)
|
||||
};
|
||||
@ -1041,7 +1041,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
|
||||
) -> &'ll Value {
|
||||
let name = cstr!("catchswitch");
|
||||
let ret = unsafe {
|
||||
llvm::LLVMRustBuildCatchSwitch(
|
||||
llvm::LLVMBuildCatchSwitch(
|
||||
self.llbuilder,
|
||||
parent,
|
||||
unwind,
|
||||
@ -1376,8 +1376,7 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
|
||||
}
|
||||
|
||||
pub fn catch_ret(&mut self, funclet: &Funclet<'ll>, unwind: &'ll BasicBlock) -> &'ll Value {
|
||||
let ret =
|
||||
unsafe { llvm::LLVMRustBuildCatchRet(self.llbuilder, funclet.cleanuppad(), unwind) };
|
||||
let ret = unsafe { llvm::LLVMBuildCatchRet(self.llbuilder, funclet.cleanuppad(), unwind) };
|
||||
ret.expect("LLVM does not have support for catchret")
|
||||
}
|
||||
|
||||
|
@ -1298,34 +1298,34 @@ extern "C" {
|
||||
pub fn LLVMBuildResume<'a>(B: &Builder<'a>, Exn: &'a Value) -> &'a Value;
|
||||
pub fn LLVMBuildUnreachable<'a>(B: &Builder<'a>) -> &'a Value;
|
||||
|
||||
pub fn LLVMRustBuildCleanupPad<'a>(
|
||||
pub fn LLVMBuildCleanupPad<'a>(
|
||||
B: &Builder<'a>,
|
||||
ParentPad: Option<&'a Value>,
|
||||
ArgCnt: c_uint,
|
||||
Args: *const &'a Value,
|
||||
NumArgs: c_uint,
|
||||
Name: *const c_char,
|
||||
) -> Option<&'a Value>;
|
||||
pub fn LLVMRustBuildCleanupRet<'a>(
|
||||
pub fn LLVMBuildCleanupRet<'a>(
|
||||
B: &Builder<'a>,
|
||||
CleanupPad: &'a Value,
|
||||
UnwindBB: Option<&'a BasicBlock>,
|
||||
BB: Option<&'a BasicBlock>,
|
||||
) -> Option<&'a Value>;
|
||||
pub fn LLVMRustBuildCatchPad<'a>(
|
||||
pub fn LLVMBuildCatchPad<'a>(
|
||||
B: &Builder<'a>,
|
||||
ParentPad: &'a Value,
|
||||
ArgCnt: c_uint,
|
||||
Args: *const &'a Value,
|
||||
NumArgs: c_uint,
|
||||
Name: *const c_char,
|
||||
) -> Option<&'a Value>;
|
||||
pub fn LLVMRustBuildCatchRet<'a>(
|
||||
pub fn LLVMBuildCatchRet<'a>(
|
||||
B: &Builder<'a>,
|
||||
Pad: &'a Value,
|
||||
CatchPad: &'a Value,
|
||||
BB: &'a BasicBlock,
|
||||
) -> Option<&'a Value>;
|
||||
pub fn LLVMRustBuildCatchSwitch<'a>(
|
||||
pub fn LLVMBuildCatchSwitch<'a>(
|
||||
Builder: &Builder<'a>,
|
||||
ParentPad: Option<&'a Value>,
|
||||
BB: Option<&'a BasicBlock>,
|
||||
UnwindBB: Option<&'a BasicBlock>,
|
||||
NumHandlers: c_uint,
|
||||
Name: *const c_char,
|
||||
) -> Option<&'a Value>;
|
||||
|
@ -1394,55 +1394,6 @@ extern "C" bool LLVMRustUnpackSMDiagnostic(LLVMSMDiagnosticRef DRef,
|
||||
return true;
|
||||
}
|
||||
|
||||
extern "C" LLVMValueRef LLVMRustBuildCleanupPad(LLVMBuilderRef B,
|
||||
LLVMValueRef ParentPad,
|
||||
unsigned ArgCount,
|
||||
LLVMValueRef *LLArgs,
|
||||
const char *Name) {
|
||||
Value **Args = unwrap(LLArgs);
|
||||
if (ParentPad == nullptr) {
|
||||
Type *Ty = Type::getTokenTy(unwrap(B)->getContext());
|
||||
ParentPad = wrap(Constant::getNullValue(Ty));
|
||||
}
|
||||
return wrap(unwrap(B)->CreateCleanupPad(
|
||||
unwrap(ParentPad), ArrayRef<Value *>(Args, ArgCount), Name));
|
||||
}
|
||||
|
||||
extern "C" LLVMValueRef LLVMRustBuildCleanupRet(LLVMBuilderRef B,
|
||||
LLVMValueRef CleanupPad,
|
||||
LLVMBasicBlockRef UnwindBB) {
|
||||
CleanupPadInst *Inst = cast<CleanupPadInst>(unwrap(CleanupPad));
|
||||
return wrap(unwrap(B)->CreateCleanupRet(Inst, unwrap(UnwindBB)));
|
||||
}
|
||||
|
||||
extern "C" LLVMValueRef
|
||||
LLVMRustBuildCatchPad(LLVMBuilderRef B, LLVMValueRef ParentPad,
|
||||
unsigned ArgCount, LLVMValueRef *LLArgs, const char *Name) {
|
||||
Value **Args = unwrap(LLArgs);
|
||||
return wrap(unwrap(B)->CreateCatchPad(
|
||||
unwrap(ParentPad), ArrayRef<Value *>(Args, ArgCount), Name));
|
||||
}
|
||||
|
||||
extern "C" LLVMValueRef LLVMRustBuildCatchRet(LLVMBuilderRef B,
|
||||
LLVMValueRef Pad,
|
||||
LLVMBasicBlockRef BB) {
|
||||
return wrap(unwrap(B)->CreateCatchRet(cast<CatchPadInst>(unwrap(Pad)),
|
||||
unwrap(BB)));
|
||||
}
|
||||
|
||||
extern "C" LLVMValueRef LLVMRustBuildCatchSwitch(LLVMBuilderRef B,
|
||||
LLVMValueRef ParentPad,
|
||||
LLVMBasicBlockRef BB,
|
||||
unsigned NumHandlers,
|
||||
const char *Name) {
|
||||
if (ParentPad == nullptr) {
|
||||
Type *Ty = Type::getTokenTy(unwrap(B)->getContext());
|
||||
ParentPad = wrap(Constant::getNullValue(Ty));
|
||||
}
|
||||
return wrap(unwrap(B)->CreateCatchSwitch(unwrap(ParentPad), unwrap(BB),
|
||||
NumHandlers, Name));
|
||||
}
|
||||
|
||||
extern "C" void LLVMRustAddHandler(LLVMValueRef CatchSwitchRef,
|
||||
LLVMBasicBlockRef Handler) {
|
||||
Value *CatchSwitch = unwrap(CatchSwitchRef);
|
||||
|
Loading…
x
Reference in New Issue
Block a user