qat.experimental.dialect.q1.ir.abstract_ops module

Abstract operation formats for the QBlox Q1 ISA.

The classes in this module describe reusable operand/result formats. For example RsIRd: encodes source register, immediate, destination register, in that order. Concrete operations in the dialect inherit one of these templates and provide the opcode-specific name and traits.

class IIIIOperation(imm1, imm2, imm3, imm4, comment=None)

Bases: Q1Instruction, ABC

A base class for QBlox Q1 operations that have four immediate operands.

assembly_line_args()

Instruction arguments in the order they should be printed in the assembly.

Return type:

tuple[IntegerAttr | SSAValue | RegisterType | StringAttr | str, ...]

imm1 = <xdsl.irdl.operations._PropertyFieldDef object>
imm2 = <xdsl.irdl.operations._PropertyFieldDef object>
imm3 = <xdsl.irdl.operations._PropertyFieldDef object>
imm4 = <xdsl.irdl.operations._PropertyFieldDef object>
class IIIOperation(imm1, imm2, imm3, comment=None)

Bases: Q1Instruction, ABC

A base class for QBlox Q1 operations that have three immediate operands.

assembly_line_args()

Instruction arguments in the order they should be printed in the assembly.

Return type:

tuple[IntegerAttr | SSAValue | RegisterType | StringAttr | str, ...]

imm1 = <xdsl.irdl.operations._PropertyFieldDef object>
imm2 = <xdsl.irdl.operations._PropertyFieldDef object>
imm3 = <xdsl.irdl.operations._PropertyFieldDef object>
class IIOperation(imm1, imm2, comment=None)

Bases: Q1Instruction, ABC

A base class for QBlox Q1 operations that have two immediate operands.

assembly_line_args()

Instruction arguments in the order they should be printed in the assembly.

Return type:

tuple[IntegerAttr | SSAValue | RegisterType | StringAttr | str, ...]

imm1 = <xdsl.irdl.operations._PropertyFieldDef object>
imm2 = <xdsl.irdl.operations._PropertyFieldDef object>
class IOperation(imm, comment=None)

Bases: Q1Instruction, ABC

A base class for QBlox Q1 operations that have one immediate operand.

assembly_line_args()

Instruction arguments in the order they should be printed in the assembly.

Return type:

tuple[IntegerAttr | SSAValue | RegisterType | StringAttr | str, ...]

imm = <xdsl.irdl.operations._PropertyFieldDef object>
class IRdOperation(imm, rd, comment=None)

Bases: Q1Instruction, ABC, Generic[RInvT]

A base class for QBlox Q1 operations that have one immediate operand followed by one destination register.

assembly_line_args()

Instruction arguments in the order they should be printed in the assembly.

Return type:

tuple[IntegerAttr | SSAValue | RegisterType | StringAttr | str, ...]

imm = <xdsl.irdl.operations._PropertyFieldDef object>
rd: OpResult[RInvT] = <xdsl.irdl.operations._ResultFieldDef object>
class IRsIOperation(imm1, rs, imm2, comment=None)

Bases: Q1Instruction, ABC, Generic[RInvT]

A base class for QBlox Q1 operations that have an immediate, a source register, and then another immediate.

assembly_line_args()

Instruction arguments in the order they should be printed in the assembly.

Return type:

tuple[IntegerAttr | SSAValue | RegisterType | StringAttr | str, ...]

imm1 = <xdsl.irdl.operations._PropertyFieldDef object>
imm2 = <xdsl.irdl.operations._PropertyFieldDef object>
rs = <xdsl.irdl.operations._OperandFieldDef object>
class NullaryOperation(comment=None)

Bases: Q1Instruction, ABC

A base class for QBlox Q1 operations that have neither sources nor destinations.

assembly_line_args()

Instruction arguments in the order they should be printed in the assembly.

Return type:

tuple[IntegerAttr | SSAValue | RegisterType | StringAttr | str, ...]

class Q1AsmOperation(*, operands=None, result_types=None, properties=None, attributes=None, successors=None, regions=None)

Bases: IRDLOperation, OneLineAssemblyPrintable, ABC

