diff options
Diffstat (limited to 'mlir/tools')
-rw-r--r-- | mlir/tools/mlir-lsp-server/CMakeLists.txt | 21 | ||||
-rw-r--r-- | mlir/tools/mlir-lsp-server/mlir-lsp-server.cpp | 1 | ||||
-rw-r--r-- | mlir/tools/mlir-opt/CMakeLists.txt | 19 | ||||
-rw-r--r-- | mlir/tools/mlir-opt/mlir-opt.cpp | 2 | ||||
-rw-r--r-- | mlir/tools/mlir-pdll/mlir-pdll.cpp | 6 | ||||
-rw-r--r-- | mlir/tools/mlir-query/CMakeLists.txt | 4 | ||||
-rw-r--r-- | mlir/tools/mlir-reduce/CMakeLists.txt | 10 | ||||
-rw-r--r-- | mlir/tools/mlir-rewrite/CMakeLists.txt | 10 | ||||
-rw-r--r-- | mlir/tools/mlir-rewrite/mlir-rewrite.cpp | 1 | ||||
-rw-r--r-- | mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp | 2 | ||||
-rw-r--r-- | mlir/tools/mlir-tblgen/RewriterGen.cpp | 16 | ||||
-rw-r--r-- | mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp | 12 | ||||
-rw-r--r-- | mlir/tools/tblgen-to-irdl/OpDefinitionsGen.cpp | 92 |
13 files changed, 86 insertions, 110 deletions
diff --git a/mlir/tools/mlir-lsp-server/CMakeLists.txt b/mlir/tools/mlir-lsp-server/CMakeLists.txt index 6932e0f..0518620 100644 --- a/mlir/tools/mlir-lsp-server/CMakeLists.txt +++ b/mlir/tools/mlir-lsp-server/CMakeLists.txt @@ -2,8 +2,6 @@ set(LLVM_OPTIONAL_SOURCES null.cpp ) -get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) -get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) set(LLVM_LINK_COMPONENTS Core Support @@ -35,22 +33,11 @@ if(MLIR_INCLUDE_TESTS) endif() set(LIBS - ${conversion_libs} - ${dialect_libs} - ${extension_libs} - - MLIRAffineAnalysis - MLIRAnalysis - MLIRDialect - MLIRFuncAllExtensions MLIRLspServerLib - MLIRParser - MLIRPass - MLIRTensorAllExtensions - MLIRTransforms - MLIRTransformUtils - MLIRSupport - MLIRIR + + MLIRRegisterAllDialects + MLIRRegisterAllExtensions + MLIRRegisterAllPasses ) add_mlir_tool(mlir-lsp-server diff --git a/mlir/tools/mlir-lsp-server/mlir-lsp-server.cpp b/mlir/tools/mlir-lsp-server/mlir-lsp-server.cpp index 6a759d9..10d602f 100644 --- a/mlir/tools/mlir-lsp-server/mlir-lsp-server.cpp +++ b/mlir/tools/mlir-lsp-server/mlir-lsp-server.cpp @@ -6,6 +6,7 @@ // //===----------------------------------------------------------------------===// +#include "mlir/IR/DialectRegistry.h" #include "mlir/IR/MLIRContext.h" #include "mlir/InitAllDialects.h" #include "mlir/InitAllExtensions.h" diff --git a/mlir/tools/mlir-opt/CMakeLists.txt b/mlir/tools/mlir-opt/CMakeLists.txt index 6958fe3..7cc6e78 100644 --- a/mlir/tools/mlir-opt/CMakeLists.txt +++ b/mlir/tools/mlir-opt/CMakeLists.txt @@ -2,9 +2,6 @@ set(LLVM_OPTIONAL_SOURCES null.cpp ) -get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) -get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) -get_property(extension_libs GLOBAL PROPERTY MLIR_EXTENSION_LIBS) set(LLVM_LINK_COMPONENTS Core Support @@ -65,21 +62,11 @@ if(MLIR_INCLUDE_TESTS) endif() set(LIBS - ${dialect_libs} - ${conversion_libs} - ${extension_libs} - MLIRAffineAnalysis - MLIRAnalysis - MLIRCastInterfaces - MLIRDialect MLIROptLib - MLIRParser - MLIRPass - MLIRTransforms - MLIRTransformUtils - MLIRSupport - MLIRIR + MLIRRegisterAllDialects + MLIRRegisterAllExtensions + MLIRRegisterAllPasses # TODO: Remove when registerAllGPUToLLVMIRTranslations is no longer # registered directly in mlir-opt.cpp. diff --git a/mlir/tools/mlir-opt/mlir-opt.cpp b/mlir/tools/mlir-opt/mlir-opt.cpp index 2c09753..14714c45 100644 --- a/mlir/tools/mlir-opt/mlir-opt.cpp +++ b/mlir/tools/mlir-opt/mlir-opt.cpp @@ -135,6 +135,7 @@ void registerTestShardSimplificationsPass(); void registerTestMultiBuffering(); void registerTestNextAccessPass(); void registerTestNVGPULowerings(); +void registerTestOneShotModuleBufferizePass(); void registerTestOpaqueLoc(); void registerTestOpLoweringPasses(); void registerTestPadFusion(); @@ -281,6 +282,7 @@ void registerTestPasses() { mlir::test::registerTestMultiBuffering(); mlir::test::registerTestNextAccessPass(); mlir::test::registerTestNVGPULowerings(); + mlir::test::registerTestOneShotModuleBufferizePass(); mlir::test::registerTestOpaqueLoc(); mlir::test::registerTestOpLoweringPasses(); mlir::test::registerTestPadFusion(); diff --git a/mlir/tools/mlir-pdll/mlir-pdll.cpp b/mlir/tools/mlir-pdll/mlir-pdll.cpp index 88a5f36..f99dcdb 100644 --- a/mlir/tools/mlir-pdll/mlir-pdll.cpp +++ b/mlir/tools/mlir-pdll/mlir-pdll.cpp @@ -201,6 +201,12 @@ int main(int argc, char **argv) { llvm::raw_string_ostream outputStrOS(outputStr); auto processFn = [&](std::unique_ptr<llvm::MemoryBuffer> chunkBuffer, raw_ostream &os) { + // Split does not guarantee null-termination. Make a copy of the buffer to + // ensure null-termination. + if (!chunkBuffer->getBuffer().ends_with('\0')) { + chunkBuffer = llvm::MemoryBuffer::getMemBufferCopy( + chunkBuffer->getBuffer(), chunkBuffer->getBufferIdentifier()); + } return processBuffer(os, std::move(chunkBuffer), outputType, includeDirs, dumpODS, includedFiles); }; diff --git a/mlir/tools/mlir-query/CMakeLists.txt b/mlir/tools/mlir-query/CMakeLists.txt index 1826397..1668bba 100644 --- a/mlir/tools/mlir-query/CMakeLists.txt +++ b/mlir/tools/mlir-query/CMakeLists.txt @@ -1,5 +1,3 @@ -get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) - if(MLIR_INCLUDE_TESTS) set(test_libs MLIRTestDialect @@ -12,8 +10,8 @@ add_mlir_tool(mlir-query llvm_update_compile_flags(mlir-query) mlir_target_link_libraries(mlir-query PRIVATE - ${dialect_libs} MLIRQueryLib + MLIRRegisterAllDialects ) target_link_libraries(mlir-query PRIVATE ${test_libs}) diff --git a/mlir/tools/mlir-reduce/CMakeLists.txt b/mlir/tools/mlir-reduce/CMakeLists.txt index d71ac86..349d75b 100644 --- a/mlir/tools/mlir-reduce/CMakeLists.txt +++ b/mlir/tools/mlir-reduce/CMakeLists.txt @@ -1,6 +1,3 @@ -get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) -get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) - if(MLIR_INCLUDE_TESTS) set(test_libs MLIRTestDialect @@ -8,12 +5,9 @@ if(MLIR_INCLUDE_TESTS) endif() set(LIBS - ${conversion_libs} - ${dialect_libs} - MLIRDialect - MLIRIR - MLIRPass MLIRReduceLib + MLIRRegisterAllDialects + MLIRRegisterAllPasses ) add_mlir_tool(mlir-reduce diff --git a/mlir/tools/mlir-rewrite/CMakeLists.txt b/mlir/tools/mlir-rewrite/CMakeLists.txt index 216491e..4120b175 100644 --- a/mlir/tools/mlir-rewrite/CMakeLists.txt +++ b/mlir/tools/mlir-rewrite/CMakeLists.txt @@ -1,21 +1,19 @@ -get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) set(LLVM_LINK_COMPONENTS Support ) set(LIBS - ${dialect_libs} - MLIRAffineAnalysis MLIRAnalysis MLIRCastInterfaces MLIRDialect + MLIRIR MLIRParser MLIRPass - MLIRTransforms - MLIRTransformUtils + MLIRRegisterAllDialects MLIRSupport - MLIRIR + MLIRTransformUtils + MLIRTransforms ) include_directories(../../../clang/include) diff --git a/mlir/tools/mlir-rewrite/mlir-rewrite.cpp b/mlir/tools/mlir-rewrite/mlir-rewrite.cpp index 87df9e1..fd8ae7e 100644 --- a/mlir/tools/mlir-rewrite/mlir-rewrite.cpp +++ b/mlir/tools/mlir-rewrite/mlir-rewrite.cpp @@ -24,6 +24,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/InitLLVM.h" #include "llvm/Support/LineIterator.h" +#include "llvm/Support/ManagedStatic.h" #include "llvm/Support/Regex.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/ToolOutputFile.h" diff --git a/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp b/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp index dbae2143..3140f12 100644 --- a/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp +++ b/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp @@ -495,7 +495,7 @@ void DefGen::emitCheckedBuilder() { MethodBody &body = m->body().indent(); auto scope = body.scope("return Base::getChecked(emitError, context", ");"); for (const auto ¶m : params) - body << ", " << param.getName(); + body << ", std::move(" << param.getName() << ")"; } static SmallVector<MethodParameter> diff --git a/mlir/tools/mlir-tblgen/RewriterGen.cpp b/mlir/tools/mlir-tblgen/RewriterGen.cpp index 975a524..605033d 100644 --- a/mlir/tools/mlir-tblgen/RewriterGen.cpp +++ b/mlir/tools/mlir-tblgen/RewriterGen.cpp @@ -632,7 +632,8 @@ void PatternEmitter::emitOpMatch(DagNode tree, StringRef opName, int depth) { ++opArgIdx; continue; } - if (auto *operand = llvm::dyn_cast_if_present<NamedTypeConstraint *>(opArg)) { + if (auto *operand = + llvm::dyn_cast_if_present<NamedTypeConstraint *>(opArg)) { if (argTree.isVariadic()) { if (!operand->isVariadic()) { auto error = formatv("variadic DAG construct can't match op {0}'s " @@ -1695,7 +1696,7 @@ std::string PatternEmitter::handleOpCreation(DagNode tree, int resultIndex, // Then create the op. os.scope("", "\n}\n").os - << formatv("{0} = rewriter.create<{1}>({2}, tblgen_values, {3});", + << formatv("{0} = {1}::create(rewriter, {2}, tblgen_values, {3});", valuePackName, resultOp.getQualCppClassName(), locToUse, useProperties ? "tblgen_props" : "tblgen_attrs"); return resultValue; @@ -1714,7 +1715,7 @@ std::string PatternEmitter::handleOpCreation(DagNode tree, int resultIndex, // aggregate-parameter builders. createSeparateLocalVarsForOpArgs(tree, childNodeNames); - os.scope().os << formatv("{0} = rewriter.create<{1}>({2}", valuePackName, + os.scope().os << formatv("{0} = {1}::create(rewriter, {2}", valuePackName, resultOp.getQualCppClassName(), locToUse); supplyValuesForOpArgs(tree, childNodeNames, depth); os << "\n );\n}\n"; @@ -1753,7 +1754,7 @@ std::string PatternEmitter::handleOpCreation(DagNode tree, int resultIndex, resultIndex + i); } } - os << formatv("{0} = rewriter.create<{1}>({2}, tblgen_types, " + os << formatv("{0} = {1}::create(rewriter, {2}, tblgen_types, " "tblgen_values, {3});\n", valuePackName, resultOp.getQualCppClassName(), locToUse, useProperties ? "tblgen_props" : "tblgen_attrs"); @@ -1772,8 +1773,8 @@ void PatternEmitter::createSeparateLocalVarsForOpArgs( int valueIndex = 0; // An index for uniquing local variable names. for (int argIndex = 0, e = resultOp.getNumArgs(); argIndex < e; ++argIndex) { - const auto *operand = - llvm::dyn_cast_if_present<NamedTypeConstraint *>(resultOp.getArg(argIndex)); + const auto *operand = llvm::dyn_cast_if_present<NamedTypeConstraint *>( + resultOp.getArg(argIndex)); // We do not need special handling for attributes or properties. if (!operand) continue; @@ -1828,7 +1829,8 @@ void PatternEmitter::supplyValuesForOpArgs( Argument opArg = resultOp.getArg(argIndex); // Handle the case of operand first. - if (auto *operand = llvm::dyn_cast_if_present<NamedTypeConstraint *>(opArg)) { + if (auto *operand = + llvm::dyn_cast_if_present<NamedTypeConstraint *>(opArg)) { if (!operand->name.empty()) os << "/*" << operand->name << "=*/"; os << childNodeNames.lookup(argIndex); diff --git a/mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp b/mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp index 7256705..41ffdfc 100644 --- a/mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp +++ b/mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp @@ -397,10 +397,9 @@ static void emitAvailabilityQueryForBitEnum(const Record &enumDef, avail.getMergeInstanceType(), avail.getQueryFnName(), enumName); - os << formatv( - " assert(::llvm::popcount(static_cast<{0}>(value)) <= 1" - " && \"cannot have more than one bit set\");\n", - underlyingType); + os << formatv(" assert(::llvm::popcount(static_cast<{0}>(value)) <= 1" + " && \"cannot have more than one bit set\");\n", + underlyingType); os << " switch (value) {\n"; for (const auto &caseSpecPair : classCasePair.getValue()) { @@ -933,7 +932,8 @@ static void emitOperandDeserialization(const Operator &op, ArrayRef<SMLoc> loc, // Process operands/attributes for (unsigned i = 0, e = op.getNumArgs(); i < e; ++i) { auto argument = op.getArg(i); - if (auto *valueArg = llvm::dyn_cast_if_present<NamedTypeConstraint *>(argument)) { + if (auto *valueArg = + llvm::dyn_cast_if_present<NamedTypeConstraint *>(argument)) { if (valueArg->isVariableLength()) { if (i != e - 1) { PrintFatalError( @@ -1044,7 +1044,7 @@ static void emitDeserializationFunction(const Record *attrClass, emitDecorationDeserialization(op, " ", valueID, attributes, os); os << formatv(" Location loc = createFileLineColLoc(opBuilder);\n"); - os << formatv(" auto {1} = opBuilder.create<{0}>(loc, {2}, {3}, {4}); " + os << formatv(" auto {1} = {0}::create(opBuilder, loc, {2}, {3}, {4}); " "(void){1};\n", op.getQualCppClassName(), opVar, resultTypes, operands, attributes); diff --git a/mlir/tools/tblgen-to-irdl/OpDefinitionsGen.cpp b/mlir/tools/tblgen-to-irdl/OpDefinitionsGen.cpp index c2ad09f..4343f2d 100644 --- a/mlir/tools/tblgen-to-irdl/OpDefinitionsGen.cpp +++ b/mlir/tools/tblgen-to-irdl/OpDefinitionsGen.cpp @@ -52,33 +52,33 @@ Value createPredicate(OpBuilder &builder, tblgen::Pred pred) { } if (combiner == "PredCombinerAnd") { auto op = - builder.create<irdl::AllOfOp>(UnknownLoc::get(ctx), constraints); + irdl::AllOfOp::create(builder, UnknownLoc::get(ctx), constraints); return op.getOutput(); } auto op = - builder.create<irdl::AnyOfOp>(UnknownLoc::get(ctx), constraints); + irdl::AnyOfOp::create(builder, UnknownLoc::get(ctx), constraints); return op.getOutput(); } } std::string condition = pred.getCondition(); // Build a CPredOp to match the C constraint built. - irdl::CPredOp op = builder.create<irdl::CPredOp>( - UnknownLoc::get(ctx), StringAttr::get(ctx, condition)); + irdl::CPredOp op = irdl::CPredOp::create(builder, UnknownLoc::get(ctx), + StringAttr::get(ctx, condition)); return op; } Value typeToConstraint(OpBuilder &builder, Type type) { MLIRContext *ctx = builder.getContext(); auto op = - builder.create<irdl::IsOp>(UnknownLoc::get(ctx), TypeAttr::get(type)); + irdl::IsOp::create(builder, UnknownLoc::get(ctx), TypeAttr::get(type)); return op.getOutput(); } Value baseToConstraint(OpBuilder &builder, StringRef baseClass) { MLIRContext *ctx = builder.getContext(); - auto op = builder.create<irdl::BaseOp>(UnknownLoc::get(ctx), - StringAttr::get(ctx, baseClass)); + auto op = irdl::BaseOp::create(builder, UnknownLoc::get(ctx), + StringAttr::get(ctx, baseClass)); return op.getOutput(); } @@ -179,7 +179,7 @@ Value createTypeConstraint(OpBuilder &builder, tblgen::Constraint constraint) { return createTypeConstraint(builder, predRec.getValueAsDef("baseType")); if (predRec.getName() == "AnyType") { - auto op = builder.create<irdl::AnyOp>(UnknownLoc::get(ctx)); + auto op = irdl::AnyOp::create(builder, UnknownLoc::get(ctx)); return op.getOutput(); } @@ -190,12 +190,12 @@ Value createTypeConstraint(OpBuilder &builder, tblgen::Constraint constraint) { SmallVector<FlatSymbolRefAttr> nested = { SymbolRefAttr::get(ctx, combined)}; auto typeSymbol = SymbolRefAttr::get(ctx, dialect, nested); - auto op = builder.create<irdl::BaseOp>(UnknownLoc::get(ctx), typeSymbol); + auto op = irdl::BaseOp::create(builder, UnknownLoc::get(ctx), typeSymbol); return op.getOutput(); } std::string typeName = ("!" + predRec.getValueAsString("typeName")).str(); - auto op = builder.create<irdl::BaseOp>(UnknownLoc::get(ctx), - StringAttr::get(ctx, typeName)); + auto op = irdl::BaseOp::create(builder, UnknownLoc::get(ctx), + StringAttr::get(ctx, typeName)); return op.getOutput(); } @@ -205,7 +205,7 @@ Value createTypeConstraint(OpBuilder &builder, tblgen::Constraint constraint) { constraints.push_back( createTypeConstraint(builder, tblgen::Constraint(child))); } - auto op = builder.create<irdl::AnyOfOp>(UnknownLoc::get(ctx), constraints); + auto op = irdl::AnyOfOp::create(builder, UnknownLoc::get(ctx), constraints); return op.getOutput(); } @@ -215,14 +215,14 @@ Value createTypeConstraint(OpBuilder &builder, tblgen::Constraint constraint) { constraints.push_back( createTypeConstraint(builder, tblgen::Constraint(child))); } - auto op = builder.create<irdl::AllOfOp>(UnknownLoc::get(ctx), constraints); + auto op = irdl::AllOfOp::create(builder, UnknownLoc::get(ctx), constraints); return op.getOutput(); } // Integer types if (predRec.getName() == "AnyInteger") { - auto op = builder.create<irdl::BaseOp>( - UnknownLoc::get(ctx), StringAttr::get(ctx, "!builtin.integer")); + auto op = irdl::BaseOp::create(builder, UnknownLoc::get(ctx), + StringAttr::get(ctx, "!builtin.integer")); return op.getOutput(); } @@ -235,7 +235,7 @@ Value createTypeConstraint(OpBuilder &builder, tblgen::Constraint constraint) { IntegerType::get(ctx, width, IntegerType::Signed)), typeToConstraint(builder, IntegerType::get(ctx, width, IntegerType::Unsigned))}; - auto op = builder.create<irdl::AnyOfOp>(UnknownLoc::get(ctx), types); + auto op = irdl::AnyOfOp::create(builder, UnknownLoc::get(ctx), types); return op.getOutput(); } @@ -253,7 +253,7 @@ Value createTypeConstraint(OpBuilder &builder, tblgen::Constraint constraint) { for (const Record *child : predRec.getValueAsListOfDefs("predicateList")) { constraints.push_back(createPredicate(builder, tblgen::Pred(child))); } - auto op = builder.create<irdl::AllOfOp>(UnknownLoc::get(ctx), constraints); + auto op = irdl::AllOfOp::create(builder, UnknownLoc::get(ctx), constraints); return op.getOutput(); } @@ -279,7 +279,7 @@ Value createAttrConstraint(OpBuilder &builder, tblgen::Constraint constraint) { constraints.push_back(createPredicate( builder, tblgen::Pred(child->getValueAsDef("predicate")))); } - auto op = builder.create<irdl::AllOfOp>(UnknownLoc::get(ctx), constraints); + auto op = irdl::AllOfOp::create(builder, UnknownLoc::get(ctx), constraints); return op.getOutput(); } @@ -290,12 +290,12 @@ Value createAttrConstraint(OpBuilder &builder, tblgen::Constraint constraint) { constraints.push_back( createAttrConstraint(builder, tblgen::Constraint(child))); } - auto op = builder.create<irdl::AnyOfOp>(UnknownLoc::get(ctx), constraints); + auto op = irdl::AnyOfOp::create(builder, UnknownLoc::get(ctx), constraints); return op.getOutput(); } if (predRec.getName() == "AnyAttr") { - auto op = builder.create<irdl::AnyOp>(UnknownLoc::get(ctx)); + auto op = irdl::AnyOp::create(builder, UnknownLoc::get(ctx)); return op.getOutput(); } @@ -317,7 +317,7 @@ Value createAttrConstraint(OpBuilder &builder, tblgen::Constraint constraint) { if (predRec.getName() == "UnitAttr") { auto op = - builder.create<irdl::IsOp>(UnknownLoc::get(ctx), UnitAttr::get(ctx)); + irdl::IsOp::create(builder, UnknownLoc::get(ctx), UnitAttr::get(ctx)); return op.getOutput(); } @@ -329,12 +329,12 @@ Value createAttrConstraint(OpBuilder &builder, tblgen::Constraint constraint) { }; auto typeSymbol = SymbolRefAttr::get(ctx, dialect, nested); - auto op = builder.create<irdl::BaseOp>(UnknownLoc::get(ctx), typeSymbol); + auto op = irdl::BaseOp::create(builder, UnknownLoc::get(ctx), typeSymbol); return op.getOutput(); } std::string typeName = ("#" + predRec.getValueAsString("attrName")).str(); - auto op = builder.create<irdl::BaseOp>(UnknownLoc::get(ctx), - StringAttr::get(ctx, typeName)); + auto op = irdl::BaseOp::create(builder, UnknownLoc::get(ctx), + StringAttr::get(ctx, typeName)); return op.getOutput(); } @@ -348,15 +348,15 @@ Value createRegionConstraint(OpBuilder &builder, tblgen::Region constraint) { if (predRec.getName() == "AnyRegion") { ValueRange entryBlockArgs = {}; auto op = - builder.create<irdl::RegionOp>(UnknownLoc::get(ctx), entryBlockArgs); + irdl::RegionOp::create(builder, UnknownLoc::get(ctx), entryBlockArgs); return op.getResult(); } if (predRec.isSubClassOf("SizedRegion")) { ValueRange entryBlockArgs = {}; auto ty = IntegerType::get(ctx, 32); - auto op = builder.create<irdl::RegionOp>( - UnknownLoc::get(ctx), entryBlockArgs, + auto op = irdl::RegionOp::create( + builder, UnknownLoc::get(ctx), entryBlockArgs, IntegerAttr::get(ty, predRec.getValueAsInt("blocks"))); return op.getResult(); } @@ -388,8 +388,8 @@ irdl::OperationOp createIRDLOperation(OpBuilder &builder, MLIRContext *ctx = builder.getContext(); StringRef opName = getOperatorName(tblgenOp); - irdl::OperationOp op = builder.create<irdl::OperationOp>( - UnknownLoc::get(ctx), StringAttr::get(ctx, opName)); + irdl::OperationOp op = irdl::OperationOp::create( + builder, UnknownLoc::get(ctx), StringAttr::get(ctx, opName)); // Add the block in the region. Block &opBlock = op.getBody().emplaceBlock(); @@ -471,19 +471,19 @@ irdl::OperationOp createIRDLOperation(OpBuilder &builder, // Create the operands and results operations. if (!operands.empty()) - consBuilder.create<irdl::OperandsOp>(UnknownLoc::get(ctx), operands, - ArrayAttr::get(ctx, operandNames), - operandVariadicity); + irdl::OperandsOp::create(consBuilder, UnknownLoc::get(ctx), operands, + ArrayAttr::get(ctx, operandNames), + operandVariadicity); if (!results.empty()) - consBuilder.create<irdl::ResultsOp>(UnknownLoc::get(ctx), results, - ArrayAttr::get(ctx, resultNames), - resultVariadicity); + irdl::ResultsOp::create(consBuilder, UnknownLoc::get(ctx), results, + ArrayAttr::get(ctx, resultNames), + resultVariadicity); if (!attributes.empty()) - consBuilder.create<irdl::AttributesOp>(UnknownLoc::get(ctx), attributes, - ArrayAttr::get(ctx, attrNames)); + irdl::AttributesOp::create(consBuilder, UnknownLoc::get(ctx), attributes, + ArrayAttr::get(ctx, attrNames)); if (!regions.empty()) - consBuilder.create<irdl::RegionsOp>(UnknownLoc::get(ctx), regions, - ArrayAttr::get(ctx, regionNames)); + irdl::RegionsOp::create(consBuilder, UnknownLoc::get(ctx), regions, + ArrayAttr::get(ctx, regionNames)); return op; } @@ -493,8 +493,8 @@ irdl::TypeOp createIRDLType(OpBuilder &builder, tblgen::TypeDef &tblgenType) { StringRef typeName = getTypeName(tblgenType); std::string combined = ("!" + typeName).str(); - irdl::TypeOp op = builder.create<irdl::TypeOp>( - UnknownLoc::get(ctx), StringAttr::get(ctx, combined)); + irdl::TypeOp op = irdl::TypeOp::create(builder, UnknownLoc::get(ctx), + StringAttr::get(ctx, combined)); op.getBody().emplaceBlock(); @@ -507,8 +507,8 @@ irdl::AttributeOp createIRDLAttr(OpBuilder &builder, StringRef attrName = getAttrName(tblgenAttr); std::string combined = ("#" + attrName).str(); - irdl::AttributeOp op = builder.create<irdl::AttributeOp>( - UnknownLoc::get(ctx), StringAttr::get(ctx, combined)); + irdl::AttributeOp op = irdl::AttributeOp::create( + builder, UnknownLoc::get(ctx), StringAttr::get(ctx, combined)); op.getBody().emplaceBlock(); @@ -517,8 +517,8 @@ irdl::AttributeOp createIRDLAttr(OpBuilder &builder, static irdl::DialectOp createIRDLDialect(OpBuilder &builder) { MLIRContext *ctx = builder.getContext(); - return builder.create<irdl::DialectOp>(UnknownLoc::get(ctx), - StringAttr::get(ctx, selectedDialect)); + return irdl::DialectOp::create(builder, UnknownLoc::get(ctx), + StringAttr::get(ctx, selectedDialect)); } static bool emitDialectIRDLDefs(const RecordKeeper &records, raw_ostream &os) { @@ -529,7 +529,7 @@ static bool emitDialectIRDLDefs(const RecordKeeper &records, raw_ostream &os) { // Create a module op and set it as the insertion point. OwningOpRef<ModuleOp> module = - builder.create<ModuleOp>(UnknownLoc::get(&ctx)); + ModuleOp::create(builder, UnknownLoc::get(&ctx)); builder = builder.atBlockBegin(module->getBody()); // Create the dialect and insert it. irdl::DialectOp dialect = createIRDLDialect(builder); |