irx.builder.numeric

irx.builder.numeric

Source: packages/irx/src/irx/builder/numeric.py

title: Checked numeric execution from resolved semantic plans.
summary: >-
  Guards precede unsafe conversions, mutation, and result publication. LLVM
  overflow intrinsics do not rely on undefined signed-overflow flags. Runtime
  failures use the registered reporter at every optimization level.

Functions

numeric_guard(visitor: VisitorCore, node: astx.AST, valid: ir.Value, *, conversion: bool) -> None

title: Deliver a deterministic arithmetic or conversion failure.
parameters:
  visitor:
    type: VisitorCore
  node:
    type: astx.AST
  valid:
    type: ir.Value
  conversion:
    type: bool

integer_operation(visitor: VisitorCore, node: astx.AST, lhs: ir.Value, rhs: ir.Value, plan: ResolvedOperator, operator: str) -> ir.Value

title: >-
  Emit checked or explicitly wrapping integer arithmetic, including SIMD.
parameters:
  visitor:
    type: VisitorCore
  node:
    type: astx.AST
  lhs:
    type: ir.Value
  rhs:
    type: ir.Value
  plan:
    type: ResolvedOperator
  operator:
    type: str
returns:
  type: ir.Value

resolved_integer_operation(visitor: VisitorCore, node: astx.AST, lhs: ir.Value, rhs: ir.Value, operator: str) -> ir.Value

title: >-
  Require an analyzed arithmetic plan before emitting a checked operation.
parameters:
  visitor:
    type: VisitorCore
  node:
    type: astx.AST
  lhs:
    type: ir.Value
  rhs:
    type: ir.Value
  operator:
    type: str
returns:
  type: ir.Value

finite_value(visitor: VisitorCore, value: ir.Value) -> ir.Value

title: >-
  Test finiteness without rejecting preexisting floating NaN or infinity.
parameters:
  visitor:
    type: VisitorCore
  value:
    type: ir.Value
returns:
  type: ir.Value

numeric_cast(visitor: VisitorCore, node: astx.Cast, value: ir.Value, plan: NumericConversion, mode: astx.NumericMode) -> ir.Value

title: >-
  Convert a valid scalar payload using the analyzed conversion contract.
parameters:
  visitor:
    type: VisitorCore
  node:
    type: astx.Cast
  value:
    type: ir.Value
  plan:
    type: NumericConversion
  mode:
    type: astx.NumericMode
returns:
  type: ir.Value

lower_numeric_cast(visitor: VisitorCore, node: astx.Cast, value: ir.Value, plan: NumericConversion, mode: astx.NumericMode) -> ir.Value

title: Guard nullable conversion payloads only when the input is valid.
parameters:
  visitor:
    type: VisitorCore
  node:
    type: astx.Cast
  value:
    type: ir.Value
  plan:
    type: NumericConversion
  mode:
    type: astx.NumericMode
returns:
  type: ir.Value

guard_collection_length(visitor: VisitorCore, node: astx.AST, length: ir.Value) -> None

title: Keep i32 collection length, index, and count results representable.
summary: The backing ABI uses i64 lengths; no narrowing may silently wrap.
parameters:
  visitor:
    type: VisitorCore
  node:
    type: astx.AST
  length:
    type: ir.Value
Back to top