| 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 | |
| Chris Lattner | 3e200e6 | 2003-12-20 10:18:58 +0000 | [diff] [blame] | 47 | /// TwoAddressInstruction pass - This pass reduces two-address instructions to |
| 48 | /// use two operands. This destroys SSA information but it is desired by |
| 49 | /// register allocators. |
| 50 | extern const PassInfo *TwoAddressInstructionPassID; |
| Chris Lattner | db00065 | 2003-01-13 01:01:31 +0000 | [diff] [blame] | 51 | |
| Chris Lattner | 3e200e6 | 2003-12-20 10:18:58 +0000 | [diff] [blame] | 52 | /// Creates a register allocator as the user specified on the command line. |
| 53 | /// |
| 54 | FunctionPass *createRegisterAllocator(); |
| Alkis Evlogimenos | 4c08086 | 2003-12-18 22:40:24 +0000 | [diff] [blame] | 55 | |
| Chris Lattner | 3e200e6 | 2003-12-20 10:18:58 +0000 | [diff] [blame] | 56 | /// SimpleRegisterAllocation Pass - This pass converts the input machine code |
| 57 | /// from SSA form to use explicit registers by spilling every register. Wow, |
| 58 | /// great policy huh? |
| 59 | /// |
| 60 | FunctionPass *createSimpleRegisterAllocator(); |
| Alkis Evlogimenos | eed462b | 2003-10-02 06:13:19 +0000 | [diff] [blame] | 61 | |
| Chris Lattner | 3e200e6 | 2003-12-20 10:18:58 +0000 | [diff] [blame] | 62 | /// LocalRegisterAllocation Pass - This pass register allocates the input code |
| 63 | /// a basic block at a time, yielding code better than the simple register |
| 64 | /// allocator, but not as good as a global allocator. |
| Misha Brukman | ea61c35 | 2005-04-21 20:39:54 +0000 | [diff] [blame] | 65 | /// |
| Chris Lattner | 3e200e6 | 2003-12-20 10:18:58 +0000 | [diff] [blame] | 66 | FunctionPass *createLocalRegisterAllocator(); |
| Misha Brukman | ea61c35 | 2005-04-21 20:39:54 +0000 | [diff] [blame] | 67 | |
| Chris Lattner | 3e200e6 | 2003-12-20 10:18:58 +0000 | [diff] [blame] | 68 | /// LinearScanRegisterAllocation Pass - This pass implements the linear scan |
| 69 | /// register allocation algorithm, a global register allocator. |
| 70 | /// |
| 71 | FunctionPass *createLinearScanRegisterAllocator(); |
| Chris Lattner | db00065 | 2003-01-13 01:01:31 +0000 | [diff] [blame] | 72 | |
| Chris Lattner | 3e200e6 | 2003-12-20 10:18:58 +0000 | [diff] [blame] | 73 | /// PrologEpilogCodeInserter Pass - This pass inserts prolog and epilog code, |
| 74 | /// and eliminates abstract frame references. |
| 75 | /// |
| 76 | FunctionPass *createPrologEpilogCodeInserter(); |
| Chris Lattner | db00065 | 2003-01-13 01:01:31 +0000 | [diff] [blame] | 77 | |
| Chris Lattner | 36c29db | 2004-07-31 09:59:14 +0000 | [diff] [blame] | 78 | /// BranchFolding Pass - This pass performs machine code CFG based |
| 79 | /// optimizations to delete branches to branches, eliminate branches to |
| 80 | /// successor blocks (creating fall throughs), and eliminating branches over |
| 81 | /// branches. |
| 82 | FunctionPass *createBranchFoldingPass(); |
| 83 | |
| Evan Cheng | 4e65485 | 2007-05-16 02:00:57 +0000 | [diff] [blame] | 84 | /// IfConverter Pass - This pass performs machine code if conversion. |
| 85 | FunctionPass *createIfConverterPass(); |
| 86 | |
| Jim Laskey | 9d4209f | 2006-11-07 19:33:46 +0000 | [diff] [blame] | 87 | /// DebugLabelFoldingPass - This pass prunes out redundant debug labels. This |
| 88 | /// allows a debug emitter to determine if the range of two labels is empty, |
| 89 | /// by seeing if the labels map to the same reduced label. |
| 90 | FunctionPass *createDebugLabelFoldingPass(); |
| 91 | |
| Chris Lattner | 3e200e6 | 2003-12-20 10:18:58 +0000 | [diff] [blame] | 92 | /// MachineCodeDeletion Pass - This pass deletes all of the machine code for |
| 93 | /// the current function, which should happen after the function has been |
| 94 | /// emitted to a .s file or to memory. |
| 95 | FunctionPass *createMachineCodeDeleter(); |
| Misha Brukman | ea61c35 | 2005-04-21 20:39:54 +0000 | [diff] [blame] | 96 | |
| Chris Lattner | 3e200e6 | 2003-12-20 10:18:58 +0000 | [diff] [blame] | 97 | /// getRegisterAllocator - This creates an instance of the register allocator |
| 98 | /// for the Sparc. |
| 99 | FunctionPass *getRegisterAllocator(TargetMachine &T); |
| Tanya Lattner | 5a75c91 | 2004-05-08 16:14:02 +0000 | [diff] [blame] | 100 | |
| 101 | //createModuloSchedulingPass - Creates the Swing Modulo Scheduling Pass |
| 102 | FunctionPass *createModuloSchedulingPass(TargetMachine & targ); |
| 103 | |
| Tanya Lattner | 9d6b628 | 2005-05-01 16:14:34 +0000 | [diff] [blame] | 104 | //createModuloSchedulingPass - Creates the Swing Modulo Scheduling Pass |
| 105 | FunctionPass *createModuloSchedulingSBPass(TargetMachine & targ); |
| 106 | |
| Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 107 | } // End llvm namespace |
| 108 | |
| Chris Lattner | db00065 | 2003-01-13 01:01:31 +0000 | [diff] [blame] | 109 | #endif |