[PATCH] D77322: Change pass registration generated code to allow users to selectively register passes
Mehdi AMINI via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 2 12:29:12 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGee4d0342771a: Change pass registration generated code to allow users to selectively register… (authored by mehdi_amini).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77322/new/
https://reviews.llvm.org/D77322
Files:
mlir/tools/mlir-tblgen/PassGen.cpp
Index: mlir/tools/mlir-tblgen/PassGen.cpp
===================================================================
--- mlir/tools/mlir-tblgen/PassGen.cpp
+++ mlir/tools/mlir-tblgen/PassGen.cpp
@@ -88,13 +88,31 @@
static void emitRegistration(ArrayRef<Pass> passes, raw_ostream &os) {
os << "#ifdef GEN_PASS_REGISTRATION\n";
for (const Pass &pass : passes) {
+ os << llvm::formatv("#define GEN_PASS_REGISTRATION_{0}\n",
+ pass.getDef()->getName());
+ }
+ os << "#endif // GEN_PASS_REGISTRATION\n";
+
+ for (const Pass &pass : passes) {
+ os << llvm::formatv("#ifdef GEN_PASS_REGISTRATION_{0}\n",
+ pass.getDef()->getName());
os << llvm::formatv("::mlir::registerPass(\"{0}\", \"{1}\", []() -> "
"std::unique_ptr<Pass> {{ return {2}; });\n",
pass.getArgument(), pass.getSummary(),
pass.getConstructor());
+ os << llvm::formatv("#endif // GEN_PASS_REGISTRATION_{0}\n",
+ pass.getDef()->getName());
+ os << llvm::formatv("#undef GEN_PASS_REGISTRATION_{0}\n",
+ pass.getDef()->getName());
+ }
+
+ os << "#ifdef GEN_PASS_REGISTRATION\n";
+ for (const Pass &pass : passes) {
+ os << llvm::formatv("#undef GEN_PASS_REGISTRATION_{0}\n",
+ pass.getDef()->getName());
}
- os << "#undef GEN_PASS_REGISTRATION\n";
os << "#endif // GEN_PASS_REGISTRATION\n";
+ os << "#undef GEN_PASS_REGISTRATION\n";
}
//===----------------------------------------------------------------------===//
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77322.254597.patch
Type: text/x-patch
Size: 1599 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200402/d40d1675/attachment.bin>
More information about the llvm-commits
mailing list