1
Fork 0
LLVMRustBuildIntCast -> LLVMBuildIntCast2
LLVMRustAddHandler -> LLVMAddHandler
This commit is contained in:
klensy 2023-04-03 16:30:34 +03:00
parent cc77ae07a9
commit f41e711b7e
3 changed files with 6 additions and 16 deletions

View file

@ -841,7 +841,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
} }
fn intcast(&mut self, val: &'ll Value, dest_ty: &'ll Type, is_signed: bool) -> &'ll Value { fn intcast(&mut self, val: &'ll Value, dest_ty: &'ll Type, is_signed: bool) -> &'ll Value {
unsafe { llvm::LLVMRustBuildIntCast(self.llbuilder, val, dest_ty, is_signed) } unsafe { llvm::LLVMBuildIntCast2(self.llbuilder, val, dest_ty, is_signed, UNNAMED) }
} }
fn pointercast(&mut self, val: &'ll Value, dest_ty: &'ll Type) -> &'ll Value { fn pointercast(&mut self, val: &'ll Value, dest_ty: &'ll Type) -> &'ll Value {
@ -1052,7 +1052,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
let ret = ret.expect("LLVM does not have support for catchswitch"); let ret = ret.expect("LLVM does not have support for catchswitch");
for handler in handlers { for handler in handlers {
unsafe { unsafe {
llvm::LLVMRustAddHandler(ret, handler); llvm::LLVMAddHandler(ret, handler);
} }
} }
ret ret

View file

@ -1329,7 +1329,7 @@ extern "C" {
NumHandlers: c_uint, NumHandlers: c_uint,
Name: *const c_char, Name: *const c_char,
) -> Option<&'a Value>; ) -> Option<&'a Value>;
pub fn LLVMRustAddHandler<'a>(CatchSwitch: &'a Value, Handler: &'a BasicBlock); pub fn LLVMAddHandler<'a>(CatchSwitch: &'a Value, Dest: &'a BasicBlock);
pub fn LLVMSetPersonalityFn<'a>(Func: &'a Value, Pers: &'a Value); pub fn LLVMSetPersonalityFn<'a>(Func: &'a Value, Pers: &'a Value);
// Add a case to the switch instruction // Add a case to the switch instruction
@ -1623,11 +1623,12 @@ extern "C" {
DestTy: &'a Type, DestTy: &'a Type,
Name: *const c_char, Name: *const c_char,
) -> &'a Value; ) -> &'a Value;
pub fn LLVMRustBuildIntCast<'a>( pub fn LLVMBuildIntCast2<'a>(
B: &Builder<'a>, B: &Builder<'a>,
Val: &'a Value, Val: &'a Value,
DestTy: &'a Type, DestTy: &'a Type,
IsSigned: bool, IsSigned: bool,
Name: *const c_char,
) -> &'a Value; ) -> &'a Value;
// Comparisons // Comparisons

View file

@ -1394,12 +1394,6 @@ extern "C" bool LLVMRustUnpackSMDiagnostic(LLVMSMDiagnosticRef DRef,
return true; return true;
} }
extern "C" void LLVMRustAddHandler(LLVMValueRef CatchSwitchRef,
LLVMBasicBlockRef Handler) {
Value *CatchSwitch = unwrap(CatchSwitchRef);
cast<CatchSwitchInst>(CatchSwitch)->addHandler(unwrap(Handler));
}
extern "C" OperandBundleDef *LLVMRustBuildOperandBundleDef(const char *Name, extern "C" OperandBundleDef *LLVMRustBuildOperandBundleDef(const char *Name,
LLVMValueRef *Inputs, LLVMValueRef *Inputs,
unsigned NumInputs) { unsigned NumInputs) {
@ -1564,6 +1558,7 @@ extern "C" void LLVMRustSetLinkage(LLVMValueRef V,
LLVMSetLinkage(V, fromRust(RustLinkage)); LLVMSetLinkage(V, fromRust(RustLinkage));
} }
// FIXME: replace with LLVMConstInBoundsGEP2 when bumped minimal version to llvm-14
extern "C" LLVMValueRef LLVMRustConstInBoundsGEP2(LLVMTypeRef Ty, extern "C" LLVMValueRef LLVMRustConstInBoundsGEP2(LLVMTypeRef Ty,
LLVMValueRef ConstantVal, LLVMValueRef ConstantVal,
LLVMValueRef *ConstantIndices, LLVMValueRef *ConstantIndices,
@ -1641,12 +1636,6 @@ extern "C" LLVMRustVisibility LLVMRustGetVisibility(LLVMValueRef V) {
return toRust(LLVMGetVisibility(V)); return toRust(LLVMGetVisibility(V));
} }
// Oh hey, a binding that makes sense for once? (because LLVMs own do not)
extern "C" LLVMValueRef LLVMRustBuildIntCast(LLVMBuilderRef B, LLVMValueRef Val,
LLVMTypeRef DestTy, bool isSigned) {
return wrap(unwrap(B)->CreateIntCast(unwrap(Val), unwrap(DestTy), isSigned, ""));
}
extern "C" void LLVMRustSetVisibility(LLVMValueRef V, extern "C" void LLVMRustSetVisibility(LLVMValueRef V,
LLVMRustVisibility RustVisibility) { LLVMRustVisibility RustVisibility) {
LLVMSetVisibility(V, fromRust(RustVisibility)); LLVMSetVisibility(V, fromRust(RustVisibility));