1 //===-- MachineFunctionPass.h - Pass for MachineFunctions --------*-C++ -*-===//
3 // This file defines the MachineFunctionPass class. MachineFunctionPass's are
4 // just FunctionPass's, except they operate on machine code as part of a code
5 // generator. Because they operate on machine code, not the LLVM
6 // representation, MachineFunctionPass's are not allowed to modify the LLVM
7 // representation. Due to this limitation, the MachineFunctionPass class takes
8 // care of declaring that no LLVM passes are invalidated.
10 //===----------------------------------------------------------------------===//
12 #ifndef LLVM_CODEGEN_MACHINE_FUNCTION_PASS_H
13 #define LLVM_CODEGEN_MACHINE_FUNCTION_PASS_H
15 #include "llvm/Pass.h"
16 #include "llvm/CodeGen/MachineFunction.h"
18 struct MachineFunctionPass : public FunctionPass {
20 /// runOnMachineFunction - This method must be overloaded to perform the
21 /// desired machine code transformation or analysis.
23 virtual bool runOnMachineFunction(MachineFunction &MF) = 0;
25 // FIXME: This pass should declare that the pass does not invalidate any LLVM
28 virtual bool runOnFunction(Function &F) {
29 return runOnMachineFunction(MachineFunction::get(&F));