middle: trans: base: remove dead code
This commit is contained in:
parent
a9bf099000
commit
49dc0193bd
@ -77,13 +77,11 @@ use std::cell::{Cell, RefCell};
|
|||||||
use std::libc::c_uint;
|
use std::libc::c_uint;
|
||||||
use std::local_data;
|
use std::local_data;
|
||||||
use syntax::abi::{X86, X86_64, Arm, Mips, Rust, RustIntrinsic};
|
use syntax::abi::{X86, X86_64, Arm, Mips, Rust, RustIntrinsic};
|
||||||
use syntax::ast_map::PathName;
|
|
||||||
use syntax::ast_util::{local_def, is_local};
|
use syntax::ast_util::{local_def, is_local};
|
||||||
use syntax::attr::AttrMetaMethods;
|
use syntax::attr::AttrMetaMethods;
|
||||||
use syntax::attr;
|
use syntax::attr;
|
||||||
use syntax::codemap::Span;
|
use syntax::codemap::Span;
|
||||||
use syntax::parse::token::InternedString;
|
use syntax::parse::token::InternedString;
|
||||||
use syntax::parse::token;
|
|
||||||
use syntax::visit::Visitor;
|
use syntax::visit::Visitor;
|
||||||
use syntax::visit;
|
use syntax::visit;
|
||||||
use syntax::{ast, ast_util, ast_map};
|
use syntax::{ast, ast_util, ast_map};
|
||||||
@ -447,10 +445,6 @@ pub fn malloc_general<'a>(bcx: &'a Block<'a>, t: ty::t, heap: heap)
|
|||||||
|
|
||||||
// Type descriptor and type glue stuff
|
// Type descriptor and type glue stuff
|
||||||
|
|
||||||
pub fn get_tydesc_simple(ccx: &CrateContext, t: ty::t) -> ValueRef {
|
|
||||||
get_tydesc(ccx, t).tydesc
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_tydesc(ccx: &CrateContext, t: ty::t) -> @tydesc_info {
|
pub fn get_tydesc(ccx: &CrateContext, t: ty::t) -> @tydesc_info {
|
||||||
match ccx.tydescs.borrow().find(&t) {
|
match ccx.tydescs.borrow().find(&t) {
|
||||||
Some(&inf) => return inf,
|
Some(&inf) => return inf,
|
||||||
@ -464,6 +458,7 @@ pub fn get_tydesc(ccx: &CrateContext, t: ty::t) -> @tydesc_info {
|
|||||||
return inf;
|
return inf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)] // useful
|
||||||
pub fn set_optimize_for_size(f: ValueRef) {
|
pub fn set_optimize_for_size(f: ValueRef) {
|
||||||
lib::llvm::SetFunctionAttribute(f, lib::llvm::OptimizeForSizeAttribute)
|
lib::llvm::SetFunctionAttribute(f, lib::llvm::OptimizeForSizeAttribute)
|
||||||
}
|
}
|
||||||
@ -472,6 +467,7 @@ pub fn set_no_inline(f: ValueRef) {
|
|||||||
lib::llvm::SetFunctionAttribute(f, lib::llvm::NoInlineAttribute)
|
lib::llvm::SetFunctionAttribute(f, lib::llvm::NoInlineAttribute)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)] // useful
|
||||||
pub fn set_no_unwind(f: ValueRef) {
|
pub fn set_no_unwind(f: ValueRef) {
|
||||||
lib::llvm::SetFunctionAttribute(f, lib::llvm::NoUnwindAttribute)
|
lib::llvm::SetFunctionAttribute(f, lib::llvm::NoUnwindAttribute)
|
||||||
}
|
}
|
||||||
@ -667,19 +663,6 @@ pub fn compare_scalar_values<'a>(
|
|||||||
pub type val_and_ty_fn<'r,'b> =
|
pub type val_and_ty_fn<'r,'b> =
|
||||||
'r |&'b Block<'b>, ValueRef, ty::t| -> &'b Block<'b>;
|
'r |&'b Block<'b>, ValueRef, ty::t| -> &'b Block<'b>;
|
||||||
|
|
||||||
pub fn load_inbounds<'a>(cx: &'a Block<'a>, p: ValueRef, idxs: &[uint])
|
|
||||||
-> ValueRef {
|
|
||||||
return Load(cx, GEPi(cx, p, idxs));
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn store_inbounds<'a>(
|
|
||||||
cx: &'a Block<'a>,
|
|
||||||
v: ValueRef,
|
|
||||||
p: ValueRef,
|
|
||||||
idxs: &[uint]) {
|
|
||||||
Store(cx, v, GEPi(cx, p, idxs));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Iterates through the elements of a structural type.
|
// Iterates through the elements of a structural type.
|
||||||
pub fn iter_structural_ty<'r,
|
pub fn iter_structural_ty<'r,
|
||||||
'b>(
|
'b>(
|
||||||
@ -975,29 +958,6 @@ pub fn need_invoke(bcx: &Block) -> bool {
|
|||||||
bcx.fcx.needs_invoke()
|
bcx.fcx.needs_invoke()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn do_spill(bcx: &Block, v: ValueRef, t: ty::t) -> ValueRef {
|
|
||||||
if ty::type_is_bot(t) {
|
|
||||||
return C_null(Type::i8p(bcx.ccx()));
|
|
||||||
}
|
|
||||||
let llptr = alloc_ty(bcx, t, "");
|
|
||||||
Store(bcx, v, llptr);
|
|
||||||
return llptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Since this function does *not* root, it is the caller's responsibility to
|
|
||||||
// ensure that the referent is pointed to by a root.
|
|
||||||
pub fn do_spill_noroot(cx: &Block, v: ValueRef) -> ValueRef {
|
|
||||||
let llptr = alloca(cx, val_ty(v), "");
|
|
||||||
Store(cx, v, llptr);
|
|
||||||
return llptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn spill_if_immediate(cx: &Block, v: ValueRef, t: ty::t) -> ValueRef {
|
|
||||||
let _icx = push_ctxt("spill_if_immediate");
|
|
||||||
if type_is_immediate(cx.ccx(), t) { return do_spill(cx, v, t); }
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn load_if_immediate(cx: &Block, v: ValueRef, t: ty::t) -> ValueRef {
|
pub fn load_if_immediate(cx: &Block, v: ValueRef, t: ty::t) -> ValueRef {
|
||||||
let _icx = push_ctxt("load_if_immediate");
|
let _icx = push_ctxt("load_if_immediate");
|
||||||
if type_is_immediate(cx.ccx(), t) { return Load(cx, v); }
|
if type_is_immediate(cx.ccx(), t) { return Load(cx, v); }
|
||||||
@ -1040,20 +1000,6 @@ pub fn raw_block<'a>(
|
|||||||
Block::new(llbb, is_lpad, None, fcx)
|
Block::new(llbb, is_lpad, None, fcx)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn block_locals(b: &ast::Block, it: |@ast::Local|) {
|
|
||||||
for s in b.stmts.iter() {
|
|
||||||
match s.node {
|
|
||||||
ast::StmtDecl(d, _) => {
|
|
||||||
match d.node {
|
|
||||||
ast::DeclLocal(ref local) => it(*local),
|
|
||||||
_ => {} /* fall through */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {} /* fall through */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn with_cond<'a>(
|
pub fn with_cond<'a>(
|
||||||
bcx: &'a Block<'a>,
|
bcx: &'a Block<'a>,
|
||||||
val: ValueRef,
|
val: ValueRef,
|
||||||
@ -1173,10 +1119,6 @@ pub fn arrayalloca(cx: &Block, ty: Type, v: ValueRef) -> ValueRef {
|
|||||||
return ArrayAlloca(cx, ty, v);
|
return ArrayAlloca(cx, ty, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct BasicBlocks {
|
|
||||||
sa: BasicBlockRef,
|
|
||||||
}
|
|
||||||
|
|
||||||
// Creates and returns space for, or returns the argument representing, the
|
// Creates and returns space for, or returns the argument representing, the
|
||||||
// slot where the return value of the function must go.
|
// slot where the return value of the function must go.
|
||||||
pub fn make_return_pointer(fcx: &FunctionContext, output_type: ty::t)
|
pub fn make_return_pointer(fcx: &FunctionContext, output_type: ty::t)
|
||||||
@ -2142,11 +2084,6 @@ fn register_method(ccx: &CrateContext, id: ast::NodeId,
|
|||||||
llfn
|
llfn
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn vp2i(cx: &Block, v: ValueRef) -> ValueRef {
|
|
||||||
let ccx = cx.ccx();
|
|
||||||
return PtrToInt(cx, v, ccx.int_type);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn p2i(ccx: &CrateContext, v: ValueRef) -> ValueRef {
|
pub fn p2i(ccx: &CrateContext, v: ValueRef) -> ValueRef {
|
||||||
unsafe {
|
unsafe {
|
||||||
return llvm::LLVMConstPtrToInt(v, ccx.int_type.to_ref());
|
return llvm::LLVMConstPtrToInt(v, ccx.int_type.to_ref());
|
||||||
@ -2315,18 +2252,6 @@ pub fn declare_intrinsics(ccx: &mut CrateContext) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn trap(bcx: &Block) {
|
|
||||||
match bcx.ccx().intrinsics.find_equiv(& &"llvm.trap") {
|
|
||||||
Some(&x) => { Call(bcx, x, [], []); },
|
|
||||||
_ => bcx.sess().bug("unbound llvm.trap in trap")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn symname(name: &str, hash: &str, vers: &str) -> ~str {
|
|
||||||
let path = [PathName(token::intern(name))];
|
|
||||||
link::exported_name(ast_map::Values(path.iter()).chain(None), hash, vers)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn crate_ctxt_to_encode_parms<'r>(cx: &'r CrateContext, ie: encoder::EncodeInlinedItem<'r>)
|
pub fn crate_ctxt_to_encode_parms<'r>(cx: &'r CrateContext, ie: encoder::EncodeInlinedItem<'r>)
|
||||||
-> encoder::EncodeParams<'r> {
|
-> encoder::EncodeParams<'r> {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user