lifetime.l0

lifetime.l0

Module: backend.lifetime

Source: compiler/stage2_l0/src/backend/lifetime.l0 Language: Dea/L0

Imports / Includes

  • types
  • std.vector
  • backend.state
  • c_emitter.names
  • ast
  • symbols
  • c_emitter.state
  • c_emitter.values
  • signatures
  • c_emitter.types
  • c_emitter.lifetime
  • c_emitter.declarations
  • c_emitter.statements
  • sem_context
  • backend.convert
  • scope_context

Symbols

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:

  • self: Backend state to update.
  • c_expr: Lowered source expression.
  • ty: Type of the copied value.

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:

  • self: Backend state to update.
  • c_expr: Lowered value expression.
  • ty: Type of the value.

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.