librustc: De-@mut
the translation FunctionContext
This commit is contained in:
parent
558099b509
commit
8ae01fc0ae
@ -1188,7 +1188,7 @@ pub fn trans_stmt(cx: @Block, s: &ast::Stmt) -> @Block {
|
||||
|
||||
// You probably don't want to use this one. See the
|
||||
// next three functions instead.
|
||||
pub fn new_block(cx: @mut FunctionContext,
|
||||
pub fn new_block(cx: @FunctionContext,
|
||||
parent: Option<@Block>,
|
||||
scope: Option<@mut ScopeInfo>,
|
||||
is_lpad: bool,
|
||||
@ -1229,7 +1229,7 @@ pub fn simple_block_scope(parent: Option<@mut ScopeInfo>,
|
||||
}
|
||||
|
||||
// Use this when you're at the top block of a function or the like.
|
||||
pub fn top_scope_block(fcx: @mut FunctionContext, opt_node_info: Option<NodeInfo>)
|
||||
pub fn top_scope_block(fcx: @FunctionContext, opt_node_info: Option<NodeInfo>)
|
||||
-> @Block {
|
||||
return new_block(fcx, None, Some(simple_block_scope(None, opt_node_info)), false,
|
||||
"function top level", opt_node_info);
|
||||
@ -1268,7 +1268,7 @@ pub fn sub_block(bcx: @Block, n: &str) -> @Block {
|
||||
new_block(bcx.fcx, Some(bcx), None, bcx.is_lpad, n, None)
|
||||
}
|
||||
|
||||
pub fn raw_block(fcx: @mut FunctionContext, is_lpad: bool, llbb: BasicBlockRef) -> @Block {
|
||||
pub fn raw_block(fcx: @FunctionContext, is_lpad: bool, llbb: BasicBlockRef) -> @Block {
|
||||
@Block::new(llbb, None, is_lpad, None, fcx)
|
||||
}
|
||||
|
||||
@ -1635,7 +1635,7 @@ pub fn mk_return_basic_block(llfn: ValueRef) -> BasicBlockRef {
|
||||
|
||||
// Creates and returns space for, or returns the argument representing, the
|
||||
// slot where the return value of the function must go.
|
||||
pub fn make_return_pointer(fcx: @mut FunctionContext, output_type: ty::t) -> ValueRef {
|
||||
pub fn make_return_pointer(fcx: @FunctionContext, output_type: ty::t) -> ValueRef {
|
||||
unsafe {
|
||||
if type_of::return_uses_outptr(fcx.ccx, output_type) {
|
||||
llvm::LLVMGetParam(fcx.llfn, 0)
|
||||
@ -1662,7 +1662,7 @@ pub fn new_fn_ctxt_w_id(ccx: @CrateContext,
|
||||
param_substs: Option<@param_substs>,
|
||||
opt_node_info: Option<NodeInfo>,
|
||||
sp: Option<Span>)
|
||||
-> @mut FunctionContext {
|
||||
-> @FunctionContext {
|
||||
for p in param_substs.iter() { p.validate(); }
|
||||
|
||||
debug!("new_fn_ctxt_w_id(path={}, id={:?}, \
|
||||
@ -1680,7 +1680,7 @@ pub fn new_fn_ctxt_w_id(ccx: @CrateContext,
|
||||
let uses_outptr = type_of::return_uses_outptr(ccx, substd_output_type);
|
||||
let debug_context = debuginfo::create_function_debug_context(ccx, id, param_substs, llfndecl);
|
||||
|
||||
let fcx = @mut FunctionContext {
|
||||
let fcx = @FunctionContext {
|
||||
llfn: llfndecl,
|
||||
llenv: unsafe {
|
||||
Cell::new(llvm::LLVMGetUndef(Type::i8p().to_ref()))
|
||||
@ -1734,7 +1734,7 @@ pub fn new_fn_ctxt(ccx: @CrateContext,
|
||||
llfndecl: ValueRef,
|
||||
output_type: ty::t,
|
||||
sp: Option<Span>)
|
||||
-> @mut FunctionContext {
|
||||
-> @FunctionContext {
|
||||
new_fn_ctxt_w_id(ccx, path, llfndecl, -1, output_type, false, None, None, sp)
|
||||
}
|
||||
|
||||
@ -1752,7 +1752,7 @@ pub fn new_fn_ctxt(ccx: @CrateContext,
|
||||
// spaces that have been created for them (by code in the llallocas field of
|
||||
// the function's fn_ctxt). create_llargs_for_fn_args populates the llargs
|
||||
// field of the fn_ctxt with
|
||||
pub fn create_llargs_for_fn_args(cx: @mut FunctionContext,
|
||||
pub fn create_llargs_for_fn_args(cx: @FunctionContext,
|
||||
self_arg: self_arg,
|
||||
args: &[ast::arg])
|
||||
-> ~[ValueRef] {
|
||||
@ -1776,7 +1776,7 @@ pub fn create_llargs_for_fn_args(cx: @mut FunctionContext,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn copy_args_to_allocas(fcx: @mut FunctionContext,
|
||||
pub fn copy_args_to_allocas(fcx: @FunctionContext,
|
||||
bcx: @Block,
|
||||
args: &[ast::arg],
|
||||
raw_llargs: &[ValueRef],
|
||||
@ -1840,7 +1840,7 @@ pub fn copy_args_to_allocas(fcx: @mut FunctionContext,
|
||||
|
||||
// Ties up the llstaticallocas -> llloadenv -> lltop edges,
|
||||
// and builds the return block.
|
||||
pub fn finish_fn(fcx: @mut FunctionContext, last_bcx: @Block) {
|
||||
pub fn finish_fn(fcx: @FunctionContext, last_bcx: @Block) {
|
||||
let _icx = push_ctxt("finish_fn");
|
||||
|
||||
let ret_cx = match fcx.llreturn.get() {
|
||||
@ -1901,7 +1901,7 @@ pub fn trans_closure(ccx: @CrateContext,
|
||||
id: ast::NodeId,
|
||||
_attributes: &[ast::Attribute],
|
||||
output_type: ty::t,
|
||||
maybe_load_env: |@mut FunctionContext|) {
|
||||
maybe_load_env: |@FunctionContext|) {
|
||||
ccx.stats.n_closures += 1;
|
||||
let _icx = push_ctxt("trans_closure");
|
||||
set_uwtable(llfndecl);
|
||||
|
@ -293,7 +293,7 @@ pub fn build_closure(bcx0: @Block,
|
||||
// Given an enclosing block context, a new function context, a closure type,
|
||||
// and a list of upvars, generate code to load and populate the environment
|
||||
// with the upvars and type descriptors.
|
||||
pub fn load_environment(fcx: @mut FunctionContext,
|
||||
pub fn load_environment(fcx: @FunctionContext,
|
||||
cdata_ty: ty::t,
|
||||
cap_vars: &[moves::CaptureVar],
|
||||
sigil: ast::Sigil) {
|
||||
|
@ -289,7 +289,7 @@ impl FunctionContext {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn cleanup(&mut self) {
|
||||
pub fn cleanup(&self) {
|
||||
unsafe {
|
||||
llvm::LLVMInstructionEraseFromParent(self.alloca_insert_pt
|
||||
.get()
|
||||
@ -299,7 +299,7 @@ impl FunctionContext {
|
||||
self.entry_bcx.set(None);
|
||||
}
|
||||
|
||||
pub fn get_llreturn(&mut self) -> BasicBlockRef {
|
||||
pub fn get_llreturn(&self) -> BasicBlockRef {
|
||||
if self.llreturn.get().is_none() {
|
||||
self.llreturn.set(Some(base::mk_return_basic_block(self.llfn)));
|
||||
}
|
||||
@ -671,17 +671,16 @@ pub struct Block {
|
||||
node_info: Option<NodeInfo>,
|
||||
// The function context for the function to which this block is
|
||||
// attached.
|
||||
fcx: @mut FunctionContext
|
||||
fcx: @FunctionContext
|
||||
}
|
||||
|
||||
impl Block {
|
||||
|
||||
pub fn new(llbb: BasicBlockRef,
|
||||
parent: Option<@Block>,
|
||||
is_lpad: bool,
|
||||
node_info: Option<NodeInfo>,
|
||||
fcx: @mut FunctionContext)
|
||||
-> Block {
|
||||
fcx: @FunctionContext)
|
||||
-> Block {
|
||||
Block {
|
||||
llbb: llbb,
|
||||
terminated: Cell::new(false),
|
||||
|
Loading…
x
Reference in New Issue
Block a user