Base class for operations that can be assembly printed.

assembly_line()

Default assembly code generator.

Return type:

str | None

abstract assembly_line_args()

Instruction arguments in the order they should be printed in the assembly.

Return type:

tuple[IntegerAttr | SSAValue | RegisterType | StringAttr | str | None, ...]

assembly_mnemonic()

Because operation name must match q1.<format>.<mnemonic>, the instruction name (mnemonic) is extracted from the operation name to be the third field.

Return type:

str

comment = <xdsl.irdl.operations._PropertyFieldDef object>
class Q1Instruction(*, operands=None, result_types=None, properties=None, attributes=None, successors=None, regions=None)

Bases: Q1AsmOperation, Q1RegAllocOperation, ABC

Base class for operations that represent an instruction in the QBlox Q1 ISA.

These instructions have the following format:

[label:] mnemonic argument,argument,… [comment]

The name of the operation will be used as the QBlox Q1 assembly mnemonic. The comment is optional. When present, it will be printed along with the instruction.

class Q1RegAllocOperation(*, operands=None, result_types=None, properties=None, attributes=None, successors=None, regions=None)

Bases: HasRegisterConstraints, IRDLOperation, ABC

Base class for operations that can take part in register allocation.

get_register_constraints()

Default constraints are that all operands are “in”, and all results are “out” registers.

If some registers are “inout” then this function must be overridden.

Return type:

RegisterConstraints

class RdIOperation(rd, imm, comment=None)

Bases: Q1Instruction, ABC, Generic[RInvT]

A base class for QBlox Q1 operations that have one destination register followed by one immediate operand.

assembly_line_args()

Instruction arguments in the order they should be printed in the assembly.

Return type:

tuple[IntegerAttr | SSAValue | RegisterType | StringAttr | str | None, ...]

imm = <xdsl.irdl.operations._PropertyFieldDef object>
rd: OpResult[RInvT] = <xdsl.irdl.operations._ResultFieldDef object>
class RdRdOperation(rd1, rd2, comment=None)

Bases: Q1Instruction, ABC, Generic[RInvT]

A base class for QBlox Q1 operations that produce two destination registers.

assembly_line_args()

Instruction arguments in the order they should be printed in the assembly.

Return type:

tuple[IntegerAttr | SSAValue | RegisterType | StringAttr | str, ...]

rd1 = <xdsl.irdl.operations._ResultFieldDef object>
rd2 = <xdsl.irdl.operations._ResultFieldDef object>
class RdRsOperation(rd, rs, comment=None)

Bases: Q1Instruction, ABC, Generic[RInvT]

A base class for QBlox Q1 operations that have one destination register followed by one source register.

assembly_line_args()

Instruction arguments in the order they should be printed in the assembly.

Return type:

tuple[IntegerAttr | SSAValue | RegisterType | StringAttr | str, ...]

rd: OpResult[RInvT] = <xdsl.irdl.operations._ResultFieldDef object>
rs = <xdsl.irdl.operations._OperandFieldDef object>
class RsIIOperation(rs, imm1, imm2, comment=None)

Bases: Q1Instruction, ABC, Generic[RInvT]

A base class for QBlox Q1 operations that have one source register followed by two immediate operands.

assembly_line_args()

Instruction arguments in the order they should be printed in the assembly.

Return type:

tuple[IntegerAttr | SSAValue | RegisterType | StringAttr | str, ...]

imm1 = <xdsl.irdl.operations._PropertyFieldDef object>
imm2 = <xdsl.irdl.operations._PropertyFieldDef object>
rs = <xdsl.irdl.operations._OperandFieldDef object>
class RsIOperation(rs, imm, comment=None)

Bases: Q1Instruction, ABC, Generic[RInvT]

A base class for QBlox Q1 operations that have one source register followed by one immediate operand.

assembly_line_args()

Instruction arguments in the order they should be printed in the assembly.

Return type:

tuple[IntegerAttr | SSAValue | RegisterType | StringAttr | str, ...]

