fhelium.compile.passes._operation_transforms
xDSL operation helpers shared by source-oriented transforms.
bool_attribute
function View source
def bool_attribute(attributes: Mapping[str, Attribute], name: str, default: bool=False) -> bool: ...Read one bool-like pass trait from xDSL attributes.
cast_before
function View source
def cast_before(operation: Operation, value: SSAValue, result_type: Attribute, *, name_hint: str) -> SSAValue: ...Reuse a dominating transparent type edge or create one before an op.
Unrealized one-to-one casts carry no storage operation. Their input identity is retained through lowering instead of manufacturing a fresh alias at every consumer. Casts with attributes are kept as supplied.
ciphertext_type
function View source
def ciphertext_type(value: SSAValue, *, domain: str | None=None, residues: str | None=None, components: int | None=None) -> ckks.CiphertextType: ...Refine one encrypted value into an explicit CKKS ciphertext type.
display_name
function View source
def display_name(operation: Operation) -> str: ...Return a stable diagnostic name for one operation.
insert_after_and_replace_uses
function View source
def insert_after_and_replace_uses(operation: Operation, inserted: Operation) -> None: ...Insert one unary result after operation and redirect prior uses.
operand_role
function View source
def operand_role(operand: SSAValue) -> str | None: ...Return the known role of one operand value.
program_operations
function View source
def program_operations(program: Program) -> tuple[Operation, ...]: ...Return local leaf operations in known structured regions.
The traversal enters scf.for, scf.if, and the registered generic distributed reduction region. Unknown region owners remain opaque so a local FHElium pass cannot accidentally rewrite vendor control flow.
replace_operation
function View source
def replace_operation(operation: Operation, replacement: Operation) -> None: ...Replace one operation and map each old result to the new result.
replacement_operation
function View source
def replacement_operation(operation: Operation, operation_type: type[Operation], *, operands: Sequence[SSAValue] | None=None, result_types: Sequence[Attribute] | None=None, attributes: Mapping[str, Attribute] | None=None) -> Operation: ...Create a same-arity replacement and preserve SSA name hints.
result_role
function View source
def result_role(operation: Operation) -> str | None: ...Return the known role of one single-result operation.
string_attribute
function View source
def string_attribute(attributes: Mapping[str, Attribute], name: str, default: str | None=None) -> str | None: ...Read one string attribute without coercing unknown attribute kinds.
users
function View source
def users(value: SSAValue) -> tuple[Operation, ...]: ...Return stable unique users of one SSA value.
with_bool_attribute
function View source
def with_bool_attribute(attributes: Mapping[str, Attribute], name: str, value: bool) -> dict[str, Attribute]: ...Copy attributes and set one bool trait.