summaryrefslogtreecommitdiff
path: root/include/llvm/Transforms/InstCombine/InstCombine.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Transforms/InstCombine/InstCombine.h')
-rw-r--r--include/llvm/Transforms/InstCombine/InstCombine.h32
1 files changed, 28 insertions, 4 deletions
diff --git a/include/llvm/Transforms/InstCombine/InstCombine.h b/include/llvm/Transforms/InstCombine/InstCombine.h
index f48ec13107bc9..d70b847c68921 100644
--- a/include/llvm/Transforms/InstCombine/InstCombine.h
+++ b/include/llvm/Transforms/InstCombine/InstCombine.h
@@ -24,23 +24,47 @@
namespace llvm {
-class InstCombinePass {
+class InstCombinePass : public PassInfoMixin<InstCombinePass> {
InstCombineWorklist Worklist;
+ bool ExpensiveCombines;
public:
static StringRef name() { return "InstCombinePass"; }
// Explicitly define constructors for MSVC.
- InstCombinePass() {}
- InstCombinePass(InstCombinePass &&Arg) : Worklist(std::move(Arg.Worklist)) {}
+ InstCombinePass(bool ExpensiveCombines = true)
+ : ExpensiveCombines(ExpensiveCombines) {}
+ InstCombinePass(InstCombinePass &&Arg)
+ : Worklist(std::move(Arg.Worklist)),
+ ExpensiveCombines(Arg.ExpensiveCombines) {}
InstCombinePass &operator=(InstCombinePass &&RHS) {
Worklist = std::move(RHS.Worklist);
+ ExpensiveCombines = RHS.ExpensiveCombines;
return *this;
}
- PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+ PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
};
+/// \brief The legacy pass manager's instcombine pass.
+///
+/// This is a basic whole-function wrapper around the instcombine utility. It
+/// will try to combine all instructions in the function.
+class InstructionCombiningPass : public FunctionPass {
+ InstCombineWorklist Worklist;
+ const bool ExpensiveCombines;
+
+public:
+ static char ID; // Pass identification, replacement for typeid
+
+ InstructionCombiningPass(bool ExpensiveCombines = true)
+ : FunctionPass(ID), ExpensiveCombines(ExpensiveCombines) {
+ initializeInstructionCombiningPassPass(*PassRegistry::getPassRegistry());
+ }
+
+ void getAnalysisUsage(AnalysisUsage &AU) const override;
+ bool runOnFunction(Function &F) override;
+};
}
#endif