Skip to content

Commit

Permalink
Rollup merge of rust-lang#47173 - dotdash:cleanup, r=michaelwoerister
Browse files Browse the repository at this point in the history
Remove some outdated LLVM-related code

Ticks two boxes on rust-lang#46437
  • Loading branch information
kennytm authored Jan 4, 2018
2 parents 891a901 + 7e522b2 commit a4e4899
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 34 deletions.
16 changes: 6 additions & 10 deletions src/librustc_llvm/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,9 +538,6 @@ extern "C" {
/// See llvm::LLVMTypeKind::getTypeID.
pub fn LLVMRustGetTypeKind(Ty: TypeRef) -> TypeKind;

/// See llvm::Value::getContext
pub fn LLVMRustGetValueContext(V: ValueRef) -> ContextRef;

// Operations on integer types
pub fn LLVMInt1TypeInContext(C: ContextRef) -> TypeRef;
pub fn LLVMInt8TypeInContext(C: ContextRef) -> TypeRef;
Expand Down Expand Up @@ -812,13 +809,12 @@ extern "C" {
Bundle: OperandBundleDefRef,
Name: *const c_char)
-> ValueRef;
pub fn LLVMRustBuildLandingPad(B: BuilderRef,
Ty: TypeRef,
PersFn: ValueRef,
NumClauses: c_uint,
Name: *const c_char,
F: ValueRef)
-> ValueRef;
pub fn LLVMBuildLandingPad(B: BuilderRef,
Ty: TypeRef,
PersFn: ValueRef,
NumClauses: c_uint,
Name: *const c_char)
-> ValueRef;
pub fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef) -> ValueRef;
pub fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef;

Expand Down
7 changes: 3 additions & 4 deletions src/librustc_trans/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1012,12 +1012,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
}

pub fn landing_pad(&self, ty: Type, pers_fn: ValueRef,
num_clauses: usize,
llfn: ValueRef) -> ValueRef {
num_clauses: usize) -> ValueRef {
self.count_insn("landingpad");
unsafe {
llvm::LLVMRustBuildLandingPad(self.llbuilder, ty.to_ref(), pers_fn,
num_clauses as c_uint, noname(), llfn)
llvm::LLVMBuildLandingPad(self.llbuilder, ty.to_ref(), pers_fn,
num_clauses as c_uint, noname())
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_trans/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ fn trans_gnu_try<'a, 'tcx>(bcx: &Builder<'a, 'tcx>,
// rust_try ignores the selector.
let lpad_ty = Type::struct_(ccx, &[Type::i8p(ccx), Type::i32(ccx)],
false);
let vals = catch.landing_pad(lpad_ty, bcx.ccx.eh_personality(), 1, catch.llfn());
let vals = catch.landing_pad(lpad_ty, bcx.ccx.eh_personality(), 1);
catch.add_clause(vals, C_null(Type::i8p(ccx)));
let ptr = catch.extract_value(vals, 0);
let ptr_align = bcx.tcx().data_layout.pointer_align;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_trans/mir/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ impl<'a, 'tcx> MirContext<'a, 'tcx> {

let llpersonality = self.ccx.eh_personality();
let llretty = self.landing_pad_type();
let lp = bcx.landing_pad(llretty, llpersonality, 1, self.llfn);
let lp = bcx.landing_pad(llretty, llpersonality, 1);
bcx.set_cleanup(lp);

let slot = self.get_personality_slot(&bcx);
Expand Down
20 changes: 2 additions & 18 deletions src/rustllvm/RustWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1144,13 +1144,6 @@ extern "C" void LLVMRustWriteSMDiagnosticToString(LLVMSMDiagnosticRef D,
unwrap(D)->print("", OS);
}

extern "C" LLVMValueRef
LLVMRustBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty,
LLVMValueRef PersFn, unsigned NumClauses,
const char *Name, LLVMValueRef F) {
return LLVMBuildLandingPad(B, Ty, PersFn, NumClauses, Name);
}

extern "C" LLVMValueRef LLVMRustBuildCleanupPad(LLVMBuilderRef B,
LLVMValueRef ParentPad,
unsigned ArgCount,
Expand Down Expand Up @@ -1355,10 +1348,6 @@ extern "C" bool LLVMRustConstInt128Get(LLVMValueRef CV, bool sext, uint64_t *hig
return true;
}

extern "C" LLVMContextRef LLVMRustGetValueContext(LLVMValueRef V) {
return wrap(&unwrap(V)->getContext());
}

enum class LLVMRustVisibility {
Default = 0,
Hidden = 1,
Expand Down Expand Up @@ -1439,11 +1428,6 @@ LLVMRustModuleBufferLen(const LLVMRustModuleBuffer *Buffer) {

extern "C" uint64_t
LLVMRustModuleCost(LLVMModuleRef M) {
Module &Mod = *unwrap(M);
uint64_t cost = 0;
for (auto &F : Mod.functions()) {
(void)F;
cost += 1;
}
return cost;
auto f = unwrap(M)->functions();
return std::distance(std::begin(f), std::end(f));
}

0 comments on commit a4e4899

Please sign in to comment.