LLVM API Documentation
00001 //===-- Passes.h - Target independent code generation passes ----*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file was developed by the LLVM research group and is distributed under 00006 // the University of Illinois Open Source License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file defines interfaces to access the target independent code generation 00011 // passes provided by the LLVM backend. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef LLVM_CODEGEN_PASSES_H 00016 #define LLVM_CODEGEN_PASSES_H 00017 00018 #include <iosfwd> 00019 #include <string> 00020 00021 namespace llvm { 00022 00023 class FunctionPass; 00024 class PassInfo; 00025 class TargetMachine; 00026 00027 /// createUnreachableBlockEliminationPass - The LLVM code generator does not 00028 /// work well with unreachable basic blocks (what live ranges make sense for a 00029 /// block that cannot be reached?). As such, a code generator should either 00030 /// not instruction select unreachable blocks, or it can run this pass as it's 00031 /// last LLVM modifying pass to clean up blocks that are not reachable from 00032 /// the entry block. 00033 FunctionPass *createUnreachableBlockEliminationPass(); 00034 00035 /// MachineFunctionPrinter pass - This pass prints out the machine function to 00036 /// standard error, as a debugging tool. 00037 FunctionPass *createMachineFunctionPrinterPass(std::ostream *OS, 00038 const std::string &Banner =""); 00039 00040 /// PHIElimination pass - This pass eliminates machine instruction PHI nodes 00041 /// by inserting copy instructions. This destroys SSA information, but is the 00042 /// desired input for some register allocators. This pass is "required" by 00043 /// these register allocator like this: AU.addRequiredID(PHIEliminationID); 00044 /// 00045 extern const PassInfo *PHIEliminationID; 00046 00047 /// TwoAddressInstruction pass - This pass reduces two-address instructions to 00048 /// use two operands. This destroys SSA information but it is desired by 00049 /// register allocators. 00050 extern const PassInfo *TwoAddressInstructionPassID; 00051 00052 /// Creates a register allocator as the user specified on the command line. 00053 /// 00054 FunctionPass *createRegisterAllocator(); 00055 00056 /// SimpleRegisterAllocation Pass - This pass converts the input machine code 00057 /// from SSA form to use explicit registers by spilling every register. Wow, 00058 /// great policy huh? 00059 /// 00060 FunctionPass *createSimpleRegisterAllocator(); 00061 00062 /// LocalRegisterAllocation Pass - This pass register allocates the input code 00063 /// a basic block at a time, yielding code better than the simple register 00064 /// allocator, but not as good as a global allocator. 00065 /// 00066 FunctionPass *createLocalRegisterAllocator(); 00067 00068 /// LinearScanRegisterAllocation Pass - This pass implements the linear scan 00069 /// register allocation algorithm, a global register allocator. 00070 /// 00071 FunctionPass *createLinearScanRegisterAllocator(); 00072 00073 /// IterativeScanRegisterAllocation Pass - This pass implements the iterative 00074 /// scan register allocation algorithm, a global register allocator. 00075 /// 00076 FunctionPass *createIterativeScanRegisterAllocator(); 00077 00078 /// PrologEpilogCodeInserter Pass - This pass inserts prolog and epilog code, 00079 /// and eliminates abstract frame references. 00080 /// 00081 FunctionPass *createPrologEpilogCodeInserter(); 00082 00083 /// BranchFolding Pass - This pass performs machine code CFG based 00084 /// optimizations to delete branches to branches, eliminate branches to 00085 /// successor blocks (creating fall throughs), and eliminating branches over 00086 /// branches. 00087 FunctionPass *createBranchFoldingPass(); 00088 00089 /// MachineCodeDeletion Pass - This pass deletes all of the machine code for 00090 /// the current function, which should happen after the function has been 00091 /// emitted to a .s file or to memory. 00092 FunctionPass *createMachineCodeDeleter(); 00093 00094 /// getRegisterAllocator - This creates an instance of the register allocator 00095 /// for the Sparc. 00096 FunctionPass *getRegisterAllocator(TargetMachine &T); 00097 00098 //createModuloSchedulingPass - Creates the Swing Modulo Scheduling Pass 00099 FunctionPass *createModuloSchedulingPass(TargetMachine & targ); 00100 00101 } // End llvm namespace 00102 00103 #endif