Documentation
irx.builder.protocols
irx.builder.protocols
Source: packages/irx/src/irx/builder/protocols.py
title: Typing protocols for llvmliteir visitors.
Classes
DispatchRegistrar(Protocol)
title: Typed view of Plum's dynamically attached registration method.
Methods
dispatch(self, method: Callable[DispatchParameters, None]) -> Any
title: Register one typed overload in the open dispatch family.
summary: Plum exposes a dynamic multimethod, not this single signature.
parameters:
method:
type: Callable[DispatchParameters, None]
returns:
type: Any
ExceptionLoweringTypingBase
title: Explicit execution-context and status-ABI lowering services.
attributes:
runtime_exception_types:
type: dict[str, ResolvedExceptionType]
exception_context:
type: ir.Value | None
exception_result_slot:
type: ir.Value | None
exception_targets:
type: list[ExceptionTarget]
pending_returns:
type: list[PendingReturn]
llvm_function_signatures:
type: dict[str, FunctionSignature]
Methods
exception_call(self, operation: str, args: list[ir.Value]) -> ir.Value
title: Call an opaque runtime exception operation.
parameters:
operation:
type: str
args:
type: list[ir.Value]
returns:
type: ir.Value
context_value(self) -> ir.Value
title: Require the current frame execution context.
returns:
type: ir.Value
emit_resolved_call(self, node: astx.AST, callee: ir.Value, signature: FunctionSignature, args: list[ir.Value]) -> ir.Value | None
title: Emit a resolved call and consume success-only output storage.
parameters:
node:
type: astx.AST
callee:
type: ir.Value
signature:
type: FunctionSignature
args:
type: list[ir.Value]
returns:
type: ir.Value | None
propagate_status(self, node: astx.AST, status: ir.Value) -> None
title: Route failed call status through lexical cleanup regions.
parameters:
node:
type: astx.AST
status:
type: ir.Value
emit_exception_transfer(self, node: astx.AST | None) -> None
title: Exit the current region with the context pending exception.
parameters:
node:
type: astx.AST | None
emit_success_return(self, value: ir.Value | None) -> None
title: Publish successful output after all cleanups.
parameters:
value:
type: ir.Value | None
abandon_pending_returns(self, completions: tuple[PendingReturn, ...] | None=None, *, preserved_depth: int | None=None) -> None
title: Release values whose pending return was replaced.
parameters:
completions:
type: tuple[PendingReturn, Ellipsis] | None
preserved_depth:
type: int | None
raise_runtime_exception(self, node: astx.AST, role: str, message: ir.Value, *, code: str) -> None
title: Materialize a builtin nominal exception from native failure.
parameters:
node:
type: astx.AST
role:
type: str
message:
type: ir.Value
code:
type: str
fatal_status(self, node: astx.AST, status: ir.Value) -> None
title: Fail without allocation on bookkeeping allocation failure.
parameters:
node:
type: astx.AST
status:
type: ir.Value
checked_native_call(self, node: astx.AST, function: ir.Function, args: list[ir.Value]) -> ir.Value
title: Invoke a checked native facade with success-only output slots.
parameters:
node:
type: astx.AST
function:
type: ir.Function
args:
type: list[ir.Value]
returns:
type: ir.Value
check_arrow_status(self, node: astx.AST, status: ir.Value, operation: str, message: ir.Value | None=None) -> None
title: Convert a native Arrow failure category into an exception.
parameters:
node:
type: astx.AST
status:
type: ir.Value
operation:
type: str
message:
type: ir.Value | None
track_native_handle(self, node: astx.AST, feature: str, destroy: str, value: ir.Value) -> CleanupAction
title: Register rollback for a partially assembled native handle.
parameters:
node:
type: astx.AST
feature:
type: str
destroy:
type: str
value:
type: ir.Value
returns:
type: CleanupAction
release_native_handle(self, action: CleanupAction) -> None
title: Release a native temporary after successful ownership transfer.
parameters:
action:
type: CleanupAction
VisitorProtocol(BaseVisitorProtocol, Protocol)
title: Stable interface used by visitor mixins and runtime features.
attributes:
runtime_exception_types:
type: dict[str, ResolvedExceptionType]
exception_context:
type: ir.Value | None
exception_result_slot:
type: ir.Value | None
exception_targets:
type: list[ExceptionTarget]
pending_returns:
type: list[PendingReturn]
llvm_function_signatures:
type: dict[str, FunctionSignature]
_llvm:
type: VariablesLLVM
named_values:
type: NamedValueMap
const_vars:
type: set[str]
function_protos:
type: dict[str, astx.FunctionPrototype]
llvm_functions_by_symbol_id:
type: dict[str, ir.Function]
result_stack:
type: list[ResultStackValue]
_buffer_view_global_counter:
type: int
loop_stack:
type: list[LoopTargets]
cleanup_stack:
type: list[CleanupAction]
class_construction_stack:
type: list[ir.Value]
emitting_failure_cleanup:
type: bool
struct_types:
type: dict[str, ir.Type]
llvm_structs_by_qualified_name:
type: dict[str, ir.IdentifiedStructType]
runtime_features:
type: RuntimeFeatureState
entry_function_symbol_id:
type: str | None
_fast_math_enabled:
type: bool
_current_function_return_type:
type: astx.DataType | None
_current_function_signature:
type: FunctionSignature | None
_current_generator_frame_ptr:
type: ir.Value | None
_current_generator_frame_slots:
type: dict[str, int]
_current_generator_out_ptr:
type: ir.Value | None
_current_generator_next_state:
type: int | None
target:
type: llvm.TargetRef
target_machine:
type: llvm.TargetMachine
Methods
declare_class(self, node: astx.ClassDefStmt) -> None
title: Declare a resolved class layout before lowering method bodies.
parameters:
node:
type: astx.ClassDefStmt
get_function(self, _name: str) -> ir.Function | None
title: Get function.
parameters:
_name:
type: str
returns:
type: ir.Function | None
llvm_function_name_for_node(self, _node: astx.AST, _fallback: str) -> str
title: Return the LLVM symbol name for a function node.
parameters:
_node:
type: astx.AST
_fallback:
type: str
returns:
type: str
create_entry_block_alloca(self, _var_name: str, _type_name: str | ir.Type) -> Any
title: Create entry block alloca.
parameters:
_var_name:
type: str
_type_name:
type: str | ir.Type
returns:
type: Any
require_runtime_symbol(self, _feature_name: str, _symbol_name: str) -> ir.Function
title: Require runtime symbol.
parameters:
_feature_name:
type: str
_symbol_name:
type: str
returns:
type: ir.Function
activate_runtime_feature(self, _feature_name: str) -> None
title: Activate runtime feature.
parameters:
_feature_name:
type: str
set_fast_math(self, _enabled: bool) -> None
title: Set fast math.
parameters:
_enabled:
type: bool
VisitorMixinTypingBase(ExceptionLoweringTypingBase)
title: Type-checking-only annotation carrier for llvmliteir visitor mixins.
attributes:
runtime_exception_types:
type: dict[str, ResolvedExceptionType]
exception_context:
type: ir.Value | None
exception_result_slot:
type: ir.Value | None
exception_targets:
type: list[ExceptionTarget]
pending_returns:
type: list[PendingReturn]
llvm_function_signatures:
type: dict[str, FunctionSignature]
_llvm:
type: VariablesLLVM
named_values:
type: NamedValueMap
const_vars:
type: set[str]
function_protos:
type: dict[str, astx.FunctionPrototype]
llvm_functions_by_symbol_id:
type: dict[str, ir.Function]
result_stack:
type: list[ResultStackValue]
_buffer_view_global_counter:
type: int
loop_stack:
type: list[LoopTargets]
cleanup_stack:
type: list[CleanupAction]
class_construction_stack:
type: list[ir.Value]
emitting_failure_cleanup:
type: bool
struct_types:
type: dict[str, ir.Type]
llvm_structs_by_qualified_name:
type: dict[str, ir.IdentifiedStructType]
runtime_features:
type: RuntimeFeatureState
entry_function_symbol_id:
type: str | None
_fast_math_enabled:
type: bool
_current_function_return_type:
type: astx.DataType | None
_current_function_signature:
type: FunctionSignature | None
_current_generator_frame_ptr:
type: ir.Value | None
_current_generator_frame_slots:
type: dict[str, int]
_current_generator_out_ptr:
type: ir.Value | None
_current_generator_next_state:
type: int | None
target:
type: llvm.TargetRef
target_machine:
type: llvm.TargetMachine
Methods
visit(self, _node: astx.AST) -> None
title: Visit AST nodes.
parameters:
_node:
type: astx.AST
visit_child(self, _node: astx.AST) -> None
title: Visit one child AST node.
parameters:
_node:
type: astx.AST
get_function(self, _name: str) -> ir.Function | None
title: Get function.
parameters:
_name:
type: str
returns:
type: ir.Function | None
llvm_function_name_for_node(self, _node: astx.AST, _fallback: str) -> str
title: Return the LLVM symbol name for a function node.
parameters:
_node:
type: astx.AST
_fallback:
type: str
returns:
type: str
create_entry_block_alloca(self, _var_name: str, _type_name: str | ir.Type) -> Any
title: Create entry block alloca.
parameters:
_var_name:
type: str
_type_name:
type: str | ir.Type
returns:
type: Any
require_runtime_symbol(self, _feature_name: str, _symbol_name: str) -> ir.Function
title: Require runtime symbol.
parameters:
_feature_name:
type: str
_symbol_name:
type: str
returns:
type: ir.Function
activate_runtime_feature(self, _feature_name: str) -> None
title: Activate runtime feature.
parameters:
_feature_name:
type: str
set_fast_math(self, _enabled: bool) -> None
title: Set fast math.
parameters:
_enabled:
type: bool
VisitorMixinRuntimeBase
title: Runtime-empty base shared by llvmliteir visitor mixins.