ed96b40a1093275187f24070740b43b20ce154b7
[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 was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source 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 <iosfwd>
19 #include <string>
20
21 namespace llvm {
22
23   class FunctionPass;
24   class PassInfo;
25   class TargetMachine;
26   class RegisterCoalescer;
27
28   /// createUnreachableBlockEliminationPass - The LLVM code generator does not
29   /// work well with unreachable basic blocks (what live ranges make sense for a
30   /// block that cannot be reached?).  As such, a code generator should either
31   /// not instruction select unreachable blocks, or it can run this pass as it's
32   /// last LLVM modifying pass to clean up blocks that are not reachable from
33   /// the entry block.
34   FunctionPass *createUnreachableBlockEliminationPass();
35
36   /// MachineFunctionPrinter pass - This pass prints out the machine function to
37   /// standard error, as a debugging tool.
38   FunctionPass *createMachineFunctionPrinterPass(std::ostream *OS,
39                                                  const std::string &Banner ="");
40
41   /// PHIElimination pass - This pass eliminates machine instruction PHI nodes
42   /// by inserting copy instructions.  This destroys SSA information, but is the
43   /// desired input for some register allocators.  This pass is "required" by
44   /// these register allocator like this: AU.addRequiredID(PHIEliminationID);
45   ///
46   extern const PassInfo *PHIEliminationID;
47
48   /// SimpleRegisterCoalescing pass.  Aggressively coalesces every register
49   /// copy it can.
50   ///
51   extern const PassInfo *SimpleRegisterCoalescingID;
52
53   /// TwoAddressInstruction pass - This pass reduces two-address instructions to
54   /// use two operands. This destroys SSA information but it is desired by
55   /// register allocators.
56   extern const PassInfo *TwoAddressInstructionPassID;
57
58   /// Creates a register allocator as the user specified on the command line.
59   ///
60   FunctionPass *createRegisterAllocator();
61
62   /// SimpleRegisterAllocation Pass - This pass converts the input machine code
63   /// from SSA form to use explicit registers by spilling every register.  Wow,
64   /// great policy huh?
65   ///
66   FunctionPass *createSimpleRegisterAllocator();
67
68   /// LocalRegisterAllocation Pass - This pass register allocates the input code
69   /// a basic block at a time, yielding code better than the simple register
70   /// allocator, but not as good as a global allocator.
71   ///
72   FunctionPass *createLocalRegisterAllocator();
73
74   /// BigBlockRegisterAllocation Pass - The BigBlock register allocator
75   /// munches single basic blocks at a time, like the local register
76   /// allocator.  While the BigBlock allocator is a little slower, and uses
77   /// somewhat more memory than the local register allocator, it tends to
78   /// yield the best allocations (of any of the allocators) for blocks that
79   /// have hundreds or thousands of instructions in sequence.
80   ///
81   FunctionPass *createBigBlockRegisterAllocator();
82
83   /// LinearScanRegisterAllocation Pass - This pass implements the linear scan
84   /// register allocation algorithm, a global register allocator.
85   ///
86   FunctionPass *createLinearScanRegisterAllocator();
87
88   /// SimpleRegisterCoalescing Pass - Coalesce all copies possible.  Can run
89   /// independently of the register allocator.
90   ///
91   RegisterCoalescer *createSimpleRegisterCoalescer();
92
93   /// PrologEpilogCodeInserter Pass - This pass inserts prolog and epilog code,
94   /// and eliminates abstract frame references.
95   ///
96   FunctionPass *createPrologEpilogCodeInserter();
97   
98   /// LowerSubregs Pass - This pass lowers subregs to register-register copies
99   /// which yields suboptimal, but correct code if the register allocator
100   /// cannot coalesce all subreg operations during allocation.
101   ///
102   FunctionPass *createLowerSubregsPass();
103
104   /// createPostRAScheduler - under development.
105   FunctionPass *createPostRAScheduler();
106
107   /// BranchFolding Pass - This pass performs machine code CFG based
108   /// optimizations to delete branches to branches, eliminate branches to
109   /// successor blocks (creating fall throughs), and eliminating branches over
110   /// branches.
111   FunctionPass *createBranchFoldingPass(bool DefaultEnableTailMerge);
112
113   /// IfConverter Pass - This pass performs machine code if conversion.
114   FunctionPass *createIfConverterPass();
115
116   /// DebugLabelFoldingPass - This pass prunes out redundant debug labels.  This
117   /// allows a debug emitter to determine if the range of two labels is empty,
118   /// by seeing if the labels map to the same reduced label.
119   FunctionPass *createDebugLabelFoldingPass();
120
121   /// MachineCodeDeletion Pass - This pass deletes all of the machine code for
122   /// the current function, which should happen after the function has been
123   /// emitted to a .s file or to memory.
124   FunctionPass *createMachineCodeDeleter();
125
126   /// getRegisterAllocator - This creates an instance of the register allocator
127   /// for the Sparc.
128   FunctionPass *getRegisterAllocator(TargetMachine &T);
129
130 } // End llvm namespace
131
132 #endif