Struct rustc_trans::trans::common::FunctionContextExperimental
[-]
[+]
[src]
pub struct FunctionContext<'a, 'tcx> {
pub llfn: ValueRef,
pub llenv: Option<ValueRef>,
pub llretslotptr: Cell<Option<ValueRef>>,
pub alloca_insert_pt: Cell<Option<ValueRef>>,
pub llreturn: Cell<Option<BasicBlockRef>>,
pub needs_ret_allocas: bool,
pub personality: Cell<Option<ValueRef>>,
pub caller_expects_out_pointer: bool,
pub lllocals: RefCell<NodeMap<LvalueDatum<'tcx>>>,
pub llupvars: RefCell<NodeMap<ValueRef>>,
pub id: NodeId,
pub param_substs: &'a Substs<'tcx>,
pub span: Option<Span>,
pub block_arena: &'a TypedArena<BlockS<'a, 'tcx>>,
pub ccx: &'a CrateContext<'a, 'tcx>,
pub debug_context: FunctionDebugContext,
pub scopes: RefCell<Vec<CleanupScope<'a, 'tcx>>>,
}Fields
llfn | |
llenv | |
llretslotptr | |
alloca_insert_pt | |
llreturn | |
needs_ret_allocas | |
personality | |
caller_expects_out_pointer | |
lllocals | |
llupvars | |
id | |
param_substs | |
span | |
block_arena | |
ccx | |
debug_context | |
scopes |
Methods
impl<'a, 'tcx> FunctionContext<'a, 'tcx>
fn arg_pos(&self, arg: uint) -> uint
fn out_arg_pos(&self) -> uint
fn env_arg_pos(&self) -> uint
fn cleanup(&self)
fn get_llreturn(&self) -> BasicBlockRef
fn get_ret_slot(&self, bcx: Block<'a, 'tcx>, output: FnOutput<'tcx>, name: &str) -> ValueRef
fn new_block(&'a self, is_lpad: bool, name: &str, opt_node_id: Option<NodeId>) -> Block<'a, 'tcx>
fn new_id_block(&'a self, name: &str, node_id: NodeId) -> Block<'a, 'tcx>
fn new_temp_block(&'a self, name: &str) -> Block<'a, 'tcx>
fn join_blocks(&'a self, id: NodeId, in_cxs: &[Block<'a, 'tcx>]) -> Block<'a, 'tcx>
Trait Implementations
impl<'blk, 'tcx> CleanupMethods<'blk, 'tcx> for FunctionContext<'blk, 'tcx>
fn push_ast_cleanup_scope(&self, debug_loc: NodeInfo)
Invoked when we start to trans the code contained within a new cleanup scope.
fn push_loop_cleanup_scope(&self, id: NodeId, exits: [Block<'blk, 'tcx>, ..EXIT_MAX])
fn push_custom_cleanup_scope(&self) -> CustomScopeIndex
fn push_custom_cleanup_scope_with_debug_loc(&self, debug_loc: NodeInfo) -> CustomScopeIndex
fn pop_and_trans_ast_cleanup_scope(&self, bcx: Block<'blk, 'tcx>, cleanup_scope: NodeId) -> Block<'blk, 'tcx>
Removes the cleanup scope for id cleanup_scope, which
must be at the top of the cleanup stack, and generates the
code to do its cleanups for normal exit.
fn pop_loop_cleanup_scope(&self, cleanup_scope: NodeId)
Removes the loop cleanup scope for id cleanup_scope, which
must be at the top of the cleanup stack. Does not generate
any cleanup code, since loop scopes should exit by
branching to a block generated by normal_exit_block.
fn pop_custom_cleanup_scope(&self, custom_scope: CustomScopeIndex)
Removes the top cleanup scope from the stack without
executing its cleanups. The top cleanup scope must
be the temporary scope custom_scope.
fn pop_and_trans_custom_cleanup_scope(&self, bcx: Block<'blk, 'tcx>, custom_scope: CustomScopeIndex) -> Block<'blk, 'tcx>
Removes the top cleanup scope from the stack, which must be a temporary scope, and generates the code to do its cleanups for normal exit.
fn top_loop_scope(&self) -> NodeId
Returns the id of the top-most loop scope
fn normal_exit_block(&'blk self, cleanup_scope: NodeId, exit: uint) -> BasicBlockRef
Returns a block to branch to which will perform all pending
cleanups and then break/continue (depending on exit) out
of the loop with id cleanup_scope
fn return_exit_block(&'blk self) -> BasicBlockRef
Returns a block to branch to which will perform all pending cleanups and then return from this function
fn schedule_lifetime_end(&self, cleanup_scope: ScopeId, val: ValueRef)
fn schedule_drop_mem(&self, cleanup_scope: ScopeId, val: ValueRef, ty: Ty<'tcx>)
Schedules a (deep) drop of val, which is a pointer to an
instance of ty
fn schedule_drop_and_zero_mem(&self, cleanup_scope: ScopeId, val: ValueRef, ty: Ty<'tcx>)
Schedules a (deep) drop and zero-ing of val, which is a pointer
to an instance of ty
fn schedule_drop_immediate(&self, cleanup_scope: ScopeId, val: ValueRef, ty: Ty<'tcx>)
Schedules a (deep) drop of val, which is an instance of ty
fn schedule_free_value(&self, cleanup_scope: ScopeId, val: ValueRef, heap: Heap, content_ty: Ty<'tcx>)
Schedules a call to free(val). Note that this is a shallow
operation.
fn schedule_free_slice(&self, cleanup_scope: ScopeId, val: ValueRef, size: ValueRef, align: ValueRef, heap: Heap)
Schedules a call to free(val). Note that this is a shallow
operation.
fn schedule_clean(&self, cleanup_scope: ScopeId, cleanup: CleanupObj<'tcx>)
fn schedule_clean_in_ast_scope(&self, cleanup_scope: NodeId, cleanup: CleanupObj<'tcx>)
Schedules a cleanup to occur upon exit from cleanup_scope.
If cleanup_scope is not provided, then the cleanup is scheduled
in the topmost scope, which must be a temporary scope.
fn schedule_clean_in_custom_scope(&self, custom_scope: CustomScopeIndex, cleanup: CleanupObj<'tcx>)
Schedules a cleanup to occur in the top-most scope, which must be a temporary scope.
fn needs_invoke(&self) -> bool
Returns true if there are pending cleanups that should execute on panic.
fn get_landing_pad(&'blk self) -> BasicBlockRef
Returns a basic block to branch to in the event of a panic.
This block will run the panic cleanups and eventually
invoke the LLVM Resume instruction.