librustc: De-@mut
FunctionContext::alloca_insert_pt
This commit is contained in:
parent
5b0401f0e8
commit
a07cee26a4
@ -1594,7 +1594,7 @@ pub fn alloca_maybe_zeroed(cx: @Block, ty: Type, name: &str, zero: bool) -> Valu
|
||||
let p = Alloca(cx, ty, name);
|
||||
if zero {
|
||||
let b = cx.fcx.ccx.builder();
|
||||
b.position_before(cx.fcx.alloca_insert_pt.unwrap());
|
||||
b.position_before(cx.fcx.alloca_insert_pt.get().unwrap());
|
||||
memzero(&b, p, ty);
|
||||
}
|
||||
p
|
||||
@ -1687,7 +1687,7 @@ pub fn new_fn_ctxt_w_id(ccx: @CrateContext,
|
||||
},
|
||||
llretptr: Cell::new(None),
|
||||
entry_bcx: None,
|
||||
alloca_insert_pt: None,
|
||||
alloca_insert_pt: Cell::new(None),
|
||||
llreturn: None,
|
||||
llself: None,
|
||||
personality: None,
|
||||
@ -1711,7 +1711,8 @@ pub fn new_fn_ctxt_w_id(ccx: @CrateContext,
|
||||
Load(entry_bcx, C_null(Type::i8p()));
|
||||
|
||||
fcx.entry_bcx = Some(entry_bcx);
|
||||
fcx.alloca_insert_pt = Some(llvm::LLVMGetFirstInstruction(entry_bcx.llbb));
|
||||
fcx.alloca_insert_pt.set(Some(
|
||||
llvm::LLVMGetFirstInstruction(entry_bcx.llbb)));
|
||||
}
|
||||
|
||||
if !ty::type_is_voidish(ccx.tcx, substd_output_type) {
|
||||
|
@ -314,7 +314,7 @@ pub fn Alloca(cx: &Block, Ty: Type, name: &str) -> 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.unwrap());
|
||||
b.position_before(cx.fcx.alloca_insert_pt.get().unwrap());
|
||||
b.alloca(Ty, name)
|
||||
}
|
||||
}
|
||||
@ -323,7 +323,7 @@ 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.unwrap());
|
||||
b.position_before(cx.fcx.alloca_insert_pt.get().unwrap());
|
||||
b.array_alloca(Ty, Val)
|
||||
}
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ pub struct FunctionContext {
|
||||
// the function, due to LLVM's quirks.
|
||||
// A marker for the place where we want to insert the function's static
|
||||
// allocas, so that LLVM will coalesce them into a single alloca call.
|
||||
alloca_insert_pt: Option<ValueRef>,
|
||||
alloca_insert_pt: Cell<Option<ValueRef>>,
|
||||
llreturn: Option<BasicBlockRef>,
|
||||
// The 'self' value currently in use in this function, if there
|
||||
// is one.
|
||||
@ -291,7 +291,9 @@ impl FunctionContext {
|
||||
|
||||
pub fn cleanup(&mut self) {
|
||||
unsafe {
|
||||
llvm::LLVMInstructionEraseFromParent(self.alloca_insert_pt.unwrap());
|
||||
llvm::LLVMInstructionEraseFromParent(self.alloca_insert_pt
|
||||
.get()
|
||||
.unwrap());
|
||||
}
|
||||
// Remove the cycle between fcx and bcx, so memory can be freed
|
||||
self.entry_bcx = None;
|
||||
|
Loading…
x
Reference in New Issue
Block a user