Implement TLSLDM.
[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   /// MachineDominators pass - This pass is a machine dominators analysis pass.
49   ///
50   extern char &MachineDominatorsID;
51
52   /// PHIElimination pass - This pass eliminates machine instruction PHI nodes
53   /// by inserting copy instructions.  This destroys SSA information, but is the
54   /// desired input for some register allocators.  This pass is "required" by
55   /// these register allocator like this: AU.addRequiredID(PHIEliminationID);
56   ///
57   extern char &PHIEliminationID;
58
59   /// StrongPHIElimination pass - This pass eliminates machine instruction PHI
60   /// nodes by inserting copy instructions.  This destroys SSA information, but
61   /// is the desired input for some register allocators.  This pass is
62   /// "required" by these register allocator like this:
63   ///    AU.addRequiredID(PHIEliminationID);
64   ///  This pass is still in development
65   extern char &StrongPHIEliminationID;
66
67   extern char &PreAllocSplittingID;
68
69   /// LiveStacks pass. An analysis keeping track of the liveness of stack slots.
70   extern char &LiveStacksID;
71
72   /// SimpleRegisterCoalescing pass.  Aggressively coalesces every register
73   /// copy it can.
74   ///
75   extern char &SimpleRegisterCoalescingID;
76
77   /// TwoAddressInstruction pass - This pass reduces two-address instructions to
78   /// use two operands. This destroys SSA information but it is desired by
79   /// register allocators.
80   extern char &TwoAddressInstructionPassID;
81
82   /// UnreachableMachineBlockElimination pass - This pass removes unreachable
83   /// machine basic blocks.
84   extern char &UnreachableMachineBlockElimID;
85
86   /// DeadMachineInstructionElim pass - This pass removes dead machine
87   /// instructions.
88   ///
89   FunctionPass *createDeadMachineInstructionElimPass();
90
91   /// Creates a register allocator as the user specified on the command line, or
92   /// picks one that matches OptLevel.
93   ///
94   FunctionPass *createRegisterAllocator(CodeGenOpt::Level OptLevel);
95
96   /// FastRegisterAllocation Pass - This pass register allocates as fast as
97   /// possible. It is best suited for debug code where live ranges are short.
98   ///
99   FunctionPass *createFastRegisterAllocator();
100
101   /// BasicRegisterAllocation Pass - This pass implements a degenerate global
102   /// register allocator using the basic regalloc framework.
103   ///
104   FunctionPass *createBasicRegisterAllocator();
105
106   /// LinearScanRegisterAllocation Pass - This pass implements the linear scan
107   /// register allocation algorithm, a global register allocator.
108   ///
109   FunctionPass *createLinearScanRegisterAllocator();
110
111   /// PBQPRegisterAllocation Pass - This pass implements the Partitioned Boolean
112   /// Quadratic Prograaming (PBQP) based register allocator.
113   ///
114   FunctionPass *createDefaultPBQPRegisterAllocator();
115
116   /// SimpleRegisterCoalescing Pass - Coalesce all copies possible.  Can run
117   /// independently of the register allocator.
118   ///
119   RegisterCoalescer *createSimpleRegisterCoalescer();
120
121   /// PrologEpilogCodeInserter Pass - This pass inserts prolog and epilog code,
122   /// and eliminates abstract frame references.
123   ///
124   FunctionPass *createPrologEpilogCodeInserter();
125
126   /// LowerSubregs Pass - This pass lowers subregs to register-register copies
127   /// which yields suboptimal, but correct code if the register allocator
128   /// cannot coalesce all subreg operations during allocation.
129   ///
130   FunctionPass *createLowerSubregsPass();
131
132   /// createPostRAScheduler - This pass performs post register allocation
133   /// scheduling.
134   FunctionPass *createPostRAScheduler(CodeGenOpt::Level OptLevel);
135
136   /// BranchFolding Pass - This pass performs machine code CFG based
137   /// optimizations to delete branches to branches, eliminate branches to
138   /// successor blocks (creating fall throughs), and eliminating branches over
139   /// branches.
140   FunctionPass *createBranchFoldingPass(bool DefaultEnableTailMerge);
141
142   /// TailDuplicate Pass - Duplicate blocks with unconditional branches
143   /// into tails of their predecessors.
144   FunctionPass *createTailDuplicatePass(bool PreRegAlloc = false);
145
146   /// IfConverter Pass - This pass performs machine code if conversion.
147   FunctionPass *createIfConverterPass();
148
149   /// Code Placement Pass - This pass optimize code placement and aligns loop
150   /// headers to target specific alignment boundary.
151   FunctionPass *createCodePlacementOptPass();
152
153   /// IntrinsicLowering Pass - Performs target-independent LLVM IR
154   /// transformations for highly portable strategies.
155   FunctionPass *createGCLoweringPass();
156
157   /// MachineCodeAnalysis Pass - Target-independent pass to mark safe points in
158   /// machine code. Must be added very late during code generation, just prior
159   /// to output, and importantly after all CFG transformations (such as branch
160   /// folding).
161   FunctionPass *createGCMachineCodeAnalysisPass();
162
163   /// Deleter Pass - Releases GC metadata.
164   ///
165   FunctionPass *createGCInfoDeleter();
166
167   /// Creates a pass to print GC metadata.
168   ///
169   FunctionPass *createGCInfoPrinter(raw_ostream &OS);
170
171   /// createMachineCSEPass - This pass performs global CSE on machine
172   /// instructions.
173   FunctionPass *createMachineCSEPass();
174
175   /// createMachineLICMPass - This pass performs LICM on machine instructions.
176   ///
177   FunctionPass *createMachineLICMPass(bool PreRegAlloc = true);
178
179   /// createMachineSinkingPass - This pass performs sinking on machine
180   /// instructions.
181   FunctionPass *createMachineSinkingPass();
182
183   /// createPeepholeOptimizerPass - This pass performs peephole optimizations -
184   /// like extension and comparison eliminations.
185   FunctionPass *createPeepholeOptimizerPass();
186
187   /// createOptimizePHIsPass - This pass optimizes machine instruction PHIs
188   /// to take advantage of opportunities created during DAG legalization.
189   FunctionPass *createOptimizePHIsPass();
190
191   /// createStackSlotColoringPass - This pass performs stack slot coloring.
192   FunctionPass *createStackSlotColoringPass(bool);
193
194   /// createStackProtectorPass - This pass adds stack protectors to functions.
195   FunctionPass *createStackProtectorPass(const TargetLowering *tli);
196
197   /// createMachineVerifierPass - This pass verifies cenerated machine code
198   /// instructions for correctness.
199   FunctionPass *createMachineVerifierPass();
200
201   /// createDwarfEHPass - This pass mulches exception handling code into a form
202   /// adapted to code generation.  Required if using dwarf exception handling.
203   FunctionPass *createDwarfEHPass(const TargetMachine *tm);
204
205   /// createSjLjEHPass - This pass adapts exception handling code to use
206   /// the GCC-style builtin setjmp/longjmp (sjlj) to handling EH control flow.
207   FunctionPass *createSjLjEHPass(const TargetLowering *tli);
208
209   /// createLocalStackSlotAllocationPass - This pass assigns local frame
210   /// indices to stack slots relative to one another and allocates
211   /// base registers to access them when it is estimated by the target to
212   /// be out of range of normal frame pointer or stack pointer index
213   /// addressing.
214   FunctionPass *createLocalStackSlotAllocationPass();
215
216 } // End llvm namespace
217
218 #endif