summaryrefslogtreecommitdiffstats
path: root/include/llvm/CodeGen/MachineFunctionPass.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/CodeGen/MachineFunctionPass.h')
-rw-r--r--include/llvm/CodeGen/MachineFunctionPass.h23
1 files changed, 17 insertions, 6 deletions
diff --git a/include/llvm/CodeGen/MachineFunctionPass.h b/include/llvm/CodeGen/MachineFunctionPass.h
index 6b5e64a..bac1103 100644
--- a/include/llvm/CodeGen/MachineFunctionPass.h
+++ b/include/llvm/CodeGen/MachineFunctionPass.h
@@ -20,23 +20,34 @@
#define LLVM_CODEGEN_MACHINE_FUNCTION_PASS_H
#include "llvm/Pass.h"
-#include "llvm/CodeGen/MachineFunction.h"
namespace llvm {
- // FIXME: This pass should declare that the pass does not invalidate any LLVM
- // passes.
-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:
+ /// 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:
bool runOnFunction(Function &F);
};
OpenPOWER on IntegriCloud