LLVM API Documentation

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

MachineFunctionPass.h

Go to the documentation of this file.
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 
00037   virtual bool runOnFunction(Function &F) {
00038     return runOnMachineFunction(MachineFunction::get(&F));
00039   }
00040 };
00041 
00042 } // End llvm namespace
00043 
00044 #endif