Skip to content

Ops

ops

The x86 dialect contains operations that represent x86 assembly operations.

In x86, the assembly operations may have different meaning depending on the types of arguments. For example, the mov instruction can assign an immediate value to a register, or move the contents of another register. In order to disambiguate the two, we use a mnemonic in the operation name to communicate which operands are expected, for example x86.ds.mov is the version that moves the contents of one register to another, and x86.di.mov is the version that sets the immediate value passed in to the register. The mnemonic encodes the types of the assembly instruction arguments, in order.

Here are the possible mnemonic values and what they stand for:

  • s: Source register
  • d: Destination register
  • k: Mask register
  • r: Register used both as a source and destination
  • i: Immediate value
  • m: Memory
  • c: Condition

This dialect is structured into abstract base classes, which are prefixed with the mnemonic that corresponds to the subclassing operations (e.g. DS_Operation).

R1InvT = TypeVar('R1InvT', bound=X86RegisterType) module-attribute

R2InvT = TypeVar('R2InvT', bound=X86RegisterType) module-attribute

R3InvT = TypeVar('R3InvT', bound=X86RegisterType) module-attribute

R4InvT = TypeVar('R4InvT', bound=X86RegisterType) module-attribute

X86AsmOperation dataclass

Bases: IRDLOperation, OneLineAssemblyPrintable, ABC

Base class for operations that can be a part of x86 assembly printing.

Source code in xdsl/dialects/x86/ops.py
125
126
127
128
class X86AsmOperation(IRDLOperation, OneLineAssemblyPrintable, ABC):
    """
    Base class for operations that can be a part of x86 assembly printing.
    """

X86RegallocOperation dataclass

Bases: IRDLOperation, HasRegisterConstraints, ABC

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

Source code in xdsl/dialects/x86/ops.py
131
132
133
134
135
136
137
138
139
140
141
142
class X86RegallocOperation(IRDLOperation, HasRegisterConstraints, ABC):
    """
    Base class for operations that can take part in register allocation.
    """

    traits = traits_def(RegisterAllocatedMemoryEffect())

    def get_register_constraints(self) -> RegisterConstraints:
        # The default register 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 RegisterConstraints(self.operands, self.results, ())

traits = traits_def(RegisterAllocatedMemoryEffect()) class-attribute instance-attribute

get_register_constraints() -> RegisterConstraints

Source code in xdsl/dialects/x86/ops.py
138
139
140
141
142
def get_register_constraints(self) -> RegisterConstraints:
    # The default register 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 RegisterConstraints(self.operands, self.results, ())

X86CustomFormatOperation dataclass

Bases: IRDLOperation, ABC

Source code in xdsl/dialects/x86/ops.py
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
class X86CustomFormatOperation(IRDLOperation, ABC):
    @classmethod
    def parse(cls, parser: Parser) -> Self:
        args = cls.parse_unresolved_operands(parser)
        custom_attributes = cls.custom_parse_attributes(parser)
        remaining_attributes = parser.parse_optional_attr_dict()
        # TODO ensure distinct keys for attributes
        attributes = custom_attributes | remaining_attributes
        regions = parser.parse_region_list()
        pos = parser.pos
        operand_types, result_types = cls.parse_op_type(parser)
        operands = parser.resolve_operands(args, operand_types, pos)
        return cls.build(
            operands=operands,
            result_types=result_types,
            attributes=attributes,
            regions=regions,
        )

    @classmethod
    def parse_optional_memory_access_offset(
        cls, parser: Parser, integer_type: IntegerType = i64
    ) -> Attribute | None:
        return parse_optional_immediate_value(
            parser,
            integer_type,
        )

    @classmethod
    def parse_unresolved_operands(cls, parser: Parser) -> list[UnresolvedOperand]:
        """
        Parse a list of comma separated unresolved operands.
        Notice that this method will consume trailing comma.
        """
        if operand := parser.parse_optional_unresolved_operand():
            operands = [operand]
            while parser.parse_optional_punctuation(",") and (
                operand := parser.parse_optional_unresolved_operand()
            ):
                operands.append(operand)
            return operands
        return []

    @classmethod
    def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
        """
        Parse attributes with custom syntax. Subclasses may override this method.
        """
        return parser.parse_optional_attr_dict()

    @classmethod
    def parse_op_type(
        cls, parser: Parser
    ) -> tuple[Sequence[Attribute], Sequence[Attribute]]:
        parser.parse_punctuation(":")
        func_type = parser.parse_function_type()
        return func_type.inputs.data, func_type.outputs.data

    def print(self, printer: Printer) -> None:
        if self.operands:
            printer.print_string(" ")
            printer.print_list(self.operands, printer.print_operand)
        printed_attributes = self.custom_print_attributes(printer)
        unprinted_attributes = {
            name: attr
            for name, attr in self.attributes.items()
            if name not in printed_attributes
        }
        printer.print_op_attributes(unprinted_attributes)
        printer.print_regions(self.regions)
        self.print_op_type(printer)

    def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
        """
        Print attributes with custom syntax. Return the names of the attributes printed. Subclasses may override this method.
        """
        printer.print_op_attributes(self.attributes)
        return self.attributes.keys()

    def print_op_type(self, printer: Printer) -> None:
        printer.print_string(" : ")
        printer.print_operation_type(self)

parse(parser: Parser) -> Self classmethod

Source code in xdsl/dialects/x86/ops.py
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
@classmethod
def parse(cls, parser: Parser) -> Self:
    args = cls.parse_unresolved_operands(parser)
    custom_attributes = cls.custom_parse_attributes(parser)
    remaining_attributes = parser.parse_optional_attr_dict()
    # TODO ensure distinct keys for attributes
    attributes = custom_attributes | remaining_attributes
    regions = parser.parse_region_list()
    pos = parser.pos
    operand_types, result_types = cls.parse_op_type(parser)
    operands = parser.resolve_operands(args, operand_types, pos)
    return cls.build(
        operands=operands,
        result_types=result_types,
        attributes=attributes,
        regions=regions,
    )

parse_optional_memory_access_offset(parser: Parser, integer_type: IntegerType = i64) -> Attribute | None classmethod

Source code in xdsl/dialects/x86/ops.py
164
165
166
167
168
169
170
171
@classmethod
def parse_optional_memory_access_offset(
    cls, parser: Parser, integer_type: IntegerType = i64
) -> Attribute | None:
    return parse_optional_immediate_value(
        parser,
        integer_type,
    )

parse_unresolved_operands(parser: Parser) -> list[UnresolvedOperand] classmethod

Parse a list of comma separated unresolved operands. Notice that this method will consume trailing comma.

Source code in xdsl/dialects/x86/ops.py
173
174
175
176
177
178
179
180
181
182
183
184
185
186
@classmethod
def parse_unresolved_operands(cls, parser: Parser) -> list[UnresolvedOperand]:
    """
    Parse a list of comma separated unresolved operands.
    Notice that this method will consume trailing comma.
    """
    if operand := parser.parse_optional_unresolved_operand():
        operands = [operand]
        while parser.parse_optional_punctuation(",") and (
            operand := parser.parse_optional_unresolved_operand()
        ):
            operands.append(operand)
        return operands
    return []

custom_parse_attributes(parser: Parser) -> dict[str, Attribute] classmethod

Parse attributes with custom syntax. Subclasses may override this method.

Source code in xdsl/dialects/x86/ops.py
188
189
190
191
192
193
@classmethod
def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
    """
    Parse attributes with custom syntax. Subclasses may override this method.
    """
    return parser.parse_optional_attr_dict()

parse_op_type(parser: Parser) -> tuple[Sequence[Attribute], Sequence[Attribute]] classmethod

Source code in xdsl/dialects/x86/ops.py
195
196
197
198
199
200
201
@classmethod
def parse_op_type(
    cls, parser: Parser
) -> tuple[Sequence[Attribute], Sequence[Attribute]]:
    parser.parse_punctuation(":")
    func_type = parser.parse_function_type()
    return func_type.inputs.data, func_type.outputs.data

print(printer: Printer) -> None

Source code in xdsl/dialects/x86/ops.py
203
204
205
206
207
208
209
210
211
212
213
214
215
def print(self, printer: Printer) -> None:
    if self.operands:
        printer.print_string(" ")
        printer.print_list(self.operands, printer.print_operand)
    printed_attributes = self.custom_print_attributes(printer)
    unprinted_attributes = {
        name: attr
        for name, attr in self.attributes.items()
        if name not in printed_attributes
    }
    printer.print_op_attributes(unprinted_attributes)
    printer.print_regions(self.regions)
    self.print_op_type(printer)

custom_print_attributes(printer: Printer) -> AbstractSet[str]

Print attributes with custom syntax. Return the names of the attributes printed. Subclasses may override this method.

Source code in xdsl/dialects/x86/ops.py
217
218
219
220
221
222
def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
    """
    Print attributes with custom syntax. Return the names of the attributes printed. Subclasses may override this method.
    """
    printer.print_op_attributes(self.attributes)
    return self.attributes.keys()

print_op_type(printer: Printer) -> None

Source code in xdsl/dialects/x86/ops.py
224
225
226
def print_op_type(self, printer: Printer) -> None:
    printer.print_string(" : ")
    printer.print_operation_type(self)

X86Instruction dataclass

Bases: X86AsmOperation, X86RegallocOperation

Base class for operations that can be a part of x86 assembly printing. Must represent an instruction in the x86 instruction set. The name of the operation will be used as the x86 assembly instruction name.

Source code in xdsl/dialects/x86/ops.py
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
class X86Instruction(X86AsmOperation, X86RegallocOperation):
    """
    Base class for operations that can be a part of x86 assembly printing. Must
    represent an instruction in the x86 instruction set.
    The name of the operation will be used as the x86 assembly instruction name.
    """

    comment = opt_attr_def(StringAttr)
    """
    An optional comment that will be printed along with the instruction.
    """

    @abstractmethod
    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        """
        The arguments to the instruction, in the order they should be printed in the
        assembly.
        """
        raise NotImplementedError()

    def assembly_instruction_name(self) -> str:
        """
        By default, the name of the instruction is the same as the name of the operation.
        """

        return self.name.split(".")[-1]

    def assembly_line(self) -> str | None:
        # default assembly code generator
        instruction_name = self.assembly_instruction_name()
        arg_str = ", ".join(
            assembly_arg_str(arg)
            for arg in self.assembly_line_args()
            if arg is not None
        )
        return AssemblyPrinter.assembly_line(instruction_name, arg_str, self.comment)

comment = opt_attr_def(StringAttr) class-attribute instance-attribute

An optional comment that will be printed along with the instruction.

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...] abstractmethod

The arguments to the instruction, in the order they should be printed in the assembly.

Source code in xdsl/dialects/x86/ops.py
241
242
243
244
245
246
247
@abstractmethod
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    """
    The arguments to the instruction, in the order they should be printed in the
    assembly.
    """
    raise NotImplementedError()

assembly_instruction_name() -> str

By default, the name of the instruction is the same as the name of the operation.

Source code in xdsl/dialects/x86/ops.py
249
250
251
252
253
254
def assembly_instruction_name(self) -> str:
    """
    By default, the name of the instruction is the same as the name of the operation.
    """

    return self.name.split(".")[-1]

assembly_line() -> str | None

Source code in xdsl/dialects/x86/ops.py
256
257
258
259
260
261
262
263
264
def assembly_line(self) -> str | None:
    # default assembly code generator
    instruction_name = self.assembly_instruction_name()
    arg_str = ", ".join(
        assembly_arg_str(arg)
        for arg in self.assembly_line_args()
        if arg is not None
    )
    return AssemblyPrinter.assembly_line(instruction_name, arg_str, self.comment)

RS_Operation

Bases: X86Instruction, ABC, Generic[R1InvT, R2InvT]

A base class for x86 operations that have one register that is read and written to, and one source register.

