[PATCH] D77887: Make TargetPassConfig and llc add pre/post passes the same way. NFC
Daniel Sanders via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 10 13:59:54 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc162bc2aedbe: Make TargetPassConfig and llc add pre/post passes the same way. NFC (authored by dsanders).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77887/new/
https://reviews.llvm.org/D77887
Files:
llvm/include/llvm/CodeGen/TargetPassConfig.h
llvm/lib/CodeGen/TargetPassConfig.cpp
llvm/tools/llc/llc.cpp
Index: llvm/tools/llc/llc.cpp
===================================================================
--- llvm/tools/llc/llc.cpp
+++ llvm/tools/llc/llc.cpp
@@ -387,8 +387,9 @@
return true;
}
std::string Banner = std::string("After ") + std::string(P->getPassName());
+ TPC.addMachinePrePasses();
PM.add(P);
- TPC.printAndVerify(Banner);
+ TPC.addMachinePostPasses(Banner);
return false;
}
Index: llvm/lib/CodeGen/TargetPassConfig.cpp
===================================================================
--- llvm/lib/CodeGen/TargetPassConfig.cpp
+++ llvm/lib/CodeGen/TargetPassConfig.cpp
@@ -530,17 +530,16 @@
if (StopBefore == PassID && StopBeforeCount++ == StopBeforeInstanceNum)
Stopped = true;
if (Started && !Stopped) {
+ if (AddingMachinePasses)
+ addMachinePrePasses();
std::string Banner;
// Construct banner message before PM->add() as that may delete the pass.
if (AddingMachinePasses && (printAfter || verifyAfter))
Banner = std::string("After ") + std::string(P->getPassName());
PM->add(P);
- if (AddingMachinePasses) {
- if (printAfter)
- addPrintPass(Banner);
- if (verifyAfter)
- addVerifyPass(Banner);
- }
+ if (AddingMachinePasses)
+ addMachinePostPasses(Banner, /*AllowPrint*/ printAfter,
+ /*AllowVerify*/ verifyAfter);
// Add the passes after the pass P if there is any.
for (auto IP : Impl->InsertedPasses) {
@@ -606,6 +605,16 @@
PM->add(createMachineVerifierPass(Banner));
}
+void TargetPassConfig::addMachinePrePasses() {}
+
+void TargetPassConfig::addMachinePostPasses(const std::string &Banner,
+ bool AllowPrint, bool AllowVerify) {
+ if (AllowPrint)
+ addPrintPass(Banner);
+ if (AllowVerify)
+ addVerifyPass(Banner);
+}
+
/// Add common target configurable passes that perform LLVM IR to IR transforms
/// following machine independent optimization.
void TargetPassConfig::addIRPasses() {
Index: llvm/include/llvm/CodeGen/TargetPassConfig.h
===================================================================
--- llvm/include/llvm/CodeGen/TargetPassConfig.h
+++ llvm/include/llvm/CodeGen/TargetPassConfig.h
@@ -306,6 +306,15 @@
/// verification is enabled.
void addVerifyPass(const std::string &Banner);
+ /// Add standard passes before a pass that's about to be added. For example,
+ /// the DebugifyMachineModulePass if it is enabled.
+ void addMachinePrePasses();
+
+ /// Add standard passes after a pass that has just been added. For example,
+ /// the MachineVerifier if it is enabled.
+ void addMachinePostPasses(const std::string &Banner, bool AllowPrint = true,
+ bool AllowVerify = true);
+
/// Check whether or not GlobalISel should abort on error.
/// When this is disabled, GlobalISel will fall back on SDISel instead of
/// erroring out.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77887.256660.patch
Type: text/x-patch
Size: 2930 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200410/a9f67ade/attachment-0001.bin>
More information about the llvm-commits
mailing list