提交 8105da80 编写于 作者: J Jed Davis

GC the now-unused old layout helpers

上级 b6bcf1a8
...@@ -239,25 +239,6 @@ pub fn bump_ptr(bcx: block, t: ty::t, base: ValueRef, sz: ValueRef) -> ...@@ -239,25 +239,6 @@ pub fn bump_ptr(bcx: block, t: ty::t, base: ValueRef, sz: ValueRef) ->
PointerCast(bcx, bumped, typ) PointerCast(bcx, bumped, typ)
} }
// Replacement for the LLVM 'GEP' instruction when field indexing into a enum.
// @llblobptr is the data part of a enum value; its actual type
// is meaningless, as it will be cast away.
pub fn GEP_enum(bcx: block, llblobptr: ValueRef, enum_id: ast::def_id,
variant_id: ast::def_id, ty_substs: &[ty::t],
ix: uint) -> ValueRef {
let _icx = bcx.insn_ctxt("GEP_enum");
let ccx = bcx.ccx();
let variant = ty::enum_variant_with_id(ccx.tcx, enum_id, variant_id);
assert ix < variant.args.len();
let arg_lltys = vec::map(variant.args, |aty| {
type_of(ccx, ty::subst_tps(ccx.tcx, ty_substs, None, *aty))
});
let typed_blobptr = PointerCast(bcx, llblobptr,
T_ptr(T_struct(arg_lltys)));
GEPi(bcx, typed_blobptr, [0u, ix])
}
// Returns a pointer to the body for the box. The box may be an opaque // Returns a pointer to the body for the box. The box may be an opaque
// box. The result will be casted to the type of body_t, if it is statically // box. The result will be casted to the type of body_t, if it is statically
// known. // known.
......
...@@ -1042,21 +1042,6 @@ pub fn T_enum_discrim(cx: @CrateContext) -> TypeRef { ...@@ -1042,21 +1042,6 @@ pub fn T_enum_discrim(cx: @CrateContext) -> TypeRef {
return cx.int_type; return cx.int_type;
} }
pub fn T_opaque_enum(cx: @CrateContext) -> TypeRef {
let s = @"opaque_enum";
match name_has_type(cx.tn, s) {
Some(t) => return t,
_ => ()
}
let t = T_struct(~[T_enum_discrim(cx), T_i8()]);
associate_type(cx.tn, s, t);
return t;
}
pub fn T_opaque_enum_ptr(cx: @CrateContext) -> TypeRef {
return T_ptr(T_opaque_enum(cx));
}
pub fn T_captured_tydescs(cx: @CrateContext, n: uint) -> TypeRef { pub fn T_captured_tydescs(cx: @CrateContext, n: uint) -> TypeRef {
return T_struct(vec::from_elem::<TypeRef>(n, T_ptr(cx.tydesc_type))); return T_struct(vec::from_elem::<TypeRef>(n, T_ptr(cx.tydesc_type)));
} }
...@@ -1468,18 +1453,6 @@ pub fn dummy_substs(+tps: ~[ty::t]) -> ty::substs { ...@@ -1468,18 +1453,6 @@ pub fn dummy_substs(+tps: ~[ty::t]) -> ty::substs {
} }
} }
pub fn struct_field(index: uint) -> [uint * 3] {
//! The GEPi sequence to access a field of a record/struct.
[0, 0, index]
}
pub fn struct_dtor() -> [uint * 2] {
//! The GEPi sequence to access the dtor of a struct.
[0, 1]
}
// Casts a Rust bool value to an i1. // Casts a Rust bool value to an i1.
pub fn bool_to_i1(bcx: block, llval: ValueRef) -> ValueRef { pub fn bool_to_i1(bcx: block, llval: ValueRef) -> ValueRef {
build::ICmp(bcx, lib::llvm::IntNE, llval, C_bool(false)) build::ICmp(bcx, lib::llvm::IntNE, llval, C_bool(false))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册