X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FCodeGen%2FMachineFunctionPass.h;h=685e86824c31f66806882592dfaea46c3aea302f;hb=8613b18a5aa80b13bb8c7f470528146f009bed74;hp=f90c696738f6083d0976bab9ef64eb8bc541d9b7;hpb=d27df628cc6fa29605fa221a2f0b03b4592caf03;p=oota-llvm.git diff --git a/include/llvm/CodeGen/MachineFunctionPass.h b/include/llvm/CodeGen/MachineFunctionPass.h index f90c696738f..685e86824c3 100644 --- a/include/llvm/CodeGen/MachineFunctionPass.h +++ b/include/llvm/CodeGen/MachineFunctionPass.h @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // @@ -20,29 +20,39 @@ #define LLVM_CODEGEN_MACHINE_FUNCTION_PASS_H #include "llvm/Pass.h" -#include "llvm/CodeGen/MachineFunction.h" namespace llvm { -struct MachineFunctionPass : public FunctionPass { +class MachineFunction; +/// MachineFunctionPass - This class adapts the FunctionPass interface to +/// allow convenient creation of passes that operate on the MachineFunction +/// representation. Instead of overriding runOnFunction, subclasses +/// override runOnMachineFunction. +class MachineFunctionPass : public FunctionPass { +protected: explicit MachineFunctionPass(intptr_t ID) : FunctionPass(ID) {} + explicit MachineFunctionPass(void *ID) : FunctionPass(ID) {} -protected: /// runOnMachineFunction - This method must be overloaded to perform the /// desired machine code transformation or analysis. /// virtual bool runOnMachineFunction(MachineFunction &MF) = 0; -public: - // FIXME: This pass should declare that the pass does not invalidate any LLVM - // passes. - bool runOnFunction(Function &F) { - return runOnMachineFunction(MachineFunction::get(&F)); - } - + /// getAnalysisUsage - Subclasses that override getAnalysisUsage + /// must call this. + /// + /// For MachineFunctionPasses, calling AU.preservesCFG() indicates that + /// the pass does not modify the MachineBasicBlock CFG. + /// + virtual void getAnalysisUsage(AnalysisUsage &AU) const; + private: - virtual void virtfn(); // out of line virtual fn to give class a home. + /// createPrinterPass - Get a machine function printer pass. + virtual Pass *createPrinterPass(raw_ostream &O, + const std::string &Banner) const; + + virtual bool runOnFunction(Function &F); }; } // End llvm namespace