Skip to content

Commit a4e4899

Browse files
authored
Rollup merge of rust-lang#47173 - dotdash:cleanup, r=michaelwoerister
Remove some outdated LLVM-related code Ticks two boxes on rust-lang#46437
2 parents 891a901 + 7e522b2 commit a4e4899

File tree

5 files changed

+13
-34
lines changed

5 files changed

+13
-34
lines changed

src/librustc_llvm/ffi.rs

+6-10
Original file line numberDiff line numberDiff line change
@@ -538,9 +538,6 @@ extern "C" {
538538
/// See llvm::LLVMTypeKind::getTypeID.
539539
pub fn LLVMRustGetTypeKind(Ty: TypeRef) -> TypeKind;
540540

541-
/// See llvm::Value::getContext
542-
pub fn LLVMRustGetValueContext(V: ValueRef) -> ContextRef;
543-
544541
// Operations on integer types
545542
pub fn LLVMInt1TypeInContext(C: ContextRef) -> TypeRef;
546543
pub fn LLVMInt8TypeInContext(C: ContextRef) -> TypeRef;
@@ -812,13 +809,12 @@ extern "C" {
812809
Bundle: OperandBundleDefRef,
813810
Name: *const c_char)
814811
-> ValueRef;
815-
pub fn LLVMRustBuildLandingPad(B: BuilderRef,
816-
Ty: TypeRef,
817-
PersFn: ValueRef,
818-
NumClauses: c_uint,
819-
Name: *const c_char,
820-
F: ValueRef)
821-
-> ValueRef;
812+
pub fn LLVMBuildLandingPad(B: BuilderRef,
813+
Ty: TypeRef,
814+
PersFn: ValueRef,
815+
NumClauses: c_uint,
816+
Name: *const c_char)
817+
-> ValueRef;
822818
pub fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef) -> ValueRef;
823819
pub fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef;
824820

src/librustc_trans/builder.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1012,12 +1012,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
10121012
}
10131013

10141014
pub fn landing_pad(&self, ty: Type, pers_fn: ValueRef,
1015-
num_clauses: usize,
1016-
llfn: ValueRef) -> ValueRef {
1015+
num_clauses: usize) -> ValueRef {
10171016
self.count_insn("landingpad");
10181017
unsafe {
1019-
llvm::LLVMRustBuildLandingPad(self.llbuilder, ty.to_ref(), pers_fn,
1020-
num_clauses as c_uint, noname(), llfn)
1018+
llvm::LLVMBuildLandingPad(self.llbuilder, ty.to_ref(), pers_fn,
1019+
num_clauses as c_uint, noname())
10211020
}
10221021
}
10231022

src/librustc_trans/intrinsic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ fn trans_gnu_try<'a, 'tcx>(bcx: &Builder<'a, 'tcx>,
925925
// rust_try ignores the selector.
926926
let lpad_ty = Type::struct_(ccx, &[Type::i8p(ccx), Type::i32(ccx)],
927927
false);
928-
let vals = catch.landing_pad(lpad_ty, bcx.ccx.eh_personality(), 1, catch.llfn());
928+
let vals = catch.landing_pad(lpad_ty, bcx.ccx.eh_personality(), 1);
929929
catch.add_clause(vals, C_null(Type::i8p(ccx)));
930930
let ptr = catch.extract_value(vals, 0);
931931
let ptr_align = bcx.tcx().data_layout.pointer_align;

src/librustc_trans/mir/block.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ impl<'a, 'tcx> MirContext<'a, 'tcx> {
753753

754754
let llpersonality = self.ccx.eh_personality();
755755
let llretty = self.landing_pad_type();
756-
let lp = bcx.landing_pad(llretty, llpersonality, 1, self.llfn);
756+
let lp = bcx.landing_pad(llretty, llpersonality, 1);
757757
bcx.set_cleanup(lp);
758758

759759
let slot = self.get_personality_slot(&bcx);

src/rustllvm/RustWrapper.cpp

+2-18
Original file line numberDiff line numberDiff line change
@@ -1144,13 +1144,6 @@ extern "C" void LLVMRustWriteSMDiagnosticToString(LLVMSMDiagnosticRef D,
11441144
unwrap(D)->print("", OS);
11451145
}
11461146

1147-
extern "C" LLVMValueRef
1148-
LLVMRustBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty,
1149-
LLVMValueRef PersFn, unsigned NumClauses,
1150-
const char *Name, LLVMValueRef F) {
1151-
return LLVMBuildLandingPad(B, Ty, PersFn, NumClauses, Name);
1152-
}
1153-
11541147
extern "C" LLVMValueRef LLVMRustBuildCleanupPad(LLVMBuilderRef B,
11551148
LLVMValueRef ParentPad,
11561149
unsigned ArgCount,
@@ -1355,10 +1348,6 @@ extern "C" bool LLVMRustConstInt128Get(LLVMValueRef CV, bool sext, uint64_t *hig
13551348
return true;
13561349
}
13571350

1358-
extern "C" LLVMContextRef LLVMRustGetValueContext(LLVMValueRef V) {
1359-
return wrap(&unwrap(V)->getContext());
1360-
}
1361-
13621351
enum class LLVMRustVisibility {
13631352
Default = 0,
13641353
Hidden = 1,
@@ -1439,11 +1428,6 @@ LLVMRustModuleBufferLen(const LLVMRustModuleBuffer *Buffer) {
14391428

14401429
extern "C" uint64_t
14411430
LLVMRustModuleCost(LLVMModuleRef M) {
1442-
Module &Mod = *unwrap(M);
1443-
uint64_t cost = 0;
1444-
for (auto &F : Mod.functions()) {
1445-
(void)F;
1446-
cost += 1;
1447-
}
1448-
return cost;
1431+
auto f = unwrap(M)->functions();
1432+
return std::distance(std::begin(f), std::end(f));
14491433
}

0 commit comments

Comments
 (0)