@@ -655,15 +655,15 @@ void PatternEmitter::emitOpMatch(DagNode tree, StringRef opName, int depth) {
655
655
}
656
656
657
657
// Next handle DAG leaf: operand or attribute
658
- if (opArg. is <NamedTypeConstraint *>()) {
658
+ if (isa <NamedTypeConstraint *>(opArg )) {
659
659
auto operandName =
660
660
formatv (" {0}.getODSOperands({1})" , castedName, nextOperand);
661
661
emitOperandMatch (tree, castedName, operandName.str (), opArgIdx,
662
662
/* operandMatcher=*/ tree.getArgAsLeaf (i),
663
663
/* argName=*/ tree.getArgName (i), opArgIdx,
664
664
/* variadicSubIndex=*/ std::nullopt);
665
665
++nextOperand;
666
- } else if (opArg. is <NamedAttribute *>()) {
666
+ } else if (isa <NamedAttribute *>(opArg )) {
667
667
emitAttributeMatch (tree, opName, opArgIdx, depth);
668
668
} else {
669
669
PrintFatalError (loc, " unhandled case when matching op" );
@@ -680,7 +680,7 @@ void PatternEmitter::emitOperandMatch(DagNode tree, StringRef opName,
680
680
int argIndex,
681
681
std::optional<int > variadicSubIndex) {
682
682
Operator &op = tree.getDialectOp (opMap);
683
- auto *operand = op. getArg (operandIndex). get <NamedTypeConstraint *>();
683
+ auto *operand = cast <NamedTypeConstraint *>(op. getArg (operandIndex) );
684
684
685
685
// If a constraint is specified, we need to generate C++ statements to
686
686
// check the constraint.
@@ -770,7 +770,7 @@ void PatternEmitter::emitEitherOperandMatch(DagNode tree, DagNode eitherArgTree,
770
770
// need to queue the operation only if the matching success. Thus we emit
771
771
// the code at the end.
772
772
tblgenOps << formatv (" tblgen_ops.push_back({0});\n " , argName);
773
- } else if (op. getArg (argIndex). is <NamedTypeConstraint *>()) {
773
+ } else if (isa <NamedTypeConstraint *>(op. getArg (argIndex) )) {
774
774
emitOperandMatch (tree, opName, /* operandName=*/ formatv (" v{0}" , i).str (),
775
775
operandIndex,
776
776
/* operandMatcher=*/ eitherArgTree.getArgAsLeaf (i),
@@ -851,7 +851,7 @@ void PatternEmitter::emitVariadicOperandMatch(DagNode tree,
851
851
os << formatv (" tblgen_ops.push_back({0});\n " , argName);
852
852
853
853
os.unindent () << " }\n " ;
854
- } else if (op. getArg (argIndex). is <NamedTypeConstraint *>()) {
854
+ } else if (isa <NamedTypeConstraint *>(op. getArg (argIndex) )) {
855
855
auto operandName = formatv (" variadic_operand_range.slice({0}, 1)" , i);
856
856
emitOperandMatch (tree, opName, operandName.str (), operandIndex,
857
857
/* operandMatcher=*/ variadicArgTree.getArgAsLeaf (i),
@@ -867,7 +867,7 @@ void PatternEmitter::emitVariadicOperandMatch(DagNode tree,
867
867
void PatternEmitter::emitAttributeMatch (DagNode tree, StringRef opName,
868
868
int argIndex, int depth) {
869
869
Operator &op = tree.getDialectOp (opMap);
870
- auto *namedAttr = op. getArg (argIndex). get <NamedAttribute *>();
870
+ auto *namedAttr = cast <NamedAttribute *>(op. getArg (argIndex) );
871
871
const auto &attr = namedAttr->attr ;
872
872
873
873
os << " {\n " ;
@@ -1775,7 +1775,7 @@ void PatternEmitter::supplyValuesForOpArgs(
1775
1775
auto patArgName = node.getArgName (argIndex);
1776
1776
if (leaf.isConstantAttr () || leaf.isEnumAttrCase ()) {
1777
1777
// TODO: Refactor out into map to avoid recomputing these.
1778
- if (!opArg. is <NamedAttribute *>())
1778
+ if (!isa <NamedAttribute *>(opArg ))
1779
1779
PrintFatalError (loc, Twine (" expected attribute " ) + Twine (argIndex));
1780
1780
if (!patArgName.empty ())
1781
1781
os << " /*" << patArgName << " =*/" ;
@@ -1805,7 +1805,7 @@ void PatternEmitter::createAggregateLocalVarsForOpArgs(
1805
1805
bool hasOperandSegmentSizes = false ;
1806
1806
std::vector<std::string> sizes;
1807
1807
for (int argIndex = 0 , e = resultOp.getNumArgs (); argIndex < e; ++argIndex) {
1808
- if (resultOp. getArg (argIndex). is <NamedAttribute *>()) {
1808
+ if (isa <NamedAttribute *>(resultOp. getArg (argIndex) )) {
1809
1809
// The argument in the op definition.
1810
1810
auto opArgName = resultOp.getArgName (argIndex);
1811
1811
hasOperandSegmentSizes =
@@ -1826,7 +1826,7 @@ void PatternEmitter::createAggregateLocalVarsForOpArgs(
1826
1826
}
1827
1827
1828
1828
const auto *operand =
1829
- resultOp. getArg (argIndex). get <NamedTypeConstraint *>();
1829
+ cast <NamedTypeConstraint *>(resultOp. getArg (argIndex) );
1830
1830
std::string varName;
1831
1831
if (operand->isVariadic ()) {
1832
1832
++numVariadic;
0 commit comments