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