LLVM  6.0.0svn
InstCombine.h
Go to the documentation of this file.
1 //===- InstCombine.h - InstCombine pass -------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 /// \file
10 ///
11 /// This file provides the primary interface to the instcombine pass. This pass
12 /// is suitable for use in the new pass manager. For a pass that works with the
13 /// legacy pass manager, please look for \c createInstructionCombiningPass() in
14 /// Scalar.h.
15 ///
16 //===----------------------------------------------------------------------===//
17 
18 #ifndef LLVM_TRANSFORMS_INSTCOMBINE_INSTCOMBINE_H
19 #define LLVM_TRANSFORMS_INSTCOMBINE_INSTCOMBINE_H
20 
21 #include "llvm/IR/Function.h"
22 #include "llvm/IR/PassManager.h"
24 
25 namespace llvm {
26 
27 class InstCombinePass : public PassInfoMixin<InstCombinePass> {
28  InstCombineWorklist Worklist;
29  bool ExpensiveCombines;
30 
31 public:
32  static StringRef name() { return "InstCombinePass"; }
33 
34  explicit InstCombinePass(bool ExpensiveCombines = true)
35  : ExpensiveCombines(ExpensiveCombines) {}
36 
38 };
39 
40 /// \brief The legacy pass manager's instcombine pass.
41 ///
42 /// This is a basic whole-function wrapper around the instcombine utility. It
43 /// will try to combine all instructions in the function.
45  InstCombineWorklist Worklist;
46  const bool ExpensiveCombines;
47 
48 public:
49  static char ID; // Pass identification, replacement for typeid
50 
51  InstructionCombiningPass(bool ExpensiveCombines = true)
52  : FunctionPass(ID), ExpensiveCombines(ExpensiveCombines) {
54  }
55 
56  void getAnalysisUsage(AnalysisUsage &AU) const override;
57  bool runOnFunction(Function &F) override;
58 };
59 }
60 
61 #endif
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
F(f)
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:365
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
static bool runOnFunction(Function &F, bool PostInlining)
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:153
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:285
The legacy pass manager&#39;s instcombine pass.
Definition: InstCombine.h:44
InstructionCombiningPass(bool ExpensiveCombines=true)
Definition: InstCombine.h:51
InstCombineWorklist - This is the worklist management logic for InstCombine.
InstCombinePass(bool ExpensiveCombines=true)
Definition: InstCombine.h:34
static StringRef name()
Definition: InstCombine.h:32
void initializeInstructionCombiningPassPass(PassRegistry &)
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
A container for analyses that lazily runs them and caches their results.
This header defines various interfaces for pass management in LLVM.