lifetime.l0
Module: backend.lifetime
Source: compiler/stage2_l0/src/backend/lifetime.l0 Language: Dea/L0
Imports / Includes
typesstd.vectorbackend.statec_emitter.namesastsymbolsc_emitter.statec_emitter.valuessignaturesc_emitter.typesc_emitter.lifetimec_emitter.declarationsc_emitter.statementssem_contextbackend.convertscope_context
Symbols
- be_is_unwrap_cast_from_place
- be_needs_arc_temp
- be_should_materialize_arc_temp
- be_materialize_arc_temp
- be_emit_retain_for_copied_value
- be_emit_copy_expr_with_retains
- be_emit_value_cleanup
- be_emit_struct_cleanup
- be_emit_enum_cleanup
- be_emit_cleanup_at_scope_exit
- be_emit_drop_stmt
Function be_is_unwrap_cast_from_place
1
func be_is_unwrap_cast_from_place(self: Backend*, expr_id: ExprId) -> bool
Report whether an expression is a borrowed cast from a place.
Outer parentheses are ignored; owner-producing ARC value-optional wraps are excluded.
Parameters:
self: Backend state to inspect.expr_id: Expression to classify.
Returns: true for a non-owner-producing cast whose source is a place expression.
Function be_needs_arc_temp
1
func be_needs_arc_temp(self: Backend*, expr_id: ExprId) -> bool
Report whether a non-place ARC rvalue needs temporary materialization.
Parameters:
self: Backend state to inspect.expr_id: Expression to classify.
Returns: true when the expression should be hoisted into a cleanup temp.
Function be_should_materialize_arc_temp
1
func be_should_materialize_arc_temp(self: Backend*, expr_id: ExprId, expr_type: Type*) -> bool
Report whether an expression should be materialized into a scope-owned temp.
Parameters:
self: Backend state to inspect.expr_id: Expression to classify.expr_type: Inferred type of the expression.
Returns: true when the expression carries ARC data and is not already a place.
Function be_materialize_arc_temp
1
func be_materialize_arc_temp(self: Backend*, c_expr: string, expr_type: Type*) -> string
Materialize one ARC rvalue into a scope-owned temporary.
Parameters:
self: Backend state to update.c_expr: Lowered expression to store.expr_type: Type of the stored expression.
Returns: Temporary variable name.
Function be_emit_retain_for_copied_value
1
func be_emit_retain_for_copied_value(self: Backend*, c_expr: string, ty: Type*)
Emit retain operations for one copied owned value.
Parameters:
self: Backend state to update.c_expr: Lowered expression containing the copied value.ty: Type of the copied value.
Function be_emit_copy_expr_with_retains
1
func be_emit_copy_expr_with_retains(self: Backend*, c_expr: string, ty: Type*) -> string
Materialize one copied value into a temp and retain any owned fields.
Parameters:
Returns: Lowered expression or new temp name when retain logic is needed.
Function be_emit_value_cleanup
1
func be_emit_value_cleanup(self: Backend*, c_expr: string, ty: Type*)
Emit cleanup for one by-value expression.
Parameters:
Function be_emit_struct_cleanup
1
func be_emit_struct_cleanup(self: Backend*, c_ptr_expr: string, struct_type: Type*)
Emit cleanup for a pointer-to-struct expression.
Parameters:
self: Backend state to update.c_ptr_expr: Lowered pointer expression.struct_type: Struct type to clean.
Function be_emit_enum_cleanup
1
func be_emit_enum_cleanup(self: Backend*, c_ptr_expr: string, enum_type: Type*)
Emit cleanup for a pointer-to-enum expression.
Parameters:
self: Backend state to update.c_ptr_expr: Lowered pointer expression.enum_type: Enum type to clean.
Function be_emit_cleanup_at_scope_exit
1
func be_emit_cleanup_at_scope_exit(self: Backend*, scope: ScopeContext*)
Emit cleanup for owned values declared in one scope.
Parameters:
Function be_emit_drop_stmt
1
func be_emit_drop_stmt(self: Backend*, stmt: StmtNode*)
Emit a drop statement.
Parameters:
self: Backend state to update.stmt: Parsed drop statement.