LLVM API Documentation

CodeGen/Passes.h

Go to the documentation of this file.
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   /// PrologEpilogCodeInserter Pass - This pass inserts prolog and epilog code,
00074   /// and eliminates abstract frame references.
00075   ///
00076   FunctionPass *createPrologEpilogCodeInserter();
00077 
00078   /// BranchFolding Pass - This pass performs machine code CFG based
00079   /// optimizations to delete branches to branches, eliminate branches to
00080   /// successor blocks (creating fall throughs), and eliminating branches over
00081   /// branches.
00082   FunctionPass *createBranchFoldingPass();
00083 
00084   /// MachineCodeDeletion Pass - This pass deletes all of the machine code for
00085   /// the current function, which should happen after the function has been
00086   /// emitted to a .s file or to memory.
00087   FunctionPass *createMachineCodeDeleter();
00088 
00089   /// getRegisterAllocator - This creates an instance of the register allocator
00090   /// for the Sparc.
00091   FunctionPass *getRegisterAllocator(TargetMachine &T);
00092 
00093   //createModuloSchedulingPass - Creates the Swing Modulo Scheduling Pass
00094   FunctionPass *createModuloSchedulingPass(TargetMachine & targ);
00095 
00096   //createModuloSchedulingPass - Creates the Swing Modulo Scheduling Pass
00097   FunctionPass *createModuloSchedulingSBPass(TargetMachine & targ);
00098 
00099 } // End llvm namespace
00100 
00101 #endif