summaryrefslogtreecommitdiff
path: root/include/llvm/Transforms/InstCombine/InstCombine.h
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-07-23 20:41:05 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-07-23 20:41:05 +0000
commit01095a5d43bbfde13731688ddcf6048ebb8b7721 (patch)
tree4def12e759965de927d963ac65840d663ef9d1ea /include/llvm/Transforms/InstCombine/InstCombine.h
parentf0f4822ed4b66e3579e92a89f368f8fb860e218e (diff)
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