LLVM API Documentation
00001 //===-- MachineFunctionPass.h - Pass for MachineFunctions --------*-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 the MachineFunctionPass class. MachineFunctionPass's are 00011 // just FunctionPass's, except they operate on machine code as part of a code 00012 // generator. Because they operate on machine code, not the LLVM 00013 // representation, MachineFunctionPass's are not allowed to modify the LLVM 00014 // representation. Due to this limitation, the MachineFunctionPass class takes 00015 // care of declaring that no LLVM passes are invalidated. 00016 // 00017 //===----------------------------------------------------------------------===// 00018 00019 #ifndef LLVM_CODEGEN_MACHINE_FUNCTION_PASS_H 00020 #define LLVM_CODEGEN_MACHINE_FUNCTION_PASS_H 00021 00022 #include "llvm/Pass.h" 00023 #include "llvm/CodeGen/MachineFunction.h" 00024 00025 namespace llvm { 00026 00027 struct MachineFunctionPass : public FunctionPass { 00028 00029 /// runOnMachineFunction - This method must be overloaded to perform the 00030 /// desired machine code transformation or analysis. 00031 /// 00032 virtual bool runOnMachineFunction(MachineFunction &MF) = 0; 00033 00034 // FIXME: This pass should declare that the pass does not invalidate any LLVM 00035 // passes. 00036 virtual bool runOnFunction(Function &F) { 00037 return runOnMachineFunction(MachineFunction::get(&F)); 00038 } 00039 00040 virtual void virtfn(); // out of line virtual fn to give class a home. 00041 }; 00042 00043 } // End llvm namespace 00044 00045 #endif