Pass a Banner argument to the machine code verifier both from
[oota-llvm.git] / include / llvm / CodeGen / Passes.h
1 //===-- Passes.h - Target independent code generation passes ----*- 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 //
10 // This file defines interfaces to access the target independent code generation
11 // passes provided by the LLVM backend.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_CODEGEN_PASSES_H
16 #define LLVM_CODEGEN_PASSES_H
17
18 #include "llvm/Target/TargetMachine.h"
19 #include <string>
20
21 namespace llvm {
22
23   class FunctionPass;
24   class MachineFunctionPass;
25   class PassInfo;
26   class TargetLowering;
27   class RegisterCoalescer;
28   class raw_ostream;
29
30   /// createUnreachableBlockEliminationPass - The LLVM code generator does not
31   /// work well with unreachable basic blocks (what live ranges make sense for a
32   /// block that cannot be reached?).  As such, a code generator should either
33   /// not instruction select unreachable blocks, or run this pass as its
34   /// last LLVM modifying pass to clean up blocks that are not reachable from
35   /// the entry block.
36   FunctionPass *createUnreachableBlockEliminationPass();
37
38   /// MachineFunctionPrinter pass - This pass prints out the machine function to
39   /// the given stream as a debugging tool.
40   MachineFunctionPass *
41   createMachineFunctionPrinterPass(raw_ostream &OS,
42                                    const std::string &Banner ="");
43
44   /// MachineLoopInfo pass - This pass is a loop analysis pass.
45   ///
46   extern char &MachineLoopInfoID;
47
48   /// MachineLoopRanges pass - This pass is an on-demand loop coverage
49   /// analysis pass.
50   ///
51   extern char &MachineLoopRangesID;
52
53   /// MachineDominators pass - This pass is a machine dominators analysis pass.
54   ///
55   extern char &MachineDominatorsID;
56
57   /// PHIElimination pass - This pass eliminates machine instruction PHI nodes
58   /// by inserting copy instructions.  This destroys SSA information, but is the
59   /// desired input for some register allocators.  This pass is "required" by
60   /// these register allocator like this: AU.addRequiredID(PHIEliminationID);
61   ///
62   extern char &PHIEliminationID;
63
64   /// StrongPHIElimination pass - This pass eliminates machine instruction PHI
65   /// nodes by inserting copy instructions.  This destroys SSA information, but
66   /// is the desired input for some register allocators.  This pass is
67   /// "required" by these register allocator like this:
68   ///    AU.addRequiredID(PHIEliminationID);
69   ///  This pass is still in development
70   extern char &StrongPHIEliminationID;
71
72   extern char &PreAllocSplittingID;
73
74   /// LiveStacks pass. An analysis keeping track of the liveness of stack slots.
75   extern char &LiveStacksID;
76
77   /// SimpleRegisterCoalescing pass.  Aggressively coalesces every register
78   /// copy it can.
79   ///
80   extern char &SimpleRegisterCoalescingID;
81
82   /// TwoAddressInstruction pass - This pass reduces two-address instructions to
83   /// use two operands. This destroys SSA information but it is desired by
84   /// register allocators.
85   extern char &TwoAddressInstructionPassID;
86
87   /// UnreachableMachineBlockElimination pass - This pass removes unreachable
88   /// machine basic blocks.
89   extern char &UnreachableMachineBlockElimID;
90
91   /// DeadMachineInstructionElim pass - This pass removes dead machine
92   /// instructions.
93   ///
94   FunctionPass *createDeadMachineInstructionElimPass();
95
96   /// Creates a register allocator as the user specified on the command line, or
97   /// picks one that matches OptLevel.
98   ///
99   FunctionPass *createRegisterAllocator(CodeGenOpt::Level OptLevel);
100
101   /// FastRegisterAllocation Pass - This pass register allocates as fast as
102   /// possible. It is best suited for debug code where live ranges are short.
103   ///
104   FunctionPass *createFastRegisterAllocator();
105
106   /// BasicRegisterAllocation Pass - This pass implements a degenerate global
107   /// register allocator using the basic regalloc framework.
108   ///
109   FunctionPass *createBasicRegisterAllocator();
110
111   /// Greedy register allocation pass - This pass implements a global register
112   /// allocator for optimized builds.
113   ///
114   FunctionPass *createGreedyRegisterAllocator();
115
116   /// LinearScanRegisterAllocation Pass - This pass implements the linear scan
117   /// register allocation algorithm, a global register allocator.
118   ///
119   FunctionPass *createLinearScanRegisterAllocator();
120
121   /// PBQPRegisterAllocation Pass - This pass implements the Partitioned Boolean
122   /// Quadratic Prograaming (PBQP) based register allocator.
123   ///
124   FunctionPass *createDefaultPBQPRegisterAllocator();
125
126   /// SimpleRegisterCoalescing Pass - Coalesce all copies possible.  Can run
127   /// independently of the register allocator.
128   ///
129   RegisterCoalescer *createSimpleRegisterCoalescer();
130
131   /// PrologEpilogCodeInserter Pass - This pass inserts prolog and epilog code,
132   /// and eliminates abstract frame references.
133   ///
134   FunctionPass *createPrologEpilogCodeInserter();
135
136   /// LowerSubregs Pass - This pass lowers subregs to register-register copies
137   /// which yields suboptimal, but correct code if the register allocator
138   /// cannot coalesce all subreg operations during allocation.
139   ///
140   FunctionPass *createLowerSubregsPass();
141
142   /// createPostRAScheduler - This pass performs post register allocation
143   /// scheduling.
144   FunctionPass *createPostRAScheduler(CodeGenOpt::Level OptLevel);
145
146   /// BranchFolding Pass - This pass performs machine code CFG based
147   /// optimizations to delete branches to branches, eliminate branches to
148   /// successor blocks (creating fall throughs), and eliminating branches over
149   /// branches.
150   FunctionPass *createBranchFoldingPass(bool DefaultEnableTailMerge);
151
152   /// TailDuplicate Pass - Duplicate blocks with unconditional branches
153   /// into tails of their predecessors.
154   FunctionPass *createTailDuplicatePass(bool PreRegAlloc = false);
155
156   /// IfConverter Pass - This pass performs machine code if conversion.
157   FunctionPass *createIfConverterPass();
158
159   /// Code Placement Pass - This pass optimize code placement and aligns loop
160   /// headers to target specific alignment boundary.
161   FunctionPass *createCodePlacementOptPass();
162
163   /// IntrinsicLowering Pass - Performs target-independent LLVM IR
164   /// transformations for highly portable strategies.
165   FunctionPass *createGCLoweringPass();
166
167   /// MachineCodeAnalysis Pass - Target-independent pass to mark safe points in
168   /// machine code. Must be added very late during code generation, just prior
169   /// to output, and importantly after all CFG transformations (such as branch
170   /// folding).
171   FunctionPass *createGCMachineCodeAnalysisPass();
172
173   /// Deleter Pass - Releases GC metadata.
174   ///
175   FunctionPass *createGCInfoDeleter();
176
177   /// Creates a pass to print GC metadata.
178   ///
179   FunctionPass *createGCInfoPrinter(raw_ostream &OS);
180
181   /// createMachineCSEPass - This pass performs global CSE on machine
182   /// instructions.
183   FunctionPass *createMachineCSEPass();
184
185   /// createMachineLICMPass - This pass performs LICM on machine instructions.
186   ///
187   FunctionPass *createMachineLICMPass(bool PreRegAlloc = true);
188
189   /// createMachineSinkingPass - This pass performs sinking on machine
190   /// instructions.
191   FunctionPass *createMachineSinkingPass();
192
193   /// createPeepholeOptimizerPass - This pass performs peephole optimizations -
194   /// like extension and comparison eliminations.
195   FunctionPass *createPeepholeOptimizerPass();
196
197   /// createOptimizePHIsPass - This pass optimizes machine instruction PHIs
198   /// to take advantage of opportunities created during DAG legalization.
199   FunctionPass *createOptimizePHIsPass();
200
201   /// createStackSlotColoringPass - This pass performs stack slot coloring.
202   FunctionPass *createStackSlotColoringPass(bool);
203
204   /// createStackProtectorPass - This pass adds stack protectors to functions.
205   FunctionPass *createStackProtectorPass(const TargetLowering *tli);
206
207   /// createMachineVerifierPass - This pass verifies cenerated machine code
208   /// instructions for correctness.
209   FunctionPass *createMachineVerifierPass(const char *Banner = 0);
210
211   /// createDwarfEHPass - This pass mulches exception handling code into a form
212   /// adapted to code generation.  Required if using dwarf exception handling.
213   FunctionPass *createDwarfEHPass(const TargetMachine *tm);
214
215   /// createSjLjEHPass - This pass adapts exception handling code to use
216   /// the GCC-style builtin setjmp/longjmp (sjlj) to handling EH control flow.
217   FunctionPass *createSjLjEHPass(const TargetLowering *tli);
218
219   /// createLocalStackSlotAllocationPass - This pass assigns local frame
220   /// indices to stack slots relative to one another and allocates
221   /// base registers to access them when it is estimated by the target to
222   /// be out of range of normal frame pointer or stack pointer index
223   /// addressing.
224   FunctionPass *createLocalStackSlotAllocationPass();
225
226   /// createExpandISelPseudosPass - This pass expands pseudo-instructions.
227   ///
228   FunctionPass *createExpandISelPseudosPass();
229
230 } // End llvm namespace
231
232 #endif