imm = <xdsl.irdl.operations._PropertyFieldDef object>
rs = <xdsl.irdl.operations._OperandFieldDef object>
class RsIRdOperation(rs, imm, rd, comment=None)

Bases: Q1Instruction, ABC, Generic[RInvT]

A base class for QBlox Q1 operations that have one immediate operand surrounded by a source register on the left and a destination register on the right.

assembly_line_args()

Instruction arguments in the order they should be printed in the assembly.

Return type:

tuple[IntegerAttr | SSAValue | RegisterType | StringAttr | str, ...]

imm = <xdsl.irdl.operations._PropertyFieldDef object>
rd: OpResult[RInvT] = <xdsl.irdl.operations._ResultFieldDef object>
rs = <xdsl.irdl.operations._OperandFieldDef object>
class RsIRsOperation(rs1, imm, rs2, comment=None)

Bases: Q1Instruction, ABC, Generic[RInvT]

A base class for QBlox Q1 operations that have one immediate operand surrounded by two source registers.

assembly_line_args()

Instruction arguments in the order they should be printed in the assembly.

Return type:

tuple[IntegerAttr | SSAValue | RegisterType | StringAttr | str, ...]

imm = <xdsl.irdl.operations._PropertyFieldDef object>
rs1 = <xdsl.irdl.operations._OperandFieldDef object>
rs2 = <xdsl.irdl.operations._OperandFieldDef object>
class RsOperation(rs, comment=None)

Bases: Q1Instruction, ABC, Generic[RInvT]

A base class for QBlox Q1 operations that have one source register.

assembly_line_args()

Instruction arguments in the order they should be printed in the assembly.

Return type:

tuple[IntegerAttr | SSAValue | RegisterType | StringAttr | str, ...]

rs = <xdsl.irdl.operations._OperandFieldDef object>
class RsRdOperation(rs, rd, comment=None)

Bases: Q1Instruction, ABC, Generic[RInvT]

A base class for QBlox Q1 operations that have one source register followed by one destination register.

assembly_line_args()

Instruction arguments in the order they should be printed in the assembly.

Return type:

tuple[IntegerAttr | SSAValue | RegisterType | StringAttr | str, ...]

rd: OpResult[RInvT] = <xdsl.irdl.operations._ResultFieldDef object>
rs = <xdsl.irdl.operations._OperandFieldDef object>
class RsRsOperation(rs1, rs2, comment=None)

Bases: Q1Instruction, ABC, Generic[RInvT]

A base class for QBlox Q1 operations that have two source registers.

assembly_line_args()

Instruction arguments in the order they should be printed in the assembly.

Return type:

tuple[IntegerAttr | SSAValue | RegisterType | StringAttr | str, ...]

rs1 = <xdsl.irdl.operations._OperandFieldDef object>
rs2 = <xdsl.irdl.operations._OperandFieldDef object>
class RsRsRdOperation(rs1, rs2, rd, comment=None)

Bases: Q1Instruction, ABC, Generic[RInvT]

A base class for QBlox Q1 operations that have two source registers followed by one destination register.

assembly_line_args()

Instruction arguments in the order they should be printed in the assembly.

Return type:

tuple[IntegerAttr | SSAValue | RegisterType | StringAttr | str, ...]

rd: OpResult[RInvT] = <xdsl.irdl.operations._ResultFieldDef object>
rs1 = <xdsl.irdl.operations._OperandFieldDef object>
rs2 = <xdsl.irdl.operations._OperandFieldDef object>
class RsRsRsIOperation(rs1, rs2, rs3, imm, comment=None)

Bases: Q1Instruction, ABC, Generic[RInvT]

A base class for QBlox Q1 operations that have three source registers followed by one immediate operand.

assembly_line_args()

Instruction arguments in the order they should be printed in the assembly.

Return type:

tuple[IntegerAttr | SSAValue | RegisterType | StringAttr | str, ...]

imm = <xdsl.irdl.operations._PropertyFieldDef object>
rs1 = <xdsl.irdl.operations._OperandFieldDef object>
rs2 = <xdsl.irdl.operations._OperandFieldDef object>
rs3 = <xdsl.irdl.operations._OperandFieldDef object>