Pdl
pdl
¶
AnyPDLType = AttributeType | OperationType | TypeType | ValueType
module-attribute
¶
PDL = Dialect('pdl', [ApplyNativeConstraintOp, ApplyNativeRewriteOp, AttributeOp, OperandOp, EraseOp, OperandsOp, OperationOp, PatternOp, RangeOp, ReplaceOp, ResultOp, ResultsOp, RewriteOp, TypeOp, TypesOp], [AttributeType, OperationType, TypeType, ValueType, RangeType])
module-attribute
¶
AttributeType
dataclass
¶
Bases: ParametrizedAttribute, TypeAttribute
Source code in xdsl/dialects/pdl.py
name = 'pdl.attribute'
class-attribute
instance-attribute
¶
OperationType
dataclass
¶
Bases: ParametrizedAttribute, TypeAttribute
Source code in xdsl/dialects/pdl.py
name = 'pdl.operation'
class-attribute
instance-attribute
¶
TypeType
dataclass
¶
Bases: ParametrizedAttribute, TypeAttribute
Source code in xdsl/dialects/pdl.py
name = 'pdl.type'
class-attribute
instance-attribute
¶
ValueType
dataclass
¶
Bases: ParametrizedAttribute, TypeAttribute
Source code in xdsl/dialects/pdl.py
name = 'pdl.value'
class-attribute
instance-attribute
¶
RangeType
dataclass
¶
Bases: ParametrizedAttribute, TypeAttribute, Generic[_RangeT]
Source code in xdsl/dialects/pdl.py
name = 'pdl.range'
class-attribute
instance-attribute
¶
element_type: _RangeT
instance-attribute
¶
parse_parameters(parser: AttrParser) -> Sequence[Attribute]
classmethod
¶
Source code in xdsl/dialects/pdl.py
print_parameters(printer: Printer) -> None
¶
Source code in xdsl/dialects/pdl.py
ApplyNativeConstraintOp
¶
Bases: IRDLOperation
See external documentation.
Source code in xdsl/dialects/pdl.py
name = 'pdl.apply_native_constraint'
class-attribute
instance-attribute
¶
constraint_name = prop_def(StringAttr, prop_name='name')
class-attribute
instance-attribute
¶
is_negated = prop_def(BoolAttr, prop_name='isNegated', default_value=BoolAttr.from_bool(False))
class-attribute
instance-attribute
¶
args = var_operand_def(AnyPDLType | RangeType[AnyPDLType])
class-attribute
instance-attribute
¶
res = var_result_def(AnyPDLType | RangeType[AnyPDLType])
class-attribute
instance-attribute
¶
irdl_options = (ParsePropInAttrDict(),)
class-attribute
instance-attribute
¶
assembly_format = '$name `(` $args `:` type($args) `)` (`:` type($res)^)? attr-dict'
class-attribute
instance-attribute
¶
__init__(name: str | StringAttr, args: Sequence[SSAValue], result_types: Sequence[Attribute], is_negated: bool = False) -> None
¶
Source code in xdsl/dialects/pdl.py
ApplyNativeRewriteOp
¶
Bases: IRDLOperation
See external documentation.
Source code in xdsl/dialects/pdl.py
name = 'pdl.apply_native_rewrite'
class-attribute
instance-attribute
¶
constraint_name = prop_def(StringAttr, prop_name='name')
class-attribute
instance-attribute
¶
args = var_operand_def(AnyPDLType | RangeType[AnyPDLType])
class-attribute
instance-attribute
¶
res = var_result_def(AnyPDLType | RangeType[AnyPDLType])
class-attribute
instance-attribute
¶
__init__(name: str | StringAttr, args: Sequence[SSAValue], result_types: Sequence[Attribute]) -> None
¶
Source code in xdsl/dialects/pdl.py
parse(parser: Parser) -> ApplyNativeRewriteOp
classmethod
¶
Source code in xdsl/dialects/pdl.py
print(printer: Printer) -> None
¶
Source code in xdsl/dialects/pdl.py
AttributeOp
¶
Bases: IRDLOperation
See external documentation. https://mlir.llvm.org/docs/Dialects/PDLOps/#pdlattribute-pdlattributeop
Source code in xdsl/dialects/pdl.py
name = 'pdl.attribute'
class-attribute
instance-attribute
¶
value = opt_prop_def()
class-attribute
instance-attribute
¶
value_type = opt_operand_def(TypeType)
class-attribute
instance-attribute
¶
output = result_def(AttributeType)
class-attribute
instance-attribute
¶
assembly_format = '(`:` $value_type^)? (`=` $value^)? attr-dict-with-keyword'
class-attribute
instance-attribute
¶
verify_()
¶
Source code in xdsl/dialects/pdl.py
__init__(value: Attribute | SSAValue | None = None) -> None
¶
The given value is either the expected attribute, if given an attribute, or the expected attribute type, if given an SSAValue.
Source code in xdsl/dialects/pdl.py
EraseOp
¶
Bases: IRDLOperation
See external documentation.
Source code in xdsl/dialects/pdl.py
OperandOp
¶
Bases: IRDLOperation
See external documentation.
Source code in xdsl/dialects/pdl.py
name = 'pdl.operand'
class-attribute
instance-attribute
¶
value_type = opt_operand_def(TypeType)
class-attribute
instance-attribute
¶
value = result_def(ValueType)
class-attribute
instance-attribute
¶
assembly_format = '(`:` $value_type^)? attr-dict'
class-attribute
instance-attribute
¶
__init__(value_type: SSAValue | None = None) -> None
¶
OperandsOp
¶
Bases: IRDLOperation
See external documentation.
Source code in xdsl/dialects/pdl.py
name = 'pdl.operands'
class-attribute
instance-attribute
¶
value_type = opt_operand_def(RangeType[TypeType])
class-attribute
instance-attribute
¶
value = result_def(RangeType[ValueType])
class-attribute
instance-attribute
¶
assembly_format = '(`:` $value_type^)? attr-dict'
class-attribute
instance-attribute
¶
__init__(value_type: SSAValue | None) -> None
¶
OperationOp
¶
Bases: IRDLOperation
See external documentation.
Source code in xdsl/dialects/pdl.py
341 342 343 344 345 346 347 348 349 350 351 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 392 393 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 430 431 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 | |
name = 'pdl.operation'
class-attribute
instance-attribute
¶
opName = opt_prop_def(StringAttr)
class-attribute
instance-attribute
¶
attributeValueNames = prop_def(ArrayAttr[StringAttr])
class-attribute
instance-attribute
¶
operand_values = var_operand_def(ValueType | RangeType[ValueType])
class-attribute
instance-attribute
¶
attribute_values = var_operand_def(AttributeType)
class-attribute
instance-attribute
¶
type_values = var_operand_def(TypeType | RangeType[TypeType])
class-attribute
instance-attribute
¶
op = result_def(OperationType)
class-attribute
instance-attribute
¶
irdl_options = (AttrSizedOperandSegments(as_property=True),)
class-attribute
instance-attribute
¶
__init__(op_name: str | StringAttr | None, attribute_value_names: Iterable[StringAttr] | None = None, operand_values: Sequence[SSAValue] | None = None, attribute_values: Sequence[SSAValue] | None = None, type_values: Sequence[SSAValue] | None = None)
¶
Source code in xdsl/dialects/pdl.py
verify_()
¶
Source code in xdsl/dialects/pdl.py
parse(parser: Parser) -> OperationOp
classmethod
¶
Source code in xdsl/dialects/pdl.py
print(printer: Printer) -> None
¶
Source code in xdsl/dialects/pdl.py
PatternOp
¶
Bases: IRDLOperation
See external documentation.
Source code in xdsl/dialects/pdl.py
502 503 504 505 506 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 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 | |
name = 'pdl.pattern'
class-attribute
instance-attribute
¶
benefit = prop_def(IntegerAttr[I16])
class-attribute
instance-attribute
¶
sym_name = opt_prop_def(StringAttr)
class-attribute
instance-attribute
¶
body = region_def('single_block')
class-attribute
instance-attribute
¶
traits = traits_def(OptionalSymbolOpInterface())
class-attribute
instance-attribute
¶
__init__(benefit: int | IntegerAttr[IntegerType], sym_name: str | StringAttr | None, body: Region | None = None)
¶
Source code in xdsl/dialects/pdl.py
verify_()
¶
Source code in xdsl/dialects/pdl.py
parse(parser: Parser) -> PatternOp
classmethod
¶
Source code in xdsl/dialects/pdl.py
print(printer: Printer) -> None
¶
RangeOp
¶
Bases: IRDLOperation
See external documentation.
Source code in xdsl/dialects/pdl.py
name = 'pdl.range'
class-attribute
instance-attribute
¶
arguments = var_operand_def(AnyPDLType | RangeType[AnyPDLType])
class-attribute
instance-attribute
¶
result = result_def(RangeType[AnyPDLType])
class-attribute
instance-attribute
¶
traits = lazy_traits_def(lambda: (HasParent(RewriteOp),))
class-attribute
instance-attribute
¶
verify_() -> None
¶
Source code in xdsl/dialects/pdl.py
__init__(arguments: Sequence[SSAValue], result_type: Attribute | None = None) -> None
¶
Source code in xdsl/dialects/pdl.py
parse(parser: Parser) -> RangeOp
classmethod
¶
print(printer: Printer) -> None
¶
ReplaceOp
¶
Bases: IRDLOperation
See external documentation.
pdl.replace operations are used within pdl.rewrite regions to specify
that an input operation should be marked as replaced. The semantics of this
operation correspond with the replaceOp method on a PatternRewriter. The
set of replacement values can be either:
* a single Operation (replOperation should be populated)
- The operation will be replaced with the results of this operation.
* a set of Values (replValues should be populated)
- The operation will be replaced with these values.
Source code in xdsl/dialects/pdl.py
name = 'pdl.replace'
class-attribute
instance-attribute
¶
op_value = operand_def(OperationType)
class-attribute
instance-attribute
¶
repl_operation = opt_operand_def(OperationType)
class-attribute
instance-attribute
¶
repl_values = var_operand_def(ValueType | RangeType[ValueType])
class-attribute
instance-attribute
¶
irdl_options = (AttrSizedOperandSegments(as_property=True),)
class-attribute
instance-attribute
¶
assembly_format = '$op_value `with` ` ` (`(` $repl_values^ `:` type($repl_values) `)`)? $repl_operation attr-dict'
class-attribute
instance-attribute
¶
__init__(op_value: SSAValue, repl_operation: SSAValue | None = None, repl_values: Sequence[SSAValue] | None = None) -> None
¶
Source code in xdsl/dialects/pdl.py
verify_() -> None
¶
Source code in xdsl/dialects/pdl.py
ResultOp
¶
Bases: IRDLOperation
See external documentation.
Source code in xdsl/dialects/pdl.py
name = 'pdl.result'
class-attribute
instance-attribute
¶
index = prop_def(IntegerAttr[I32])
class-attribute
instance-attribute
¶
parent_ = operand_def(OperationType)
class-attribute
instance-attribute
¶
val = result_def(ValueType)
class-attribute
instance-attribute
¶
assembly_format = '$index `of` $parent_ attr-dict'
class-attribute
instance-attribute
¶
__init__(index: int | IntegerAttr[IntegerType], parent: SSAValue) -> None
¶
ResultsOp
¶
Bases: IRDLOperation
See external documentation.
Source code in xdsl/dialects/pdl.py
name = 'pdl.results'
class-attribute
instance-attribute
¶
index = opt_prop_def(IntegerAttr[I32])
class-attribute
instance-attribute
¶
parent_ = operand_def(OperationType)
class-attribute
instance-attribute
¶
val = result_def(ValueType | RangeType[ValueType])
class-attribute
instance-attribute
¶
__init__(parent: SSAValue, index: int | IntegerAttr[IntegerType] | None = None, result_type: Attribute = RangeType(ValueType())) -> None
¶
Source code in xdsl/dialects/pdl.py
parse(parser: Parser) -> ResultsOp
classmethod
¶
Source code in xdsl/dialects/pdl.py
print(printer: Printer) -> None
¶
Source code in xdsl/dialects/pdl.py
RewriteOp
¶
Bases: IRDLOperation
See external documentation.
Source code in xdsl/dialects/pdl.py
name = 'pdl.rewrite'
class-attribute
instance-attribute
¶
root = opt_operand_def(OperationType)
class-attribute
instance-attribute
¶
name_ = opt_prop_def(StringAttr, prop_name='name')
class-attribute
instance-attribute
¶
external_args = var_operand_def(AnyPDLType)
class-attribute
instance-attribute
¶
body = region_def()
class-attribute
instance-attribute
¶
irdl_options = (AttrSizedOperandSegments(as_property=True),)
class-attribute
instance-attribute
¶
traits = traits_def(HasParent(PatternOp), NoTerminator(), IsTerminator())
class-attribute
instance-attribute
¶
assembly_format = '($root^)? (`with` $name^ (`(` $external_args^ `:` type($external_args) `)`)?)?($body^)? attr-dict-with-keyword'
class-attribute
instance-attribute
¶
__init__(root: SSAValue | None, body: Region | type[Region.DEFAULT] = Region.DEFAULT, name: str | StringAttr | None = None, external_args: Sequence[SSAValue] = ()) -> None
¶
Source code in xdsl/dialects/pdl.py
TypeOp
¶
Bases: IRDLOperation
See external documentation.
Source code in xdsl/dialects/pdl.py
name = 'pdl.type'
class-attribute
instance-attribute
¶
constantType = opt_prop_def(TypeAttribute)
class-attribute
instance-attribute
¶
result = result_def(TypeType)
class-attribute
instance-attribute
¶
assembly_format = 'attr-dict (`:` $constantType^)?'
class-attribute
instance-attribute
¶
__init__(constant_type: Attribute | None = None) -> None
¶
TypesOp
¶
Bases: IRDLOperation
See external documentation.
Source code in xdsl/dialects/pdl.py
name = 'pdl.types'
class-attribute
instance-attribute
¶
constantTypes = opt_prop_def(ArrayAttr[TypeAttribute])
class-attribute
instance-attribute
¶
result = result_def(RangeType[TypeType])
class-attribute
instance-attribute
¶
assembly_format = 'attr-dict (`:` $constantTypes^)?'
class-attribute
instance-attribute
¶
__init__(constant_types: Iterable[Attribute] | None = None) -> None
¶
Source code in xdsl/dialects/pdl.py
parse_operands_with_types(parser: Parser) -> list[SSAValue]
¶
Parse a list of operands with types of the following format:
operand1, operand2 : type1, type2
At least one operand is expected.
Source code in xdsl/dialects/pdl.py
print_operands_with_types(printer: Printer, operands: Iterable[SSAValue]) -> None
¶
has_binding_use(op: Operation) -> bool
¶
Returns true if the given operation is used by a "binding" pdl operation.
Source code in xdsl/dialects/pdl.py
verify_has_binding_use(op: Operation) -> None
¶
Raise an exception if the operation is in the main matcher body and is not used by a "binding" pdl operation.