From fd41738e2ca975b6d3bea021ef38e6d49f27a71b Mon Sep 17 00:00:00 2001 From: Markus Lavin Date: Tue, 2 Nov 2021 10:11:54 +0100 Subject: 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 --- llvm/tools/llvm-reduce/DeltaManager.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'llvm/tools/llvm-reduce/DeltaManager.cpp') 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 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 } -- cgit v1.1