qat.experimental.dialect.q1_cf package
The q1_cf dialect.
q1_cf specifies target-specific CFG operations for QBlox Q1. It sits above
flat q1 (ISA mnemonics). Every operation is a block terminator with named
successor blocks, per-successor SSA operand groups, and explicit register-type
condition operands. Conditional branches carry a predicate attribute selecting
the test applied to their operands.
Reference: https://docs.qblox.com/en/main/products/qblox_instruments/q1/index.html
- class ComparisonBranchOp(predicate, lhs, rhs, then_arguments, else_arguments, then_block, else_block)
Bases:
ComparisonBranchOp,HasRegisterConstraints,RegisterAllocatableOperation,IRDLOperation,Operation,_IRNode,ABC,objectBranch on a comparison of two operands.
The
predicateselects the signed/unsigned comparison applied tolhsandrhs, both register-typed SSA values. Thethenblock is taken when the comparison holds;elseis the fall-through successor and must immediately follow the parent block in its region. Lowers to acmpfollowed by the matching flag jump at flat q1.q1_cf.comparison_branch slt %lhs : q1.reg, %rhs : q1.reg, ^then(...), ^else(...)
- const_evaluate(lhs, rhs, bitwidth)
Evaluate the comparison predicate on constant operand values.
This is the hook a future CFG-canonicalisation pattern will call when both operands fold to constants: the branch is then rewritten to an unconditional
q1_cf.jmp_branchto the statically taken edge (the dead edge and any blocks it solely reaches become unreachable and are pruned). It exists ahead of that pattern so the constant-folding semantics live with the op that defines them; the rewrite itself is tracked separately.- Parameters:
- Return type:
bool- Returns:
Trueif thethenedge is taken,Falseif the branch falls through toelse.
- else_arguments
Access a variadic construct when there is a “segment size” attribute.
- else_block
Access a non-variadic construct which appears before any variadic arguments.
- classmethod get_irdl_definition()
Get the IRDL operation definition.
- get_register_constraints()
The values with register types used by this operation, for use in register allocation.
- Return type:
RegisterConstraints
- irdl_options = (AttrSizedOperandSegments(as_property=False),)
- lhs
Access a non-variadic construct when there is a “segment size” attribute.
- name: ClassVar[str] = 'q1_cf.comparison_branch'
The operation name. Should be a static member of the class
- classmethod parse(parser)
- Return type:
Self
- predicate
Accessor for an operation property.
- print(printer)
- Return type:
None
- rhs
Access a non-variadic construct when there is a “segment size” attribute.
- then_arguments
Access a variadic construct when there is a “segment size” attribute.
- then_block
Access a non-variadic construct which appears before any variadic arguments.
- traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>
Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.
- verify_()
- class ComparisonPredicate(value)
Bases:
StrEnumComparison applied between two operand values.
- eq = 'eq'
- ne = 'ne'
- sge = 'sge'
- sgt = 'sgt'
- sle = 'sle'
- slt = 'slt'
- uge = 'uge'
- ugt = 'ugt'
- ule = 'ule'
- ult = 'ult'
- class ComparisonPredicateAttr(data)
Bases:
EnumAttribute[ComparisonPredicate],SpacedOpaqueSyntaxAttributeAttribute wrapper carrying a
ComparisonPredicate.- enum_type
alias of
ComparisonPredicate
- name: ClassVar[str] = 'q1_cf.comparison_predicate'
The attribute name should be a static field in the attribute classes.
- class FlagBranchOp(predicate, rs, then_arguments, else_arguments, then_block, else_block)
Bases:
FlagBranchOp,HasRegisterConstraints,RegisterAllocatableOperation,IRDLOperation,Operation,_IRNode,ABC,objectBranch on a condition-code test of a single register.
The
predicateselects the zero/sign test applied tors. Thethenblock is taken when the test holds;elseis the fall-through successor and must immediately follow the parent block in its region. Lowers to atest/cmpagainst zero followed by the matching flag jump at flat q1.q1_cf.flag_branch eqz %rs : q1.reg, ^then(...), ^else(...)
- const_evaluate(rs, bitwidth)
Evaluate the flag predicate on a constant operand value.
- else_arguments
Access a variadic construct when there is a “segment size” attribute.
- else_block
Access a non-variadic construct which appears before any variadic arguments.
- classmethod get_irdl_definition()
Get the IRDL operation definition.
- get_register_constraints()
The values with register types used by this operation, for use in register allocation.
- Return type:
RegisterConstraints
- irdl_options = (AttrSizedOperandSegments(as_property=False),)
- name: ClassVar[str] = 'q1_cf.flag_branch'
The operation name. Should be a static member of the class
- classmethod parse(parser)
- Return type:
Self
- predicate
Accessor for an operation property.
- print(printer)
- Return type:
None
- rs
Access a non-variadic construct when there is a “segment size” attribute.
- then_arguments
Access a variadic construct when there is a “segment size” attribute.
- then_block
Access a non-variadic construct which appears before any variadic arguments.
- traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>
Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.
- verify_()
- class FlagPredicate(value)
Bases:
StrEnumCondition-code test applied to a single register value.
- eqz = 'eqz'
- gez = 'gez'
- ltz = 'ltz'
- nez = 'nez'
- class FlagPredicateAttr(data)
Bases:
EnumAttribute[FlagPredicate],SpacedOpaqueSyntaxAttributeAttribute wrapper carrying a
FlagPredicate.- enum_type
alias of
FlagPredicate
- name: ClassVar[str] = 'q1_cf.flag_predicate'
The attribute name should be a static field in the attribute classes.
- class JmpBranchOp(successor_arguments, successor)
Bases:
JmpBranchOp,HasRegisterConstraints,RegisterAllocatableOperation,IRDLOperation,Operation,_IRNode,ABC,objectUnconditional branch to a successor block.
Carries optional per-successor block arguments. At linearisation to flat
q1this becomesq1.i.jmp(or is elided whensuccessoris the fall-through block).q1_cf.jmp_branch ^dest(%arg0 : q1.reg, ...)
- classmethod get_irdl_definition()
Get the IRDL operation definition.
- get_register_constraints()
The values with register types used by this operation, for use in register allocation.
- Return type:
RegisterConstraints
- name: ClassVar[str] = 'q1_cf.jmp_branch'
The operation name. Should be a static member of the class
- classmethod parse(parser)
- Return type:
Self
- print(printer)
- Return type:
None
- successor
Access a non-variadic construct which appears before any variadic arguments.
- successor_arguments
Access a variadic construct in the case where it is the only variadic.
- traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>
Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.
- verify_()
- class LoopBranchOp(counter, body_arguments, exit_arguments, body_block, exit_block)
Bases:
LoopBranchOp,HasRegisterConstraints,RegisterAllocatableOperation,IRDLOperation,Operation,_IRNode,ABC,objectDecrement
counterand branch tobodywhile non-zero; elseexit.Lowers to
q1.ri.loop/q1.rr.loopat flat q1.q1_cf.loop_branch %counter : q1.reg, ^body(%a : q1.reg, ...), ^exit(%b : q1.reg, ...)
- body_arguments
Access a variadic construct when there is a “segment size” attribute.
- body_block
Access a non-variadic construct which appears before any variadic arguments.
- counter
Access a non-variadic construct when there is a “segment size” attribute.
- exit_arguments
Access a variadic construct when there is a “segment size” attribute.
- exit_block
Access a non-variadic construct which appears before any variadic arguments.
- classmethod get_irdl_definition()
Get the IRDL operation definition.
- get_register_constraints()
The values with register types used by this operation, for use in register allocation.
- Return type:
RegisterConstraints
- irdl_options = (AttrSizedOperandSegments(as_property=False),)
- name: ClassVar[str] = 'q1_cf.loop_branch'
The operation name. Should be a static member of the class
- classmethod parse(parser)
- Return type:
Self
- print(printer)
- Return type:
None
- traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>
Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.
- verify_()