2002-12-28 20:03:01 +00:00
|
|
|
//===-- MachineFunctionPass.h - Pass for MachineFunctions --------*-C++ -*-===//
|
2005-04-21 20:39:54 +00:00
|
|
|
//
|
2003-10-20 20:19:47 +00:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 19:59:42 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-21 20:39:54 +00:00
|
|
|
//
|
2003-10-20 20:19:47 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2002-12-28 20:03:01 +00:00
|
|
|
//
|
|
|
|
// This file defines the MachineFunctionPass class. MachineFunctionPass's are
|
|
|
|
// just FunctionPass's, except they operate on machine code as part of a code
|
|
|
|
// generator. Because they operate on machine code, not the LLVM
|
|
|
|
// representation, MachineFunctionPass's are not allowed to modify the LLVM
|
|
|
|
// representation. Due to this limitation, the MachineFunctionPass class takes
|
|
|
|
// care of declaring that no LLVM passes are invalidated.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_CODEGEN_MACHINE_FUNCTION_PASS_H
|
|
|
|
#define LLVM_CODEGEN_MACHINE_FUNCTION_PASS_H
|
|
|
|
|
|
|
|
#include "llvm/Pass.h"
|
|
|
|
#include "llvm/CodeGen/MachineFunction.h"
|
|
|
|
|
2003-11-11 22:41:34 +00:00
|
|
|
namespace llvm {
|
|
|
|
|
2002-12-28 20:03:01 +00:00
|
|
|
struct MachineFunctionPass : public FunctionPass {
|
|
|
|
|
2007-07-02 14:53:37 +00:00
|
|
|
explicit MachineFunctionPass(intptr_t ID) : FunctionPass(ID) {}
|
2008-09-04 17:05:41 +00:00
|
|
|
explicit MachineFunctionPass(void *ID) : FunctionPass(ID) {}
|
2007-05-01 21:15:47 +00:00
|
|
|
|
2007-07-05 20:39:35 +00:00
|
|
|
protected:
|
2002-12-28 20:03:01 +00:00
|
|
|
/// runOnMachineFunction - This method must be overloaded to perform the
|
|
|
|
/// desired machine code transformation or analysis.
|
|
|
|
///
|
|
|
|
virtual bool runOnMachineFunction(MachineFunction &MF) = 0;
|
|
|
|
|
2007-07-05 20:39:35 +00:00
|
|
|
public:
|
2002-12-28 20:03:01 +00:00
|
|
|
// FIXME: This pass should declare that the pass does not invalidate any LLVM
|
|
|
|
// passes.
|
2007-07-05 20:39:35 +00:00
|
|
|
bool runOnFunction(Function &F) {
|
2002-12-28 20:03:01 +00:00
|
|
|
return runOnMachineFunction(MachineFunction::get(&F));
|
|
|
|
}
|
2006-07-14 23:08:47 +00:00
|
|
|
|
2007-07-05 20:39:35 +00:00
|
|
|
private:
|
2006-07-14 23:08:47 +00:00
|
|
|
virtual void virtfn(); // out of line virtual fn to give class a home.
|
2002-12-28 20:03:01 +00:00
|
|
|
};
|
|
|
|
|
2003-11-11 22:41:34 +00:00
|
|
|
} // End llvm namespace
|
|
|
|
|
2002-12-28 20:03:01 +00:00
|
|
|
#endif
|