llvm.org GIT mirror llvm / 2a4a095
Initial check in of MachineFunctionPass.h git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5162 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 17 years ago
1 changed file(s) with 33 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 //===-- MachineFunctionPass.h - Pass for MachineFunctions --------*-C++ -*-===//
1 //
2 // This file defines the MachineFunctionPass class. MachineFunctionPass's are
3 // just FunctionPass's, except they operate on machine code as part of a code
4 // generator. Because they operate on machine code, not the LLVM
5 // representation, MachineFunctionPass's are not allowed to modify the LLVM
6 // representation. Due to this limitation, the MachineFunctionPass class takes
7 // care of declaring that no LLVM passes are invalidated.
8 //
9 //===----------------------------------------------------------------------===//
10
11 #ifndef LLVM_CODEGEN_MACHINE_FUNCTION_PASS_H
12 #define LLVM_CODEGEN_MACHINE_FUNCTION_PASS_H
13
14 #include "llvm/Pass.h"
15 #include "llvm/CodeGen/MachineFunction.h"
16
17 struct MachineFunctionPass : public FunctionPass {
18
19 /// runOnMachineFunction - This method must be overloaded to perform the
20 /// desired machine code transformation or analysis.
21 ///
22 virtual bool runOnMachineFunction(MachineFunction &MF) = 0;
23
24 // FIXME: This pass should declare that the pass does not invalidate any LLVM
25 // passes.
26
27 virtual bool runOnFunction(Function &F) {
28 return runOnMachineFunction(MachineFunction::get(&F));
29 }
30 };
31
32 #endif