diff options
author | River Riddle <riddleriver@gmail.com> | 2022-09-21 13:40:47 -0700 |
---|---|---|
committer | River Riddle <riddleriver@gmail.com> | 2022-09-21 17:36:13 -0700 |
commit | 72fddfb5993e99d6e1a6d204167b6eac4b7eb934 (patch) | |
tree | 9bd37092025bc1db6e246818cea4e08078032594 /mlir/python | |
parent | 986b5c56ea678dcc33cb55270bb79a83a20e5d60 (diff) | |
download | llvm-72fddfb5993e99d6e1a6d204167b6eac4b7eb934.zip llvm-72fddfb5993e99d6e1a6d204167b6eac4b7eb934.tar.gz llvm-72fddfb5993e99d6e1a6d204167b6eac4b7eb934.tar.bz2 |
[mlir] Flip PDL to use Both accessors
This allows for incrementally updating the old API usages without
needing to update everything at once. PDL will be left on Both
for a little bit and then flipped to prefixed when all APIs have been
updated.
Differential Revision: https://reviews.llvm.org/D134387
Diffstat (limited to 'mlir/python')
-rw-r--r-- | mlir/python/mlir/dialects/_pdl_ops_ext.py | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/mlir/python/mlir/dialects/_pdl_ops_ext.py b/mlir/python/mlir/dialects/_pdl_ops_ext.py index bb63fe6..428301b 100644 --- a/mlir/python/mlir/dialects/_pdl_ops_ext.py +++ b/mlir/python/mlir/dialects/_pdl_ops_ext.py @@ -86,14 +86,14 @@ class AttributeOp: """Specialization for PDL attribute op class.""" def __init__(self, - type: Optional[Union[OpView, Operation, Value]] = None, + valueType: Optional[Union[OpView, Operation, Value]] = None, value: Optional[Attribute] = None, *, loc=None, ip=None): - type = type if type is None else _get_value(type) + valueType = valueType if valueType is None else _get_value(valueType) result = pdl.AttributeType.get() - super().__init__(result, type=type, value=value, loc=loc, ip=ip) + super().__init__(result, valueType=valueType, value=value, loc=loc, ip=ip) class EraseOp: @@ -118,7 +118,7 @@ class OperandOp: ip=None): type = type if type is None else _get_value(type) result = pdl.ValueType.get() - super().__init__(result, type=type, loc=loc, ip=ip) + super().__init__(result, valueType=type, loc=loc, ip=ip) class OperandsOp: @@ -131,7 +131,7 @@ class OperandsOp: ip=None): types = types if types is None else _get_value(types) result = pdl.RangeType.get(pdl.ValueType.get()) - super().__init__(result, type=types, loc=loc, ip=ip) + super().__init__(result, valueType=types, loc=loc, ip=ip) class OperationOp: @@ -147,15 +147,15 @@ class OperationOp: ip=None): name = name if name is None else _get_str_attr(name) args = _get_values(args) - attributeNames = [] - attributeValues = [] + attrNames = [] + attrValues = [] for attrName, attrValue in attributes.items(): - attributeNames.append(StringAttr.get(attrName)) - attributeValues.append(_get_value(attrValue)) - attributeNames = ArrayAttr.get(attributeNames) + attrNames.append(StringAttr.get(attrName)) + attrValues.append(_get_value(attrValue)) + attrNames = ArrayAttr.get(attrNames) types = _get_values(types) result = pdl.OperationType.get() - super().__init__(result, args, attributeValues, attributeNames, types, name=name, loc=loc, ip=ip) + super().__init__(result, args, attrValues, attrNames, types, opName=name, loc=loc, ip=ip) class PatternOp: @@ -255,24 +255,26 @@ class TypeOp: """Specialization for PDL type op class.""" def __init__(self, - type: Optional[Union[TypeAttr, Type]] = None, + constantType: Optional[Union[TypeAttr, Type]] = None, *, loc=None, ip=None): - type = type if type is None else _get_type_attr(type) + constantType = constantType if constantType is None else _get_type_attr( + constantType) result = pdl.TypeType.get() - super().__init__(result, type=type, loc=loc, ip=ip) + super().__init__(result, constantType=constantType, loc=loc, ip=ip) class TypesOp: """Specialization for PDL types op class.""" def __init__(self, - types: Sequence[Union[TypeAttr, Type]] = [], + constantTypes: Sequence[Union[TypeAttr, Type]] = [], *, loc=None, ip=None): - types = _get_array_attr([_get_type_attr(ty) for ty in types]) - types = None if not types else types + constantTypes = _get_array_attr( + [_get_type_attr(ty) for ty in constantTypes]) + constantTypes = None if not constantTypes else constantTypes result = pdl.RangeType.get(pdl.TypeType.get()) - super().__init__(result, types=types, loc=loc, ip=ip) + super().__init__(result, constantTypes=constantTypes, loc=loc, ip=ip) |