Source code in xdsl/dialects/x86/ops.py
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
class RS_Operation(X86Instruction, ABC, Generic[R1InvT, R2InvT]):
    """
    A base class for x86 operations that have one register that is read and written to,
    and one source register.
    """

    register_in = operand_def(R1InvT)
    register_out = result_def(R1InvT)

    source = operand_def(R2InvT)

    assembly_format = (
        "$register_in `,` $source attr-dict `:` "
        "`(` type($register_in) `,` type($source) `)` `->` type($register_out)"
    )

    def __init__(
        self,
        register_in: Operation | SSAValue,
        source: Operation | SSAValue,
        *,
        comment: str | StringAttr | None = None,
        register_out: R1InvT | None = None,
    ):
        if isinstance(comment, str):
            comment = StringAttr(comment)
        register_in = SSAValue.get(register_in)
        if register_out is None:
            register_out = cast(R1InvT, register_in.type)

        super().__init__(
            operands=[register_in, source],
            attributes={
                "comment": comment,
            },
            result_types=[register_out],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        return self.register_in, self.source

    def get_register_constraints(self) -> RegisterConstraints:
        return RegisterConstraints(
            (self.source,), (), ((self.register_in, self.register_out),)
        )

register_in = operand_def(R1InvT) class-attribute instance-attribute

register_out = result_def(R1InvT) class-attribute instance-attribute

source = operand_def(R2InvT) class-attribute instance-attribute

assembly_format = '$register_in `,` $source attr-dict `:` `(` type($register_in) `,` type($source) `)` `->` type($register_out)' class-attribute instance-attribute

__init__(register_in: Operation | SSAValue, source: Operation | SSAValue, *, comment: str | StringAttr | None = None, register_out: R1InvT | None = None)

Source code in xdsl/dialects/x86/ops.py
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
def __init__(
    self,
    register_in: Operation | SSAValue,
    source: Operation | SSAValue,
    *,
    comment: str | StringAttr | None = None,
    register_out: R1InvT | None = None,
):
    if isinstance(comment, str):
        comment = StringAttr(comment)
    register_in = SSAValue.get(register_in)
    if register_out is None:
        register_out = cast(R1InvT, register_in.type)

    super().__init__(
        operands=[register_in, source],
        attributes={
            "comment": comment,
        },
        result_types=[register_out],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
308
309
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    return self.register_in, self.source

get_register_constraints() -> RegisterConstraints

Source code in xdsl/dialects/x86/ops.py
311
312
313
314
def get_register_constraints(self) -> RegisterConstraints:
    return RegisterConstraints(
        (self.source,), (), ((self.register_in, self.register_out),)
    )

DS_Operation

Bases: X86Instruction, ABC, Generic[R1InvT, R2InvT]

A base class for x86 operations that have one destination register and one source register.

Source code in xdsl/dialects/x86/ops.py
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
class DS_Operation(X86Instruction, ABC, Generic[R1InvT, R2InvT]):
    """
    A base class for x86 operations that have one destination register and one source
    register.
    """

    destination: OpResult[R1InvT] = result_def(R1InvT)
    source = operand_def(R2InvT)

    assembly_format = (
        "$source attr-dict `:` `(` type($source) `)` `->` type($destination)"
    )

    def __init__(
        self,
        source: Operation | SSAValue,
        *,
        comment: str | StringAttr | None = None,
        destination: R1InvT,
    ):
        if isinstance(comment, str):
            comment = StringAttr(comment)

        super().__init__(
            operands=[source],
            attributes={
                "comment": comment,
            },
            result_types=[destination],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        return (self.destination, self.source)

destination: OpResult[R1InvT] = result_def(R1InvT) class-attribute instance-attribute

source = operand_def(R2InvT) class-attribute instance-attribute

assembly_format = '$source attr-dict `:` `(` type($source) `)` `->` type($destination)' class-attribute instance-attribute

__init__(source: Operation | SSAValue, *, comment: str | StringAttr | None = None, destination: R1InvT)

Source code in xdsl/dialects/x86/ops.py
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
def __init__(
    self,
    source: Operation | SSAValue,
    *,
    comment: str | StringAttr | None = None,
    destination: R1InvT,
):
    if isinstance(comment, str):
        comment = StringAttr(comment)

    super().__init__(
        operands=[source],
        attributes={
            "comment": comment,
        },
        result_types=[destination],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
348
349
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    return (self.destination, self.source)

DSK_Operation

Bases: X86Instruction, ABC

A base class for x86 operations that have one destination register and one source register.

Source code in xdsl/dialects/x86/ops.py
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
class DSK_Operation(X86Instruction, ABC):
    """
    A base class for x86 operations that have one destination register and one source
    register.
    """

    destination: OpResult[AVX512RegisterType] = result_def(AVX512RegisterType)
    source = operand_def(AVX512RegisterType)
    mask_reg = operand_def(AVX512MaskRegisterType)
    z = opt_attr_def(UnitAttr)

    assembly_format = (
        "$source `,` $mask_reg attr-dict `:` "
        "`(` type($source) `,` type($mask_reg) `)` `->` type($destination)"
    )

    def __init__(
        self,
        source: Operation | SSAValue,
        mask_reg: Operation | SSAValue,
        *,
        z: bool = False,
        comment: str | StringAttr | None = None,
        destination: AVX512RegisterType,
    ):
        if isinstance(comment, str):
            comment = StringAttr(comment)

        super().__init__(
            operands=[source, mask_reg],
            attributes={
                "z": UnitAttr() if z else None,
                "comment": comment,
            },
            result_types=[destination],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        register_out = masked_source_str(self.destination, self.mask_reg, self.z)
        return register_out, self.source

destination: OpResult[AVX512RegisterType] = result_def(AVX512RegisterType) class-attribute instance-attribute

source = operand_def(AVX512RegisterType) class-attribute instance-attribute

mask_reg = operand_def(AVX512MaskRegisterType) class-attribute instance-attribute

z = opt_attr_def(UnitAttr) class-attribute instance-attribute

assembly_format = '$source `,` $mask_reg attr-dict `:` `(` type($source) `,` type($mask_reg) `)` `->` type($destination)' class-attribute instance-attribute

__init__(source: Operation | SSAValue, mask_reg: Operation | SSAValue, *, z: bool = False, comment: str | StringAttr | None = None, destination: AVX512RegisterType)

Source code in xdsl/dialects/x86/ops.py
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
def __init__(
    self,
    source: Operation | SSAValue,
    mask_reg: Operation | SSAValue,
    *,
    z: bool = False,
    comment: str | StringAttr | None = None,
    destination: AVX512RegisterType,
):
    if isinstance(comment, str):
        comment = StringAttr(comment)

    super().__init__(
        operands=[source, mask_reg],
        attributes={
            "z": UnitAttr() if z else None,
            "comment": comment,
        },
        result_types=[destination],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
389
390
391
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    register_out = masked_source_str(self.destination, self.mask_reg, self.z)
    return register_out, self.source

R_Operation

Bases: X86Instruction, ABC, Generic[R1InvT]

A base class for x86 operations that have one register that is read and written to.

Source code in xdsl/dialects/x86/ops.py
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
class R_Operation(X86Instruction, ABC, Generic[R1InvT]):
    """
    A base class for x86 operations that have one register that is read and written to.
    """

    register_in = operand_def(R1InvT)
    register_out = result_def(R1InvT)

    assembly_format = (
        "$register_in attr-dict `:` `(` type($register_in) `)` `->` type($register_out)"
    )

    def __init__(
        self,
        register_in: SSAValue[R1InvT],
        *,
        comment: str | StringAttr | None = None,
        register_out: R1InvT | None = None,
    ):
        if isinstance(comment, str):
            comment = StringAttr(comment)
        if register_out is None:
            register_out = register_in.type
        super().__init__(
            operands=[register_in],
            attributes={
                "comment": comment,
            },
            result_types=[register_out],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        return (self.register_in,)

    def get_register_constraints(self) -> RegisterConstraints:
        return RegisterConstraints((), (), ((self.register_in, self.register_out),))

register_in = operand_def(R1InvT) class-attribute instance-attribute

register_out = result_def(R1InvT) class-attribute instance-attribute

assembly_format = '$register_in attr-dict `:` `(` type($register_in) `)` `->` type($register_out)' class-attribute instance-attribute

__init__(register_in: SSAValue[R1InvT], *, comment: str | StringAttr | None = None, register_out: R1InvT | None = None)

Source code in xdsl/dialects/x86/ops.py
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
def __init__(
    self,
    register_in: SSAValue[R1InvT],
    *,
    comment: str | StringAttr | None = None,
    register_out: R1InvT | None = None,
):
    if isinstance(comment, str):
        comment = StringAttr(comment)
    if register_out is None:
        register_out = register_in.type
    super().__init__(
        operands=[register_in],
        attributes={
            "comment": comment,
        },
        result_types=[register_out],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
425
426
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    return (self.register_in,)

get_register_constraints() -> RegisterConstraints

Source code in xdsl/dialects/x86/ops.py
428
429
def get_register_constraints(self) -> RegisterConstraints:
    return RegisterConstraints((), (), ((self.register_in, self.register_out),))

RM_Operation

Bases: X86Instruction, X86CustomFormatOperation, ABC, Generic[R1InvT, R2InvT]

A base class for x86 operations that have one register read and written to and one memory access with an optional offset.

Source code in xdsl/dialects/x86/ops.py
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
class RM_Operation(
    X86Instruction, X86CustomFormatOperation, ABC, Generic[R1InvT, R2InvT]
):
    """
    A base class for x86 operations that have one register read and written to and one
    memory access with an optional offset.
    """

    register_in = operand_def(R1InvT)
    register_out = result_def(R1InvT)

    memory = operand_def(R2InvT)
    memory_offset = attr_def(IntegerAttr, default_value=IntegerAttr(0, 64))

    traits = traits_def(MemoryReadEffect())

    def __init__(
        self,
        register_in: Operation | SSAValue,
        memory: Operation | SSAValue,
        memory_offset: int | IntegerAttr,
        *,
        comment: str | StringAttr | None = None,
        register_out: R1InvT | None = None,
    ):
        if isinstance(memory_offset, int):
            memory_offset = IntegerAttr(memory_offset, 64)
        if isinstance(comment, str):
            comment = StringAttr(comment)
        register_in = SSAValue.get(register_in)
        if register_out is None:
            register_out = cast(R1InvT, register_in.type)

        super().__init__(
            operands=[register_in, memory],
            attributes={
                "memory_offset": memory_offset,
                "comment": comment,
            },
            result_types=[register_out],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        memory_access = memory_access_str(self.memory, self.memory_offset)
        destination = assembly_arg_str(self.register_in)
        return (destination, memory_access)

    @classmethod
    def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
        attributes = dict[str, Attribute]()
        if offset := cls.parse_optional_memory_access_offset(parser):
            attributes["memory_offset"] = offset
        return attributes

    def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
        printer.print_string(", ")
        print_immediate_value(printer, self.memory_offset)
        return {"memory_offset"}

    def get_register_constraints(self) -> RegisterConstraints:
        return RegisterConstraints(
            (self.memory,), (), ((self.register_in, self.register_out),)
        )

register_in = operand_def(R1InvT) class-attribute instance-attribute

register_out = result_def(R1InvT) class-attribute instance-attribute

memory = operand_def(R2InvT) class-attribute instance-attribute

memory_offset = attr_def(IntegerAttr, default_value=(IntegerAttr(0, 64))) class-attribute instance-attribute

traits = traits_def(MemoryReadEffect()) class-attribute instance-attribute

__init__(register_in: Operation | SSAValue, memory: Operation | SSAValue, memory_offset: int | IntegerAttr, *, comment: str | StringAttr | None = None, register_out: R1InvT | None = None)

Source code in xdsl/dialects/x86/ops.py
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
def __init__(
    self,
    register_in: Operation | SSAValue,
    memory: Operation | SSAValue,
    memory_offset: int | IntegerAttr,
    *,
    comment: str | StringAttr | None = None,
    register_out: R1InvT | None = None,
):
    if isinstance(memory_offset, int):
        memory_offset = IntegerAttr(memory_offset, 64)
    if isinstance(comment, str):
        comment = StringAttr(comment)
    register_in = SSAValue.get(register_in)
    if register_out is None:
        register_out = cast(R1InvT, register_in.type)

    super().__init__(
        operands=[register_in, memory],
        attributes={
            "memory_offset": memory_offset,
            "comment": comment,
        },
        result_types=[register_out],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
474
475
476
477
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    memory_access = memory_access_str(self.memory, self.memory_offset)
    destination = assembly_arg_str(self.register_in)
    return (destination, memory_access)

custom_parse_attributes(parser: Parser) -> dict[str, Attribute] classmethod

Source code in xdsl/dialects/x86/ops.py
479
480
481
482
483
484
@classmethod
def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
    attributes = dict[str, Attribute]()
    if offset := cls.parse_optional_memory_access_offset(parser):
        attributes["memory_offset"] = offset
    return attributes

custom_print_attributes(printer: Printer) -> AbstractSet[str]

Source code in xdsl/dialects/x86/ops.py
486
487
488
489
def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
    printer.print_string(", ")
    print_immediate_value(printer, self.memory_offset)
    return {"memory_offset"}

get_register_constraints() -> RegisterConstraints

Source code in xdsl/dialects/x86/ops.py
491
492
493
494
def get_register_constraints(self) -> RegisterConstraints:
    return RegisterConstraints(
        (self.memory,), (), ((self.register_in, self.register_out),)
    )

DM_OperationHasCanonicalizationPatterns dataclass

Bases: HasCanonicalizationPatternsTrait

Source code in xdsl/dialects/x86/ops.py
497
498
499
500
501
502
503
504
class DM_OperationHasCanonicalizationPatterns(HasCanonicalizationPatternsTrait):
    @classmethod
    def get_canonicalization_patterns(cls) -> tuple[RewritePattern, ...]:
        from xdsl.transforms.canonicalization_patterns.x86 import (
            DM_Operation_ConstantOffset,
        )

        return (DM_Operation_ConstantOffset(),)

get_canonicalization_patterns() -> tuple[RewritePattern, ...] classmethod

Source code in xdsl/dialects/x86/ops.py
498
499
500
501
502
503
504
@classmethod
def get_canonicalization_patterns(cls) -> tuple[RewritePattern, ...]:
    from xdsl.transforms.canonicalization_patterns.x86 import (
        DM_Operation_ConstantOffset,
    )

    return (DM_Operation_ConstantOffset(),)

DM_Operation

Bases: X86Instruction, X86CustomFormatOperation, ABC, Generic[R1InvT, R2InvT]

A base class for x86 operations that load from memory into a destination register.

Source code in xdsl/dialects/x86/ops.py
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
class DM_Operation(
    X86Instruction, X86CustomFormatOperation, ABC, Generic[R1InvT, R2InvT]
):
    """
    A base class for x86 operations that load from memory into a destination register.
    """

    destination = result_def(R1InvT)
    memory = operand_def(R2InvT)
    memory_offset = attr_def(IntegerAttr, default_value=IntegerAttr(0, 64))

    traits = traits_def(
        DM_OperationHasCanonicalizationPatterns(),
        MemoryReadEffect(),
    )

    def __init__(
        self,
        memory: Operation | SSAValue,
        memory_offset: int | IntegerAttr,
        *,
        comment: str | StringAttr | None = None,
        destination: R1InvT,
    ):
        if isinstance(memory_offset, int):
            memory_offset = IntegerAttr(memory_offset, 64)
        if isinstance(comment, str):
            comment = StringAttr(comment)
        super().__init__(
            operands=[memory],
            attributes={
                "memory_offset": memory_offset,
                "comment": comment,
            },
            result_types=[destination],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        memory_access = memory_access_str(self.memory, self.memory_offset)
        destination = assembly_arg_str(self.destination)
        return (destination, memory_access)

    @classmethod
    def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
        attributes = dict[str, Attribute]()
        if offset := cls.parse_optional_memory_access_offset(parser):
            attributes["memory_offset"] = offset
        return attributes

    def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
        printer.print_string(", ")
        print_immediate_value(printer, self.memory_offset)
        return {"memory_offset"}

destination = result_def(R1InvT) class-attribute instance-attribute

memory = operand_def(R2InvT) class-attribute instance-attribute

memory_offset = attr_def(IntegerAttr, default_value=(IntegerAttr(0, 64))) class-attribute instance-attribute

traits = traits_def(DM_OperationHasCanonicalizationPatterns(), MemoryReadEffect()) class-attribute instance-attribute

__init__(memory: Operation | SSAValue, memory_offset: int | IntegerAttr, *, comment: str | StringAttr | None = None, destination: R1InvT)

Source code in xdsl/dialects/x86/ops.py
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
def __init__(
    self,
    memory: Operation | SSAValue,
    memory_offset: int | IntegerAttr,
    *,
    comment: str | StringAttr | None = None,
    destination: R1InvT,
):
    if isinstance(memory_offset, int):
        memory_offset = IntegerAttr(memory_offset, 64)
    if isinstance(comment, str):
        comment = StringAttr(comment)
    super().__init__(
        operands=[memory],
        attributes={
            "memory_offset": memory_offset,
            "comment": comment,
        },
        result_types=[destination],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
544
545
546
547
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    memory_access = memory_access_str(self.memory, self.memory_offset)
    destination = assembly_arg_str(self.destination)
    return (destination, memory_access)

custom_parse_attributes(parser: Parser) -> dict[str, Attribute] classmethod

Source code in xdsl/dialects/x86/ops.py
549
550
551
552
553
554
@classmethod
def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
    attributes = dict[str, Attribute]()
    if offset := cls.parse_optional_memory_access_offset(parser):
        attributes["memory_offset"] = offset
    return attributes

custom_print_attributes(printer: Printer) -> AbstractSet[str]

Source code in xdsl/dialects/x86/ops.py
556
557
558
559
def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
    printer.print_string(", ")
    print_immediate_value(printer, self.memory_offset)
    return {"memory_offset"}

DI_Operation

Bases: X86Instruction, X86CustomFormatOperation, ABC, Generic[R1InvT]

A base class for x86 operations that have one destination register and an immediate value.

Source code in xdsl/dialects/x86/ops.py
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
class DI_Operation(X86Instruction, X86CustomFormatOperation, ABC, Generic[R1InvT]):
    """
    A base class for x86 operations that have one destination register and an immediate
    value.
    """

    immediate = attr_def(IntegerAttr)
    destination = result_def(R1InvT)

    def __init__(
        self,
        immediate: int | IntegerAttr,
        *,
        comment: str | StringAttr | None = None,
        destination: R1InvT,
    ):
        if isinstance(immediate, int):
            immediate = IntegerAttr(
                immediate, 32
            )  # the default immediate size is 32 bits
        if isinstance(comment, str):
            comment = StringAttr(comment)

        super().__init__(
            attributes={
                "immediate": immediate,
                "comment": comment,
            },
            result_types=[destination],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        return self.destination, self.immediate

    @classmethod
    def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
        return {
            "immediate": parse_immediate_value(
                parser, IntegerType(32, Signedness.SIGNED)
            )
        }

    def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
        printer.print_string(" ", indent=0)
        print_immediate_value(printer, self.immediate)
        return {"immediate"}

immediate = attr_def(IntegerAttr) class-attribute instance-attribute

destination = result_def(R1InvT) class-attribute instance-attribute

__init__(immediate: int | IntegerAttr, *, comment: str | StringAttr | None = None, destination: R1InvT)

Source code in xdsl/dialects/x86/ops.py
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
def __init__(
    self,
    immediate: int | IntegerAttr,
    *,
    comment: str | StringAttr | None = None,
    destination: R1InvT,
):
    if isinstance(immediate, int):
        immediate = IntegerAttr(
            immediate, 32
        )  # the default immediate size is 32 bits
    if isinstance(comment, str):
        comment = StringAttr(comment)

    super().__init__(
        attributes={
            "immediate": immediate,
            "comment": comment,
        },
        result_types=[destination],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
593
594
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    return self.destination, self.immediate

custom_parse_attributes(parser: Parser) -> dict[str, Attribute] classmethod

Source code in xdsl/dialects/x86/ops.py
596
597
598
599
600
601
602
@classmethod
def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
    return {
        "immediate": parse_immediate_value(
            parser, IntegerType(32, Signedness.SIGNED)
        )
    }

custom_print_attributes(printer: Printer) -> AbstractSet[str]

Source code in xdsl/dialects/x86/ops.py
604
605
606
607
def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
    printer.print_string(" ", indent=0)
    print_immediate_value(printer, self.immediate)
    return {"immediate"}

RI_Operation

Bases: X86Instruction, X86CustomFormatOperation, ABC, Generic[R1InvT]

A base class for x86 operations that have one register that is read and written to and an immediate value.

Source code in xdsl/dialects/x86/ops.py
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
class RI_Operation(X86Instruction, X86CustomFormatOperation, ABC, Generic[R1InvT]):
    """
    A base class for x86 operations that have one register that is read and written to
    and an immediate value.
    """

    register_in = operand_def(R1InvT)
    register_out = result_def(R1InvT)

    immediate = attr_def(IntegerAttr)

    def __init__(
        self,
        register_in: Operation | SSAValue,
        immediate: int | IntegerAttr,
        *,
        comment: str | StringAttr | None = None,
        register_out: R1InvT | None = None,
    ):
        if isinstance(immediate, int):
            immediate = IntegerAttr(
                immediate, 32
            )  # the default immediate size is 32 bits
        if isinstance(comment, str):
            comment = StringAttr(comment)
        register_in = SSAValue.get(register_in)
        if register_out is None:
            register_out = cast(R1InvT, register_in.type)

        super().__init__(
            operands=[register_in],
            attributes={
                "immediate": immediate,
                "comment": comment,
            },
            result_types=[register_out],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        return self.register_in, self.immediate

    @classmethod
    def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
        attributes = dict[str, Attribute]()
        temp = parse_optional_immediate_value(
            parser, IntegerType(32, Signedness.SIGNED)
        )
        if temp is not None:
            attributes["immediate"] = temp
        return attributes

    def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
        printer.print_string(", ")
        print_immediate_value(printer, self.immediate)
        return {"immediate"}

    def get_register_constraints(self) -> RegisterConstraints:
        return RegisterConstraints((), (), ((self.register_in, self.register_out),))

register_in = operand_def(R1InvT) class-attribute instance-attribute

register_out = result_def(R1InvT) class-attribute instance-attribute

immediate = attr_def(IntegerAttr) class-attribute instance-attribute

__init__(register_in: Operation | SSAValue, immediate: int | IntegerAttr, *, comment: str | StringAttr | None = None, register_out: R1InvT | None = None)

Source code in xdsl/dialects/x86/ops.py
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
def __init__(
    self,
    register_in: Operation | SSAValue,
    immediate: int | IntegerAttr,
    *,
    comment: str | StringAttr | None = None,
    register_out: R1InvT | None = None,
):
    if isinstance(immediate, int):
        immediate = IntegerAttr(
            immediate, 32
        )  # the default immediate size is 32 bits
    if isinstance(comment, str):
        comment = StringAttr(comment)
    register_in = SSAValue.get(register_in)
    if register_out is None:
        register_out = cast(R1InvT, register_in.type)

    super().__init__(
        operands=[register_in],
        attributes={
            "immediate": immediate,
            "comment": comment,
        },
        result_types=[register_out],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
648
649
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    return self.register_in, self.immediate

custom_parse_attributes(parser: Parser) -> dict[str, Attribute] classmethod

Source code in xdsl/dialects/x86/ops.py
651
652
653
654
655
656
657
658
659
@classmethod
def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
    attributes = dict[str, Attribute]()
    temp = parse_optional_immediate_value(
        parser, IntegerType(32, Signedness.SIGNED)
    )
    if temp is not None:
        attributes["immediate"] = temp
    return attributes

custom_print_attributes(printer: Printer) -> AbstractSet[str]

Source code in xdsl/dialects/x86/ops.py
661
662
663
664
def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
    printer.print_string(", ")
    print_immediate_value(printer, self.immediate)
    return {"immediate"}

get_register_constraints() -> RegisterConstraints

Source code in xdsl/dialects/x86/ops.py
666
667
def get_register_constraints(self) -> RegisterConstraints:
    return RegisterConstraints((), (), ((self.register_in, self.register_out),))

MS_OperationHasCanonicalizationPatterns dataclass

Bases: HasCanonicalizationPatternsTrait

Source code in xdsl/dialects/x86/ops.py
670
671
672
673
674
675
676
677
class MS_OperationHasCanonicalizationPatterns(HasCanonicalizationPatternsTrait):
    @classmethod
    def get_canonicalization_patterns(cls) -> tuple[RewritePattern, ...]:
        from xdsl.transforms.canonicalization_patterns.x86 import (
            MS_Operation_ConstantOffset,
        )

        return (MS_Operation_ConstantOffset(),)

get_canonicalization_patterns() -> tuple[RewritePattern, ...] classmethod

Source code in xdsl/dialects/x86/ops.py
671
672
673
674
675
676
677
@classmethod
def get_canonicalization_patterns(cls) -> tuple[RewritePattern, ...]:
    from xdsl.transforms.canonicalization_patterns.x86 import (
        MS_Operation_ConstantOffset,
    )

    return (MS_Operation_ConstantOffset(),)

MS_Operation

Bases: X86Instruction, X86CustomFormatOperation, ABC, Generic[R1InvT, R2InvT]

A base class for x86 operations that have one memory reference and one source register.

Source code in xdsl/dialects/x86/ops.py
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
class MS_Operation(
    X86Instruction, X86CustomFormatOperation, ABC, Generic[R1InvT, R2InvT]
):
    """
    A base class for x86 operations that have one memory reference and one source
    register.
    """

    memory = operand_def(R1InvT)
    memory_offset = attr_def(IntegerAttr, default_value=IntegerAttr(0, 64))
    source = operand_def(R2InvT)

    traits = traits_def(
        MS_OperationHasCanonicalizationPatterns(),
        MemoryReadEffect(),
        MemoryWriteEffect(),
    )

    def __init__(
        self,
        memory: Operation | SSAValue,
        source: Operation | SSAValue,
        memory_offset: int | IntegerAttr,
        *,
        comment: str | StringAttr | None = None,
    ):
        if isinstance(memory_offset, int):
            memory_offset = IntegerAttr(memory_offset, 64)
        if isinstance(comment, str):
            comment = StringAttr(comment)

        super().__init__(
            operands=[memory, source],
            attributes={
                "memory_offset": memory_offset,
                "comment": comment,
            },
            result_types=[],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        memory_access = memory_access_str(self.memory, self.memory_offset)
        return memory_access, self.source

    @classmethod
    def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
        attributes = dict[str, Attribute]()
        if offset := cls.parse_optional_memory_access_offset(parser):
            attributes["memory_offset"] = offset
        return attributes

    def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
        printer.print_string(", ")
        print_immediate_value(printer, self.memory_offset)
        return {"memory_offset"}

memory = operand_def(R1InvT) class-attribute instance-attribute

memory_offset = attr_def(IntegerAttr, default_value=(IntegerAttr(0, 64))) class-attribute instance-attribute

source = operand_def(R2InvT) class-attribute instance-attribute

traits = traits_def(MS_OperationHasCanonicalizationPatterns(), MemoryReadEffect(), MemoryWriteEffect()) class-attribute instance-attribute

__init__(memory: Operation | SSAValue, source: Operation | SSAValue, memory_offset: int | IntegerAttr, *, comment: str | StringAttr | None = None)

Source code in xdsl/dialects/x86/ops.py
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
def __init__(
    self,
    memory: Operation | SSAValue,
    source: Operation | SSAValue,
    memory_offset: int | IntegerAttr,
    *,
    comment: str | StringAttr | None = None,
):
    if isinstance(memory_offset, int):
        memory_offset = IntegerAttr(memory_offset, 64)
    if isinstance(comment, str):
        comment = StringAttr(comment)

    super().__init__(
        operands=[memory, source],
        attributes={
            "memory_offset": memory_offset,
            "comment": comment,
        },
        result_types=[],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
720
721
722
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    memory_access = memory_access_str(self.memory, self.memory_offset)
    return memory_access, self.source

custom_parse_attributes(parser: Parser) -> dict[str, Attribute] classmethod

Source code in xdsl/dialects/x86/ops.py
724
725
726
727
728
729
@classmethod
def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
    attributes = dict[str, Attribute]()
    if offset := cls.parse_optional_memory_access_offset(parser):
        attributes["memory_offset"] = offset
    return attributes

custom_print_attributes(printer: Printer) -> AbstractSet[str]

Source code in xdsl/dialects/x86/ops.py
731
732
733
734
def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
    printer.print_string(", ")
    print_immediate_value(printer, self.memory_offset)
    return {"memory_offset"}

MI_Operation

Bases: X86Instruction, X86CustomFormatOperation, ABC, Generic[R1InvT]

A base class for x86 operations that have one memory reference and an immediate value.

Source code in xdsl/dialects/x86/ops.py
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
class MI_Operation(X86Instruction, X86CustomFormatOperation, ABC, Generic[R1InvT]):
    """
    A base class for x86 operations that have one memory reference and an immediate
    value.
    """

    memory = operand_def(R1InvT)
    memory_offset = attr_def(IntegerAttr, default_value=IntegerAttr(0, 64))
    immediate = attr_def(IntegerAttr)

    traits = traits_def(MemoryReadEffect(), MemoryWriteEffect())

    def __init__(
        self,
        memory: Operation | SSAValue,
        memory_offset: int | IntegerAttr,
        immediate: int | IntegerAttr,
        *,
        comment: str | StringAttr | None = None,
    ):
        if isinstance(immediate, int):
            immediate = IntegerAttr(
                immediate, 32
            )  # the default immediate size is 32 bits
        if isinstance(memory_offset, int):
            memory_offset = IntegerAttr(memory_offset, 64)
        if isinstance(comment, str):
            comment = StringAttr(comment)

        super().__init__(
            operands=[memory],
            attributes={
                "immediate": immediate,
                "memory_offset": memory_offset,
                "comment": comment,
            },
            result_types=[],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        immediate = assembly_arg_str(self.immediate)
        memory_access = memory_access_str(self.memory, self.memory_offset)
        return memory_access, immediate

    @classmethod
    def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
        attributes = dict[str, Attribute]()
        temp = parse_immediate_value(parser, IntegerType(64, Signedness.SIGNED))
        attributes["immediate"] = temp
        if parser.parse_optional_punctuation(",") is not None:
            if offset := cls.parse_optional_memory_access_offset(parser):
                attributes["memory_offset"] = offset
        return attributes

    def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
        printer.print_string(", ")
        print_immediate_value(printer, self.immediate)
        if self.memory_offset.value.data != 0:
            printer.print_string(", ")
            print_immediate_value(printer, self.memory_offset)
        return {"immediate", "memory_offset"}

memory = operand_def(R1InvT) class-attribute instance-attribute

memory_offset = attr_def(IntegerAttr, default_value=(IntegerAttr(0, 64))) class-attribute instance-attribute

immediate = attr_def(IntegerAttr) class-attribute instance-attribute

traits = traits_def(MemoryReadEffect(), MemoryWriteEffect()) class-attribute instance-attribute

__init__(memory: Operation | SSAValue, memory_offset: int | IntegerAttr, immediate: int | IntegerAttr, *, comment: str | StringAttr | None = None)

Source code in xdsl/dialects/x86/ops.py
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
def __init__(
    self,
    memory: Operation | SSAValue,
    memory_offset: int | IntegerAttr,
    immediate: int | IntegerAttr,
    *,
    comment: str | StringAttr | None = None,
):
    if isinstance(immediate, int):
        immediate = IntegerAttr(
            immediate, 32
        )  # the default immediate size is 32 bits
    if isinstance(memory_offset, int):
        memory_offset = IntegerAttr(memory_offset, 64)
    if isinstance(comment, str):
        comment = StringAttr(comment)

    super().__init__(
        operands=[memory],
        attributes={
            "immediate": immediate,
            "memory_offset": memory_offset,
            "comment": comment,
        },
        result_types=[],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
776
777
778
779
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    immediate = assembly_arg_str(self.immediate)
    memory_access = memory_access_str(self.memory, self.memory_offset)
    return memory_access, immediate

custom_parse_attributes(parser: Parser) -> dict[str, Attribute] classmethod

Source code in xdsl/dialects/x86/ops.py
781
782
783
784
785
786
787
788
789
@classmethod
def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
    attributes = dict[str, Attribute]()
    temp = parse_immediate_value(parser, IntegerType(64, Signedness.SIGNED))
    attributes["immediate"] = temp
    if parser.parse_optional_punctuation(",") is not None:
        if offset := cls.parse_optional_memory_access_offset(parser):
            attributes["memory_offset"] = offset
    return attributes

custom_print_attributes(printer: Printer) -> AbstractSet[str]

Source code in xdsl/dialects/x86/ops.py
791
792
793
794
795
796
797
def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
    printer.print_string(", ")
    print_immediate_value(printer, self.immediate)
    if self.memory_offset.value.data != 0:
        printer.print_string(", ")
        print_immediate_value(printer, self.memory_offset)
    return {"immediate", "memory_offset"}

DSI_Operation

Bases: X86Instruction, X86CustomFormatOperation, ABC, Generic[R1InvT, R2InvT]

A base class for x86 operations that have one destination register, one source register and an immediate value.

Source code in xdsl/dialects/x86/ops.py
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
class DSI_Operation(
    X86Instruction, X86CustomFormatOperation, ABC, Generic[R1InvT, R2InvT]
):
    """
    A base class for x86 operations that have one destination register, one source
    register and an immediate value.
    """

    destination = result_def(R1InvT)
    source = operand_def(R2InvT)
    immediate = attr_def(IntegerAttr)

    def __init__(
        self,
        source: Operation | SSAValue,
        immediate: int | IntegerAttr,
        *,
        comment: str | StringAttr | None = None,
        destination: R1InvT,
    ):
        if isinstance(immediate, int):
            immediate = IntegerAttr(
                immediate, 32
            )  # the default immediate size is 32 bits
        if isinstance(comment, str):
            comment = StringAttr(comment)

        super().__init__(
            operands=[source],
            attributes={
                "immediate": immediate,
                "comment": comment,
            },
            result_types=[destination],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        return self.destination, self.source, self.immediate

    @classmethod
    def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
        attributes = dict[str, Attribute]()
        temp = parse_immediate_value(parser, IntegerType(32, Signedness.SIGNED))
        attributes["immediate"] = temp
        return attributes

    def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
        printer.print_string(", ")
        print_immediate_value(printer, self.immediate)
        return {"immediate"}

destination = result_def(R1InvT) class-attribute instance-attribute

source = operand_def(R2InvT) class-attribute instance-attribute

immediate = attr_def(IntegerAttr) class-attribute instance-attribute

__init__(source: Operation | SSAValue, immediate: int | IntegerAttr, *, comment: str | StringAttr | None = None, destination: R1InvT)

Source code in xdsl/dialects/x86/ops.py
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
def __init__(
    self,
    source: Operation | SSAValue,
    immediate: int | IntegerAttr,
    *,
    comment: str | StringAttr | None = None,
    destination: R1InvT,
):
    if isinstance(immediate, int):
        immediate = IntegerAttr(
            immediate, 32
        )  # the default immediate size is 32 bits
    if isinstance(comment, str):
        comment = StringAttr(comment)

    super().__init__(
        operands=[source],
        attributes={
            "immediate": immediate,
            "comment": comment,
        },
        result_types=[destination],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
836
837
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    return self.destination, self.source, self.immediate

custom_parse_attributes(parser: Parser) -> dict[str, Attribute] classmethod

Source code in xdsl/dialects/x86/ops.py
839
840
841
842
843
844
@classmethod
def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
    attributes = dict[str, Attribute]()
    temp = parse_immediate_value(parser, IntegerType(32, Signedness.SIGNED))
    attributes["immediate"] = temp
    return attributes

custom_print_attributes(printer: Printer) -> AbstractSet[str]

Source code in xdsl/dialects/x86/ops.py
846
847
848
849
def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
    printer.print_string(", ")
    print_immediate_value(printer, self.immediate)
    return {"immediate"}

DMI_Operation

Bases: X86Instruction, X86CustomFormatOperation, ABC, Generic[R1InvT, R2InvT]

A base class for x86 operations that have one destination register, one memory reference and an immediate value.

Source code in xdsl/dialects/x86/ops.py
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
class DMI_Operation(
    X86Instruction, X86CustomFormatOperation, ABC, Generic[R1InvT, R2InvT]
):
    """
    A base class for x86 operations that have one destination register, one memory
    reference and an immediate value.
    """

    destination = result_def(R1InvT)
    memory = operand_def(R2InvT)
    memory_offset = attr_def(IntegerAttr, default_value=IntegerAttr(0, 64))
    immediate = attr_def(IntegerAttr)
    traits = traits_def(MemoryReadEffect())

    def __init__(
        self,
        memory: Operation | SSAValue,
        immediate: int | IntegerAttr,
        memory_offset: int | IntegerAttr,
        *,
        comment: str | StringAttr | None = None,
        destination: R1InvT,
    ):
        if isinstance(immediate, int):
            immediate = IntegerAttr(
                immediate, 32
            )  # the default immediate size is 32 bits
        if isinstance(memory_offset, int):
            memory_offset = IntegerAttr(memory_offset, 64)
        if isinstance(comment, str):
            comment = StringAttr(comment)

        super().__init__(
            operands=[memory],
            attributes={
                "immediate": immediate,
                "memory_offset": memory_offset,
                "comment": comment,
            },
            result_types=[destination],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        destination = assembly_arg_str(self.destination)
        immediate = assembly_arg_str(self.immediate)
        memory_access = memory_access_str(self.memory, self.memory_offset)
        return destination, memory_access, immediate

    @classmethod
    def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
        attributes = dict[str, Attribute]()
        temp = parse_immediate_value(parser, IntegerType(64, Signedness.SIGNED))
        attributes["immediate"] = temp
        if parser.parse_optional_punctuation(",") is not None:
            if offset := cls.parse_optional_memory_access_offset(parser):
                attributes["memory_offset"] = offset
        return attributes

    def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
        printer.print_string(", ")
        print_immediate_value(printer, self.immediate)
        if self.memory_offset.value.data != 0:
            printer.print_string(", ")
            print_immediate_value(printer, self.memory_offset)
        return {"immediate", "memory_offset"}

destination = result_def(R1InvT) class-attribute instance-attribute

memory = operand_def(R2InvT) class-attribute instance-attribute

memory_offset = attr_def(IntegerAttr, default_value=(IntegerAttr(0, 64))) class-attribute instance-attribute

immediate = attr_def(IntegerAttr) class-attribute instance-attribute

traits = traits_def(MemoryReadEffect()) class-attribute instance-attribute

__init__(memory: Operation | SSAValue, immediate: int | IntegerAttr, memory_offset: int | IntegerAttr, *, comment: str | StringAttr | None = None, destination: R1InvT)

Source code in xdsl/dialects/x86/ops.py
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
def __init__(
    self,
    memory: Operation | SSAValue,
    immediate: int | IntegerAttr,
    memory_offset: int | IntegerAttr,
    *,
    comment: str | StringAttr | None = None,
    destination: R1InvT,
):
    if isinstance(immediate, int):
        immediate = IntegerAttr(
            immediate, 32
        )  # the default immediate size is 32 bits
    if isinstance(memory_offset, int):
        memory_offset = IntegerAttr(memory_offset, 64)
    if isinstance(comment, str):
        comment = StringAttr(comment)

    super().__init__(
        operands=[memory],
        attributes={
            "immediate": immediate,
            "memory_offset": memory_offset,
            "comment": comment,
        },
        result_types=[destination],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
894
895
896
897
898
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    destination = assembly_arg_str(self.destination)
    immediate = assembly_arg_str(self.immediate)
    memory_access = memory_access_str(self.memory, self.memory_offset)
    return destination, memory_access, immediate

custom_parse_attributes(parser: Parser) -> dict[str, Attribute] classmethod

Source code in xdsl/dialects/x86/ops.py
900
901
902
903
904
905
906
907
908
@classmethod
def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
    attributes = dict[str, Attribute]()
    temp = parse_immediate_value(parser, IntegerType(64, Signedness.SIGNED))
    attributes["immediate"] = temp
    if parser.parse_optional_punctuation(",") is not None:
        if offset := cls.parse_optional_memory_access_offset(parser):
            attributes["memory_offset"] = offset
    return attributes

custom_print_attributes(printer: Printer) -> AbstractSet[str]

Source code in xdsl/dialects/x86/ops.py
910
911
912
913
914
915
916
def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
    printer.print_string(", ")
    print_immediate_value(printer, self.immediate)
    if self.memory_offset.value.data != 0:
        printer.print_string(", ")
        print_immediate_value(printer, self.memory_offset)
    return {"immediate", "memory_offset"}

M_Operation

Bases: X86Instruction, X86CustomFormatOperation, ABC, Generic[R1InvT]

A base class for x86 operations with a memory reference.

Source code in xdsl/dialects/x86/ops.py
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
class M_Operation(X86Instruction, X86CustomFormatOperation, ABC, Generic[R1InvT]):
    """
    A base class for x86 operations with a memory reference.
    """

    memory = operand_def(R1InvT)
    memory_offset = attr_def(IntegerAttr, default_value=IntegerAttr(0, 64))
    traits = traits_def(MemoryWriteEffect(), MemoryReadEffect())

    def __init__(
        self,
        memory: Operation | SSAValue,
        memory_offset: int | IntegerAttr,
        *,
        comment: str | StringAttr | None = None,
    ):
        if isinstance(comment, str):
            comment = StringAttr(comment)
        if isinstance(memory_offset, int):
            memory_offset = IntegerAttr(memory_offset, 64)

        super().__init__(
            operands=[memory],
            attributes={
                "memory_offset": memory_offset,
                "comment": comment,
            },
            result_types=[],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        memory_access = memory_access_str(self.memory, self.memory_offset)
        return (memory_access,)

    @classmethod
    def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
        attributes = dict[str, Attribute]()
        if offset := cls.parse_optional_memory_access_offset(parser):
            attributes["memory_offset"] = offset
        return attributes

    def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
        printer.print_string(", ")
        print_immediate_value(printer, self.memory_offset)
        return {"memory_offset"}

memory = operand_def(R1InvT) class-attribute instance-attribute

memory_offset = attr_def(IntegerAttr, default_value=(IntegerAttr(0, 64))) class-attribute instance-attribute

traits = traits_def(MemoryWriteEffect(), MemoryReadEffect()) class-attribute instance-attribute

__init__(memory: Operation | SSAValue, memory_offset: int | IntegerAttr, *, comment: str | StringAttr | None = None)

Source code in xdsl/dialects/x86/ops.py
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
def __init__(
    self,
    memory: Operation | SSAValue,
    memory_offset: int | IntegerAttr,
    *,
    comment: str | StringAttr | None = None,
):
    if isinstance(comment, str):
        comment = StringAttr(comment)
    if isinstance(memory_offset, int):
        memory_offset = IntegerAttr(memory_offset, 64)

    super().__init__(
        operands=[memory],
        attributes={
            "memory_offset": memory_offset,
            "comment": comment,
        },
        result_types=[],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
949
950
951
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    memory_access = memory_access_str(self.memory, self.memory_offset)
    return (memory_access,)

custom_parse_attributes(parser: Parser) -> dict[str, Attribute] classmethod

Source code in xdsl/dialects/x86/ops.py
953
954
955
956
957
958
@classmethod
def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
    attributes = dict[str, Attribute]()
    if offset := cls.parse_optional_memory_access_offset(parser):
        attributes["memory_offset"] = offset
    return attributes

custom_print_attributes(printer: Printer) -> AbstractSet[str]

Source code in xdsl/dialects/x86/ops.py
960
961
962
963
def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
    printer.print_string(", ")
    print_immediate_value(printer, self.memory_offset)
    return {"memory_offset"}

ConditionalJumpOperation

Bases: X86Instruction, X86CustomFormatOperation, ABC

A base class for Jcc operations.

See external documentation.

Source code in xdsl/dialects/x86/ops.py
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
class ConditionalJumpOperation(X86Instruction, X86CustomFormatOperation, ABC):
    """
    A base class for Jcc operations.

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    rflags = operand_def(RFLAGS)

    then_values = var_operand_def(X86RegisterType)
    else_values = var_operand_def(X86RegisterType)

    irdl_options = (AttrSizedOperandSegments(),)

    then_block = successor_def()
    else_block = successor_def()

    traits = traits_def(IsTerminator())

    def __init__(
        self,
        rflags: Operation | SSAValue,
        then_values: Sequence[SSAValue],
        else_values: Sequence[SSAValue],
        then_block: Successor,
        else_block: Successor,
        *,
        comment: str | StringAttr | None = None,
    ):
        if isinstance(comment, str):
            comment = StringAttr(comment)

        super().__init__(
            operands=[rflags, then_values, else_values],
            attributes={
                "comment": comment,
            },
            successors=(then_block, else_block),
        )

    def verify_(self) -> None:
        # The then block must start with a label op

        then_block_first_op = self.then_block.first_op

        if not isinstance(then_block_first_op, LabelOp):
            raise VerifyException("then block first op must be a label")

        # Types of arguments must match arg types of blocks

        for op_arg, block_arg in zip(self.then_values, self.then_block.args):
            if op_arg.type != block_arg.type:
                raise VerifyException(
                    f"Block arg types must match {op_arg.type} {block_arg.type}"
                )

        for op_arg, block_arg in zip(self.else_values, self.else_block.args):
            if op_arg.type != block_arg.type:
                raise VerifyException(
                    f"Block arg types must match {op_arg.type} {block_arg.type}"
                )

        # The else block must be the one immediately following this one

        parent_block = self.parent
        if parent_block is None:
            return

        parent_region = parent_block.parent
        if parent_region is None:
            return

        if parent_block.next_block is not self.else_block:
            raise VerifyException("else block must be immediately after op")

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg, ...]:
        then_label = self.then_block.first_op
        assert isinstance(then_label, LabelOp)
        then_label_str = then_label.label.data
        if then_label_str.isdigit():
            # x86 Assembly: Numeric jump labels must be annotated with a suffix.
            # Jumping backward in code requires appending 'b' (e.g., "1b"), and
            # jumping forward requires appending 'f' (e.g., "1f").
            # Proper support for generating these labels is currently unimplemented.
            raise NotImplementedError(
                "Assembly printing for jumps to numeric labels not implemented"
            )
        return (then_label_str,)

    def print(self, printer: Printer) -> None:
        printer.print_string(" ")
        print_type_pair(printer, self.rflags)
        printer.print_string(", ")
        printer.print_block_name(self.then_block)
        printer.print_string("(")
        printer.print_list(self.then_values, lambda val: print_type_pair(printer, val))
        printer.print_string("), ")
        printer.print_block_name(self.else_block)
        printer.print_string("(")
        printer.print_list(self.else_values, lambda val: print_type_pair(printer, val))
        printer.print_string(")")
        if self.attributes:
            printer.print_op_attributes(
                self.attributes,
                reserved_attr_names="operandSegmentSizes",
                print_keyword=True,
            )

    @classmethod
    def parse(cls, parser: Parser) -> Self:
        rflags = parse_type_pair(parser)
        parser.parse_punctuation(",")
        then_block = parser.parse_successor()
        then_args = parser.parse_comma_separated_list(
            parser.Delimiter.PAREN, lambda: parse_type_pair(parser)
        )
        parser.parse_punctuation(",")
        else_block = parser.parse_successor()
        else_args = parser.parse_comma_separated_list(
            parser.Delimiter.PAREN, lambda: parse_type_pair(parser)
        )
        attrs = parser.parse_optional_attr_dict_with_keyword()
        op = cls(rflags, then_args, else_args, then_block, else_block)
        if attrs is not None:
            op.attributes |= attrs.data
        return op

rflags = operand_def(RFLAGS) class-attribute instance-attribute

then_values = var_operand_def(X86RegisterType) class-attribute instance-attribute

else_values = var_operand_def(X86RegisterType) class-attribute instance-attribute

irdl_options = (AttrSizedOperandSegments(),) class-attribute instance-attribute

then_block = successor_def() class-attribute instance-attribute

else_block = successor_def() class-attribute instance-attribute

traits = traits_def(IsTerminator()) class-attribute instance-attribute

__init__(rflags: Operation | SSAValue, then_values: Sequence[SSAValue], else_values: Sequence[SSAValue], then_block: Successor, else_block: Successor, *, comment: str | StringAttr | None = None)

Source code in xdsl/dialects/x86/ops.py
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
def __init__(
    self,
    rflags: Operation | SSAValue,
    then_values: Sequence[SSAValue],
    else_values: Sequence[SSAValue],
    then_block: Successor,
    else_block: Successor,
    *,
    comment: str | StringAttr | None = None,
):
    if isinstance(comment, str):
        comment = StringAttr(comment)

    super().__init__(
        operands=[rflags, then_values, else_values],
        attributes={
            "comment": comment,
        },
        successors=(then_block, else_block),
    )

verify_() -> None

Source code in xdsl/dialects/x86/ops.py
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
def verify_(self) -> None:
    # The then block must start with a label op

    then_block_first_op = self.then_block.first_op

    if not isinstance(then_block_first_op, LabelOp):
        raise VerifyException("then block first op must be a label")

    # Types of arguments must match arg types of blocks

    for op_arg, block_arg in zip(self.then_values, self.then_block.args):
        if op_arg.type != block_arg.type:
            raise VerifyException(
                f"Block arg types must match {op_arg.type} {block_arg.type}"
            )

    for op_arg, block_arg in zip(self.else_values, self.else_block.args):
        if op_arg.type != block_arg.type:
            raise VerifyException(
                f"Block arg types must match {op_arg.type} {block_arg.type}"
            )

    # The else block must be the one immediately following this one

    parent_block = self.parent
    if parent_block is None:
        return

    parent_region = parent_block.parent
    if parent_region is None:
        return

    if parent_block.next_block is not self.else_block:
        raise VerifyException("else block must be immediately after op")

assembly_line_args() -> tuple[AssemblyInstructionArg, ...]

Source code in xdsl/dialects/x86/ops.py
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
def assembly_line_args(self) -> tuple[AssemblyInstructionArg, ...]:
    then_label = self.then_block.first_op
    assert isinstance(then_label, LabelOp)
    then_label_str = then_label.label.data
    if then_label_str.isdigit():
        # x86 Assembly: Numeric jump labels must be annotated with a suffix.
        # Jumping backward in code requires appending 'b' (e.g., "1b"), and
        # jumping forward requires appending 'f' (e.g., "1f").
        # Proper support for generating these labels is currently unimplemented.
        raise NotImplementedError(
            "Assembly printing for jumps to numeric labels not implemented"
        )
    return (then_label_str,)

print(printer: Printer) -> None

Source code in xdsl/dialects/x86/ops.py
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
def print(self, printer: Printer) -> None:
    printer.print_string(" ")
    print_type_pair(printer, self.rflags)
    printer.print_string(", ")
    printer.print_block_name(self.then_block)
    printer.print_string("(")
    printer.print_list(self.then_values, lambda val: print_type_pair(printer, val))
    printer.print_string("), ")
    printer.print_block_name(self.else_block)
    printer.print_string("(")
    printer.print_list(self.else_values, lambda val: print_type_pair(printer, val))
    printer.print_string(")")
    if self.attributes:
        printer.print_op_attributes(
            self.attributes,
            reserved_attr_names="operandSegmentSizes",
            print_keyword=True,
        )

parse(parser: Parser) -> Self classmethod

Source code in xdsl/dialects/x86/ops.py
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
@classmethod
def parse(cls, parser: Parser) -> Self:
    rflags = parse_type_pair(parser)
    parser.parse_punctuation(",")
    then_block = parser.parse_successor()
    then_args = parser.parse_comma_separated_list(
        parser.Delimiter.PAREN, lambda: parse_type_pair(parser)
    )
    parser.parse_punctuation(",")
    else_block = parser.parse_successor()
    else_args = parser.parse_comma_separated_list(
        parser.Delimiter.PAREN, lambda: parse_type_pair(parser)
    )
    attrs = parser.parse_optional_attr_dict_with_keyword()
    op = cls(rflags, then_args, else_args, then_block, else_block)
    if attrs is not None:
        op.attributes |= attrs.data
    return op

RSS_Operation

Bases: X86Instruction, ABC, Generic[R1InvT, R2InvT, R3InvT]

A base class for x86 operations that have one register that is read and written to, and two source registers.

Source code in xdsl/dialects/x86/ops.py
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
class RSS_Operation(X86Instruction, ABC, Generic[R1InvT, R2InvT, R3InvT]):
    """
    A base class for x86 operations that have one register that is read and written to,
    and two source registers.
    """

    register_in = operand_def(R1InvT)
    register_out = result_def(R1InvT)
    source1 = operand_def(R2InvT)
    source2 = operand_def(R3InvT)

    assembly_format = (
        "$register_in `,` $source1 `,` $source2 attr-dict `:` "
        "`(` type($register_in) `,` type($source1) `,` type($source2) `)` `->` type($register_out)"
    )

    def __init__(
        self,
        register_in: SSAValue[R1InvT],
        source1: Operation | SSAValue,
        source2: Operation | SSAValue,
        *,
        comment: str | StringAttr | None = None,
        register_out: R1InvT | None = None,
    ):
        if isinstance(comment, str):
            comment = StringAttr(comment)

        if register_out is None:
            register_out = register_in.type

        super().__init__(
            operands=[register_in, source1, source2],
            attributes={
                "comment": comment,
            },
            result_types=[register_out],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        return self.register_in, self.source1, self.source2

    def get_register_constraints(self) -> RegisterConstraints:
        return RegisterConstraints(
            (self.source1, self.source2), (), ((self.register_in, self.register_out),)
        )

register_in = operand_def(R1InvT) class-attribute instance-attribute

register_out = result_def(R1InvT) class-attribute instance-attribute

source1 = operand_def(R2InvT) class-attribute instance-attribute

source2 = operand_def(R3InvT) class-attribute instance-attribute

assembly_format = '$register_in `,` $source1 `,` $source2 attr-dict `:` `(` type($register_in) `,` type($source1) `,` type($source2) `)` `->` type($register_out)' class-attribute instance-attribute

__init__(register_in: SSAValue[R1InvT], source1: Operation | SSAValue, source2: Operation | SSAValue, *, comment: str | StringAttr | None = None, register_out: R1InvT | None = None)

Source code in xdsl/dialects/x86/ops.py
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
def __init__(
    self,
    register_in: SSAValue[R1InvT],
    source1: Operation | SSAValue,
    source2: Operation | SSAValue,
    *,
    comment: str | StringAttr | None = None,
    register_out: R1InvT | None = None,
):
    if isinstance(comment, str):
        comment = StringAttr(comment)

    if register_out is None:
        register_out = register_in.type

    super().__init__(
        operands=[register_in, source1, source2],
        attributes={
            "comment": comment,
        },
        result_types=[register_out],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
1133
1134
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    return self.register_in, self.source1, self.source2

get_register_constraints() -> RegisterConstraints

Source code in xdsl/dialects/x86/ops.py
1136
1137
1138
1139
def get_register_constraints(self) -> RegisterConstraints:
    return RegisterConstraints(
        (self.source1, self.source2), (), ((self.register_in, self.register_out),)
    )

RSSK_Operation

Bases: X86Instruction, ABC

A base class for x86 AVX512 operations that have one register r that is read and written to, and two source registers s1 and s2, with mask register k. The z attribute enables zero masking, which sets the elements of the destination register to zero where the corresponding bit in the mask is zero.

Source code in xdsl/dialects/x86/ops.py
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
class RSSK_Operation(X86Instruction, ABC):
    """
    A base class for x86 AVX512 operations that have one register r that is read and written to,
    and two source registers s1 and s2, with mask register k. The z attribute enables zero masking,
    which sets the elements of the destination register to zero where the corresponding
    bit in the mask is zero.
    """

    T: ClassVar[VarConstraint] = VarConstraint("T", base(AVX512RegisterType))

    register_in = operand_def(T)
    register_out = result_def(T)
    source1 = operand_def(AVX512RegisterType)
    source2 = operand_def(AVX512RegisterType)
    mask_reg = operand_def(AVX512MaskRegisterType)
    z = opt_attr_def(UnitAttr)

    assembly_format = (
        "$register_in `,` $source1 `,` $source2 `,` $mask_reg attr-dict `:` "
        "`(` type($register_in) `,` type($source1) `,` type($source2) `,` type($mask_reg) `)` `->` type($register_out)"
    )

    def __init__(
        self,
        register_in: SSAValue[R1InvT],
        source1: Operation | SSAValue,
        source2: Operation | SSAValue,
        mask_reg: Operation | SSAValue,
        *,
        z: bool = False,
        comment: str | StringAttr | None = None,
        register_out: R1InvT | None = None,
    ):
        if isinstance(comment, str):
            comment = StringAttr(comment)

        if register_out is None:
            register_out = register_in.type

        super().__init__(
            operands=[register_in, source1, source2, mask_reg],
            attributes={
                "z": UnitAttr() if z else None,
                "comment": comment,
            },
            result_types=[register_out],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        register_in = masked_source_str(self.register_in, self.mask_reg, self.z)
        return register_in, self.source1, self.source2

    def get_register_constraints(self) -> RegisterConstraints:
        return RegisterConstraints(
            (self.source1, self.source2, self.mask_reg),
            (),
            ((self.register_in, self.register_out),),
        )

T: VarConstraint = VarConstraint('T', base(AVX512RegisterType)) class-attribute

register_in = operand_def(T) class-attribute instance-attribute

register_out = result_def(T) class-attribute instance-attribute

source1 = operand_def(AVX512RegisterType) class-attribute instance-attribute

source2 = operand_def(AVX512RegisterType) class-attribute instance-attribute

mask_reg = operand_def(AVX512MaskRegisterType) class-attribute instance-attribute

z = opt_attr_def(UnitAttr) class-attribute instance-attribute

assembly_format = '$register_in `,` $source1 `,` $source2 `,` $mask_reg attr-dict `:` `(` type($register_in) `,` type($source1) `,` type($source2) `,` type($mask_reg) `)` `->` type($register_out)' class-attribute instance-attribute

__init__(register_in: SSAValue[R1InvT], source1: Operation | SSAValue, source2: Operation | SSAValue, mask_reg: Operation | SSAValue, *, z: bool = False, comment: str | StringAttr | None = None, register_out: R1InvT | None = None)

Source code in xdsl/dialects/x86/ops.py
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
def __init__(
    self,
    register_in: SSAValue[R1InvT],
    source1: Operation | SSAValue,
    source2: Operation | SSAValue,
    mask_reg: Operation | SSAValue,
    *,
    z: bool = False,
    comment: str | StringAttr | None = None,
    register_out: R1InvT | None = None,
):
    if isinstance(comment, str):
        comment = StringAttr(comment)

    if register_out is None:
        register_out = register_in.type

    super().__init__(
        operands=[register_in, source1, source2, mask_reg],
        attributes={
            "z": UnitAttr() if z else None,
            "comment": comment,
        },
        result_types=[register_out],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
1190
1191
1192
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    register_in = masked_source_str(self.register_in, self.mask_reg, self.z)
    return register_in, self.source1, self.source2

get_register_constraints() -> RegisterConstraints

Source code in xdsl/dialects/x86/ops.py
1194
1195
1196
1197
1198
1199
def get_register_constraints(self) -> RegisterConstraints:
    return RegisterConstraints(
        (self.source1, self.source2, self.mask_reg),
        (),
        ((self.register_in, self.register_out),),
    )

DSS_Operation

Bases: X86Instruction, ABC, Generic[R1InvT, R2InvT, R3InvT]

A base class for x86 operations that have one destination register and two source registers.

Source code in xdsl/dialects/x86/ops.py
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
class DSS_Operation(X86Instruction, ABC, Generic[R1InvT, R2InvT, R3InvT]):
    """
    A base class for x86 operations that have one destination register and two source
    registers.
    """

    destination = result_def(R1InvT)
    source1 = operand_def(R2InvT)
    source2 = operand_def(R3InvT)

    assembly_format = (
        "$source1 `,` $source2 attr-dict `:` "
        "`(` type($source1) `,` type($source2) `)` `->` type($destination)"
    )

    def __init__(
        self,
        source1: Operation | SSAValue[R2InvT],
        source2: Operation | SSAValue[R3InvT],
        *,
        comment: str | StringAttr | None = None,
        destination: R1InvT,
    ):
        if isinstance(comment, str):
            comment = StringAttr(comment)

        super().__init__(
            operands=[source1, source2],
            attributes={
                "comment": comment,
            },
            result_types=[destination],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        return self.destination, self.source1, self.source2

    def get_register_constraints(self) -> RegisterConstraints:
        return RegisterConstraints(
            (self.source1, self.source2), (self.destination,), ()
        )

destination = result_def(R1InvT) class-attribute instance-attribute

source1 = operand_def(R2InvT) class-attribute instance-attribute

source2 = operand_def(R3InvT) class-attribute instance-attribute

assembly_format = '$source1 `,` $source2 attr-dict `:` `(` type($source1) `,` type($source2) `)` `->` type($destination)' class-attribute instance-attribute

__init__(source1: Operation | SSAValue[R2InvT], source2: Operation | SSAValue[R3InvT], *, comment: str | StringAttr | None = None, destination: R1InvT)

Source code in xdsl/dialects/x86/ops.py
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
def __init__(
    self,
    source1: Operation | SSAValue[R2InvT],
    source2: Operation | SSAValue[R3InvT],
    *,
    comment: str | StringAttr | None = None,
    destination: R1InvT,
):
    if isinstance(comment, str):
        comment = StringAttr(comment)

    super().__init__(
        operands=[source1, source2],
        attributes={
            "comment": comment,
        },
        result_types=[destination],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
1236
1237
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    return self.destination, self.source1, self.source2

get_register_constraints() -> RegisterConstraints

Source code in xdsl/dialects/x86/ops.py
1239
1240
1241
1242
def get_register_constraints(self) -> RegisterConstraints:
    return RegisterConstraints(
        (self.source1, self.source2), (self.destination,), ()
    )

RSM_Operation

Bases: X86Instruction, X86CustomFormatOperation, ABC, Generic[R1InvT, R2InvT, R4InvT]

A base class for x86 operations that have one register that is read and written to, one source register and one memory source operand.

Source code in xdsl/dialects/x86/ops.py
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
class RSM_Operation(
    X86Instruction, X86CustomFormatOperation, ABC, Generic[R1InvT, R2InvT, R4InvT]
):
    """
    A base class for x86 operations that have one register that is read and written to,
    one source register and one memory source operand.
    """

    register_in = operand_def(R1InvT)
    register_out = result_def(R1InvT)
    source1 = operand_def(R2InvT)
    memory = operand_def(R4InvT)
    memory_offset = attr_def(IntegerAttr[I32], default_value=IntegerAttr(0, 32))

    traits = traits_def(MemoryReadEffect())

    def __init__(
        self,
        register_in: SSAValue[R1InvT],
        source1: Operation | SSAValue,
        memory: Operation | SSAValue,
        memory_offset: int | IntegerAttr[I32],
        *,
        comment: str | StringAttr | None = None,
        register_out: R1InvT | None = None,
    ):
        if isinstance(memory_offset, int):
            memory_offset = IntegerAttr[I32](memory_offset, 32)
        if isinstance(comment, str):
            comment = StringAttr(comment)

        if register_out is None:
            register_out = register_in.type

        super().__init__(
            operands=[register_in, source1, memory],
            attributes={
                "memory_offset": memory_offset,
                "comment": comment,
            },
            result_types=[register_out],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        memory_access = memory_access_str(self.memory, self.memory_offset)
        src1 = assembly_arg_str(self.source1)
        destination = assembly_arg_str(self.register_in)
        return destination, src1, memory_access

    @classmethod
    def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
        attributes = dict[str, Attribute]()
        if offset := cls.parse_optional_memory_access_offset(parser, i32):
            attributes["memory_offset"] = offset
        return attributes

    def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
        printer.print_string(", ")
        print_immediate_value(printer, self.memory_offset)
        return {"memory_offset"}

    def get_register_constraints(self) -> RegisterConstraints:
        return RegisterConstraints(
            (self.source1, self.memory), (), ((self.register_in, self.register_out),)
        )

register_in = operand_def(R1InvT) class-attribute instance-attribute

register_out = result_def(R1InvT) class-attribute instance-attribute

source1 = operand_def(R2InvT) class-attribute instance-attribute

memory = operand_def(R4InvT) class-attribute instance-attribute

memory_offset = attr_def(IntegerAttr[I32], default_value=(IntegerAttr(0, 32))) class-attribute instance-attribute

traits = traits_def(MemoryReadEffect()) class-attribute instance-attribute

__init__(register_in: SSAValue[R1InvT], source1: Operation | SSAValue, memory: Operation | SSAValue, memory_offset: int | IntegerAttr[I32], *, comment: str | StringAttr | None = None, register_out: R1InvT | None = None)

Source code in xdsl/dialects/x86/ops.py
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
def __init__(
    self,
    register_in: SSAValue[R1InvT],
    source1: Operation | SSAValue,
    memory: Operation | SSAValue,
    memory_offset: int | IntegerAttr[I32],
    *,
    comment: str | StringAttr | None = None,
    register_out: R1InvT | None = None,
):
    if isinstance(memory_offset, int):
        memory_offset = IntegerAttr[I32](memory_offset, 32)
    if isinstance(comment, str):
        comment = StringAttr(comment)

    if register_out is None:
        register_out = register_in.type

    super().__init__(
        operands=[register_in, source1, memory],
        attributes={
            "memory_offset": memory_offset,
            "comment": comment,
        },
        result_types=[register_out],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
1288
1289
1290
1291
1292
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    memory_access = memory_access_str(self.memory, self.memory_offset)
    src1 = assembly_arg_str(self.source1)
    destination = assembly_arg_str(self.register_in)
    return destination, src1, memory_access

custom_parse_attributes(parser: Parser) -> dict[str, Attribute] classmethod

Source code in xdsl/dialects/x86/ops.py
1294
1295
1296
1297
1298
1299
@classmethod
def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
    attributes = dict[str, Attribute]()
    if offset := cls.parse_optional_memory_access_offset(parser, i32):
        attributes["memory_offset"] = offset
    return attributes

custom_print_attributes(printer: Printer) -> AbstractSet[str]

Source code in xdsl/dialects/x86/ops.py
1301
1302
1303
1304
def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
    printer.print_string(", ")
    print_immediate_value(printer, self.memory_offset)
    return {"memory_offset"}

get_register_constraints() -> RegisterConstraints

Source code in xdsl/dialects/x86/ops.py
1306
1307
1308
1309
def get_register_constraints(self) -> RegisterConstraints:
    return RegisterConstraints(
        (self.source1, self.memory), (), ((self.register_in, self.register_out),)
    )

DSSI_Operation

Bases: X86Instruction, X86CustomFormatOperation, ABC, Generic[R1InvT, R2InvT, R3InvT]

A base class for x86 operations that have one destination register, one source register and an immediate value.

Source code in xdsl/dialects/x86/ops.py
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
class DSSI_Operation(
    X86Instruction, X86CustomFormatOperation, ABC, Generic[R1InvT, R2InvT, R3InvT]
):
    """
    A base class for x86 operations that have one destination register, one source
    register and an immediate value.
    """

    destination = result_def(R1InvT)
    source0 = operand_def(R2InvT)
    source1 = operand_def(R3InvT)
    immediate = attr_def(IntegerAttr[IntegerType[8]])

    def __init__(
        self,
        source0: Operation | SSAValue,
        source1: Operation | SSAValue,
        immediate: int
        | IntegerAttr[IntegerType[Literal[8], Literal[Signedness.UNSIGNED]]],
        *,
        comment: str | StringAttr | None = None,
        destination: R1InvT,
    ):
        if isinstance(immediate, int):
            immediate = IntegerAttr(
                immediate, IntegerType[8, Signedness.UNSIGNED](8, Signedness.UNSIGNED)
            )
        if isinstance(comment, str):
            comment = StringAttr(comment)

        super().__init__(
            operands=[source0, source1],
            attributes={
                "immediate": immediate,
                "comment": comment,
            },
            result_types=[destination],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        return self.destination, self.source0, self.source1, self.immediate

    @classmethod
    def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
        attributes = dict[str, Attribute]()
        temp = parse_immediate_value(parser, IntegerType(8, Signedness.UNSIGNED))
        attributes["immediate"] = temp
        return attributes

    def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
        printer.print_string(", ")
        print_immediate_value(printer, self.immediate)
        return {"immediate"}

destination = result_def(R1InvT) class-attribute instance-attribute

source0 = operand_def(R2InvT) class-attribute instance-attribute

source1 = operand_def(R3InvT) class-attribute instance-attribute

immediate = attr_def(IntegerAttr[IntegerType[8]]) class-attribute instance-attribute

__init__(source0: Operation | SSAValue, source1: Operation | SSAValue, immediate: int | IntegerAttr[IntegerType[Literal[8], Literal[Signedness.UNSIGNED]]], *, comment: str | StringAttr | None = None, destination: R1InvT)

Source code in xdsl/dialects/x86/ops.py
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
def __init__(
    self,
    source0: Operation | SSAValue,
    source1: Operation | SSAValue,
    immediate: int
    | IntegerAttr[IntegerType[Literal[8], Literal[Signedness.UNSIGNED]]],
    *,
    comment: str | StringAttr | None = None,
    destination: R1InvT,
):
    if isinstance(immediate, int):
        immediate = IntegerAttr(
            immediate, IntegerType[8, Signedness.UNSIGNED](8, Signedness.UNSIGNED)
        )
    if isinstance(comment, str):
        comment = StringAttr(comment)

    super().__init__(
        operands=[source0, source1],
        attributes={
            "immediate": immediate,
            "comment": comment,
        },
        result_types=[destination],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
1351
1352
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    return self.destination, self.source0, self.source1, self.immediate

custom_parse_attributes(parser: Parser) -> dict[str, Attribute] classmethod

Source code in xdsl/dialects/x86/ops.py
1354
1355
1356
1357
1358
1359
@classmethod
def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
    attributes = dict[str, Attribute]()
    temp = parse_immediate_value(parser, IntegerType(8, Signedness.UNSIGNED))
    attributes["immediate"] = temp
    return attributes

custom_print_attributes(printer: Printer) -> AbstractSet[str]

Source code in xdsl/dialects/x86/ops.py
1361
1362
1363
1364
def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
    printer.print_string(", ")
    print_immediate_value(printer, self.immediate)
    return {"immediate"}

RS_AddOpHasCanonicalizationPatterns dataclass

Bases: HasCanonicalizationPatternsTrait

Source code in xdsl/dialects/x86/ops.py
1370
1371
1372
1373
1374
1375
class RS_AddOpHasCanonicalizationPatterns(HasCanonicalizationPatternsTrait):
    @classmethod
    def get_canonicalization_patterns(cls) -> tuple[RewritePattern, ...]:
        from xdsl.transforms.canonicalization_patterns.x86 import RS_Add_Zero

        return (RS_Add_Zero(),)

get_canonicalization_patterns() -> tuple[RewritePattern, ...] classmethod

Source code in xdsl/dialects/x86/ops.py
1371
1372
1373
1374
1375
@classmethod
def get_canonicalization_patterns(cls) -> tuple[RewritePattern, ...]:
    from xdsl.transforms.canonicalization_patterns.x86 import RS_Add_Zero

    return (RS_Add_Zero(),)

RS_AddOp dataclass

Bases: RS_Operation[GeneralRegisterType, GeneralRegisterType]

Adds the registers r and s and stores the result in r.

x[r] = x[r] + x[s]

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
@irdl_op_definition
class RS_AddOp(RS_Operation[GeneralRegisterType, GeneralRegisterType]):
    """
    Adds the registers r and s and stores the result in r.
    ```C
    x[r] = x[r] + x[s]
    ```

    See external [documentation](https://www.felixcloutier.com/x86/add).
    """

    name = "x86.rs.add"

    traits = traits_def(Pure(), RS_AddOpHasCanonicalizationPatterns())

name = 'x86.rs.add' class-attribute instance-attribute

traits = traits_def(Pure(), RS_AddOpHasCanonicalizationPatterns()) class-attribute instance-attribute

RS_SubOp dataclass

Bases: RS_Operation[GeneralRegisterType, GeneralRegisterType]

subtracts s from r and stores the result in r.

x[r] = x[r] - x[s]

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
@irdl_op_definition
class RS_SubOp(RS_Operation[GeneralRegisterType, GeneralRegisterType]):
    """
    subtracts s from r and stores the result in r.
    ```C
    x[r] = x[r] - x[s]
    ```

    See external [documentation](https://www.felixcloutier.com/x86/sub).
    """

    name = "x86.rs.sub"

name = 'x86.rs.sub' class-attribute instance-attribute

RS_ImulOp dataclass

Bases: RS_Operation[GeneralRegisterType, GeneralRegisterType]

Multiplies the registers r and s and stores the result in r.

x[r] = x[r] * x[s]

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
@irdl_op_definition
class RS_ImulOp(RS_Operation[GeneralRegisterType, GeneralRegisterType]):
    """
    Multiplies the registers r and s and stores the result in r.
    ```C
    x[r] = x[r] * x[s]
    ```

    See external [documentation](https://www.felixcloutier.com/x86/imul).
    """

    name = "x86.rs.imul"

name = 'x86.rs.imul' class-attribute instance-attribute

RS_FAddOp dataclass

Bases: RS_Operation[GeneralRegisterType, GeneralRegisterType]

Adds the floating point values in registers r and s and stores the result in r.

x[r] += x[s]

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
@irdl_op_definition
class RS_FAddOp(RS_Operation[GeneralRegisterType, GeneralRegisterType]):
    """
    Adds the floating point values in registers r and s and stores the result in r.
    ```C
    x[r] += x[s]
    ```

    See external [documentation](https://www.felixcloutier.com/x86/fadd:faddp:fiadd).
    """

    name = "x86.rs.fadd"

name = 'x86.rs.fadd' class-attribute instance-attribute

RS_FMulOp dataclass

Bases: RS_Operation[GeneralRegisterType, GeneralRegisterType]

Multiplies the floating point values in registers r and s and stores the result in r.

x[r] *= x[s]

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
@irdl_op_definition
class RS_FMulOp(RS_Operation[GeneralRegisterType, GeneralRegisterType]):
    """
    Multiplies the floating point values in registers r and s and stores the result in
    r.
    ```C
    x[r] *= x[s]
    ```

    See external [documentation](https://www.felixcloutier.com/x86/fmul:fmulp:fimul).
    """

    name = "x86.rs.fmul"

name = 'x86.rs.fmul' class-attribute instance-attribute

RS_AndOp dataclass

Bases: RS_Operation[GeneralRegisterType, GeneralRegisterType]

bitwise and of r and s, stored in r

x[r] = x[r] & x[s]

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
@irdl_op_definition
class RS_AndOp(RS_Operation[GeneralRegisterType, GeneralRegisterType]):
    """
    bitwise and of r and s, stored in r
    ```C
    x[r] = x[r] & x[s]
    ```

    See external [documentation](https://www.felixcloutier.com/x86/and).
    """

    name = "x86.rs.and"

name = 'x86.rs.and' class-attribute instance-attribute

RS_OrOp dataclass

Bases: RS_Operation[GeneralRegisterType, GeneralRegisterType]

bitwise or of r and s, stored in r

x[r] = x[r] | x[s]

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
@irdl_op_definition
class RS_OrOp(RS_Operation[GeneralRegisterType, GeneralRegisterType]):
    """
    bitwise or of r and s, stored in r
    ```C
    x[r] = x[r] | x[s]
    ```

    See external [documentation](https://www.felixcloutier.com/x86/or).
    """

    name = "x86.rs.or"

name = 'x86.rs.or' class-attribute instance-attribute

RS_XorOp dataclass

Bases: RS_Operation[GeneralRegisterType, GeneralRegisterType]

bitwise xor of r and s, stored in r

x[r] = x[r] ^ x[s]

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
@irdl_op_definition
class RS_XorOp(RS_Operation[GeneralRegisterType, GeneralRegisterType]):
    """
    bitwise xor of r and s, stored in r
    ```C
    x[r] = x[r] ^ x[s]
    ```

    See external [documentation](https://www.felixcloutier.com/x86/xor).
    """

    name = "x86.rs.xor"

name = 'x86.rs.xor' class-attribute instance-attribute

DS_MovOpHasCanonicalizationPatterns dataclass

Bases: HasCanonicalizationPatternsTrait

Source code in xdsl/dialects/x86/ops.py
1493
1494
1495
1496
1497
1498
class DS_MovOpHasCanonicalizationPatterns(HasCanonicalizationPatternsTrait):
    @classmethod
    def get_canonicalization_patterns(cls) -> tuple[RewritePattern, ...]:
        from xdsl.transforms.canonicalization_patterns.x86 import RemoveRedundantDS_Mov

        return (RemoveRedundantDS_Mov(),)

get_canonicalization_patterns() -> tuple[RewritePattern, ...] classmethod

Source code in xdsl/dialects/x86/ops.py
1494
1495
1496
1497
1498
@classmethod
def get_canonicalization_patterns(cls) -> tuple[RewritePattern, ...]:
    from xdsl.transforms.canonicalization_patterns.x86 import RemoveRedundantDS_Mov

    return (RemoveRedundantDS_Mov(),)

DS_MovOp dataclass

Bases: DS_Operation[X86RegisterType, GeneralRegisterType]

Copies the value of s into r.

x[r] = x[s]

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
@irdl_op_definition
class DS_MovOp(DS_Operation[X86RegisterType, GeneralRegisterType]):
    """
    Copies the value of s into r.
    ```C
    x[r] = x[s]
    ```

    See external [documentation](https://www.felixcloutier.com/x86/mov).
    """

    name = "x86.ds.mov"

    traits = traits_def(Pure(), DS_MovOpHasCanonicalizationPatterns())

name = 'x86.ds.mov' class-attribute instance-attribute

traits = traits_def(Pure(), DS_MovOpHasCanonicalizationPatterns()) class-attribute instance-attribute

DS_VpbroadcastdOp dataclass

Bases: DS_Operation[X86VectorRegisterType, GeneralRegisterType]

Broadcast single precision floating-point scalar in s to d.

x[r] = x[s]

See external documentation

Source code in xdsl/dialects/x86/ops.py
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
@irdl_op_definition
class DS_VpbroadcastdOp(DS_Operation[X86VectorRegisterType, GeneralRegisterType]):
    """
    Broadcast single precision floating-point scalar in s to d.
    ```C
    x[r] = x[s]
    ```

    See external [documentation](https://www.felixcloutier.com/x86/vpbroadcast)
    """

    name = "x86.ds.vpbroadcastd"

name = 'x86.ds.vpbroadcastd' class-attribute instance-attribute

DS_VpbroadcastqOp dataclass

Bases: DS_Operation[X86VectorRegisterType, GeneralRegisterType]

Broadcast double precision floating-point scalar in s to d.

x[r] = x[s]

See external documentation

Source code in xdsl/dialects/x86/ops.py
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
@irdl_op_definition
class DS_VpbroadcastqOp(DS_Operation[X86VectorRegisterType, GeneralRegisterType]):
    """
    Broadcast double precision floating-point scalar in s to d.
    ```C
    x[r] = x[s]
    ```

    See external [documentation](https://www.felixcloutier.com/x86/vpbroadcast)
    """

    name = "x86.ds.vpbroadcastq"

name = 'x86.ds.vpbroadcastq' class-attribute instance-attribute

S_PushOp

Bases: X86Instruction, X86CustomFormatOperation

Decreases %rsp and places s at the new memory location pointed to by %rsp.

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
@irdl_op_definition
class S_PushOp(X86Instruction, X86CustomFormatOperation):
    """
    Decreases %rsp and places s at the new memory location pointed to by %rsp.

    See external [documentation](https://www.felixcloutier.com/x86/push).
    """

    name = "x86.s.push"

    rsp_in = operand_def(RSP)
    rsp_out = result_def(RSP)
    source = operand_def(X86RegisterType)

    def __init__(
        self,
        rsp_in: Operation | SSAValue,
        source: Operation | SSAValue,
        *,
        comment: str | StringAttr | None = None,
    ):
        if isinstance(comment, str):
            comment = StringAttr(comment)

        super().__init__(
            operands=[rsp_in, source],
            attributes={
                "comment": comment,
            },
            result_types=[RSP],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        return (self.source,)

name = 'x86.s.push' class-attribute instance-attribute

rsp_in = operand_def(RSP) class-attribute instance-attribute

rsp_out = result_def(RSP) class-attribute instance-attribute

source = operand_def(X86RegisterType) class-attribute instance-attribute

__init__(rsp_in: Operation | SSAValue, source: Operation | SSAValue, *, comment: str | StringAttr | None = None)

Source code in xdsl/dialects/x86/ops.py
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
def __init__(
    self,
    rsp_in: Operation | SSAValue,
    source: Operation | SSAValue,
    *,
    comment: str | StringAttr | None = None,
):
    if isinstance(comment, str):
        comment = StringAttr(comment)

    super().__init__(
        operands=[rsp_in, source],
        attributes={
            "comment": comment,
        },
        result_types=[RSP],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
1577
1578
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    return (self.source,)

D_PopOp

Bases: X86Instruction, X86CustomFormatOperation

Copies the value at the top of the stack into d and increases %rsp.

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
@irdl_op_definition
class D_PopOp(X86Instruction, X86CustomFormatOperation):
    """
    Copies the value at the top of the stack into d and increases %rsp.

    See external [documentation](https://www.felixcloutier.com/x86/pop).
    """

    name = "x86.d.pop"

    rsp_in = operand_def(RSP)
    rsp_out = result_def(RSP)
    destination = result_def(X86RegisterType)

    def __init__(
        self,
        rsp_in: Operation | SSAValue,
        *,
        comment: str | StringAttr | None = None,
        destination: X86RegisterType,
    ):
        if isinstance(comment, str):
            comment = StringAttr(comment)

        super().__init__(
            operands=[rsp_in],
            attributes={
                "comment": comment,
            },
            result_types=[RSP, destination],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        return (self.destination,)

name = 'x86.d.pop' class-attribute instance-attribute

rsp_in = operand_def(RSP) class-attribute instance-attribute

rsp_out = result_def(RSP) class-attribute instance-attribute

destination = result_def(X86RegisterType) class-attribute instance-attribute

__init__(rsp_in: Operation | SSAValue, *, comment: str | StringAttr | None = None, destination: X86RegisterType)

Source code in xdsl/dialects/x86/ops.py
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
def __init__(
    self,
    rsp_in: Operation | SSAValue,
    *,
    comment: str | StringAttr | None = None,
    destination: X86RegisterType,
):
    if isinstance(comment, str):
        comment = StringAttr(comment)

    super().__init__(
        operands=[rsp_in],
        attributes={
            "comment": comment,
        },
        result_types=[RSP, destination],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
1613
1614
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    return (self.destination,)

R_NegOp dataclass

Bases: R_Operation[GeneralRegisterType]

Negates r and stores the result in r.

x[r] = -x[r]

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
@irdl_op_definition
class R_NegOp(R_Operation[GeneralRegisterType]):
    """
    Negates r and stores the result in r.
    ```C
    x[r] = -x[r]
    ```

    See external [documentation](https://www.felixcloutier.com/x86/neg).
    """

    name = "x86.r.neg"

name = 'x86.r.neg' class-attribute instance-attribute

R_NotOp dataclass

Bases: R_Operation[GeneralRegisterType]

bitwise not of r, stored in r

x[r] = ~x[r]

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
@irdl_op_definition
class R_NotOp(R_Operation[GeneralRegisterType]):
    """
    bitwise not of r, stored in r
    ```C
    x[r] = ~x[r]
    ```

    See external [documentation](https://www.felixcloutier.com/x86/not).
    """

    name = "x86.r.not"

name = 'x86.r.not' class-attribute instance-attribute

R_IncOp dataclass

Bases: R_Operation[GeneralRegisterType]

Increments r by 1 and stores the result in r.

x[r] = x[r] + 1

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
@irdl_op_definition
class R_IncOp(R_Operation[GeneralRegisterType]):
    """
    Increments r by 1 and stores the result in r.
    ```C
    x[r] = x[r] + 1
    ```

    See external [documentation](https://www.felixcloutier.com/x86/inc).
    """

    name = "x86.r.inc"

name = 'x86.r.inc' class-attribute instance-attribute

R_DecOp dataclass

Bases: R_Operation[GeneralRegisterType]

Decrements r by 1 and stores the result in r.

x[r] = x[r] - 1

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
@irdl_op_definition
class R_DecOp(R_Operation[GeneralRegisterType]):
    """
    Decrements r by 1 and stores the result in r.
    ```C
    x[r] = x[r] - 1
    ```

    See external [documentation](https://www.felixcloutier.com/x86/dec).
    """

    name = "x86.r.dec"

name = 'x86.r.dec' class-attribute instance-attribute

S_IDivOp

Bases: X86Instruction, X86CustomFormatOperation

Divides the value in RDX:RAX by s and stores the quotient in RAX and the remainder in RDX.

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
@irdl_op_definition
class S_IDivOp(X86Instruction, X86CustomFormatOperation):
    """
    Divides the value in RDX:RAX by s and stores the quotient in RAX and the remainder
    in RDX.

    See external [documentation](https://www.felixcloutier.com/x86/idiv).
    """

    name = "x86.s.idiv"

    source = operand_def(X86RegisterType)
    rdx_input = operand_def(RDX)
    rax_input = operand_def(RAX)

    rdx_output = result_def(RDX)
    rax_output = result_def(RAX)

    def __init__(
        self,
        source: Operation | SSAValue,
        rdx_input: Operation | SSAValue,
        rax_input: Operation | SSAValue,
        *,
        comment: str | StringAttr | None = None,
        rdx_output: GeneralRegisterType,
        rax_output: GeneralRegisterType,
    ):
        if isinstance(comment, str):
            comment = StringAttr(comment)

        super().__init__(
            operands=[source, rdx_input, rax_input],
            attributes={
                "comment": comment,
            },
            result_types=[rdx_output, rax_output],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        return (self.source,)

name = 'x86.s.idiv' class-attribute instance-attribute

source = operand_def(X86RegisterType) class-attribute instance-attribute

rdx_input = operand_def(RDX) class-attribute instance-attribute

rax_input = operand_def(RAX) class-attribute instance-attribute

rdx_output = result_def(RDX) class-attribute instance-attribute

rax_output = result_def(RAX) class-attribute instance-attribute

__init__(source: Operation | SSAValue, rdx_input: Operation | SSAValue, rax_input: Operation | SSAValue, *, comment: str | StringAttr | None = None, rdx_output: GeneralRegisterType, rax_output: GeneralRegisterType)

Source code in xdsl/dialects/x86/ops.py
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
def __init__(
    self,
    source: Operation | SSAValue,
    rdx_input: Operation | SSAValue,
    rax_input: Operation | SSAValue,
    *,
    comment: str | StringAttr | None = None,
    rdx_output: GeneralRegisterType,
    rax_output: GeneralRegisterType,
):
    if isinstance(comment, str):
        comment = StringAttr(comment)

    super().__init__(
        operands=[source, rdx_input, rax_input],
        attributes={
            "comment": comment,
        },
        result_types=[rdx_output, rax_output],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
1712
1713
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    return (self.source,)

S_ImulOp

Bases: X86Instruction, X86CustomFormatOperation

The source operand is multiplied by the value in the RAX register and the product is stored in the RDX:RAX registers.

x[RDX:RAX] = x[RAX] * s

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
@irdl_op_definition
class S_ImulOp(X86Instruction, X86CustomFormatOperation):
    """
    The source operand is multiplied by the value in the RAX register and the product is
    stored in the RDX:RAX registers.
    ```C
    x[RDX:RAX] = x[RAX] * s
    ```

    See external [documentation](https://www.felixcloutier.com/x86/imul).
    """

    name = "x86.s.imul"

    source = operand_def(GeneralRegisterType)
    rax_input = operand_def(RAX)

    rdx_output = result_def(RDX)
    rax_output = result_def(RAX)

    def __init__(
        self,
        source: Operation | SSAValue,
        rax_input: Operation | SSAValue,
        *,
        comment: str | StringAttr | None = None,
        rdx_output: GeneralRegisterType,
        rax_output: GeneralRegisterType,
    ):
        if isinstance(comment, str):
            comment = StringAttr(comment)

        super().__init__(
            operands=[source, rax_input],
            attributes={
                "comment": comment,
            },
            result_types=[rdx_output, rax_output],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        return (self.source,)

name = 'x86.s.imul' class-attribute instance-attribute

source = operand_def(GeneralRegisterType) class-attribute instance-attribute

rax_input = operand_def(RAX) class-attribute instance-attribute

rdx_output = result_def(RDX) class-attribute instance-attribute

rax_output = result_def(RAX) class-attribute instance-attribute

__init__(source: Operation | SSAValue, rax_input: Operation | SSAValue, *, comment: str | StringAttr | None = None, rdx_output: GeneralRegisterType, rax_output: GeneralRegisterType)

Source code in xdsl/dialects/x86/ops.py
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
def __init__(
    self,
    source: Operation | SSAValue,
    rax_input: Operation | SSAValue,
    *,
    comment: str | StringAttr | None = None,
    rdx_output: GeneralRegisterType,
    rax_output: GeneralRegisterType,
):
    if isinstance(comment, str):
        comment = StringAttr(comment)

    super().__init__(
        operands=[source, rax_input],
        attributes={
            "comment": comment,
        },
        result_types=[rdx_output, rax_output],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
1756
1757
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    return (self.source,)

RM_AddOp dataclass

Bases: RM_Operation[GeneralRegisterType, GeneralRegisterType]

Adds the value from the memory location pointed to by m to r and stores the result in r.

x[r] = x[r] + [x[m]]

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
@irdl_op_definition
class RM_AddOp(RM_Operation[GeneralRegisterType, GeneralRegisterType]):
    """
    Adds the value from the memory location pointed to by m to r and stores the result
    in r.
    ```C
    x[r] = x[r] + [x[m]]
    ```

    See external [documentation](https://www.felixcloutier.com/x86/add).
    """

    name = "x86.rm.add"

name = 'x86.rm.add' class-attribute instance-attribute

RM_SubOp dataclass

Bases: RM_Operation[GeneralRegisterType, GeneralRegisterType]

Subtracts the value from the memory location pointed to by m from r and stores the result in r.

x[r] = x[r] - [x[m]]

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
@irdl_op_definition
class RM_SubOp(RM_Operation[GeneralRegisterType, GeneralRegisterType]):
    """
    Subtracts the value from the memory location pointed to by m from r and stores the
    result in r.
    ```C
    x[r] = x[r] - [x[m]]
    ```

    See external [documentation](https://www.felixcloutier.com/x86/sub).
    """

    name = "x86.rm.sub"

name = 'x86.rm.sub' class-attribute instance-attribute

RM_ImulOp dataclass

Bases: RM_Operation[GeneralRegisterType, GeneralRegisterType]

Multiplies the value from the memory location pointed to by m with r and stores the result in r.

x[r] = x[r] * [x[m]]

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
@irdl_op_definition
class RM_ImulOp(RM_Operation[GeneralRegisterType, GeneralRegisterType]):
    """
    Multiplies the value from the memory location pointed to by m with r and stores the
    result in r.
    ```C
    x[r] = x[r] * [x[m]]
    ```

    See external [documentation](https://www.felixcloutier.com/x86/imul).
    """

    name = "x86.rm.imul"

name = 'x86.rm.imul' class-attribute instance-attribute

RM_AndOp dataclass

Bases: RM_Operation[GeneralRegisterType, GeneralRegisterType]

bitwise and of r and [m], stored in r

x[r] = x[r] & [x[m]]

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
@irdl_op_definition
class RM_AndOp(RM_Operation[GeneralRegisterType, GeneralRegisterType]):
    """
    bitwise and of r and [m], stored in r
    ```C
    x[r] = x[r] & [x[m]]
    ```

    See external [documentation](https://www.felixcloutier.com/x86/and).
    """

    name = "x86.rm.and"

name = 'x86.rm.and' class-attribute instance-attribute

RM_OrOp dataclass

Bases: RM_Operation[GeneralRegisterType, GeneralRegisterType]

bitwise or of r and [m], stored in r

x[r] = x[r] | [x[m]]

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
@irdl_op_definition
class RM_OrOp(RM_Operation[GeneralRegisterType, GeneralRegisterType]):
    """
    bitwise or of r and [m], stored in r
    ```C
    x[r] = x[r] | [x[m]]
    ```

    See external [documentation](https://www.felixcloutier.com/x86/or).
    """

    name = "x86.rm.or"

name = 'x86.rm.or' class-attribute instance-attribute

RM_XorOp dataclass

Bases: RM_Operation[GeneralRegisterType, GeneralRegisterType]

bitwise xor of r and [m], stored in r

x[r] = x[r] ^ [x[m]]

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
@irdl_op_definition
class RM_XorOp(RM_Operation[GeneralRegisterType, GeneralRegisterType]):
    """
    bitwise xor of r and [m], stored in r
    ```C
    x[r] = x[r] ^ [x[m]]
    ```

    See external [documentation](https://www.felixcloutier.com/x86/xor).
    """

    name = "x86.rm.xor"

name = 'x86.rm.xor' class-attribute instance-attribute

DM_MovOp dataclass

Bases: DM_Operation[GeneralRegisterType, GeneralRegisterType]

Copies the value from the memory location pointed to by source register m into destination register d.

x[d] = [x[m]]

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
@irdl_op_definition
class DM_MovOp(DM_Operation[GeneralRegisterType, GeneralRegisterType]):
    """
    Copies the value from the memory location pointed to by source register m into destination register d.
    ```C
    x[d] = [x[m]]
    ```

    See external [documentation](https://www.felixcloutier.com/x86/mov).
    """

    name = "x86.dm.mov"

name = 'x86.dm.mov' class-attribute instance-attribute

DM_LeaOp dataclass

Bases: DM_Operation[GeneralRegisterType, GeneralRegisterType]

Loads the effective address of the memory location pointed to by m into d.

x[d] = &x[m]

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
@irdl_op_definition
class DM_LeaOp(DM_Operation[GeneralRegisterType, GeneralRegisterType]):
    """
    Loads the effective address of the memory location pointed to by m into d.
    ```C
    x[d] = &x[m]
    ```

    See external [documentation](https://www.felixcloutier.com/x86/lea).
    """

    name = "x86.dm.lea"

name = 'x86.dm.lea' class-attribute instance-attribute

RI_AddOp dataclass

Bases: RI_Operation[GeneralRegisterType]

Adds the immediate value to r and stores the result in r.

x[r] = x[r] + immediate

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
@irdl_op_definition
class RI_AddOp(RI_Operation[GeneralRegisterType]):
    """
    Adds the immediate value to r and stores the result in r.
    ```C
    x[r] = x[r] + immediate
    ```

    See external [documentation](https://www.felixcloutier.com/x86/add).
    """

    name = "x86.ri.add"

name = 'x86.ri.add' class-attribute instance-attribute

RI_SubOp dataclass

Bases: RI_Operation[GeneralRegisterType]

Subtracts the immediate value from r and stores the result in r.

x[r] = x[r] - immediate

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
@irdl_op_definition
class RI_SubOp(RI_Operation[GeneralRegisterType]):
    """
    Subtracts the immediate value from r and stores the result in r.
    ```C
    x[r] = x[r] - immediate
    ```

    See external [documentation](https://www.felixcloutier.com/x86/sub).
    """

    name = "x86.ri.sub"

name = 'x86.ri.sub' class-attribute instance-attribute

RI_AndOp dataclass

Bases: RI_Operation[GeneralRegisterType]

bitwise and of r and immediate, stored in r

x[r] = x[r] & immediate

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
@irdl_op_definition
class RI_AndOp(RI_Operation[GeneralRegisterType]):
    """
    bitwise and of r and immediate, stored in r
    ```C
    x[r] = x[r] & immediate
    ```

    See external [documentation](https://www.felixcloutier.com/x86/and).
    """

    name = "x86.ri.and"

name = 'x86.ri.and' class-attribute instance-attribute

RI_OrOp dataclass

Bases: RI_Operation[GeneralRegisterType]

bitwise or of r and immediate, stored in r

x[r] = x[r] | immediate

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
@irdl_op_definition
class RI_OrOp(RI_Operation[GeneralRegisterType]):
    """
    bitwise or of r and immediate, stored in r
    ```C
    x[r] = x[r] | immediate
    ```

    See external [documentation](https://www.felixcloutier.com/x86/or).
    """

    name = "x86.ri.or"

name = 'x86.ri.or' class-attribute instance-attribute

RI_XorOp dataclass

Bases: RI_Operation[GeneralRegisterType]

bitwise xor of r and immediate, stored in r

x[r] = x[r] ^ immediate

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
@irdl_op_definition
class RI_XorOp(RI_Operation[GeneralRegisterType]):
    """
    bitwise xor of r and immediate, stored in r
    ```C
    x[r] = x[r] ^ immediate
    ```

    See external [documentation](https://www.felixcloutier.com/x86/xor).
    """

    name = "x86.ri.xor"

name = 'x86.ri.xor' class-attribute instance-attribute

DI_MovOp dataclass

Bases: DI_Operation[GeneralRegisterType]

Copies the immediate value into r.

x[r] = immediate

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
@irdl_op_definition
class DI_MovOp(DI_Operation[GeneralRegisterType]):
    """
    Copies the immediate value into r.
    ```C
    x[r] = immediate
    ```

    See external [documentation](https://www.felixcloutier.com/x86/mov).
    """

    name = "x86.di.mov"

    traits = traits_def(Pure())

name = 'x86.di.mov' class-attribute instance-attribute

traits = traits_def(Pure()) class-attribute instance-attribute

MS_AddOp dataclass

Bases: MS_Operation[GeneralRegisterType, GeneralRegisterType]

Adds the value from s to the memory location pointed to by m.

[x[m]] = [x[m]] + x[s]

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
@irdl_op_definition
class MS_AddOp(MS_Operation[GeneralRegisterType, GeneralRegisterType]):
    """
    Adds the value from s to the memory location pointed to by m.
    ```C
    [x[m]] = [x[m]] + x[s]
    ```

    See external [documentation](https://www.felixcloutier.com/x86/add).
    """

    name = "x86.ms.add"

name = 'x86.ms.add' class-attribute instance-attribute

MS_SubOp dataclass

Bases: MS_Operation[GeneralRegisterType, GeneralRegisterType]

Subtracts the value from s from the memory location pointed to by m. [x[m]] = [x[m]] - x[s]

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
@irdl_op_definition
class MS_SubOp(MS_Operation[GeneralRegisterType, GeneralRegisterType]):
    """
    Subtracts the value from s from the memory location pointed to by m.
    [x[m]] = [x[m]] - x[s]

    See external [documentation](https://www.felixcloutier.com/x86/sub).
    """

    name = "x86.ms.sub"

name = 'x86.ms.sub' class-attribute instance-attribute

MS_AndOp dataclass

Bases: MS_Operation[GeneralRegisterType, GeneralRegisterType]

bitwise and of [m] and s [x[m]] = [x[m]] & x[s]

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
@irdl_op_definition
class MS_AndOp(MS_Operation[GeneralRegisterType, GeneralRegisterType]):
    """
    bitwise and of [m] and s
    [x[m]] = [x[m]] & x[s]

    See external [documentation](https://www.felixcloutier.com/x86/and).
    """

    name = "x86.ms.and"

name = 'x86.ms.and' class-attribute instance-attribute

MS_OrOp dataclass

Bases: MS_Operation[GeneralRegisterType, GeneralRegisterType]

bitwise or of [m] and s [x[m]] = [x[m]] | x[s]

See external documentation.

Source code in xdsl/dialects/x86/ops.py
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
@irdl_op_definition
class MS_OrOp(MS_Operation[GeneralRegisterType, GeneralRegisterType]):
    """
    bitwise or of [m] and s
    [x[m]] = [x[m]] | x[s]

    See external [documentation](https://www.felixcloutier.com/x86/or).
    """

    name = "x86.ms.or"

name = 'x86.ms.or' class-attribute instance-attribute

MS_XorOp dataclass

Bases: MS_Operation[GeneralRegisterType, GeneralRegisterType]

bitwise xor of [m] and s [x[m]] = [x[m]] ^ x[s]

See external documentation.

Source code in xdsl/dialects/x86/ops.py
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
@irdl_op_definition
class MS_XorOp(MS_Operation[GeneralRegisterType, GeneralRegisterType]):
    """
    bitwise xor of [m] and s
    [x[m]] = [x[m]] ^ x[s]

    See external [documentation](https://www.felixcloutier.com/x86/xor).
    """

    name = "x86.ms.xor"

name = 'x86.ms.xor' class-attribute instance-attribute

MS_MovOp dataclass

Bases: MS_Operation[GeneralRegisterType, GeneralRegisterType]

Copies the value from s into the memory location pointed to by m. [x[m]] = x[s]

See external documentation.

Source code in xdsl/dialects/x86/ops.py
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
@irdl_op_definition
class MS_MovOp(MS_Operation[GeneralRegisterType, GeneralRegisterType]):
    """
    Copies the value from s into the memory location pointed to by m.
    [x[m]] = x[s]

    See external [documentation](https://www.felixcloutier.com/x86/mov).
    """

    name = "x86.ms.mov"

name = 'x86.ms.mov' class-attribute instance-attribute

MI_AddOp dataclass

Bases: MI_Operation[GeneralRegisterType]

Adds the immediate value to the memory location pointed to by m. [x[m]] = [x[m]] + immediate

See external documentation.

Source code in xdsl/dialects/x86/ops.py
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
@irdl_op_definition
class MI_AddOp(MI_Operation[GeneralRegisterType]):
    """
    Adds the immediate value to the memory location pointed to by m.
    [x[m]] = [x[m]] + immediate

    See external [documentation](https://www.felixcloutier.com/x86/add).
    """

    name = "x86.mi.add"

name = 'x86.mi.add' class-attribute instance-attribute

MI_SubOp dataclass

Bases: MI_Operation[GeneralRegisterType]

Subtracts the immediate value from the memory location pointed to by m. [x[m]] = [x[m]] - immediate

See external documentation.

Source code in xdsl/dialects/x86/ops.py
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
@irdl_op_definition
class MI_SubOp(MI_Operation[GeneralRegisterType]):
    """
    Subtracts the immediate value from the memory location pointed to by m.
    [x[m]] = [x[m]] - immediate

    See external [documentation](https://www.felixcloutier.com/x86/sub).
    """

    name = "x86.mi.sub"

name = 'x86.mi.sub' class-attribute instance-attribute

MI_AndOp dataclass

Bases: MI_Operation[GeneralRegisterType]

bitwise and of immediate and [m], stored in [m]

[x[m]] = [x[m]] & immediate

See external documentation.

Source code in xdsl/dialects/x86/ops.py
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
@irdl_op_definition
class MI_AndOp(MI_Operation[GeneralRegisterType]):
    """
    bitwise and of immediate and [m], stored in [m]
    ```C
    [x[m]] = [x[m]] & immediate
    ```

    See external [documentation](https://www.felixcloutier.com/x86/and).
    """

    name = "x86.mi.and"

name = 'x86.mi.and' class-attribute instance-attribute

MI_OrOp dataclass

Bases: MI_Operation[GeneralRegisterType]

bitwise or of immediate and [m], stored in [m]

[x[m]] = [x[m]] | immediate

See external documentation.

Source code in xdsl/dialects/x86/ops.py
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
@irdl_op_definition
class MI_OrOp(MI_Operation[GeneralRegisterType]):
    """
    bitwise or of immediate and [m], stored in [m]
    ```C
    [x[m]] = [x[m]] | immediate
    ```

    See external [documentation](https://www.felixcloutier.com/x86/or).
    """

    name = "x86.mi.or"

name = 'x86.mi.or' class-attribute instance-attribute

MI_XorOp dataclass

Bases: MI_Operation[GeneralRegisterType]

bitwise xor of immediate and [m], stored in [m]

[x[m]] = [x[m]] ^ immediate

See external documentation.

Source code in xdsl/dialects/x86/ops.py
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
@irdl_op_definition
class MI_XorOp(MI_Operation[GeneralRegisterType]):
    """
    bitwise xor of immediate and [m], stored in [m]
    ```C
    [x[m]] = [x[m]] ^ immediate
    ```

    See external [documentation](https://www.felixcloutier.com/x86/xor).
    """

    name = "x86.mi.xor"

name = 'x86.mi.xor' class-attribute instance-attribute

MI_MovOp dataclass

Bases: MI_Operation[GeneralRegisterType]

Copies the immediate value into the memory location pointed to by m. [x[m]] = immediate

See external documentation.

Source code in xdsl/dialects/x86/ops.py
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
@irdl_op_definition
class MI_MovOp(MI_Operation[GeneralRegisterType]):
    """
    Copies the immediate value into the memory location pointed to by m.
    [x[m]] = immediate

    See external [documentation](https://www.felixcloutier.com/x86/mov).
    """

    name = "x86.mi.mov"

name = 'x86.mi.mov' class-attribute instance-attribute

DSI_ImulOp dataclass

Bases: DSI_Operation[GeneralRegisterType, GeneralRegisterType]

Multiplies the immediate value with the source register and stores the result in the destination register. x[d] = x[s] * immediate

See external documentation.

Source code in xdsl/dialects/x86/ops.py
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
@irdl_op_definition
class DSI_ImulOp(DSI_Operation[GeneralRegisterType, GeneralRegisterType]):
    """
    Multiplies the immediate value with the source register and stores the result in the destination register.
    x[d] = x[s] * immediate

    See external [documentation](https://www.felixcloutier.com/x86/imul).
    """

    name = "x86.dsi.imul"

name = 'x86.dsi.imul' class-attribute instance-attribute

DMI_ImulOp dataclass

Bases: DMI_Operation[GeneralRegisterType, GeneralRegisterType]

Multiplies the immediate value with the memory location pointed to by m and stores the result in d. x[d] = [x[m]] * immediate

See external documentation.

Source code in xdsl/dialects/x86/ops.py
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
@irdl_op_definition
class DMI_ImulOp(DMI_Operation[GeneralRegisterType, GeneralRegisterType]):
    """
    Multiplies the immediate value with the memory location pointed to by m and stores the result in d.
    x[d] = [x[m]] * immediate

    See external [documentation](https://www.felixcloutier.com/x86/imul).
    """

    name = "x86.dmi.imul"

name = 'x86.dmi.imul' class-attribute instance-attribute

M_PushOp

Bases: X86Instruction, X86CustomFormatOperation

Decreases %rsp and places [m] at the new memory location pointed to by %rsp.

See external documentation.

Source code in xdsl/dialects/x86/ops.py
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
@irdl_op_definition
class M_PushOp(X86Instruction, X86CustomFormatOperation):
    """
    Decreases %rsp and places [m] at the new memory location pointed to by %rsp.

    See external [documentation](https://www.felixcloutier.com/x86/push).
    """

    name = "x86.m.push"

    rsp_in = operand_def(RSP)
    rsp_out = result_def(RSP)

    memory = operand_def(X86RegisterType)
    memory_offset = attr_def(IntegerAttr, default_value=IntegerAttr(0, 64))

    traits = traits_def(MemoryWriteEffect())

    def __init__(
        self,
        rsp_in: Operation | SSAValue,
        memory: Operation | SSAValue,
        *,
        comment: str | StringAttr | None = None,
        memory_offset: int | IntegerAttr,
        rsp_out: GeneralRegisterType,
    ):
        if isinstance(comment, str):
            comment = StringAttr(comment)
        if isinstance(memory_offset, int):
            memory_offset = IntegerAttr(memory_offset, 64)

        super().__init__(
            operands=[rsp_in, memory],
            attributes={
                "memory_offset": memory_offset,
                "comment": comment,
            },
            result_types=[rsp_out],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        memory_access = memory_access_str(self.memory, self.memory_offset)
        return (memory_access,)

    @classmethod
    def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
        attributes = dict[str, Attribute]()
        if offset := cls.parse_optional_memory_access_offset(parser):
            attributes["memory_offset"] = offset
        return attributes

    def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
        printer.print_string(", ")
        print_immediate_value(printer, self.memory_offset)
        return {"memory_offset"}

name = 'x86.m.push' class-attribute instance-attribute

rsp_in = operand_def(RSP) class-attribute instance-attribute

rsp_out = result_def(RSP) class-attribute instance-attribute

memory = operand_def(X86RegisterType) class-attribute instance-attribute

memory_offset = attr_def(IntegerAttr, default_value=(IntegerAttr(0, 64))) class-attribute instance-attribute

traits = traits_def(MemoryWriteEffect()) class-attribute instance-attribute

__init__(rsp_in: Operation | SSAValue, memory: Operation | SSAValue, *, comment: str | StringAttr | None = None, memory_offset: int | IntegerAttr, rsp_out: GeneralRegisterType)

Source code in xdsl/dialects/x86/ops.py
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
def __init__(
    self,
    rsp_in: Operation | SSAValue,
    memory: Operation | SSAValue,
    *,
    comment: str | StringAttr | None = None,
    memory_offset: int | IntegerAttr,
    rsp_out: GeneralRegisterType,
):
    if isinstance(comment, str):
        comment = StringAttr(comment)
    if isinstance(memory_offset, int):
        memory_offset = IntegerAttr(memory_offset, 64)

    super().__init__(
        operands=[rsp_in, memory],
        attributes={
            "memory_offset": memory_offset,
            "comment": comment,
        },
        result_types=[rsp_out],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
2178
2179
2180
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    memory_access = memory_access_str(self.memory, self.memory_offset)
    return (memory_access,)

custom_parse_attributes(parser: Parser) -> dict[str, Attribute] classmethod

Source code in xdsl/dialects/x86/ops.py
2182
2183
2184
2185
2186
2187
@classmethod
def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
    attributes = dict[str, Attribute]()
    if offset := cls.parse_optional_memory_access_offset(parser):
        attributes["memory_offset"] = offset
    return attributes

custom_print_attributes(printer: Printer) -> AbstractSet[str]

Source code in xdsl/dialects/x86/ops.py
2189
2190
2191
2192
def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
    printer.print_string(", ")
    print_immediate_value(printer, self.memory_offset)
    return {"memory_offset"}

M_PopOp

Bases: X86Instruction, X86CustomFormatOperation

Copies the value at the top of the stack into [m] and increases %rsp. The value held by m is a pointer to the memory location where the value is stored. The only register modified by this operation is %rsp.

See external documentation.

Source code in xdsl/dialects/x86/ops.py
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
@irdl_op_definition
class M_PopOp(X86Instruction, X86CustomFormatOperation):
    """
    Copies the value at the top of the stack into [m] and increases %rsp.
    The value held by m is a pointer to the memory location where the value is stored.
    The only register modified by this operation is %rsp.

    See external [documentation](https://www.felixcloutier.com/x86/pop).
    """

    name = "x86.m.pop"

    rsp_in = operand_def(RSP)
    memory = operand_def(GeneralRegisterType)
    memory_offset = attr_def(IntegerAttr, default_value=IntegerAttr(0, 64))
    rsp_out = result_def(RSP)

    traits = traits_def(MemoryWriteEffect())

    def __init__(
        self,
        rsp_in: Operation | SSAValue,
        memory: Operation | SSAValue,
        *,
        comment: str | StringAttr | None = None,
        memory_offset: int | IntegerAttr,
        rsp_out: GeneralRegisterType,
    ):
        if isinstance(memory_offset, int):
            memory_offset = IntegerAttr(memory_offset, 64)
        if isinstance(comment, str):
            comment = StringAttr(comment)

        super().__init__(
            operands=[rsp_in, memory],
            attributes={
                "comment": comment,
            },
            result_types=[rsp_out],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        memory_access = memory_access_str(self.memory, self.memory_offset)
        return (memory_access,)

    @classmethod
    def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
        attributes = dict[str, Attribute]()
        temp = parse_optional_immediate_value(
            parser, IntegerType(64, Signedness.SIGNED)
        )
        if temp is not None:
            attributes["memory_offset"] = temp
        return attributes

    def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
        printer.print_string(", ")
        print_immediate_value(printer, self.memory_offset)
        return {"memory_offset"}

name = 'x86.m.pop' class-attribute instance-attribute

rsp_in = operand_def(RSP) class-attribute instance-attribute

memory = operand_def(GeneralRegisterType) class-attribute instance-attribute

memory_offset = attr_def(IntegerAttr, default_value=(IntegerAttr(0, 64))) class-attribute instance-attribute

rsp_out = result_def(RSP) class-attribute instance-attribute

traits = traits_def(MemoryWriteEffect()) class-attribute instance-attribute

__init__(rsp_in: Operation | SSAValue, memory: Operation | SSAValue, *, comment: str | StringAttr | None = None, memory_offset: int | IntegerAttr, rsp_out: GeneralRegisterType)

Source code in xdsl/dialects/x86/ops.py
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
def __init__(
    self,
    rsp_in: Operation | SSAValue,
    memory: Operation | SSAValue,
    *,
    comment: str | StringAttr | None = None,
    memory_offset: int | IntegerAttr,
    rsp_out: GeneralRegisterType,
):
    if isinstance(memory_offset, int):
        memory_offset = IntegerAttr(memory_offset, 64)
    if isinstance(comment, str):
        comment = StringAttr(comment)

    super().__init__(
        operands=[rsp_in, memory],
        attributes={
            "comment": comment,
        },
        result_types=[rsp_out],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
2236
2237
2238
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    memory_access = memory_access_str(self.memory, self.memory_offset)
    return (memory_access,)

custom_parse_attributes(parser: Parser) -> dict[str, Attribute] classmethod

Source code in xdsl/dialects/x86/ops.py
2240
2241
2242
2243
2244
2245
2246
2247
2248
@classmethod
def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
    attributes = dict[str, Attribute]()
    temp = parse_optional_immediate_value(
        parser, IntegerType(64, Signedness.SIGNED)
    )
    if temp is not None:
        attributes["memory_offset"] = temp
    return attributes

custom_print_attributes(printer: Printer) -> AbstractSet[str]

Source code in xdsl/dialects/x86/ops.py
2250
2251
2252
2253
def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
    printer.print_string(", ")
    print_immediate_value(printer, self.memory_offset)
    return {"memory_offset"}

M_NegOp dataclass

Bases: M_Operation[GeneralRegisterType]

Negates the value at the memory location pointed to by m.

[x[m]] = -[x[m]]

See external documentation.

Source code in xdsl/dialects/x86/ops.py
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
@irdl_op_definition
class M_NegOp(M_Operation[GeneralRegisterType]):
    """
    Negates the value at the memory location pointed to by m.
    ```C
    [x[m]] = -[x[m]]
    ```

    See external [documentation](https://www.felixcloutier.com/x86/neg).
    """

    name = "x86.m.neg"

name = 'x86.m.neg' class-attribute instance-attribute

M_NotOp dataclass

Bases: M_Operation[GeneralRegisterType]

bitwise not of [m], stored in [m]

[x[m]] = ~[x[m]]

See external documentation.

Source code in xdsl/dialects/x86/ops.py
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
@irdl_op_definition
class M_NotOp(M_Operation[GeneralRegisterType]):
    """
    bitwise not of [m], stored in [m]
    ```C
    [x[m]] = ~[x[m]]
    ```

    See external [documentation](https://www.felixcloutier.com/x86/not).
    """

    name = "x86.m.not"

name = 'x86.m.not' class-attribute instance-attribute

M_IncOp dataclass

Bases: M_Operation[GeneralRegisterType]

Increments the value at the memory location pointed to by m. [x[m]] = [x[m]] + 1

See external documentation.

Source code in xdsl/dialects/x86/ops.py
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
@irdl_op_definition
class M_IncOp(M_Operation[GeneralRegisterType]):
    """
    Increments the value at the memory location pointed to by m.
    [x[m]] = [x[m]] + 1

    See external [documentation](https://www.felixcloutier.com/x86/inc).
    """

    name = "x86.m.inc"

name = 'x86.m.inc' class-attribute instance-attribute

M_DecOp dataclass

Bases: M_Operation[GeneralRegisterType]

Decrements the value at the memory location pointed to by m. [x[m]] = [x[m]] - 1

See external documentation.

Source code in xdsl/dialects/x86/ops.py
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
@irdl_op_definition
class M_DecOp(M_Operation[GeneralRegisterType]):
    """
    Decrements the value at the memory location pointed to by m.
    [x[m]] = [x[m]] - 1

    See external [documentation](https://www.felixcloutier.com/x86/dec).
    """

    name = "x86.m.dec"

name = 'x86.m.dec' class-attribute instance-attribute

M_IDivOp

Bases: X86Instruction, X86CustomFormatOperation

Divides the value in RDX:RAX by [m] and stores the quotient in RAX and the remainder in RDX.

See external documentation.

Source code in xdsl/dialects/x86/ops.py
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
@irdl_op_definition
class M_IDivOp(X86Instruction, X86CustomFormatOperation):
    """
    Divides the value in RDX:RAX by [m] and stores the quotient in RAX and the remainder in RDX.

    See external [documentation](https://www.felixcloutier.com/x86/idiv).
    """

    name = "x86.m.idiv"

    memory = operand_def(X86RegisterType)
    memory_offset = attr_def(IntegerAttr, default_value=IntegerAttr(0, 64))
    rdx_in = operand_def(RDX)
    rdx_out = result_def(RDX)
    rax_in = operand_def(RAX)
    rax_out = result_def(RAX)

    traits = traits_def(MemoryReadEffect())

    def __init__(
        self,
        memory: Operation | SSAValue,
        rdx_in: Operation | SSAValue,
        rax_in: Operation | SSAValue,
        memory_offset: int | IntegerAttr,
        *,
        comment: str | StringAttr | None = None,
        rdx_out: GeneralRegisterType,
        rax_out: GeneralRegisterType,
    ):
        if isinstance(memory_offset, int):
            memory_offset = IntegerAttr(memory_offset, 64)
        if isinstance(comment, str):
            comment = StringAttr(comment)

        super().__init__(
            operands=[memory, rdx_in, rax_in],
            attributes={
                "memory_offset": memory_offset,
                "comment": comment,
            },
            result_types=[rdx_out, rax_out],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        memory_access = memory_access_str(self.memory, self.memory_offset)
        return (memory_access,)

    @classmethod
    def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
        attributes = dict[str, Attribute]()
        if offset := cls.parse_optional_memory_access_offset(parser):
            attributes["memory_offset"] = offset
        return attributes

    def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
        printer.print_string(", ")
        print_immediate_value(printer, self.memory_offset)
        return {"memory_offset"}

name = 'x86.m.idiv' class-attribute instance-attribute

memory = operand_def(X86RegisterType) class-attribute instance-attribute

memory_offset = attr_def(IntegerAttr, default_value=(IntegerAttr(0, 64))) class-attribute instance-attribute

rdx_in = operand_def(RDX) class-attribute instance-attribute

rdx_out = result_def(RDX) class-attribute instance-attribute

rax_in = operand_def(RAX) class-attribute instance-attribute

rax_out = result_def(RAX) class-attribute instance-attribute

traits = traits_def(MemoryReadEffect()) class-attribute instance-attribute

__init__(memory: Operation | SSAValue, rdx_in: Operation | SSAValue, rax_in: Operation | SSAValue, memory_offset: int | IntegerAttr, *, comment: str | StringAttr | None = None, rdx_out: GeneralRegisterType, rax_out: GeneralRegisterType)

Source code in xdsl/dialects/x86/ops.py
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
def __init__(
    self,
    memory: Operation | SSAValue,
    rdx_in: Operation | SSAValue,
    rax_in: Operation | SSAValue,
    memory_offset: int | IntegerAttr,
    *,
    comment: str | StringAttr | None = None,
    rdx_out: GeneralRegisterType,
    rax_out: GeneralRegisterType,
):
    if isinstance(memory_offset, int):
        memory_offset = IntegerAttr(memory_offset, 64)
    if isinstance(comment, str):
        comment = StringAttr(comment)

    super().__init__(
        operands=[memory, rdx_in, rax_in],
        attributes={
            "memory_offset": memory_offset,
            "comment": comment,
        },
        result_types=[rdx_out, rax_out],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
2352
2353
2354
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    memory_access = memory_access_str(self.memory, self.memory_offset)
    return (memory_access,)

custom_parse_attributes(parser: Parser) -> dict[str, Attribute] classmethod

Source code in xdsl/dialects/x86/ops.py
2356
2357
2358
2359
2360
2361
@classmethod
def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
    attributes = dict[str, Attribute]()
    if offset := cls.parse_optional_memory_access_offset(parser):
        attributes["memory_offset"] = offset
    return attributes

custom_print_attributes(printer: Printer) -> AbstractSet[str]

Source code in xdsl/dialects/x86/ops.py
2363
2364
2365
2366
def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
    printer.print_string(", ")
    print_immediate_value(printer, self.memory_offset)
    return {"memory_offset"}

M_ImulOp

Bases: X86Instruction, X86CustomFormatOperation

The source operand is multiplied by the value in the RAX register and the product is stored in the RDX:RAX registers. x[RDX:RAX] = x[RAX] * [x[m]]

See external documentation.

Source code in xdsl/dialects/x86/ops.py
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
@irdl_op_definition
class M_ImulOp(X86Instruction, X86CustomFormatOperation):
    """
    The source operand is multiplied by the value in the RAX register and the product is stored in the RDX:RAX registers.
    x[RDX:RAX] = x[RAX] * [x[m]]

    See external [documentation](https://www.felixcloutier.com/x86/imul).
    """

    name = "x86.m.imul"

    memory = operand_def(GeneralRegisterType)
    memory_offset = attr_def(IntegerAttr, default_value=IntegerAttr(0, 64))

    rdx_out = result_def(RDX)

    rax_in = operand_def(RAX)
    rax_out = result_def(RAX)

    traits = traits_def(MemoryReadEffect())

    def __init__(
        self,
        memory: Operation | SSAValue,
        rax_in: Operation | SSAValue,
        memory_offset: int | IntegerAttr,
        *,
        comment: str | StringAttr | None = None,
        rdx_out: GeneralRegisterType,
        rax_out: GeneralRegisterType,
    ):
        if isinstance(memory_offset, int):
            memory_offset = IntegerAttr(memory_offset, 64)
        if isinstance(comment, str):
            comment = StringAttr(comment)

        super().__init__(
            operands=[memory, rax_in],
            attributes={
                "memory_offset": memory_offset,
                "comment": comment,
            },
            result_types=[rdx_out, rax_out],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        memory_access = memory_access_str(self.memory, self.memory_offset)
        return (memory_access,)

    @classmethod
    def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
        attributes = dict[str, Attribute]()
        temp = parse_optional_immediate_value(
            parser, IntegerType(64, Signedness.SIGNED)
        )
        if temp is not None:
            attributes["memory_offset"] = temp
        return attributes

    def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
        printer.print_string(", ")
        print_immediate_value(printer, self.memory_offset)
        return {"memory_offset"}

name = 'x86.m.imul' class-attribute instance-attribute

memory = operand_def(GeneralRegisterType) class-attribute instance-attribute

memory_offset = attr_def(IntegerAttr, default_value=(IntegerAttr(0, 64))) class-attribute instance-attribute

rdx_out = result_def(RDX) class-attribute instance-attribute

rax_in = operand_def(RAX) class-attribute instance-attribute

rax_out = result_def(RAX) class-attribute instance-attribute

traits = traits_def(MemoryReadEffect()) class-attribute instance-attribute

__init__(memory: Operation | SSAValue, rax_in: Operation | SSAValue, memory_offset: int | IntegerAttr, *, comment: str | StringAttr | None = None, rdx_out: GeneralRegisterType, rax_out: GeneralRegisterType)

Source code in xdsl/dialects/x86/ops.py
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
def __init__(
    self,
    memory: Operation | SSAValue,
    rax_in: Operation | SSAValue,
    memory_offset: int | IntegerAttr,
    *,
    comment: str | StringAttr | None = None,
    rdx_out: GeneralRegisterType,
    rax_out: GeneralRegisterType,
):
    if isinstance(memory_offset, int):
        memory_offset = IntegerAttr(memory_offset, 64)
    if isinstance(comment, str):
        comment = StringAttr(comment)

    super().__init__(
        operands=[memory, rax_in],
        attributes={
            "memory_offset": memory_offset,
            "comment": comment,
        },
        result_types=[rdx_out, rax_out],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
2414
2415
2416
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    memory_access = memory_access_str(self.memory, self.memory_offset)
    return (memory_access,)

custom_parse_attributes(parser: Parser) -> dict[str, Attribute] classmethod

Source code in xdsl/dialects/x86/ops.py
2418
2419
2420
2421
2422
2423
2424
2425
2426
@classmethod
def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
    attributes = dict[str, Attribute]()
    temp = parse_optional_immediate_value(
        parser, IntegerType(64, Signedness.SIGNED)
    )
    if temp is not None:
        attributes["memory_offset"] = temp
    return attributes

custom_print_attributes(printer: Printer) -> AbstractSet[str]

Source code in xdsl/dialects/x86/ops.py
2428
2429
2430
2431
def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
    printer.print_string(", ")
    print_immediate_value(printer, self.memory_offset)
    return {"memory_offset"}

LabelOp

Bases: X86AsmOperation, X86RegallocOperation, X86CustomFormatOperation

The label operation is used to emit text labels (e.g. loop:) that are used as branch, unconditional jump targets and symbol offsets.

Source code in xdsl/dialects/x86/ops.py
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
@irdl_op_definition
class LabelOp(X86AsmOperation, X86RegallocOperation, X86CustomFormatOperation):
    """
    The label operation is used to emit text labels (e.g. loop:) that are used
    as branch, unconditional jump targets and symbol offsets.
    """

    name = "x86.label"
    label = attr_def(LabelAttr)
    comment = opt_attr_def(StringAttr)

    def __init__(
        self,
        label: str | LabelAttr,
        *,
        comment: str | StringAttr | None = None,
    ):
        if isinstance(label, str):
            label = LabelAttr(label)
        if isinstance(comment, str):
            comment = StringAttr(comment)

        super().__init__(
            attributes={
                "label": label,
                "comment": comment,
            },
        )

    def assembly_line(self) -> str | None:
        return AssemblyPrinter.append_comment(f"{self.label.data}:", self.comment)

    @classmethod
    def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
        attributes = dict[str, Attribute]()
        attributes["label"] = LabelAttr(parser.parse_str_literal("Expected label"))
        return attributes

    def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
        printer.print_string(" ")
        printer.print_string_literal(self.label.data)
        return {"label"}

    def print_op_type(self, printer: Printer) -> None:
        return

    @classmethod
    def parse_op_type(
        cls, parser: Parser
    ) -> tuple[Sequence[Attribute], Sequence[Attribute]]:
        return (), ()

name = 'x86.label' class-attribute instance-attribute

label = attr_def(LabelAttr) class-attribute instance-attribute

comment = opt_attr_def(StringAttr) class-attribute instance-attribute

__init__(label: str | LabelAttr, *, comment: str | StringAttr | None = None)

Source code in xdsl/dialects/x86/ops.py
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
def __init__(
    self,
    label: str | LabelAttr,
    *,
    comment: str | StringAttr | None = None,
):
    if isinstance(label, str):
        label = LabelAttr(label)
    if isinstance(comment, str):
        comment = StringAttr(comment)

    super().__init__(
        attributes={
            "label": label,
            "comment": comment,
        },
    )

assembly_line() -> str | None

Source code in xdsl/dialects/x86/ops.py
2463
2464
def assembly_line(self) -> str | None:
    return AssemblyPrinter.append_comment(f"{self.label.data}:", self.comment)

custom_parse_attributes(parser: Parser) -> dict[str, Attribute] classmethod

Source code in xdsl/dialects/x86/ops.py
2466
2467
2468
2469
2470
@classmethod
def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
    attributes = dict[str, Attribute]()
    attributes["label"] = LabelAttr(parser.parse_str_literal("Expected label"))
    return attributes

custom_print_attributes(printer: Printer) -> AbstractSet[str]

Source code in xdsl/dialects/x86/ops.py
2472
2473
2474
2475
def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
    printer.print_string(" ")
    printer.print_string_literal(self.label.data)
    return {"label"}

print_op_type(printer: Printer) -> None

Source code in xdsl/dialects/x86/ops.py
2477
2478
def print_op_type(self, printer: Printer) -> None:
    return

parse_op_type(parser: Parser) -> tuple[Sequence[Attribute], Sequence[Attribute]] classmethod

Source code in xdsl/dialects/x86/ops.py
2480
2481
2482
2483
2484
@classmethod
def parse_op_type(
    cls, parser: Parser
) -> tuple[Sequence[Attribute], Sequence[Attribute]]:
    return (), ()

DirectiveOp

Bases: X86AsmOperation, X86RegallocOperation, X86CustomFormatOperation

The directive operation is used to represent a directive in the assembly code. (e.g. .globl; .type etc)

Source code in xdsl/dialects/x86/ops.py
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
@irdl_op_definition
class DirectiveOp(X86AsmOperation, X86RegallocOperation, X86CustomFormatOperation):
    """
    The directive operation is used to represent a directive in the assembly code. (e.g. .globl; .type etc)
    """

    name = "x86.directive"

    directive = attr_def(StringAttr)
    value = opt_attr_def(StringAttr)

    def __init__(
        self,
        directive: str | StringAttr,
        value: str | StringAttr | None,
    ):
        if isinstance(directive, str):
            directive = StringAttr(directive)
        if isinstance(value, str):
            value = StringAttr(value)

        super().__init__(
            attributes={
                "directive": directive,
                "value": value,
            },
        )

    def assembly_line(self) -> str | None:
        if self.value is not None and self.value.data:
            arg_str = assembly_arg_str(self.value.data)
        else:
            arg_str = ""

        return AssemblyPrinter.assembly_line(
            self.directive.data, arg_str, is_indented=False
        )

    @classmethod
    def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
        attributes = dict[str, Attribute]()
        attributes["directive"] = StringAttr(
            parser.parse_str_literal("Expected directive")
        )
        if (value := parser.parse_optional_str_literal()) is not None:
            attributes["value"] = StringAttr(value)
        return attributes

    def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
        printer.print_string(" ")
        printer.print_string_literal(self.directive.data)
        if self.value is not None:
            printer.print_string(" ")
            printer.print_string_literal(self.value.data)
        return {"directive", "value"}

    def print_op_type(self, printer: Printer) -> None:
        return

    @classmethod
    def parse_op_type(
        cls, parser: Parser
    ) -> tuple[Sequence[Attribute], Sequence[Attribute]]:
        return (), ()

name = 'x86.directive' class-attribute instance-attribute

directive = attr_def(StringAttr) class-attribute instance-attribute

value = opt_attr_def(StringAttr) class-attribute instance-attribute

__init__(directive: str | StringAttr, value: str | StringAttr | None)

Source code in xdsl/dialects/x86/ops.py
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
def __init__(
    self,
    directive: str | StringAttr,
    value: str | StringAttr | None,
):
    if isinstance(directive, str):
        directive = StringAttr(directive)
    if isinstance(value, str):
        value = StringAttr(value)

    super().__init__(
        attributes={
            "directive": directive,
            "value": value,
        },
    )

assembly_line() -> str | None

Source code in xdsl/dialects/x86/ops.py
2515
2516
2517
2518
2519
2520
2521
2522
2523
def assembly_line(self) -> str | None:
    if self.value is not None and self.value.data:
        arg_str = assembly_arg_str(self.value.data)
    else:
        arg_str = ""

    return AssemblyPrinter.assembly_line(
        self.directive.data, arg_str, is_indented=False
    )

custom_parse_attributes(parser: Parser) -> dict[str, Attribute] classmethod

Source code in xdsl/dialects/x86/ops.py
2525
2526
2527
2528
2529
2530
2531
2532
2533
@classmethod
def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
    attributes = dict[str, Attribute]()
    attributes["directive"] = StringAttr(
        parser.parse_str_literal("Expected directive")
    )
    if (value := parser.parse_optional_str_literal()) is not None:
        attributes["value"] = StringAttr(value)
    return attributes

custom_print_attributes(printer: Printer) -> AbstractSet[str]

Source code in xdsl/dialects/x86/ops.py
2535
2536
2537
2538
2539
2540
2541
def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
    printer.print_string(" ")
    printer.print_string_literal(self.directive.data)
    if self.value is not None:
        printer.print_string(" ")
        printer.print_string_literal(self.value.data)
    return {"directive", "value"}

print_op_type(printer: Printer) -> None

Source code in xdsl/dialects/x86/ops.py
2543
2544
def print_op_type(self, printer: Printer) -> None:
    return

parse_op_type(parser: Parser) -> tuple[Sequence[Attribute], Sequence[Attribute]] classmethod

Source code in xdsl/dialects/x86/ops.py
2546
2547
2548
2549
2550
@classmethod
def parse_op_type(
    cls, parser: Parser
) -> tuple[Sequence[Attribute], Sequence[Attribute]]:
    return (), ()

C_JmpOp

Bases: X86Instruction, X86CustomFormatOperation

Unconditional jump to the label specified in destination.

See external documentation.

Source code in xdsl/dialects/x86/ops.py
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
@irdl_op_definition
class C_JmpOp(X86Instruction, X86CustomFormatOperation):
    """
    Unconditional jump to the label specified in destination.

    See external [documentation](https://www.felixcloutier.com/x86/jmp).
    """

    name = "x86.c.jmp"

    block_values = var_operand_def(X86RegisterType)

    successor = successor_def()

    traits = traits_def(IsTerminator())

    def __init__(
        self,
        block_values: Sequence[SSAValue],
        successor: Successor,
        *,
        comment: str | StringAttr | None = None,
    ):
        if isinstance(comment, str):
            comment = StringAttr(comment)

        super().__init__(
            operands=[block_values],
            attributes={
                "comment": comment,
            },
            successors=(successor,),
        )

    def verify_(self) -> None:
        # Types of arguments must match arg types of blocks

        for op_arg, block_arg in zip(self.block_values, self.successor.args):
            if op_arg.type != block_arg.type:
                raise VerifyException(
                    f"Block arg types must match {op_arg.type} {block_arg.type}"
                )

        if not isinstance(self.successor.first_op, LabelOp):
            raise VerifyException(
                "jmp operation successor must have a x86.label operation as a "
                f"first argument, found {self.successor.first_op}"
            )

    def print(self, printer: Printer) -> None:
        printer.print_string(" ")
        printer.print_block_name(self.successor)
        printer.print_string("(")
        printer.print_list(self.block_values, lambda val: print_type_pair(printer, val))
        printer.print_string(")")
        if self.attributes:
            printer.print_op_attributes(self.attributes, print_keyword=True)

    @classmethod
    def parse(cls, parser: Parser) -> Self:
        successor = parser.parse_successor()
        block_values = parser.parse_comma_separated_list(
            parser.Delimiter.PAREN, lambda: parse_type_pair(parser)
        )
        attrs = parser.parse_optional_attr_dict_with_keyword()
        op = cls(block_values, successor)
        if attrs is not None:
            op.attributes |= attrs.data
        return op

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg, ...]:
        dest_label = self.successor.first_op
        assert isinstance(dest_label, LabelOp)
        dest_label_str = dest_label.label.data
        if dest_label_str.isdigit():
            # x86 Assembly: Numeric jump labels must be annotated with a suffix.
            # Jumping backward in code requires appending 'b' (e.g., "1b"), and
            # jumping forward requires appending 'f' (e.g., "1f").
            # Proper support for generating these labels is currently unimplemented.
            raise NotImplementedError(
                "Assembly printing for jumps to numeric labels not implemented"
            )
        return (dest_label_str,)

name = 'x86.c.jmp' class-attribute instance-attribute

block_values = var_operand_def(X86RegisterType) class-attribute instance-attribute

successor = successor_def() class-attribute instance-attribute

traits = traits_def(IsTerminator()) class-attribute instance-attribute

__init__(block_values: Sequence[SSAValue], successor: Successor, *, comment: str | StringAttr | None = None)

Source code in xdsl/dialects/x86/ops.py
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
def __init__(
    self,
    block_values: Sequence[SSAValue],
    successor: Successor,
    *,
    comment: str | StringAttr | None = None,
):
    if isinstance(comment, str):
        comment = StringAttr(comment)

    super().__init__(
        operands=[block_values],
        attributes={
            "comment": comment,
        },
        successors=(successor,),
    )

verify_() -> None

Source code in xdsl/dialects/x86/ops.py
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
def verify_(self) -> None:
    # Types of arguments must match arg types of blocks

    for op_arg, block_arg in zip(self.block_values, self.successor.args):
        if op_arg.type != block_arg.type:
            raise VerifyException(
                f"Block arg types must match {op_arg.type} {block_arg.type}"
            )

    if not isinstance(self.successor.first_op, LabelOp):
        raise VerifyException(
            "jmp operation successor must have a x86.label operation as a "
            f"first argument, found {self.successor.first_op}"
        )

print(printer: Printer) -> None

Source code in xdsl/dialects/x86/ops.py
2602
2603
2604
2605
2606
2607
2608
2609
def print(self, printer: Printer) -> None:
    printer.print_string(" ")
    printer.print_block_name(self.successor)
    printer.print_string("(")
    printer.print_list(self.block_values, lambda val: print_type_pair(printer, val))
    printer.print_string(")")
    if self.attributes:
        printer.print_op_attributes(self.attributes, print_keyword=True)

parse(parser: Parser) -> Self classmethod

Source code in xdsl/dialects/x86/ops.py
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
@classmethod
def parse(cls, parser: Parser) -> Self:
    successor = parser.parse_successor()
    block_values = parser.parse_comma_separated_list(
        parser.Delimiter.PAREN, lambda: parse_type_pair(parser)
    )
    attrs = parser.parse_optional_attr_dict_with_keyword()
    op = cls(block_values, successor)
    if attrs is not None:
        op.attributes |= attrs.data
    return op

assembly_line_args() -> tuple[AssemblyInstructionArg, ...]

Source code in xdsl/dialects/x86/ops.py
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
def assembly_line_args(self) -> tuple[AssemblyInstructionArg, ...]:
    dest_label = self.successor.first_op
    assert isinstance(dest_label, LabelOp)
    dest_label_str = dest_label.label.data
    if dest_label_str.isdigit():
        # x86 Assembly: Numeric jump labels must be annotated with a suffix.
        # Jumping backward in code requires appending 'b' (e.g., "1b"), and
        # jumping forward requires appending 'f' (e.g., "1f").
        # Proper support for generating these labels is currently unimplemented.
        raise NotImplementedError(
            "Assembly printing for jumps to numeric labels not implemented"
        )
    return (dest_label_str,)

FallthroughOp

Bases: X86AsmOperation, X86RegallocOperation, X86CustomFormatOperation

Continue execution into the next block. The successor of this operation must be immediately after this operation's parent.

Source code in xdsl/dialects/x86/ops.py
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
@irdl_op_definition
class FallthroughOp(X86AsmOperation, X86RegallocOperation, X86CustomFormatOperation):
    """
    Continue execution into the next block.
    The successor of this operation must be immediately after this operation's parent.
    """

    name = "x86.fallthrough"

    block_values = var_operand_def(X86RegisterType)

    successor = successor_def()

    traits = traits_def(IsTerminator())

    def __init__(
        self,
        block_values: Sequence[SSAValue],
        successor: Successor,
        *,
        comment: str | StringAttr | None = None,
    ):
        if isinstance(comment, str):
            comment = StringAttr(comment)

        super().__init__(
            operands=[block_values],
            attributes={
                "comment": comment,
            },
            successors=(successor,),
        )

    def verify_(self) -> None:
        # Types of arguments must match arg types of blocks

        for op_arg, block_arg in zip(self.block_values, self.successor.args):
            if op_arg.type != block_arg.type:
                raise VerifyException(
                    f"Block arg types must match {op_arg.type} {block_arg.type}"
                )

        if (parent := self.parent) is not None:
            if parent.next_block is not self.successor:
                raise VerifyException(
                    "Fallthrough op successor must immediately follow its parent."
                )

    def print(self, printer: Printer) -> None:
        printer.print_string(" ")
        printer.print_block_name(self.successor)
        printer.print_string("(")
        printer.print_list(self.block_values, lambda val: print_type_pair(printer, val))
        printer.print_string(")")
        if self.attributes:
            printer.print_op_attributes(self.attributes, print_keyword=True)

    @classmethod
    def parse(cls, parser: Parser) -> Self:
        successor = parser.parse_successor()
        block_values = parser.parse_comma_separated_list(
            parser.Delimiter.PAREN, lambda: parse_type_pair(parser)
        )
        attrs = parser.parse_optional_attr_dict_with_keyword()
        op = cls(block_values, successor)
        if attrs is not None:
            op.attributes |= attrs.data
        return op

    def assembly_line(self) -> str | None:
        # Not printed in assembly
        return None

name = 'x86.fallthrough' class-attribute instance-attribute

block_values = var_operand_def(X86RegisterType) class-attribute instance-attribute

successor = successor_def() class-attribute instance-attribute

traits = traits_def(IsTerminator()) class-attribute instance-attribute

__init__(block_values: Sequence[SSAValue], successor: Successor, *, comment: str | StringAttr | None = None)

Source code in xdsl/dialects/x86/ops.py
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
def __init__(
    self,
    block_values: Sequence[SSAValue],
    successor: Successor,
    *,
    comment: str | StringAttr | None = None,
):
    if isinstance(comment, str):
        comment = StringAttr(comment)

    super().__init__(
        operands=[block_values],
        attributes={
            "comment": comment,
        },
        successors=(successor,),
    )

verify_() -> None

Source code in xdsl/dialects/x86/ops.py
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
def verify_(self) -> None:
    # Types of arguments must match arg types of blocks

    for op_arg, block_arg in zip(self.block_values, self.successor.args):
        if op_arg.type != block_arg.type:
            raise VerifyException(
                f"Block arg types must match {op_arg.type} {block_arg.type}"
            )

    if (parent := self.parent) is not None:
        if parent.next_block is not self.successor:
            raise VerifyException(
                "Fallthrough op successor must immediately follow its parent."
            )

print(printer: Printer) -> None

Source code in xdsl/dialects/x86/ops.py
2686
2687
2688
2689
2690
2691
2692
2693
def print(self, printer: Printer) -> None:
    printer.print_string(" ")
    printer.print_block_name(self.successor)
    printer.print_string("(")
    printer.print_list(self.block_values, lambda val: print_type_pair(printer, val))
    printer.print_string(")")
    if self.attributes:
        printer.print_op_attributes(self.attributes, print_keyword=True)

parse(parser: Parser) -> Self classmethod

Source code in xdsl/dialects/x86/ops.py
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
@classmethod
def parse(cls, parser: Parser) -> Self:
    successor = parser.parse_successor()
    block_values = parser.parse_comma_separated_list(
        parser.Delimiter.PAREN, lambda: parse_type_pair(parser)
    )
    attrs = parser.parse_optional_attr_dict_with_keyword()
    op = cls(block_values, successor)
    if attrs is not None:
        op.attributes |= attrs.data
    return op

assembly_line() -> str | None

Source code in xdsl/dialects/x86/ops.py
2707
2708
2709
def assembly_line(self) -> str | None:
    # Not printed in assembly
    return None

SS_CmpOp

Bases: X86Instruction, X86CustomFormatOperation

Compares the first source operand with the second source operand and sets the status flags in the EFLAGS register according to the results.

See external documentation.

Source code in xdsl/dialects/x86/ops.py
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
@irdl_op_definition
class SS_CmpOp(X86Instruction, X86CustomFormatOperation):
    """
    Compares the first source operand with the second source operand and sets the status
    flags in the EFLAGS register according to the results.

    See external [documentation](https://www.felixcloutier.com/x86/cmp).
    """

    name = "x86.ss.cmp"

    source1 = operand_def(X86RegisterType)
    source2 = operand_def(X86RegisterType)

    result = result_def(RFLAGSRegisterType)

    def __init__(
        self,
        source1: Operation | SSAValue,
        source2: Operation | SSAValue,
        *,
        comment: str | StringAttr | None = None,
        result: RFLAGSRegisterType,
    ):
        if isinstance(comment, str):
            comment = StringAttr(comment)

        super().__init__(
            operands=[source1, source2],
            attributes={
                "comment": comment,
            },
            result_types=[result],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        return self.source1, self.source2

name = 'x86.ss.cmp' class-attribute instance-attribute

source1 = operand_def(X86RegisterType) class-attribute instance-attribute

source2 = operand_def(X86RegisterType) class-attribute instance-attribute

result = result_def(RFLAGSRegisterType) class-attribute instance-attribute

__init__(source1: Operation | SSAValue, source2: Operation | SSAValue, *, comment: str | StringAttr | None = None, result: RFLAGSRegisterType)

Source code in xdsl/dialects/x86/ops.py
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
def __init__(
    self,
    source1: Operation | SSAValue,
    source2: Operation | SSAValue,
    *,
    comment: str | StringAttr | None = None,
    result: RFLAGSRegisterType,
):
    if isinstance(comment, str):
        comment = StringAttr(comment)

    super().__init__(
        operands=[source1, source2],
        attributes={
            "comment": comment,
        },
        result_types=[result],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
2747
2748
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    return self.source1, self.source2

SM_CmpOp

Bases: X86Instruction, X86CustomFormatOperation

Compares the first source operand with the second source operand and sets the status flags in the EFLAGS register according to the results.

See external documentation.

Source code in xdsl/dialects/x86/ops.py
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
@irdl_op_definition
class SM_CmpOp(X86Instruction, X86CustomFormatOperation):
    """
    Compares the first source operand with the second source operand and sets the status
    flags in the EFLAGS register according to the results.

    See external [documentation](https://www.felixcloutier.com/x86/cmp).
    """

    name = "x86.sm.cmp"

    source = operand_def(GeneralRegisterType)
    memory = operand_def(GeneralRegisterType)
    memory_offset = attr_def(IntegerAttr, default_value=IntegerAttr(0, 64))

    result = result_def(RFLAGSRegisterType)

    traits = traits_def(MemoryReadEffect())

    def __init__(
        self,
        source: Operation | SSAValue,
        memory: Operation | SSAValue,
        memory_offset: int | IntegerAttr,
        *,
        comment: str | StringAttr | None = None,
        result: RFLAGSRegisterType,
    ):
        if isinstance(memory_offset, int):
            memory_offset = IntegerAttr(memory_offset, 64)
        if isinstance(comment, str):
            comment = StringAttr(comment)

        super().__init__(
            operands=[source, memory],
            attributes={
                "memory_offset": memory_offset,
                "comment": comment,
            },
            result_types=[result],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        memory_access = memory_access_str(self.memory, self.memory_offset)
        return self.source, memory_access

    @classmethod
    def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
        attributes = dict[str, Attribute]()
        temp = parse_optional_immediate_value(
            parser, IntegerType(64, Signedness.SIGNED)
        )
        if temp is not None:
            attributes["memory_offset"] = temp
        return attributes

    def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
        printer.print_string(", ")
        print_immediate_value(printer, self.memory_offset)
        return {"memory_offset"}

name = 'x86.sm.cmp' class-attribute instance-attribute

source = operand_def(GeneralRegisterType) class-attribute instance-attribute

memory = operand_def(GeneralRegisterType) class-attribute instance-attribute

memory_offset = attr_def(IntegerAttr, default_value=(IntegerAttr(0, 64))) class-attribute instance-attribute

result = result_def(RFLAGSRegisterType) class-attribute instance-attribute

traits = traits_def(MemoryReadEffect()) class-attribute instance-attribute

__init__(source: Operation | SSAValue, memory: Operation | SSAValue, memory_offset: int | IntegerAttr, *, comment: str | StringAttr | None = None, result: RFLAGSRegisterType)

Source code in xdsl/dialects/x86/ops.py
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
def __init__(
    self,
    source: Operation | SSAValue,
    memory: Operation | SSAValue,
    memory_offset: int | IntegerAttr,
    *,
    comment: str | StringAttr | None = None,
    result: RFLAGSRegisterType,
):
    if isinstance(memory_offset, int):
        memory_offset = IntegerAttr(memory_offset, 64)
    if isinstance(comment, str):
        comment = StringAttr(comment)

    super().__init__(
        operands=[source, memory],
        attributes={
            "memory_offset": memory_offset,
            "comment": comment,
        },
        result_types=[result],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
2793
2794
2795
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    memory_access = memory_access_str(self.memory, self.memory_offset)
    return self.source, memory_access

custom_parse_attributes(parser: Parser) -> dict[str, Attribute] classmethod

Source code in xdsl/dialects/x86/ops.py
2797
2798
2799
2800
2801
2802
2803
2804
2805
@classmethod
def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
    attributes = dict[str, Attribute]()
    temp = parse_optional_immediate_value(
        parser, IntegerType(64, Signedness.SIGNED)
    )
    if temp is not None:
        attributes["memory_offset"] = temp
    return attributes

custom_print_attributes(printer: Printer) -> AbstractSet[str]

Source code in xdsl/dialects/x86/ops.py
2807
2808
2809
2810
def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
    printer.print_string(", ")
    print_immediate_value(printer, self.memory_offset)
    return {"memory_offset"}

SI_CmpOp

Bases: X86Instruction, X86CustomFormatOperation

Compares the first source operand with the second source operand and sets the status flags in the EFLAGS register according to the results.

See external documentation.

Source code in xdsl/dialects/x86/ops.py
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
@irdl_op_definition
class SI_CmpOp(X86Instruction, X86CustomFormatOperation):
    """
    Compares the first source operand with the second source operand and sets the status
    flags in the EFLAGS register according to the results.

    See external [documentation](https://www.felixcloutier.com/x86/cmp).
    """

    name = "x86.si.cmp"

    source = operand_def(GeneralRegisterType)
    immediate = attr_def(IntegerAttr)

    result = result_def(RFLAGS)

    def __init__(
        self,
        source: Operation | SSAValue,
        immediate: int | IntegerAttr,
        *,
        comment: str | StringAttr | None = None,
    ):
        if isinstance(immediate, int):
            immediate = IntegerAttr(immediate, 32)
        if isinstance(comment, str):
            comment = StringAttr(comment)

        super().__init__(
            operands=[source],
            attributes={
                "immediate": immediate,
                "comment": comment,
            },
            result_types=[RFLAGS],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg, ...]:
        return self.source, self.immediate

    @classmethod
    def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
        attributes = dict[str, Attribute]()
        temp = parse_immediate_value(parser, IntegerType(32, Signedness.SIGNED))
        attributes["immediate"] = temp
        return attributes

    def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
        printer.print_string(", ")
        print_immediate_value(printer, self.immediate)
        return {"immediate"}

name = 'x86.si.cmp' class-attribute instance-attribute

source = operand_def(GeneralRegisterType) class-attribute instance-attribute

immediate = attr_def(IntegerAttr) class-attribute instance-attribute

result = result_def(RFLAGS) class-attribute instance-attribute

__init__(source: Operation | SSAValue, immediate: int | IntegerAttr, *, comment: str | StringAttr | None = None)

Source code in xdsl/dialects/x86/ops.py
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
def __init__(
    self,
    source: Operation | SSAValue,
    immediate: int | IntegerAttr,
    *,
    comment: str | StringAttr | None = None,
):
    if isinstance(immediate, int):
        immediate = IntegerAttr(immediate, 32)
    if isinstance(comment, str):
        comment = StringAttr(comment)

    super().__init__(
        operands=[source],
        attributes={
            "immediate": immediate,
            "comment": comment,
        },
        result_types=[RFLAGS],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg, ...]

Source code in xdsl/dialects/x86/ops.py
2850
2851
def assembly_line_args(self) -> tuple[AssemblyInstructionArg, ...]:
    return self.source, self.immediate

custom_parse_attributes(parser: Parser) -> dict[str, Attribute] classmethod

Source code in xdsl/dialects/x86/ops.py
2853
2854
2855
2856
2857
2858
@classmethod
def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
    attributes = dict[str, Attribute]()
    temp = parse_immediate_value(parser, IntegerType(32, Signedness.SIGNED))
    attributes["immediate"] = temp
    return attributes

custom_print_attributes(printer: Printer) -> AbstractSet[str]

Source code in xdsl/dialects/x86/ops.py
2860
2861
2862
2863
def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
    printer.print_string(", ")
    print_immediate_value(printer, self.immediate)
    return {"immediate"}

MS_CmpOp

Bases: X86Instruction, X86CustomFormatOperation

Compares the first source operand with the second source operand and sets the status flags in the EFLAGS register according to the results.

See external documentation.

Source code in xdsl/dialects/x86/ops.py
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
@irdl_op_definition
class MS_CmpOp(X86Instruction, X86CustomFormatOperation):
    """
    Compares the first source operand with the second source operand and sets the status
    flags in the EFLAGS register according to the results.

    See external [documentation](https://www.felixcloutier.com/x86/cmp).
    """

    name = "x86.ms.cmp"

    memory = operand_def(GeneralRegisterType)
    memory_offset = attr_def(IntegerAttr, default_value=IntegerAttr(0, 64))
    source = operand_def(GeneralRegisterType)

    result = result_def(RFLAGSRegisterType)

    traits = traits_def(MemoryReadEffect())

    def __init__(
        self,
        memory: Operation | SSAValue,
        source: Operation | SSAValue,
        memory_offset: int | IntegerAttr,
        *,
        comment: str | StringAttr | None = None,
        result: RFLAGSRegisterType,
    ):
        if isinstance(memory_offset, int):
            memory_offset = IntegerAttr(memory_offset, 64)
        if isinstance(comment, str):
            comment = StringAttr(comment)

        super().__init__(
            operands=[memory, source],
            attributes={
                "memory_offset": memory_offset,
                "comment": comment,
            },
            result_types=[result],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        memory_access = memory_access_str(self.memory, self.memory_offset)
        return memory_access, self.source

    @classmethod
    def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
        attributes = dict[str, Attribute]()
        temp = parse_optional_immediate_value(
            parser, IntegerType(64, Signedness.SIGNED)
        )
        if temp is not None:
            attributes["memory_offset"] = temp
        return attributes

    def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
        printer.print_string(", ")
        print_immediate_value(printer, self.memory_offset)
        return {"memory_offset"}

name = 'x86.ms.cmp' class-attribute instance-attribute

memory = operand_def(GeneralRegisterType) class-attribute instance-attribute

memory_offset = attr_def(IntegerAttr, default_value=(IntegerAttr(0, 64))) class-attribute instance-attribute

source = operand_def(GeneralRegisterType) class-attribute instance-attribute

result = result_def(RFLAGSRegisterType) class-attribute instance-attribute

traits = traits_def(MemoryReadEffect()) class-attribute instance-attribute

__init__(memory: Operation | SSAValue, source: Operation | SSAValue, memory_offset: int | IntegerAttr, *, comment: str | StringAttr | None = None, result: RFLAGSRegisterType)

Source code in xdsl/dialects/x86/ops.py
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
def __init__(
    self,
    memory: Operation | SSAValue,
    source: Operation | SSAValue,
    memory_offset: int | IntegerAttr,
    *,
    comment: str | StringAttr | None = None,
    result: RFLAGSRegisterType,
):
    if isinstance(memory_offset, int):
        memory_offset = IntegerAttr(memory_offset, 64)
    if isinstance(comment, str):
        comment = StringAttr(comment)

    super().__init__(
        operands=[memory, source],
        attributes={
            "memory_offset": memory_offset,
            "comment": comment,
        },
        result_types=[result],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
2908
2909
2910
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    memory_access = memory_access_str(self.memory, self.memory_offset)
    return memory_access, self.source

custom_parse_attributes(parser: Parser) -> dict[str, Attribute] classmethod

Source code in xdsl/dialects/x86/ops.py
2912
2913
2914
2915
2916
2917
2918
2919
2920
@classmethod
def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
    attributes = dict[str, Attribute]()
    temp = parse_optional_immediate_value(
        parser, IntegerType(64, Signedness.SIGNED)
    )
    if temp is not None:
        attributes["memory_offset"] = temp
    return attributes

custom_print_attributes(printer: Printer) -> AbstractSet[str]

Source code in xdsl/dialects/x86/ops.py
2922
2923
2924
2925
def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
    printer.print_string(", ")
    print_immediate_value(printer, self.memory_offset)
    return {"memory_offset"}

MI_CmpOp

Bases: X86Instruction, X86CustomFormatOperation

Compares the first source operand with the second source operand and sets the status flags in the EFLAGS register according to the results.

See external documentation.

Source code in xdsl/dialects/x86/ops.py
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
@irdl_op_definition
class MI_CmpOp(X86Instruction, X86CustomFormatOperation):
    """
    Compares the first source operand with the second source operand and sets the status
    flags in the EFLAGS register according to the results.

    See external [documentation](https://www.felixcloutier.com/x86/cmp).
    """

    name = "x86.mi.cmp"

    memory = operand_def(GeneralRegisterType)
    memory_offset = attr_def(IntegerAttr, default_value=IntegerAttr(0, 64))
    immediate = attr_def(IntegerAttr)

    result = result_def(RFLAGSRegisterType)

    traits = traits_def(MemoryReadEffect())

    def __init__(
        self,
        memory: Operation | SSAValue,
        memory_offset: int | IntegerAttr,
        immediate: int | IntegerAttr,
        *,
        comment: str | StringAttr | None = None,
        result: RFLAGSRegisterType,
    ):
        if isinstance(immediate, int):
            immediate = IntegerAttr(
                immediate, 32
            )  # the default immediate size is 32 bits
        if isinstance(memory_offset, int):
            memory_offset = IntegerAttr(memory_offset, 64)
        if isinstance(comment, str):
            comment = StringAttr(comment)

        super().__init__(
            operands=[memory],
            attributes={
                "immediate": immediate,
                "memory_offset": memory_offset,
                "comment": comment,
            },
            result_types=[result],
        )

    def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
        immediate = assembly_arg_str(self.immediate)
        memory_access = memory_access_str(self.memory, self.memory_offset)
        return memory_access, immediate

    @classmethod
    def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
        attributes = dict[str, Attribute]()
        temp = parse_immediate_value(parser, IntegerType(64, Signedness.SIGNED))
        attributes["immediate"] = temp
        if parser.parse_optional_punctuation(",") is not None:
            temp2 = parse_optional_immediate_value(
                parser, IntegerType(32, Signedness.SIGNED)
            )
            if temp2 is not None:
                attributes["memory_offset"] = temp2
        return attributes

    def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
        printer.print_string(", ")
        print_immediate_value(printer, self.immediate)
        printer.print_string(", ")
        print_immediate_value(printer, self.memory_offset)
        return {"immediate", "memory_offset"}

name = 'x86.mi.cmp' class-attribute instance-attribute

memory = operand_def(GeneralRegisterType) class-attribute instance-attribute

memory_offset = attr_def(IntegerAttr, default_value=(IntegerAttr(0, 64))) class-attribute instance-attribute

immediate = attr_def(IntegerAttr) class-attribute instance-attribute

result = result_def(RFLAGSRegisterType) class-attribute instance-attribute

traits = traits_def(MemoryReadEffect()) class-attribute instance-attribute

__init__(memory: Operation | SSAValue, memory_offset: int | IntegerAttr, immediate: int | IntegerAttr, *, comment: str | StringAttr | None = None, result: RFLAGSRegisterType)

Source code in xdsl/dialects/x86/ops.py
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
def __init__(
    self,
    memory: Operation | SSAValue,
    memory_offset: int | IntegerAttr,
    immediate: int | IntegerAttr,
    *,
    comment: str | StringAttr | None = None,
    result: RFLAGSRegisterType,
):
    if isinstance(immediate, int):
        immediate = IntegerAttr(
            immediate, 32
        )  # the default immediate size is 32 bits
    if isinstance(memory_offset, int):
        memory_offset = IntegerAttr(memory_offset, 64)
    if isinstance(comment, str):
        comment = StringAttr(comment)

    super().__init__(
        operands=[memory],
        attributes={
            "immediate": immediate,
            "memory_offset": memory_offset,
            "comment": comment,
        },
        result_types=[result],
    )

assembly_line_args() -> tuple[AssemblyInstructionArg | None, ...]

Source code in xdsl/dialects/x86/ops.py
2975
2976
2977
2978
def assembly_line_args(self) -> tuple[AssemblyInstructionArg | None, ...]:
    immediate = assembly_arg_str(self.immediate)
    memory_access = memory_access_str(self.memory, self.memory_offset)
    return memory_access, immediate

custom_parse_attributes(parser: Parser) -> dict[str, Attribute] classmethod

Source code in xdsl/dialects/x86/ops.py
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
@classmethod
def custom_parse_attributes(cls, parser: Parser) -> dict[str, Attribute]:
    attributes = dict[str, Attribute]()
    temp = parse_immediate_value(parser, IntegerType(64, Signedness.SIGNED))
    attributes["immediate"] = temp
    if parser.parse_optional_punctuation(",") is not None:
        temp2 = parse_optional_immediate_value(
            parser, IntegerType(32, Signedness.SIGNED)
        )
        if temp2 is not None:
            attributes["memory_offset"] = temp2
    return attributes

custom_print_attributes(printer: Printer) -> AbstractSet[str]

Source code in xdsl/dialects/x86/ops.py
2993
2994
2995
2996
2997
2998
def custom_print_attributes(self, printer: Printer) -> AbstractSet[str]:
    printer.print_string(", ")
    print_immediate_value(printer, self.immediate)
    printer.print_string(", ")
    print_immediate_value(printer, self.memory_offset)
    return {"immediate", "memory_offset"}

C_JaOp dataclass

Bases: ConditionalJumpOperation

Jump if above (CF=0 and ZF=0).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3001
3002
3003
3004
3005
3006
3007
3008
3009
@irdl_op_definition
class C_JaOp(ConditionalJumpOperation):
    """
    Jump if above (CF=0 and ZF=0).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.ja"

name = 'x86.c.ja' class-attribute instance-attribute

C_JaeOp dataclass

Bases: ConditionalJumpOperation

Jump if above or equal (CF=0).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3012
3013
3014
3015
3016
3017
3018
3019
3020
@irdl_op_definition
class C_JaeOp(ConditionalJumpOperation):
    """
    Jump if above or equal (CF=0).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.jae"

name = 'x86.c.jae' class-attribute instance-attribute

C_JbOp dataclass

Bases: ConditionalJumpOperation

Jump if below (CF=1).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3023
3024
3025
3026
3027
3028
3029
3030
3031
@irdl_op_definition
class C_JbOp(ConditionalJumpOperation):
    """
    Jump if below (CF=1).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.jb"

name = 'x86.c.jb' class-attribute instance-attribute

C_JbeOp dataclass

Bases: ConditionalJumpOperation

Jump if below or equal (CF=1 or ZF=1).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3034
3035
3036
3037
3038
3039
3040
3041
3042
@irdl_op_definition
class C_JbeOp(ConditionalJumpOperation):
    """
    Jump if below or equal (CF=1 or ZF=1).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.jbe"

name = 'x86.c.jbe' class-attribute instance-attribute

C_JcOp dataclass

Bases: ConditionalJumpOperation

Jump if carry (CF=1).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3045
3046
3047
3048
3049
3050
3051
3052
3053
@irdl_op_definition
class C_JcOp(ConditionalJumpOperation):
    """
    Jump if carry (CF=1).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.jc"

name = 'x86.c.jc' class-attribute instance-attribute

C_JeOp dataclass

Bases: ConditionalJumpOperation

Jump if equal (ZF=1).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3056
3057
3058
3059
3060
3061
3062
3063
3064
@irdl_op_definition
class C_JeOp(ConditionalJumpOperation):
    """
    Jump if equal (ZF=1).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.je"

name = 'x86.c.je' class-attribute instance-attribute

C_JgOp dataclass

Bases: ConditionalJumpOperation

Jump if greater (ZF=0 and SF=OF).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3067
3068
3069
3070
3071
3072
3073
3074
3075
@irdl_op_definition
class C_JgOp(ConditionalJumpOperation):
    """
    Jump if greater (ZF=0 and SF=OF).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.jg"

name = 'x86.c.jg' class-attribute instance-attribute

C_JgeOp dataclass

Bases: ConditionalJumpOperation

Jump if greater or equal (SF=OF).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3078
3079
3080
3081
3082
3083
3084
3085
3086
@irdl_op_definition
class C_JgeOp(ConditionalJumpOperation):
    """
    Jump if greater or equal (SF=OF).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.jge"

name = 'x86.c.jge' class-attribute instance-attribute

C_JlOp dataclass

Bases: ConditionalJumpOperation

Jump if less (SF≠OF).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3089
3090
3091
3092
3093
3094
3095
3096
3097
@irdl_op_definition
class C_JlOp(ConditionalJumpOperation):
    """
    Jump if less (SF≠OF).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.jl"

name = 'x86.c.jl' class-attribute instance-attribute

C_JleOp dataclass

Bases: ConditionalJumpOperation

Jump if less or equal (ZF=1 or SF≠OF).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3100
3101
3102
3103
3104
3105
3106
3107
3108
@irdl_op_definition
class C_JleOp(ConditionalJumpOperation):
    """
    Jump if less or equal (ZF=1 or SF≠OF).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.jle"

name = 'x86.c.jle' class-attribute instance-attribute

C_JnaOp dataclass

Bases: ConditionalJumpOperation

Jump if not above (CF=1 or ZF=1).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3111
3112
3113
3114
3115
3116
3117
3118
3119
@irdl_op_definition
class C_JnaOp(ConditionalJumpOperation):
    """
    Jump if not above (CF=1 or ZF=1).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.jna"

name = 'x86.c.jna' class-attribute instance-attribute

C_JnaeOp dataclass

Bases: ConditionalJumpOperation

Jump if not above or equal (CF=1).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3122
3123
3124
3125
3126
3127
3128
3129
3130
@irdl_op_definition
class C_JnaeOp(ConditionalJumpOperation):
    """
    Jump if not above or equal (CF=1).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.jnae"

name = 'x86.c.jnae' class-attribute instance-attribute

C_JnbOp dataclass

Bases: ConditionalJumpOperation

Jump if not below (CF=0).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3133
3134
3135
3136
3137
3138
3139
3140
3141
@irdl_op_definition
class C_JnbOp(ConditionalJumpOperation):
    """
    Jump if not below (CF=0).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.jnb"

name = 'x86.c.jnb' class-attribute instance-attribute

C_JnbeOp dataclass

Bases: ConditionalJumpOperation

Jump if not below or equal (CF=0 and ZF=0).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3144
3145
3146
3147
3148
3149
3150
3151
3152
@irdl_op_definition
class C_JnbeOp(ConditionalJumpOperation):
    """
    Jump if not below or equal (CF=0 and ZF=0).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.jnbe"

name = 'x86.c.jnbe' class-attribute instance-attribute

C_JncOp dataclass

Bases: ConditionalJumpOperation

Jump if not carry (CF=0).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3155
3156
3157
3158
3159
3160
3161
3162
3163
@irdl_op_definition
class C_JncOp(ConditionalJumpOperation):
    """
    Jump if not carry (CF=0).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.jnc"

name = 'x86.c.jnc' class-attribute instance-attribute

C_JneOp dataclass

Bases: ConditionalJumpOperation

Jump if not equal (ZF=0).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3166
3167
3168
3169
3170
3171
3172
3173
3174
@irdl_op_definition
class C_JneOp(ConditionalJumpOperation):
    """
    Jump if not equal (ZF=0).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.jne"

name = 'x86.c.jne' class-attribute instance-attribute

C_JngOp dataclass

Bases: ConditionalJumpOperation

Jump if not greater (ZF=1 or SF≠OF).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3177
3178
3179
3180
3181
3182
3183
3184
3185
@irdl_op_definition
class C_JngOp(ConditionalJumpOperation):
    """
    Jump if not greater (ZF=1 or SF≠OF).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.jng"

name = 'x86.c.jng' class-attribute instance-attribute

C_JngeOp dataclass

Bases: ConditionalJumpOperation

Jump if not greater or equal (SF≠OF).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3188
3189
3190
3191
3192
3193
3194
3195
3196
@irdl_op_definition
class C_JngeOp(ConditionalJumpOperation):
    """
    Jump if not greater or equal (SF≠OF).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.jnge"

name = 'x86.c.jnge' class-attribute instance-attribute

C_JnlOp dataclass

Bases: ConditionalJumpOperation

Jump if not less (SF=OF).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3199
3200
3201
3202
3203
3204
3205
3206
3207
@irdl_op_definition
class C_JnlOp(ConditionalJumpOperation):
    """
    Jump if not less (SF=OF).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.jnl"

name = 'x86.c.jnl' class-attribute instance-attribute

C_JnleOp dataclass

Bases: ConditionalJumpOperation

Jump if not less or equal (ZF=0 and SF=OF).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3210
3211
3212
3213
3214
3215
3216
3217
3218
@irdl_op_definition
class C_JnleOp(ConditionalJumpOperation):
    """
    Jump if not less or equal (ZF=0 and SF=OF).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.jnle"

name = 'x86.c.jnle' class-attribute instance-attribute

C_JnoOp dataclass

Bases: ConditionalJumpOperation

Jump if not overflow (OF=0).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3221
3222
3223
3224
3225
3226
3227
3228
3229
@irdl_op_definition
class C_JnoOp(ConditionalJumpOperation):
    """
    Jump if not overflow (OF=0).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.jno"

name = 'x86.c.jno' class-attribute instance-attribute

C_JnpOp dataclass

Bases: ConditionalJumpOperation

Jump if not parity (PF=0).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3232
3233
3234
3235
3236
3237
3238
3239
3240
@irdl_op_definition
class C_JnpOp(ConditionalJumpOperation):
    """
    Jump if not parity (PF=0).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.jnp"

name = 'x86.c.jnp' class-attribute instance-attribute

C_JnsOp dataclass

Bases: ConditionalJumpOperation

Jump if not sign (SF=0).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3243
3244
3245
3246
3247
3248
3249
3250
3251
@irdl_op_definition
class C_JnsOp(ConditionalJumpOperation):
    """
    Jump if not sign (SF=0).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.jns"

name = 'x86.c.jns' class-attribute instance-attribute

C_JnzOp dataclass

Bases: ConditionalJumpOperation

Jump if not zero (ZF=0).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3254
3255
3256
3257
3258
3259
3260
3261
3262
@irdl_op_definition
class C_JnzOp(ConditionalJumpOperation):
    """
    Jump if not zero (ZF=0).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.jnz"

name = 'x86.c.jnz' class-attribute instance-attribute

C_JoOp dataclass

Bases: ConditionalJumpOperation

Jump if overflow (OF=1).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3265
3266
3267
3268
3269
3270
3271
3272
3273
@irdl_op_definition
class C_JoOp(ConditionalJumpOperation):
    """
    Jump if overflow (OF=1).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.jo"

name = 'x86.c.jo' class-attribute instance-attribute

C_JpOp dataclass

Bases: ConditionalJumpOperation

Jump if parity (PF=1).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3276
3277
3278
3279
3280
3281
3282
3283
3284
@irdl_op_definition
class C_JpOp(ConditionalJumpOperation):
    """
    Jump if parity (PF=1).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.jp"

name = 'x86.c.jp' class-attribute instance-attribute

C_JpeOp dataclass

Bases: ConditionalJumpOperation

Jump if parity even (PF=1).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3287
3288
3289
3290
3291
3292
3293
3294
3295
@irdl_op_definition
class C_JpeOp(ConditionalJumpOperation):
    """
    Jump if parity even (PF=1).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.jpe"

name = 'x86.c.jpe' class-attribute instance-attribute

C_JpoOp dataclass

Bases: ConditionalJumpOperation

Jump if parity odd (PF=0).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3298
3299
3300
3301
3302
3303
3304
3305
3306
@irdl_op_definition
class C_JpoOp(ConditionalJumpOperation):
    """
    Jump if parity odd (PF=0).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.jpo"

name = 'x86.c.jpo' class-attribute instance-attribute

C_JsOp dataclass

Bases: ConditionalJumpOperation

Jump if sign (SF=1).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3309
3310
3311
3312
3313
3314
3315
3316
3317
@irdl_op_definition
class C_JsOp(ConditionalJumpOperation):
    """
    Jump if sign (SF=1).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.js"

name = 'x86.c.js' class-attribute instance-attribute

C_JzOp dataclass

Bases: ConditionalJumpOperation

Jump if zero (ZF=1).

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3320
3321
3322
3323
3324
3325
3326
3327
3328
@irdl_op_definition
class C_JzOp(ConditionalJumpOperation):
    """
    Jump if zero (ZF=1).

    See external [documentation](https://www.felixcloutier.com/x86/jcc).
    """

    name = "x86.c.jz"

name = 'x86.c.jz' class-attribute instance-attribute

RSS_Vfmadd231pdOp dataclass

Bases: RSS_Operation[X86VectorRegisterType, X86VectorRegisterType, X86VectorRegisterType]

Multiply packed double-precision floating-point elements in s1 and s2, add the intermediate result to r, and store the final result in r.

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
@irdl_op_definition
class RSS_Vfmadd231pdOp(
    RSS_Operation[X86VectorRegisterType, X86VectorRegisterType, X86VectorRegisterType]
):
    """
    Multiply packed double-precision floating-point elements in s1 and s2, add the
    intermediate result to r, and store the final result in r.

    See external [documentation](https://www.felixcloutier.com/x86/vfmadd132pd:vfmadd213pd:vfmadd231pd).
    """

    name = "x86.rss.vfmadd231pd"

name = 'x86.rss.vfmadd231pd' class-attribute instance-attribute

RSSK_Vfmadd231pdOp dataclass

Bases: RSSK_Operation

AVX512 masked multiply packed double-precision floating-point elements in s1 and s2, add the intermediate result to r, and store the final result in r.

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
@irdl_op_definition
class RSSK_Vfmadd231pdOp(RSSK_Operation):
    """
    AVX512 masked multiply packed double-precision floating-point elements in s1 and s2, add the
    intermediate result to r, and store the final result in r.

    See external [documentation](https://www.felixcloutier.com/x86/vfmadd132pd:vfmadd213pd:vfmadd231pd).
    """

    name = "x86.rssk.vfmadd231pd"

name = 'x86.rssk.vfmadd231pd' class-attribute instance-attribute

RSM_Vfmadd231pdOp dataclass

Bases: RSM_Operation[X86VectorRegisterType, X86VectorRegisterType, GeneralRegisterType]

Multiply packed double-precision floating-point elements in s1 and at specified memory location, add the intermediate result to r, and store the final result in r.

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
@irdl_op_definition
class RSM_Vfmadd231pdOp(
    RSM_Operation[X86VectorRegisterType, X86VectorRegisterType, GeneralRegisterType]
):
    """
    Multiply packed double-precision floating-point elements in s1 and at specified memory location, add the
    intermediate result to r, and store the final result in r.

    See external [documentation](https://www.felixcloutier.com/x86/vfmadd132pd:vfmadd213pd:vfmadd231pd).
    """

    name = "x86.rsm.vfmadd231pd"

name = 'x86.rsm.vfmadd231pd' class-attribute instance-attribute

RSS_Vfmadd231psOp dataclass

Bases: RSS_Operation[X86VectorRegisterType, X86VectorRegisterType, X86VectorRegisterType]

Multiply packed single-precision floating-point elements in s1 and s2, add the intermediate result to r, and store the final result in r.

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
@irdl_op_definition
class RSS_Vfmadd231psOp(
    RSS_Operation[X86VectorRegisterType, X86VectorRegisterType, X86VectorRegisterType]
):
    """
    Multiply packed single-precision floating-point elements in s1 and s2, add the
    intermediate result to r, and store the final result in r.

    See external [documentation](https://www.felixcloutier.com/x86/vfmadd132pd:vfmadd213pd:vfmadd231pd).
    """

    name = "x86.rss.vfmadd231ps"

name = 'x86.rss.vfmadd231ps' class-attribute instance-attribute

RSM_Vfmadd231psOp dataclass

Bases: RSM_Operation[X86VectorRegisterType, X86VectorRegisterType, GeneralRegisterType]

Multiply packed single-precision floating-point elements in s1 and at specified memory location, add the intermediate result to r, and store the final result in r.

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
@irdl_op_definition
class RSM_Vfmadd231psOp(
    RSM_Operation[X86VectorRegisterType, X86VectorRegisterType, GeneralRegisterType]
):
    """
    Multiply packed single-precision floating-point elements in s1 and at specified memory location, add the
    intermediate result to r, and store the final result in r.

    See external [documentation](https://www.felixcloutier.com/x86/vfmadd132pd:vfmadd213pd:vfmadd231pd).
    """

    name = "x86.rsm.vfmadd231ps"

name = 'x86.rsm.vfmadd231ps' class-attribute instance-attribute

DSS_AddpdOp dataclass

Bases: DSS_Operation[X86VectorRegisterType, X86VectorRegisterType, X86VectorRegisterType]

Add packed double-precision floating-point elements in s1 and s2 and store the result in d.

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
@irdl_op_definition
class DSS_AddpdOp(
    DSS_Operation[X86VectorRegisterType, X86VectorRegisterType, X86VectorRegisterType]
):
    """
    Add packed double-precision floating-point elements in s1 and s2 and store the
    result in d.

    See external [documentation](https://www.felixcloutier.com/x86/addpd).
    """

    name = "x86.dss.addpd"

name = 'x86.dss.addpd' class-attribute instance-attribute

DSS_AddpsOp dataclass

Bases: DSS_Operation[X86VectorRegisterType, X86VectorRegisterType, X86VectorRegisterType]

Add packed single-precision floating-point elements in s1 and s2 and store the result in d.

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
@irdl_op_definition
class DSS_AddpsOp(
    DSS_Operation[X86VectorRegisterType, X86VectorRegisterType, X86VectorRegisterType]
):
    """
    Add packed single-precision floating-point elements in s1 and s2 and store the
    result in d.

    See external [documentation](https://www.felixcloutier.com/x86/addps).
    """

    name = "x86.dss.addps"

name = 'x86.dss.addps' class-attribute instance-attribute

DS_VmovapdOp dataclass

Bases: DS_Operation[X86VectorRegisterType, X86VectorRegisterType]

Move aligned packed double precision floating-point values from zmm1 to zmm2

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3427
3428
3429
3430
3431
3432
3433
3434
3435
@irdl_op_definition
class DS_VmovapdOp(DS_Operation[X86VectorRegisterType, X86VectorRegisterType]):
    """
    Move aligned packed double precision floating-point values from zmm1 to zmm2

    See external [documentation](https://www.felixcloutier.com/x86/movapd).
    """

    name = "x86.ds.vmovapd"

name = 'x86.ds.vmovapd' class-attribute instance-attribute

DSK_VmovapdOp dataclass

Bases: DSK_Operation

Move aligned packed double precision floating-point values from zmm1 to zmm2 using writemask k1

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
@irdl_op_definition
class DSK_VmovapdOp(DSK_Operation):
    """
    Move aligned packed double precision floating-point values from zmm1 to zmm2 using
    writemask k1

    See external [documentation](https://www.felixcloutier.com/x86/movapd).
    """

    name = "x86.dsk.vmovapd"

name = 'x86.dsk.vmovapd' class-attribute instance-attribute

DS_VmovapsOp dataclass

Bases: DS_Operation[X86VectorRegisterType, X86VectorRegisterType]

Move aligned packed single precision floating-point values from zmm1 to zmm2

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3450
3451
3452
3453
3454
3455
3456
3457
3458
@irdl_op_definition
class DS_VmovapsOp(DS_Operation[X86VectorRegisterType, X86VectorRegisterType]):
    """
    Move aligned packed single precision floating-point values from zmm1 to zmm2

    See external [documentation](https://www.felixcloutier.com/x86/movaps).
    """

    name = "x86.ds.vmovaps"

name = 'x86.ds.vmovaps' class-attribute instance-attribute

MS_VmovapdOp dataclass

Bases: MS_Operation[GeneralRegisterType, X86VectorRegisterType]

Move aligned packed double precision floating-point values from zmm1 to m512

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3461
3462
3463
3464
3465
3466
3467
3468
3469
@irdl_op_definition
class MS_VmovapdOp(MS_Operation[GeneralRegisterType, X86VectorRegisterType]):
    """
    Move aligned packed double precision floating-point values from zmm1 to m512

    See external [documentation](https://www.felixcloutier.com/x86/movapd).
    """

    name = "x86.ms.vmovapd"

name = 'x86.ms.vmovapd' class-attribute instance-attribute

MS_VmovapsOp dataclass

Bases: MS_Operation[GeneralRegisterType, X86VectorRegisterType]

Move aligned packed single precision floating-point values from zmm1 to m512

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3472
3473
3474
3475
3476
3477
3478
3479
3480
@irdl_op_definition
class MS_VmovapsOp(MS_Operation[GeneralRegisterType, X86VectorRegisterType]):
    """
    Move aligned packed single precision floating-point values from zmm1 to m512

    See external [documentation](https://www.felixcloutier.com/x86/movaps).
    """

    name = "x86.ms.vmovaps"

name = 'x86.ms.vmovaps' class-attribute instance-attribute

MS_VmovupdOp dataclass

Bases: MS_Operation[GeneralRegisterType, X86VectorRegisterType]

Move unaligned packed double precision floating-point values from vector register to memory

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3483
3484
3485
3486
3487
3488
3489
3490
3491
@irdl_op_definition
class MS_VmovupdOp(MS_Operation[GeneralRegisterType, X86VectorRegisterType]):
    """
    Move unaligned packed double precision floating-point values from vector register to memory

    See external [documentation](https://www.felixcloutier.com/x86/movupd).
    """

    name = "x86.ms.vmovupd"

name = 'x86.ms.vmovupd' class-attribute instance-attribute

MS_VmovupsOp dataclass

Bases: MS_Operation[GeneralRegisterType, X86VectorRegisterType]

Move unaligned packed single precision floating-point values from vector register to memory

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3494
3495
3496
3497
3498
3499
3500
3501
3502
@irdl_op_definition
class MS_VmovupsOp(MS_Operation[GeneralRegisterType, X86VectorRegisterType]):
    """
    Move unaligned packed single precision floating-point values from vector register to memory

    See external [documentation](https://www.felixcloutier.com/x86/movups).
    """

    name = "x86.ms.vmovups"

name = 'x86.ms.vmovups' class-attribute instance-attribute

DM_VmovapdOp dataclass

Bases: DM_Operation[X86VectorRegisterType, GeneralRegisterType]

Move aligned packed double precision floating-point values from memory to vector register.

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
@irdl_op_definition
class DM_VmovapdOp(DM_Operation[X86VectorRegisterType, GeneralRegisterType]):
    """
    Move aligned packed double precision floating-point values from memory to vector
    register.

    See external [documentation](https://www.felixcloutier.com/x86/movapd).
    """

    name = "x86.dm.vmovapd"

name = 'x86.dm.vmovapd' class-attribute instance-attribute

DM_VmovapsOp dataclass

Bases: DM_Operation[X86VectorRegisterType, GeneralRegisterType]

Move aligned packed single precision floating-point values from memory to vector register.

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
@irdl_op_definition
class DM_VmovapsOp(DM_Operation[X86VectorRegisterType, GeneralRegisterType]):
    """
    Move aligned packed single precision floating-point values from memory to vector
    register.

    See external [documentation](https://www.felixcloutier.com/x86/movaps).
    """

    name = "x86.dm.vmovaps"

name = 'x86.dm.vmovaps' class-attribute instance-attribute

DM_VmovupdOp dataclass

Bases: DM_Operation[X86VectorRegisterType, GeneralRegisterType]

Move unaligned packed double precision floating-point values from memory to vector register.

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
@irdl_op_definition
class DM_VmovupdOp(DM_Operation[X86VectorRegisterType, GeneralRegisterType]):
    """
    Move unaligned packed double precision floating-point values from memory to vector
    register.

    See external [documentation](https://www.felixcloutier.com/x86/movupd).
    """

    name = "x86.dm.vmovupd"

name = 'x86.dm.vmovupd' class-attribute instance-attribute

DM_VmovupsOp dataclass

Bases: DM_Operation[X86VectorRegisterType, GeneralRegisterType]

Move unaligned packed single precision floating-point values from memory to vector register.

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
@irdl_op_definition
class DM_VmovupsOp(DM_Operation[X86VectorRegisterType, GeneralRegisterType]):
    """
    Move unaligned packed single precision floating-point values from memory to vector
    register.

    See external [documentation](https://www.felixcloutier.com/x86/movups).
    """

    name = "x86.dm.vmovups"

name = 'x86.dm.vmovups' class-attribute instance-attribute

MS_VmovntpdOp dataclass

Bases: MS_Operation[GeneralRegisterType, X86VectorRegisterType]

Moves the packed double precision floating-point values in the source operand to the destination operand using a non-temporal hint to prevent caching of the data during the write to memory.

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
@irdl_op_definition
class MS_VmovntpdOp(MS_Operation[GeneralRegisterType, X86VectorRegisterType]):
    """
    Moves the packed double precision floating-point values in the source operand to the
    destination operand using a non-temporal hint to prevent caching of the data during
    the write to memory.

    See external [documentation](https://www.felixcloutier.com/x86/movntpd).
    """

    name = "x86.ms.vmovntpd"

name = 'x86.ms.vmovntpd' class-attribute instance-attribute

MS_VmovntpsOp dataclass

Bases: MS_Operation[GeneralRegisterType, X86VectorRegisterType]

Moves the packed single precision floating-point values in the source operand to the destination operand using a non-temporal hint to prevent caching of the data during the write to memory.

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
@irdl_op_definition
class MS_VmovntpsOp(MS_Operation[GeneralRegisterType, X86VectorRegisterType]):
    """
    Moves the packed single precision floating-point values in the source operand to the
    destination operand using a non-temporal hint to prevent caching of the data during
    the write to memory.

    See external [documentation](https://www.felixcloutier.com/x86/movntps).
    """

    name = "x86.ms.vmovntps"

name = 'x86.ms.vmovntps' class-attribute instance-attribute

DM_VbroadcastsdOp dataclass

Bases: DM_Operation[X86VectorRegisterType, GeneralRegisterType]

Broadcast low double precision floating-point element in m64 to eight locations in zmm1 using writemask k1

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3579
3580
3581
3582
3583
3584
3585
3586
3587
@irdl_op_definition
class DM_VbroadcastsdOp(DM_Operation[X86VectorRegisterType, GeneralRegisterType]):
    """
    Broadcast low double precision floating-point element in m64 to eight locations in zmm1 using writemask k1

    See external [documentation](https://www.felixcloutier.com/x86/vbroadcast).
    """

    name = "x86.dm.vbroadcastsd"

name = 'x86.dm.vbroadcastsd' class-attribute instance-attribute

DM_VbroadcastssOp dataclass

Bases: DM_Operation[X86VectorRegisterType, GeneralRegisterType]

Broadcast single precision floating-point element to eight locations in memory

See external documentation.

Source code in xdsl/dialects/x86/ops.py
3590
3591
3592
3593
3594
3595
3596
3597
3598
@irdl_op_definition
class DM_VbroadcastssOp(DM_Operation[X86VectorRegisterType, GeneralRegisterType]):
    """
    Broadcast single precision floating-point element to eight locations in memory

    See external [documentation](https://www.felixcloutier.com/x86/vbroadcast).
    """

    name = "x86.dm.vbroadcastss"

name = 'x86.dm.vbroadcastss' class-attribute instance-attribute

DSSI_ShufpsOp dataclass

Bases: DSSI_Operation[X86VectorRegisterType, X86VectorRegisterType, X86VectorRegisterType]

Selects a single precision floating-point value of an input quadruplet using a two-bit control and move to a designated element of the destination operand. Each 64-bit element-pair of a 128-bit lane of the destination operand is interleaved between the corresponding lane of the first source operand and the second source operand at the granularity 128 bits. Each two bits in the imm8 byte, starting from bit 0, is the select control of the corresponding element of a 128-bit lane of the destination to received the shuffled result of an input quadruplet. The two lower elements of a 128-bit lane in the destination receives shuffle results from the quadruple of the first source operand. The next two elements of the destination receives shuffle results from the quadruple of the second source operand.

See external documentation

Source code in xdsl/dialects/x86/ops.py
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
@irdl_op_definition
class DSSI_ShufpsOp(
    DSSI_Operation[X86VectorRegisterType, X86VectorRegisterType, X86VectorRegisterType]
):
    """
    Selects a single precision floating-point value of an input quadruplet using a
    two-bit control and move to a designated element of the destination operand.
    Each 64-bit element-pair of a 128-bit lane of the destination operand is interleaved
    between the corresponding lane of the first source operand and the second source
    operand at the granularity 128 bits. Each two bits in the imm8 byte, starting from
    bit 0, is the select control of the corresponding element of a 128-bit lane of the
    destination to received the shuffled result of an input quadruplet. The two lower
    elements of a 128-bit lane in the destination receives shuffle results from the
    quadruple of the first source operand. The next two elements of the destination
    receives shuffle results from the quadruple of the second source operand.

    See external [documentation](https://www.felixcloutier.com/x86/shufps)
    """

    name = "x86.dssi.shufps"

name = 'x86.dssi.shufps' class-attribute instance-attribute

GetAnyRegisterOperation

Bases: X86AsmOperation, X86RegallocOperation, X86CustomFormatOperation, ABC, Generic[R1InvT]

This instruction allows us to create an SSAValue for a given register name.

Source code in xdsl/dialects/x86/ops.py
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
class GetAnyRegisterOperation(
    X86AsmOperation,
    X86RegallocOperation,
    X86CustomFormatOperation,
    ABC,
    Generic[R1InvT],
):
    """
    This instruction allows us to create an SSAValue for a given register name.
    """

    result: OpResult[R1InvT] = result_def(R1InvT)

    def __init__(
        self,
        register_type: R1InvT,
    ):
        super().__init__(result_types=[register_type])

    def assembly_line(self) -> str | None:
        return None

result: OpResult[R1InvT] = result_def(R1InvT) class-attribute instance-attribute

__init__(register_type: R1InvT)

Source code in xdsl/dialects/x86/ops.py
3636
3637
3638
3639
3640
def __init__(
    self,
    register_type: R1InvT,
):
    super().__init__(result_types=[register_type])

assembly_line() -> str | None

Source code in xdsl/dialects/x86/ops.py
3642
3643
def assembly_line(self) -> str | None:
    return None

GetRegisterOp dataclass

Bases: GetAnyRegisterOperation[GeneralRegisterType]

Source code in xdsl/dialects/x86/ops.py
3646
3647
3648
@irdl_op_definition
class GetRegisterOp(GetAnyRegisterOperation[GeneralRegisterType]):
    name = "x86.get_register"

name = 'x86.get_register' class-attribute instance-attribute

GetAVXRegisterOp dataclass

Bases: GetAnyRegisterOperation[X86VectorRegisterType]

Source code in xdsl/dialects/x86/ops.py
3651
3652
3653
@irdl_op_definition
class GetAVXRegisterOp(GetAnyRegisterOperation[X86VectorRegisterType]):
    name = "x86.get_avx_register"

name = 'x86.get_avx_register' class-attribute instance-attribute

GetMaskRegisterOp dataclass

Bases: GetAnyRegisterOperation[AVX512MaskRegisterType]

Source code in xdsl/dialects/x86/ops.py
3656
3657
3658
@irdl_op_definition
class GetMaskRegisterOp(GetAnyRegisterOperation[AVX512MaskRegisterType]):
    name = "x86.get_mask_register"

name = 'x86.get_mask_register' class-attribute instance-attribute

ParallelMovOp

Bases: X86RegallocOperation

Source code in xdsl/dialects/x86/ops.py
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
@irdl_op_definition
class ParallelMovOp(X86RegallocOperation):
    name = "x86.parallel_mov"
    inputs = var_operand_def(X86RegisterType)
    outputs: VarOpResult[X86RegisterType] = var_result_def(X86RegisterType)
    free_registers = opt_prop_def(ArrayAttr[X86RegisterType])

    assembly_format = "$inputs attr-dict `:` functional-type($inputs, $outputs)"
    irdl_options = (ParsePropInAttrDict(),)

    def __init__(
        self,
        inputs: Sequence[SSAValue],
        outputs: Sequence[X86RegisterType],
        free_registers: ArrayAttr[X86RegisterType] | None = None,
    ):
        super().__init__(
            operands=(inputs,),
            result_types=(outputs,),
            properties={"free_registers": free_registers},
        )

    def verify_(self) -> None:
        if len(self.inputs) != len(self.outputs):
            raise VerifyException(
                "Input count must match output count. "
                f"Num inputs: {len(self.inputs)}, Num outputs: {len(self.outputs)}"
            )

        input_types = cast(Sequence[X86RegisterType], self.inputs.types)
        output_types = cast(Sequence[X86RegisterType], self.outputs.types)

        # Check type of register type matches for input and output
        for input_type, output_type in zip(input_types, output_types, strict=True):
            if type(input_type) is not type(output_type):
                raise VerifyException("Input type must match output type.")

        # Check outputs are distinct if allocated
        filtered_outputs = tuple(i for i in output_types if i.is_allocated)
        if len(filtered_outputs) != len(set(filtered_outputs)):
            raise VerifyException("Outputs must be unallocated or distinct.")

name = 'x86.parallel_mov' class-attribute instance-attribute

inputs = var_operand_def(X86RegisterType) class-attribute instance-attribute

outputs: VarOpResult[X86RegisterType] = var_result_def(X86RegisterType) class-attribute instance-attribute

free_registers = opt_prop_def(ArrayAttr[X86RegisterType]) class-attribute instance-attribute

assembly_format = '$inputs attr-dict `:` functional-type($inputs, $outputs)' class-attribute instance-attribute

irdl_options = (ParsePropInAttrDict(),) class-attribute instance-attribute

__init__(inputs: Sequence[SSAValue], outputs: Sequence[X86RegisterType], free_registers: ArrayAttr[X86RegisterType] | None = None)

Source code in xdsl/dialects/x86/ops.py
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
def __init__(
    self,
    inputs: Sequence[SSAValue],
    outputs: Sequence[X86RegisterType],
    free_registers: ArrayAttr[X86RegisterType] | None = None,
):
    super().__init__(
        operands=(inputs,),
        result_types=(outputs,),
        properties={"free_registers": free_registers},
    )

verify_() -> None

Source code in xdsl/dialects/x86/ops.py
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
def verify_(self) -> None:
    if len(self.inputs) != len(self.outputs):
        raise VerifyException(
            "Input count must match output count. "
            f"Num inputs: {len(self.inputs)}, Num outputs: {len(self.outputs)}"
        )

    input_types = cast(Sequence[X86RegisterType], self.inputs.types)
    output_types = cast(Sequence[X86RegisterType], self.outputs.types)

    # Check type of register type matches for input and output
    for input_type, output_type in zip(input_types, output_types, strict=True):
        if type(input_type) is not type(output_type):
            raise VerifyException("Input type must match output type.")

    # Check outputs are distinct if allocated
    filtered_outputs = tuple(i for i in output_types if i.is_allocated)
    if len(filtered_outputs) != len(set(filtered_outputs)):
        raise VerifyException("Outputs must be unallocated or distinct.")

print_assembly(module: ModuleOp, output: IO[str]) -> None

Source code in xdsl/dialects/x86/ops.py
3704
3705
3706
3707
def print_assembly(module: ModuleOp, output: IO[str]) -> None:
    printer = AssemblyPrinter(stream=output)
    print(".intel_syntax noprefix", file=output)
    printer.print_module(module)

x86_code(module: ModuleOp) -> str

Source code in xdsl/dialects/x86/ops.py
3710
3711
3712
3713
def x86_code(module: ModuleOp) -> str:
    stream = StringIO()
    print_assembly(module, stream)
    return stream.getvalue()