From 8105da80676a9ff85199a2bbcd9d9fd4ca019086 Mon Sep 17 00:00:00 2001 From: Jed Davis Date: Sun, 24 Feb 2013 23:21:22 -0800 Subject: [PATCH] GC the now-unused old layout helpers --- src/librustc/middle/trans/base.rs | 19 ------------------- src/librustc/middle/trans/common.rs | 27 --------------------------- 2 files changed, 46 deletions(-) diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index 9120ac3083a..fb7d5bba1e5 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -239,25 +239,6 @@ pub fn bump_ptr(bcx: block, t: ty::t, base: ValueRef, sz: ValueRef) -> 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 // box. The result will be casted to the type of body_t, if it is statically // known. diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index 2d06a5a5e87..70b63f7952e 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -1042,21 +1042,6 @@ pub fn T_enum_discrim(cx: @CrateContext) -> TypeRef { 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 { return T_struct(vec::from_elem::(n, T_ptr(cx.tydesc_type))); } @@ -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. pub fn bool_to_i1(bcx: block, llval: ValueRef) -> ValueRef { build::ICmp(bcx, lib::llvm::IntNE, llval, C_bool(false)) -- GitLab