[Mlir-commits] [mlir] [mlir] [irdl] Add support for regions in irdl-to-cpp (PR #158540)
Théo Degioanni
llvmlistbot at llvm.org
Mon Sep 29 10:24:29 PDT 2025
================
@@ -131,6 +140,15 @@ static void fillDict(irdl::detail::dictionary &dict, const OpStrings &strings) {
operandCount ? joinNameList(strings.opOperandNames) : "{\"\"}";
dict["OP_RESULT_INITIALIZER_LIST"] =
resultCount ? joinNameList(strings.opResultNames) : "{\"\"}";
+ dict["OP_REGION_COUNT"] = std::to_string(regionCount);
+ dict["OP_ADD_REGIONS"] = regionCount
+ ? std::string(llvm::formatv(
+ R"(for (unsigned i = 0; i != {0}; ++i) {{
+ (void)odsState.addRegion();
+ }
+)",
+ regionCount))
+ : "";
----------------
Moxinilian wrote:
Why not put this directly in the template and use `OP_REGION_COUNT`? I have a feeling it's better to put as many things in the template as possible as it is more readable.
https://github.com/llvm/llvm-project/pull/158540
More information about the Mlir-commits
mailing list