librustc: De-mut trans. rs=demuting

This commit is contained in:
Patrick Walton 2013-02-21 15:30:24 -08:00
parent 553c27c515
commit 9c71249b9d
6 changed files with 43 additions and 43 deletions

View File

@ -831,7 +831,7 @@ pub fn extract_variant_args(bcx: block,
-> ExtractedBlock {
let (enm, evar) = vdefs;
let _icx = bcx.insn_ctxt("match::extract_variant_args");
let ccx = bcx.fcx.ccx;
let ccx = *bcx.fcx.ccx;
let enum_ty_substs = match ty::get(node_id_type(bcx, pat_id)).sty {
ty::ty_enum(id, ref substs) => {
assert id == enm;
@ -1272,7 +1272,7 @@ pub fn compile_submatch(bcx: block,
let vals_left = vec::append(vec::slice(vals, 0u, col).to_vec(),
vec::slice(vals, col + 1u, vals.len()));
let ccx = bcx.fcx.ccx;
let ccx = *bcx.fcx.ccx;
let mut pat_id = 0;
for vec::each(m) |br| {
// Find a real id (we're adding placeholder wildcard patterns, but
@ -1710,7 +1710,7 @@ pub fn bind_irrefutable_pat(bcx: block,
binding_mode: IrrefutablePatternBindingMode)
-> block {
let _icx = bcx.insn_ctxt("match::bind_irrefutable_pat");
let ccx = bcx.fcx.ccx;
let ccx = *bcx.fcx.ccx;
let mut bcx = bcx;
// Necessary since bind_irrefutable_pat is called outside trans_match

View File

@ -1162,7 +1162,7 @@ pub fn trans_stmt(cx: block, s: ast::stmt) -> block {
}
}
}
ast::decl_item(i) => trans_item(cx.fcx.ccx, *i)
ast::decl_item(i) => trans_item(*cx.fcx.ccx, *i)
}
}
ast::stmt_mac(*) => cx.tcx().sess.bug(~"unexpanded macro")
@ -1584,25 +1584,25 @@ pub fn new_fn_ctxt_w_id(ccx: @CrateContext,
param_substs: Option<@param_substs>,
sp: Option<span>) -> fn_ctxt {
let llbbs = mk_standard_basic_blocks(llfndecl);
return @fn_ctxt_ {
return @mut fn_ctxt_ {
llfn: llfndecl,
llenv: unsafe { llvm::LLVMGetParam(llfndecl, 1u as c_uint) },
llretptr: unsafe { llvm::LLVMGetParam(llfndecl, 0u as c_uint) },
mut llstaticallocas: llbbs.sa,
mut llloadenv: None,
mut llreturn: llbbs.rt,
mut llself: None,
mut personality: None,
mut loop_ret: None,
llargs: HashMap(),
lllocals: HashMap(),
llupvars: HashMap(),
llstaticallocas: llbbs.sa,
llloadenv: None,
llreturn: llbbs.rt,
llself: None,
personality: None,
loop_ret: None,
llargs: @HashMap(),
lllocals: @HashMap(),
llupvars: @HashMap(),
id: id,
impl_id: impl_id,
param_substs: param_substs,
span: sp,
path: path,
ccx: ccx
ccx: @ccx
};
}
@ -1792,7 +1792,7 @@ pub fn trans_closure(ccx: @CrateContext,
llvm::LLVMSetGC(fcx.llfn, strategy);
}
}
ccx.uses_gc = true;
*ccx.uses_gc = true;
}
// Create the first basic block in the function and keep a handle on it to
@ -2815,7 +2815,7 @@ pub fn trap(bcx: block) {
}
pub fn decl_gc_metadata(ccx: @CrateContext, llmod_id: ~str) {
if !ccx.sess.opts.gc || !ccx.uses_gc {
if !ccx.sess.opts.gc || !*ccx.uses_gc {
return;
}
@ -3050,7 +3050,7 @@ pub fn trans_crate(sess: session::Session,
discrims: HashMap(),
discrim_symbols: HashMap(),
tydescs: ty::new_ty_hash(),
mut finished_tydescs: false,
finished_tydescs: @mut false,
external: HashMap(),
monomorphized: HashMap(),
monomorphizing: HashMap(),
@ -3092,9 +3092,9 @@ pub fn trans_crate(sess: session::Session,
builder: BuilderRef_res(unsafe { llvm::LLVMCreateBuilder() }),
shape_cx: mk_ctxt(llmod),
crate_map: crate_map,
mut uses_gc: false,
uses_gc: @mut false,
dbg_cx: dbg_cx,
mut do_not_commit_warning_issued: false
do_not_commit_warning_issued: @mut false
};
{

View File

@ -175,7 +175,7 @@ pub struct CrateContext {
tydescs: HashMap<ty::t, @mut tydesc_info>,
// Set when running emit_tydescs to enforce that no more tydescs are
// created.
mut finished_tydescs: bool,
finished_tydescs: @mut bool,
// Track mapping of external ids to local items imported for inlining
external: HashMap<ast::def_id, Option<ast::node_id>>,
// Cache instances of monomorphized functions
@ -224,9 +224,9 @@ pub struct CrateContext {
// Set when at least one function uses GC. Needed so that
// decl_gc_metadata knows whether to link to the module metadata, which
// is not emitted by LLVM's GC pass when no functions use GC.
mut uses_gc: bool,
uses_gc: @mut bool,
dbg_cx: Option<debuginfo::DebugContext>,
mut do_not_commit_warning_issued: bool
do_not_commit_warning_issued: @mut bool
}
// Types used for llself.
@ -273,34 +273,34 @@ pub struct fn_ctxt_ {
// the function, due to LLVM's quirks.
// A block for all the function's static allocas, so that LLVM
// will coalesce them into a single alloca call.
mut llstaticallocas: BasicBlockRef,
llstaticallocas: BasicBlockRef,
// A block containing code that copies incoming arguments to space
// already allocated by code in one of the llallocas blocks.
// (LLVM requires that arguments be copied to local allocas before
// allowing most any operation to be performed on them.)
mut llloadenv: Option<BasicBlockRef>,
mut llreturn: BasicBlockRef,
llloadenv: Option<BasicBlockRef>,
llreturn: BasicBlockRef,
// The 'self' value currently in use in this function, if there
// is one.
//
// NB: This is the type of the self *variable*, not the self *type*. The
// self type is set only for default methods, while the self variable is
// set for all methods.
mut llself: Option<ValSelfData>,
llself: Option<ValSelfData>,
// The a value alloca'd for calls to upcalls.rust_personality. Used when
// outputting the resume instruction.
mut personality: Option<ValueRef>,
personality: Option<ValueRef>,
// If this is a for-loop body that returns, this holds the pointers needed
// for that (flagptr, retptr)
mut loop_ret: Option<(ValueRef, ValueRef)>,
loop_ret: Option<(ValueRef, ValueRef)>,
// Maps arguments to allocas created for them in llallocas.
llargs: HashMap<ast::node_id, local_val>,
llargs: @HashMap<ast::node_id, local_val>,
// Maps the def_ids for local variables to the allocas created for
// them in llallocas.
lllocals: HashMap<ast::node_id, local_val>,
lllocals: @HashMap<ast::node_id, local_val>,
// Same as above, but for closure upvars
llupvars: HashMap<ast::node_id, ValueRef>,
llupvars: @HashMap<ast::node_id, ValueRef>,
// The node_id of the function, or -1 if it doesn't correspond to
// a user-defined function.
@ -319,14 +319,14 @@ pub struct fn_ctxt_ {
path: path,
// This function's enclosing crate context.
ccx: @CrateContext
ccx: @@CrateContext
}
pub type fn_ctxt = @fn_ctxt_;
pub type fn_ctxt = @mut fn_ctxt_;
pub fn warn_not_to_commit(ccx: @CrateContext, msg: ~str) {
if !ccx.do_not_commit_warning_issued {
ccx.do_not_commit_warning_issued = true;
if !*ccx.do_not_commit_warning_issued {
*ccx.do_not_commit_warning_issued = true;
ccx.sess.warn(msg + ~" -- do not commit like this!");
}
}
@ -689,7 +689,7 @@ pub fn block_parent(cx: block) -> block {
// Accessors
pub impl block {
pure fn ccx() -> @CrateContext { self.fcx.ccx }
pure fn ccx() -> @CrateContext { *self.fcx.ccx }
pure fn tcx() -> ty::ctxt { self.fcx.ccx.tcx }
pure fn sess() -> Session { self.fcx.ccx.sess }

View File

@ -778,7 +778,7 @@ pub fn create_local_var(bcx: block, local: @ast::local)
pub fn create_arg(bcx: block, arg: ast::arg, sp: span)
-> Option<@Metadata<ArgumentMetadata>> {
unsafe {
let fcx = bcx.fcx, cx = fcx.ccx;
let fcx = bcx.fcx, cx = *fcx.ccx;
let cache = get_cache(cx);
let tg = ArgVariableTag;
match cached_metadata::<@Metadata<ArgumentMetadata>>(
@ -845,7 +845,7 @@ pub fn update_source_pos(cx: block, s: span) {
}
pub fn create_function(fcx: fn_ctxt) -> @Metadata<SubProgramMetadata> {
let cx = fcx.ccx;
let cx = *fcx.ccx;
let dbg_cx = (/*bad*/copy cx.dbg_cx).get();
debug!("~~");

View File

@ -944,10 +944,10 @@ pub fn trans_local_var(bcx: block, def: ast::def) -> Datum {
}
}
ast::def_arg(nid, _, _) => {
take_local(bcx, bcx.fcx.llargs, nid)
take_local(bcx, *bcx.fcx.llargs, nid)
}
ast::def_local(nid, _) | ast::def_binding(nid, _) => {
take_local(bcx, bcx.fcx.lllocals, nid)
take_local(bcx, *bcx.fcx.lllocals, nid)
}
ast::def_self(nid, _) => {
let self_info: ValSelfData = match bcx.fcx.llself {

View File

@ -654,7 +654,7 @@ pub fn declare_tydesc(ccx: @CrateContext, t: ty::t) -> @mut tydesc_info {
let _icx = ccx.insn_ctxt("declare_tydesc");
// If emit_tydescs already ran, then we shouldn't be creating any new
// tydescs.
assert !ccx.finished_tydescs;
assert !*ccx.finished_tydescs;
let llty = type_of(ccx, t);
@ -761,7 +761,7 @@ pub fn make_generic_glue(ccx: @CrateContext, t: ty::t, llfn: ValueRef,
pub fn emit_tydescs(ccx: @CrateContext) {
let _icx = ccx.insn_ctxt("emit_tydescs");
// As of this point, allow no more tydescs to be created.
ccx.finished_tydescs = true;
*ccx.finished_tydescs = true;
for ccx.tydescs.each_value |&val| {
let glue_fn_ty = T_ptr(T_generic_glue_fn(ccx));
let ti = val;