| Misha Brukman | ef6a6a6 | 2003-08-21 22:14:26 +0000 | [diff] [blame] | 1 | //===-- Passes.h - Target independent code generation passes ----*- C++ -*-===// |
| Misha Brukman | ea61c35 | 2005-04-21 20:39:54 +0000 | [diff] [blame] | 2 | // |
| John Criswell | 6fbcc26 | 2003-10-20 20:19:47 +0000 | [diff] [blame] | 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. |
| Misha Brukman | ea61c35 | 2005-04-21 20:39:54 +0000 | [diff] [blame] | 7 | // |
| John Criswell | 6fbcc26 | 2003-10-20 20:19:47 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
| Chris Lattner | db00065 | 2003-01-13 01:01:31 +0000 | [diff] [blame] | 9 | // |
| Misha Brukman | ef6a6a6 | 2003-08-21 22:14:26 +0000 | [diff] [blame] | 10 | // This file defines interfaces to access the target independent code generation |
| Chris Lattner | db00065 | 2003-01-13 01:01:31 +0000 | [diff] [blame] | 11 | // passes provided by the LLVM backend. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #ifndef LLVM_CODEGEN_PASSES_H |
| 16 | #define LLVM_CODEGEN_PASSES_H |
| 17 | |
| Brian Gaeke | fc1f6e8 | 2004-02-04 21:41:10 +0000 | [diff] [blame] | 18 | #include <iosfwd> |
| 19 | #include <string> |
| Brian Gaeke | 09caa37 | 2004-01-30 21:53:46 +0000 | [diff] [blame] | 20 | |
| Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 21 | namespace llvm { |
| 22 | |
| Chris Lattner | 3e200e6 | 2003-12-20 10:18:58 +0000 | [diff] [blame] | 23 | class FunctionPass; |
| 24 | class PassInfo; |
| 25 | class TargetMachine; |
| Chris Lattner | 8b708e4 | 2004-07-02 05:44:13 +0000 | [diff] [blame] | 26 | |
| 27 | /// createUnreachableBlockEliminationPass - The LLVM code generator does not |
| 28 | /// work well with unreachable basic blocks (what live ranges make sense for a |
| 29 | /// block that cannot be reached?). As such, a code generator should either |
| 30 | /// not instruction select unreachable blocks, or it can run this pass as it's |
| 31 | /// last LLVM modifying pass to clean up blocks that are not reachable from |
| 32 | /// the entry block. |
| 33 | FunctionPass *createUnreachableBlockEliminationPass(); |
| Misha Brukman | ea61c35 | 2005-04-21 20:39:54 +0000 | [diff] [blame] | 34 | |
| Chris Lattner | 3e200e6 | 2003-12-20 10:18:58 +0000 | [diff] [blame] | 35 | /// MachineFunctionPrinter pass - This pass prints out the machine function to |
| 36 | /// standard error, as a debugging tool. |
| Brian Gaeke | fc1f6e8 | 2004-02-04 21:41:10 +0000 | [diff] [blame] | 37 | FunctionPass *createMachineFunctionPrinterPass(std::ostream *OS, |
| Brian Gaeke | 09caa37 | 2004-01-30 21:53:46 +0000 | [diff] [blame] | 38 | const std::string &Banner =""); |
| 39 | |
| Chris Lattner | 3e200e6 | 2003-12-20 10:18:58 +0000 | [diff] [blame] | 40 | /// PHIElimination pass - This pass eliminates machine instruction PHI nodes |
| 41 | /// by inserting copy instructions. This destroys SSA information, but is the |
| 42 | /// desired input for some register allocators. This pass is "required" by |
| 43 | /// these register allocator like this: AU.addRequiredID(PHIEliminationID); |
| 44 | /// |
| 45 | extern const PassInfo *PHIEliminationID; |
| Chris Lattner | db00065 | 2003-01-13 01:01:31 +0000 | [diff] [blame] | 46 | |
| David Greene | 2513330 | 2007-06-08 17:18:56 +0000 | [diff] [blame] | 47 | /// SimpleRegisterCoalescing pass. Aggressively coalesces every register |
| 48 | /// copy it can. |
| 49 | /// |
| 50 | extern const PassInfo *SimpleRegisterCoalescingID; |
| 51 | |
| Chris Lattner | 3e200e6 | 2003-12-20 10:18:58 +0000 | [diff] [blame] | 52 | /// TwoAddressInstruction pass - This pass reduces two-address instructions to |
| 53 | /// use two operands. This destroys SSA information but it is desired by |
| 54 | /// register allocators. |
| 55 | extern const PassInfo *TwoAddressInstructionPassID; |
| Chris Lattner | db00065 | 2003-01-13 01:01:31 +0000 | [diff] [blame] | 56 | |
| Chris Lattner | 3e200e6 | 2003-12-20 10:18:58 +0000 | [diff] [blame] | 57 | /// Creates a register allocator as the user specified on the command line. |
| 58 | /// |
| 59 | FunctionPass *createRegisterAllocator(); |
| Alkis Evlogimenos | 4c08086 | 2003-12-18 22:40:24 +0000 | [diff] [blame] | 60 | |
| Chris Lattner | 3e200e6 | 2003-12-20 10:18:58 +0000 | [diff] [blame] | 61 | /// SimpleRegisterAllocation Pass - This pass converts the input machine code |
| 62 | /// from SSA form to use explicit registers by spilling every register. Wow, |
| 63 | /// great policy huh? |
| 64 | /// |
| 65 | FunctionPass *createSimpleRegisterAllocator(); |
| Alkis Evlogimenos | eed462b | 2003-10-02 06:13:19 +0000 | [diff] [blame] | 66 | |
| Chris Lattner | 3e200e6 | 2003-12-20 10:18:58 +0000 | [diff] [blame] | 67 | /// LocalRegisterAllocation Pass - This pass register allocates the input code |
| 68 | /// a basic block at a time, yielding code better than the simple register |
| 69 | /// allocator, but not as good as a global allocator. |
| Misha Brukman | ea61c35 | 2005-04-21 20:39:54 +0000 | [diff] [blame] | 70 | /// |
| Chris Lattner | 3e200e6 | 2003-12-20 10:18:58 +0000 | [diff] [blame] | 71 | FunctionPass *createLocalRegisterAllocator(); |
| Misha Brukman | ea61c35 | 2005-04-21 20:39:54 +0000 | [diff] [blame] | 72 | |
| Duraid Madina | a8c7682 | 2007-06-22 08:27:12 +0000 | [diff] [blame] | 73 | /// BigBlockRegisterAllocation Pass - The BigBlock register allocator |
| 74 | /// munches single basic blocks at a time, like the local register |
| 75 | /// allocator. While the BigBlock allocator is a little slower, and uses |
| 76 | /// somewhat more memory than the local register allocator, it tends to |
| 77 | /// yield the best allocations (of any of the allocators) for blocks that |
| 78 | /// have hundreds or thousands of instructions in sequence. |
| 79 | /// |
| 80 | FunctionPass *createBigBlockRegisterAllocator(); |
| 81 | |
| Chris Lattner | 3e200e6 | 2003-12-20 10:18:58 +0000 | [diff] [blame] | 82 | /// LinearScanRegisterAllocation Pass - This pass implements the linear scan |
| 83 | /// register allocation algorithm, a global register allocator. |
| 84 | /// |
| 85 | FunctionPass *createLinearScanRegisterAllocator(); |
| Chris Lattner | db00065 | 2003-01-13 01:01:31 +0000 | [diff] [blame] | 86 | |
| Chris Lattner | 3e200e6 | 2003-12-20 10:18:58 +0000 | [diff] [blame] | 87 | /// PrologEpilogCodeInserter Pass - This pass inserts prolog and epilog code, |
| 88 | /// and eliminates abstract frame references. |
| 89 | /// |
| 90 | FunctionPass *createPrologEpilogCodeInserter(); |
| Christopher Lamb | bab2474 | 2007-07-26 08:18:32 +0000 | [diff] [blame^] | 91 | |
| 92 | /// LowerSubregs Pass - This pass lowers subregs to register-register copies |
| 93 | /// which yields suboptimial, but correct code if the register allocator |
| 94 | /// cannot coalesce all subreg operations during allocation. |
| 95 | /// |
| 96 | FunctionPass *createLowerSubregsPass(); |
| Chris Lattner | db00065 | 2003-01-13 01:01:31 +0000 | [diff] [blame] | 97 | |
| Dale Johannesen | e7e7d0d | 2007-07-13 17:13:54 +0000 | [diff] [blame] | 98 | /// createPostRAScheduler - under development. |
| 99 | FunctionPass *createPostRAScheduler(); |
| 100 | |
| Chris Lattner | 36c29db | 2004-07-31 09:59:14 +0000 | [diff] [blame] | 101 | /// BranchFolding Pass - This pass performs machine code CFG based |
| 102 | /// optimizations to delete branches to branches, eliminate branches to |
| 103 | /// successor blocks (creating fall throughs), and eliminating branches over |
| 104 | /// branches. |
| Dale Johannesen | 81da02b | 2007-05-22 17:14:46 +0000 | [diff] [blame] | 105 | FunctionPass *createBranchFoldingPass(bool DefaultEnableTailMerge); |
| Chris Lattner | 36c29db | 2004-07-31 09:59:14 +0000 | [diff] [blame] | 106 | |
| Evan Cheng | 4e65485 | 2007-05-16 02:00:57 +0000 | [diff] [blame] | 107 | /// IfConverter Pass - This pass performs machine code if conversion. |
| 108 | FunctionPass *createIfConverterPass(); |
| 109 | |
| Jim Laskey | 9d4209f | 2006-11-07 19:33:46 +0000 | [diff] [blame] | 110 | /// DebugLabelFoldingPass - This pass prunes out redundant debug labels. This |
| 111 | /// allows a debug emitter to determine if the range of two labels is empty, |
| 112 | /// by seeing if the labels map to the same reduced label. |
| 113 | FunctionPass *createDebugLabelFoldingPass(); |
| 114 | |
| Chris Lattner | 3e200e6 | 2003-12-20 10:18:58 +0000 | [diff] [blame] | 115 | /// MachineCodeDeletion Pass - This pass deletes all of the machine code for |
| 116 | /// the current function, which should happen after the function has been |
| 117 | /// emitted to a .s file or to memory. |
| 118 | FunctionPass *createMachineCodeDeleter(); |
| Misha Brukman | ea61c35 | 2005-04-21 20:39:54 +0000 | [diff] [blame] | 119 | |
| Chris Lattner | 3e200e6 | 2003-12-20 10:18:58 +0000 | [diff] [blame] | 120 | /// getRegisterAllocator - This creates an instance of the register allocator |
| 121 | /// for the Sparc. |
| 122 | FunctionPass *getRegisterAllocator(TargetMachine &T); |
| Tanya Lattner | 5a75c91 | 2004-05-08 16:14:02 +0000 | [diff] [blame] | 123 | |
| Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 124 | } // End llvm namespace |
| 125 | |
| Chris Lattner | db00065 | 2003-01-13 01:01:31 +0000 | [diff] [blame] | 126 | #endif |