Skip to content

Commit f41e711

Browse files
committed
replace
LLVMRustBuildIntCast -> LLVMBuildIntCast2 LLVMRustAddHandler -> LLVMAddHandler
1 parent cc77ae0 commit f41e711

File tree

3 files changed

+6
-16
lines changed

3 files changed

+6
-16
lines changed

compiler/rustc_codegen_llvm/src/builder.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
841841
}
842842

843843
fn intcast(&mut self, val: &'ll Value, dest_ty: &'ll Type, is_signed: bool) -> &'ll Value {
844-
unsafe { llvm::LLVMRustBuildIntCast(self.llbuilder, val, dest_ty, is_signed) }
844+
unsafe { llvm::LLVMBuildIntCast2(self.llbuilder, val, dest_ty, is_signed, UNNAMED) }
845845
}
846846

847847
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> {
10521052
let ret = ret.expect("LLVM does not have support for catchswitch");
10531053
for handler in handlers {
10541054
unsafe {
1055-
llvm::LLVMRustAddHandler(ret, handler);
1055+
llvm::LLVMAddHandler(ret, handler);
10561056
}
10571057
}
10581058
ret

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,7 @@ extern "C" {
13291329
NumHandlers: c_uint,
13301330
Name: *const c_char,
13311331
) -> Option<&'a Value>;
1332-
pub fn LLVMRustAddHandler<'a>(CatchSwitch: &'a Value, Handler: &'a BasicBlock);
1332+
pub fn LLVMAddHandler<'a>(CatchSwitch: &'a Value, Dest: &'a BasicBlock);
13331333
pub fn LLVMSetPersonalityFn<'a>(Func: &'a Value, Pers: &'a Value);
13341334

13351335
// Add a case to the switch instruction
@@ -1623,11 +1623,12 @@ extern "C" {
16231623
DestTy: &'a Type,
16241624
Name: *const c_char,
16251625
) -> &'a Value;
1626-
pub fn LLVMRustBuildIntCast<'a>(
1626+
pub fn LLVMBuildIntCast2<'a>(
16271627
B: &Builder<'a>,
16281628
Val: &'a Value,
16291629
DestTy: &'a Type,
16301630
IsSigned: bool,
1631+
Name: *const c_char,
16311632
) -> &'a Value;
16321633

16331634
// Comparisons

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

+1-12
Original file line numberDiff line numberDiff line change
@@ -1394,12 +1394,6 @@ extern "C" bool LLVMRustUnpackSMDiagnostic(LLVMSMDiagnosticRef DRef,
13941394
return true;
13951395
}
13961396

1397-
extern "C" void LLVMRustAddHandler(LLVMValueRef CatchSwitchRef,
1398-
LLVMBasicBlockRef Handler) {
1399-
Value *CatchSwitch = unwrap(CatchSwitchRef);
1400-
cast<CatchSwitchInst>(CatchSwitch)->addHandler(unwrap(Handler));
1401-
}
1402-
14031397
extern "C" OperandBundleDef *LLVMRustBuildOperandBundleDef(const char *Name,
14041398
LLVMValueRef *Inputs,
14051399
unsigned NumInputs) {
@@ -1564,6 +1558,7 @@ extern "C" void LLVMRustSetLinkage(LLVMValueRef V,
15641558
LLVMSetLinkage(V, fromRust(RustLinkage));
15651559
}
15661560

1561+
// FIXME: replace with LLVMConstInBoundsGEP2 when bumped minimal version to llvm-14
15671562
extern "C" LLVMValueRef LLVMRustConstInBoundsGEP2(LLVMTypeRef Ty,
15681563
LLVMValueRef ConstantVal,
15691564
LLVMValueRef *ConstantIndices,
@@ -1641,12 +1636,6 @@ extern "C" LLVMRustVisibility LLVMRustGetVisibility(LLVMValueRef V) {
16411636
return toRust(LLVMGetVisibility(V));
16421637
}
16431638

1644-
// Oh hey, a binding that makes sense for once? (because LLVM’s own do not)
1645-
extern "C" LLVMValueRef LLVMRustBuildIntCast(LLVMBuilderRef B, LLVMValueRef Val,
1646-
LLVMTypeRef DestTy, bool isSigned) {
1647-
return wrap(unwrap(B)->CreateIntCast(unwrap(Val), unwrap(DestTy), isSigned, ""));
1648-
}
1649-
16501639
extern "C" void LLVMRustSetVisibility(LLVMValueRef V,
16511640
LLVMRustVisibility RustVisibility) {
16521641
LLVMSetVisibility(V, fromRust(RustVisibility));

0 commit comments

Comments
 (0)