aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-reduce/DeltaManager.cpp
diff options
context:
space:
mode:
authorMarkus Lavin <markus.lavin@ericsson.com>2021-11-02 10:11:54 +0100
committerMarkus Lavin <markus.lavin@ericsson.com>2021-11-02 10:16:42 +0100
commitfd41738e2ca975b6d3bea021ef38e6d49f27a71b (patch)
tree06933f2dd90e91919a6a61fa06ec4582abd4e891 /llvm/tools/llvm-reduce/DeltaManager.cpp
parentcd2e66efa65fd63cf6f48112f49c09489a1baac0 (diff)
downloadllvm-fd41738e2ca975b6d3bea021ef38e6d49f27a71b.zip
llvm-fd41738e2ca975b6d3bea021ef38e6d49f27a71b.tar.gz
llvm-fd41738e2ca975b6d3bea021ef38e6d49f27a71b.tar.bz2
Recommit "[llvm-reduce] Add MIR support"
(Second try. Need to link against CodeGen and MC libs.) The llvm-reduce tool has been extended to operate on MIR (import, clone and export). Current limitation is that only a single machine function is supported. A single reducer pass that operates on machine instructions (while on SSA-form) has been added. Additional MIR specific reducer passes can be added later as needed. Differential Revision: https://reviews.llvm.org/D110527
Diffstat (limited to 'llvm/tools/llvm-reduce/DeltaManager.cpp')
-rw-r--r--llvm/tools/llvm-reduce/DeltaManager.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/llvm/tools/llvm-reduce/DeltaManager.cpp b/llvm/tools/llvm-reduce/DeltaManager.cpp
index dab4040..8dd16b0 100644
--- a/llvm/tools/llvm-reduce/DeltaManager.cpp
+++ b/llvm/tools/llvm-reduce/DeltaManager.cpp
@@ -24,6 +24,7 @@
#include "deltas/ReduceGlobalVarInitializers.h"
#include "deltas/ReduceGlobalVars.h"
#include "deltas/ReduceInstructions.h"
+#include "deltas/ReduceInstructionsMIR.h"
#include "deltas/ReduceMetadata.h"
#include "deltas/ReduceModuleData.h"
#include "deltas/ReduceOperandBundles.h"
@@ -59,9 +60,16 @@ static cl::opt<std::string>
DELTA_PASS("attributes", reduceAttributesDeltaPass) \
DELTA_PASS("module-data", reduceModuleDataDeltaPass)
+#define DELTA_PASSES_MIR \
+ DELTA_PASS("instructions", reduceInstructionsMIRDeltaPass)
+
static void runAllDeltaPasses(TestRunner &Tester) {
#define DELTA_PASS(NAME, FUNC) FUNC(Tester);
- DELTA_PASSES
+ if (Tester.getProgram().isMIR()) {
+ DELTA_PASSES_MIR
+ } else {
+ DELTA_PASSES
+ }
#undef DELTA_PASS
}
@@ -71,7 +79,11 @@ static void runDeltaPassName(TestRunner &Tester, StringRef PassName) {
FUNC(Tester); \
return; \
}
- DELTA_PASSES
+ if (Tester.getProgram().isMIR()) {
+ DELTA_PASSES_MIR
+ } else {
+ DELTA_PASSES
+ }
#undef DELTA_PASS
errs() << "unknown pass \"" << PassName << "\"";
exit(1);
@@ -80,7 +92,10 @@ static void runDeltaPassName(TestRunner &Tester, StringRef PassName) {
void llvm::printDeltaPasses(raw_ostream &OS) {
OS << "Delta passes (pass to `--delta-passes=` as a comma separated list):\n";
#define DELTA_PASS(NAME, FUNC) OS << " " << NAME << "\n";
+ OS << " IR:\n";
DELTA_PASSES
+ OS << " MIR:\n";
+ DELTA_PASSES_MIR
#undef DELTA_PASS
}