Skip to content

remove unused functions from trans and llvm #26392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 18, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions src/librustc_llvm/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1300,20 +1300,8 @@ extern {
-> ValueRef;

/* Memory */
pub fn LLVMBuildMalloc(B: BuilderRef, Ty: TypeRef, Name: *const c_char)
-> ValueRef;
pub fn LLVMBuildArrayMalloc(B: BuilderRef,
Ty: TypeRef,
Val: ValueRef,
Name: *const c_char)
-> ValueRef;
pub fn LLVMBuildAlloca(B: BuilderRef, Ty: TypeRef, Name: *const c_char)
-> ValueRef;
pub fn LLVMBuildArrayAlloca(B: BuilderRef,
Ty: TypeRef,
Val: ValueRef,
Name: *const c_char)
-> ValueRef;
pub fn LLVMBuildFree(B: BuilderRef, PointerVal: ValueRef) -> ValueRef;
pub fn LLVMBuildLoad(B: BuilderRef,
PointerVal: ValueRef,
Expand Down
34 changes: 0 additions & 34 deletions src/librustc_trans/trans/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,30 +522,6 @@ pub fn Not(cx: Block, v: ValueRef, debug_loc: DebugLoc) -> ValueRef {
B(cx).not(v)
}

/* Memory */
pub fn Malloc(cx: Block, ty: Type, debug_loc: DebugLoc) -> ValueRef {
unsafe {
if cx.unreachable.get() {
return llvm::LLVMGetUndef(Type::i8p(cx.ccx()).to_ref());
}
debug_loc.apply(cx.fcx);
B(cx).malloc(ty)
}
}

pub fn ArrayMalloc(cx: Block,
ty: Type,
val: ValueRef,
debug_loc: DebugLoc) -> ValueRef {
unsafe {
if cx.unreachable.get() {
return llvm::LLVMGetUndef(Type::i8p(cx.ccx()).to_ref());
}
debug_loc.apply(cx.fcx);
B(cx).array_malloc(ty, val)
}
}

pub fn Alloca(cx: Block, ty: Type, name: &str) -> ValueRef {
unsafe {
if cx.unreachable.get() { return llvm::LLVMGetUndef(ty.ptr_to().to_ref()); }
Expand All @@ -560,16 +536,6 @@ pub fn AllocaFcx(fcx: &FunctionContext, ty: Type, name: &str) -> ValueRef {
b.alloca(ty, name)
}

pub fn ArrayAlloca(cx: Block, ty: Type, val: ValueRef) -> ValueRef {
unsafe {
if cx.unreachable.get() { return llvm::LLVMGetUndef(ty.ptr_to().to_ref()); }
let b = cx.fcx.ccx.builder();
b.position_before(cx.fcx.alloca_insert_pt.get().unwrap());
DebugLoc::None.apply(cx.fcx);
b.array_alloca(ty, val)
}
}

pub fn Free(cx: Block, pointer_val: ValueRef) {
if cx.unreachable.get() { return; }
B(cx).free(pointer_val)
Expand Down
22 changes: 0 additions & 22 deletions src/librustc_trans/trans/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,21 +410,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
}
}

/* Memory */
pub fn malloc(&self, ty: Type) -> ValueRef {
self.count_insn("malloc");
unsafe {
llvm::LLVMBuildMalloc(self.llbuilder, ty.to_ref(), noname())
}
}

pub fn array_malloc(&self, ty: Type, val: ValueRef) -> ValueRef {
self.count_insn("arraymalloc");
unsafe {
llvm::LLVMBuildArrayMalloc(self.llbuilder, ty.to_ref(), val, noname())
}
}

pub fn alloca(&self, ty: Type, name: &str) -> ValueRef {
self.count_insn("alloca");
unsafe {
Expand All @@ -438,13 +423,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
}
}

pub fn array_alloca(&self, ty: Type, val: ValueRef) -> ValueRef {
self.count_insn("arrayalloca");
unsafe {
llvm::LLVMBuildArrayAlloca(self.llbuilder, ty.to_ref(), val, noname())
}
}

pub fn free(&self, ptr: ValueRef) {
self.count_insn("free");
unsafe {
Expand Down