mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-12 13:30:51 +00:00
Do not use typeinfo to identify pass in pass manager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36632 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e50fb9ac17
commit
794fd75c67
@ -61,6 +61,7 @@ protected:
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
|
||||
|
||||
public:
|
||||
static const int ID; // Class identification, replacement for typeinfo
|
||||
AliasAnalysis() : TD(0), AA(0) {}
|
||||
virtual ~AliasAnalysis(); // We want to be subclassed
|
||||
|
||||
|
@ -73,6 +73,7 @@ protected:
|
||||
FunctionMapTy FunctionMap; // Map from a function to its node
|
||||
|
||||
public:
|
||||
static const int ID; // Class identification, replacement for typeinfo
|
||||
//===---------------------------------------------------------------------
|
||||
// Accessors...
|
||||
//
|
||||
|
@ -42,9 +42,10 @@ class DominatorBase : public FunctionPass {
|
||||
protected:
|
||||
std::vector<BasicBlock*> Roots;
|
||||
const bool IsPostDominators;
|
||||
|
||||
inline DominatorBase(bool isPostDom) : Roots(), IsPostDominators(isPostDom) {}
|
||||
inline DominatorBase(intptr_t ID, bool isPostDom) :
|
||||
FunctionPass(ID), Roots(), IsPostDominators(isPostDom) {}
|
||||
public:
|
||||
|
||||
/// getRoots - Return the root blocks of the current CFG. This may include
|
||||
/// multiple blocks if we are computing post dominators. For forward
|
||||
/// dominators, this will always be a single block (the entry node).
|
||||
@ -135,7 +136,8 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
DominatorTreeBase(bool isPostDom) : DominatorBase(isPostDom) {}
|
||||
DominatorTreeBase(intptr_t ID, bool isPostDom)
|
||||
: DominatorBase(ID, isPostDom) {}
|
||||
~DominatorTreeBase() { reset(); }
|
||||
|
||||
virtual void releaseMemory() { reset(); }
|
||||
@ -206,7 +208,8 @@ public:
|
||||
///
|
||||
class DominatorTree : public DominatorTreeBase {
|
||||
public:
|
||||
DominatorTree() : DominatorTreeBase(false) {}
|
||||
static const int ID; // Pass ID, replacement for typeid
|
||||
DominatorTree() : DominatorTreeBase((intptr_t)&ID, false) {}
|
||||
|
||||
BasicBlock *getRoot() const {
|
||||
assert(Roots.size() == 1 && "Should always have entry node!");
|
||||
@ -264,8 +267,9 @@ template <> struct GraphTraits<DominatorTree*>
|
||||
///
|
||||
class ETForestBase : public DominatorBase {
|
||||
public:
|
||||
ETForestBase(bool isPostDom) : DominatorBase(isPostDom), Nodes(),
|
||||
DFSInfoValid(false), SlowQueries(0) {}
|
||||
ETForestBase(intptr_t ID, bool isPostDom)
|
||||
: DominatorBase(ID, isPostDom), Nodes(),
|
||||
DFSInfoValid(false), SlowQueries(0) {}
|
||||
|
||||
virtual void releaseMemory() { reset(); }
|
||||
|
||||
@ -395,7 +399,9 @@ protected:
|
||||
|
||||
class ETForest : public ETForestBase {
|
||||
public:
|
||||
ETForest() : ETForestBase(false) {}
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
|
||||
ETForest() : ETForestBase((intptr_t)&ID, false) {}
|
||||
|
||||
BasicBlock *getRoot() const {
|
||||
assert(Roots.size() == 1 && "Should always have entry node!");
|
||||
@ -425,7 +431,8 @@ public:
|
||||
protected:
|
||||
DomSetMapType Frontiers;
|
||||
public:
|
||||
DominanceFrontierBase(bool isPostDom) : DominatorBase(isPostDom) {}
|
||||
DominanceFrontierBase(intptr_t ID, bool isPostDom)
|
||||
: DominatorBase(ID, isPostDom) {}
|
||||
|
||||
virtual void releaseMemory() { Frontiers.clear(); }
|
||||
|
||||
@ -470,7 +477,9 @@ public:
|
||||
///
|
||||
class DominanceFrontier : public DominanceFrontierBase {
|
||||
public:
|
||||
DominanceFrontier() : DominanceFrontierBase(false) {}
|
||||
static const int ID; // Pass ID, replacement for typeid
|
||||
DominanceFrontier() :
|
||||
DominanceFrontierBase((intptr_t)& ID, false) {}
|
||||
|
||||
BasicBlock *getRoot() const {
|
||||
assert(Roots.size() == 1 && "Should always have entry node!");
|
||||
|
@ -24,6 +24,9 @@ class Type;
|
||||
class FindUsedTypes : public ModulePass {
|
||||
std::set<const Type *> UsedTypes;
|
||||
public:
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
FindUsedTypes() : ModulePass((intptr_t)&ID) {}
|
||||
|
||||
/// getTypes - After the pass has been run, return the set containing all of
|
||||
/// the types used in the module.
|
||||
///
|
||||
|
@ -45,7 +45,9 @@ class IntervalPartition : public FunctionPass {
|
||||
std::vector<Interval*> Intervals;
|
||||
|
||||
public:
|
||||
IntervalPartition() : RootInterval(0) {}
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
|
||||
IntervalPartition() : FunctionPass((intptr_t)&ID), RootInterval(0) {}
|
||||
|
||||
// run - Calculate the interval partition for this function
|
||||
virtual bool runOnFunction(Function &F);
|
||||
|
@ -241,6 +241,9 @@ class LoopInfo : public FunctionPass {
|
||||
std::vector<Loop*> TopLevelLoops;
|
||||
friend class Loop;
|
||||
public:
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
|
||||
LoopInfo() : FunctionPass((intptr_t)&ID) {}
|
||||
~LoopInfo() { releaseMemory(); }
|
||||
|
||||
/// iterator/begin/end - The interface to the top-level loops in the current
|
||||
|
@ -29,6 +29,8 @@ class Function;
|
||||
class LoopPass : public Pass {
|
||||
|
||||
public:
|
||||
LoopPass(intptr_t pid) : Pass(pid) {}
|
||||
|
||||
// runOnLoop - THis method should be implemented by the subclass to perform
|
||||
// whatever action is necessary for the specfied Loop.
|
||||
virtual bool runOnLoop (Loop *L, LPPassManager &LPM) = 0;
|
||||
@ -66,6 +68,7 @@ class LoopPass : public Pass {
|
||||
class LPPassManager : public FunctionPass, public PMDataManager {
|
||||
|
||||
public:
|
||||
static const int ID;
|
||||
LPPassManager(int Depth);
|
||||
|
||||
/// run - Execute all of the passes scheduled for execution. Keep track of
|
||||
|
@ -22,7 +22,10 @@ namespace llvm {
|
||||
/// compute the a post-dominator tree.
|
||||
///
|
||||
struct PostDominatorTree : public DominatorTreeBase {
|
||||
PostDominatorTree() : DominatorTreeBase(true) {}
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
|
||||
PostDominatorTree() :
|
||||
DominatorTreeBase((intptr_t)&ID, true) {}
|
||||
|
||||
virtual bool runOnFunction(Function &F) {
|
||||
reset(); // Reset from the last time we were run...
|
||||
@ -51,7 +54,8 @@ private:
|
||||
/// PostETForest Class - Concrete subclass of ETForestBase that is used to
|
||||
/// compute a forwards post-dominator ET-Forest.
|
||||
struct PostETForest : public ETForestBase {
|
||||
PostETForest() : ETForestBase(true) {}
|
||||
static const int ID;
|
||||
PostETForest() : ETForestBase((intptr_t)&ID, true) {}
|
||||
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.setPreservesAll();
|
||||
@ -75,7 +79,9 @@ struct PostETForest : public ETForestBase {
|
||||
/// used to compute the a post-dominance frontier.
|
||||
///
|
||||
struct PostDominanceFrontier : public DominanceFrontierBase {
|
||||
PostDominanceFrontier() : DominanceFrontierBase(true) {}
|
||||
static const int ID;
|
||||
PostDominanceFrontier()
|
||||
: DominanceFrontierBase((intptr_t) &ID, true) {}
|
||||
|
||||
virtual bool runOnFunction(Function &) {
|
||||
Frontiers.clear();
|
||||
|
@ -38,6 +38,7 @@ namespace llvm {
|
||||
// entered.
|
||||
std::map<std::pair<BasicBlock*, BasicBlock*>, unsigned> EdgeCounts;
|
||||
public:
|
||||
static const int ID; // Class identification, replacement for typeinfo
|
||||
virtual ~ProfileInfo(); // We want to be subclassed
|
||||
|
||||
//===------------------------------------------------------------------===//
|
||||
|
@ -197,7 +197,8 @@ namespace llvm {
|
||||
class ScalarEvolution : public FunctionPass {
|
||||
void *Impl; // ScalarEvolution uses the pimpl pattern
|
||||
public:
|
||||
ScalarEvolution() : Impl(0) {}
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
ScalarEvolution() : FunctionPass((intptr_t)&ID), Impl(0) {}
|
||||
|
||||
/// getSCEV - Return a SCEV expression handle for the full generality of the
|
||||
/// specified expression.
|
||||
|
@ -29,6 +29,7 @@ class Value;
|
||||
class Instruction;
|
||||
|
||||
struct ValueNumbering {
|
||||
static const int ID; // Class identification, replacement for typeinfo
|
||||
virtual ~ValueNumbering(); // We want to be subclassed
|
||||
|
||||
/// getEqualNumberNodes - Return nodes with the same value number as the
|
||||
|
@ -28,9 +28,10 @@ class PrintModulePass : public ModulePass {
|
||||
OStream *Out; // ostream to print on
|
||||
bool DeleteStream; // Delete the ostream in our dtor?
|
||||
public:
|
||||
PrintModulePass() : Out(&cerr), DeleteStream(false) {}
|
||||
static const int ID;
|
||||
PrintModulePass() : ModulePass((intptr_t)&ID), Out(&cerr), DeleteStream(false) {}
|
||||
PrintModulePass(OStream *o, bool DS = false)
|
||||
: Out(o), DeleteStream(DS) {}
|
||||
: ModulePass((intptr_t)&ID), Out(o), DeleteStream(DS) {}
|
||||
|
||||
~PrintModulePass() {
|
||||
if (DeleteStream) delete Out;
|
||||
@ -51,10 +52,12 @@ class PrintFunctionPass : public FunctionPass {
|
||||
OStream *Out; // ostream to print on
|
||||
bool DeleteStream; // Delete the ostream in our dtor?
|
||||
public:
|
||||
PrintFunctionPass() : Banner(""), Out(&cerr), DeleteStream(false) {}
|
||||
static const int ID;
|
||||
PrintFunctionPass() : FunctionPass((intptr_t)&ID), Banner(""), Out(&cerr),
|
||||
DeleteStream(false) {}
|
||||
PrintFunctionPass(const std::string &B, OStream *o = &cout,
|
||||
bool DS = false)
|
||||
: Banner(B), Out(o), DeleteStream(DS) {}
|
||||
: FunctionPass((intptr_t)&ID), Banner(B), Out(o), DeleteStream(DS) {}
|
||||
|
||||
inline ~PrintFunctionPass() {
|
||||
if (DeleteStream) delete Out;
|
||||
|
@ -26,10 +26,12 @@ class WriteBytecodePass : public ModulePass {
|
||||
bool DeleteStream;
|
||||
bool CompressFile;
|
||||
public:
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
WriteBytecodePass()
|
||||
: Out(&cout), DeleteStream(false), CompressFile(false) {}
|
||||
: ModulePass((intptr_t) &ID), Out(&cout), DeleteStream(false),
|
||||
CompressFile(false) {}
|
||||
WriteBytecodePass(OStream *o, bool DS = false, bool CF = false)
|
||||
: Out(o), DeleteStream(DS), CompressFile(CF) {}
|
||||
: ModulePass((intptr_t) &ID), Out(o), DeleteStream(DS), CompressFile(CF) {}
|
||||
|
||||
inline ~WriteBytecodePass() {
|
||||
if (DeleteStream) delete Out;
|
||||
|
@ -31,6 +31,8 @@ class PMStack;
|
||||
|
||||
struct CallGraphSCCPass : public Pass {
|
||||
|
||||
CallGraphSCCPass(intptr_t pid) : Pass(pid) {}
|
||||
|
||||
/// doInitialization - This method is called before the SCC's of the program
|
||||
/// has been processed, allowing the pass to do initialization as necessary.
|
||||
virtual bool doInitialization(CallGraph &CG) {
|
||||
|
@ -34,6 +34,8 @@ namespace llvm {
|
||||
/// AsmPrinter - This class is intended to be used as a driving class for all
|
||||
/// asm writers.
|
||||
class AsmPrinter : public MachineFunctionPass {
|
||||
static const int ID;
|
||||
|
||||
/// FunctionNumber - This provides a unique ID for each function emitted in
|
||||
/// this translation unit. It is autoincremented by SetupMachineFunction,
|
||||
/// and can be accessed with getFunctionNumber() and
|
||||
|
@ -65,6 +65,9 @@ namespace llvm {
|
||||
BitVector JoinedLIs;
|
||||
|
||||
public:
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
LiveIntervals() : MachineFunctionPass((intptr_t)&ID) {}
|
||||
|
||||
struct CopyRec {
|
||||
MachineInstr *MI;
|
||||
unsigned SrcReg, DstReg;
|
||||
|
@ -40,6 +40,9 @@ class MRegisterInfo;
|
||||
|
||||
class LiveVariables : public MachineFunctionPass {
|
||||
public:
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
LiveVariables() : MachineFunctionPass((intptr_t)&ID) {}
|
||||
|
||||
/// VarInfo - This represents the regions where a virtual register is live in
|
||||
/// the program. We represent this with three different pieces of
|
||||
/// information: the instruction that uniquely defines the value, the set of
|
||||
|
@ -26,6 +26,8 @@ namespace llvm {
|
||||
|
||||
struct MachineFunctionPass : public FunctionPass {
|
||||
|
||||
MachineFunctionPass(intptr_t ID) : FunctionPass(ID) {}
|
||||
|
||||
/// runOnMachineFunction - This method must be overloaded to perform the
|
||||
/// desired machine code transformation or analysis.
|
||||
///
|
||||
|
@ -1022,6 +1022,8 @@ private:
|
||||
std::vector<GlobalVariable *> TypeInfos;
|
||||
|
||||
public:
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
|
||||
MachineModuleInfo();
|
||||
~MachineModuleInfo();
|
||||
|
||||
|
@ -41,8 +41,10 @@ public:
|
||||
MachineBasicBlock *BB;
|
||||
std::vector<SDNode*> TopOrder;
|
||||
unsigned DAGSize;
|
||||
static const int ID;
|
||||
|
||||
explicit SelectionDAGISel(TargetLowering &tli) : TLI(tli), DAGSize(0) {}
|
||||
explicit SelectionDAGISel(TargetLowering &tli) :
|
||||
FunctionPass((intptr_t)&ID), TLI(tli), DAGSize(0) {}
|
||||
|
||||
TargetLowering &getTargetLowering() { return TLI; }
|
||||
|
||||
|
@ -34,8 +34,8 @@
|
||||
#include <deque>
|
||||
#include <map>
|
||||
#include <iosfwd>
|
||||
#include <typeinfo>
|
||||
#include <cassert>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
@ -77,7 +77,7 @@ typedef enum PassManagerType PassManagerType;
|
||||
///
|
||||
class Pass {
|
||||
AnalysisResolver *Resolver; // Used to resolve analysis
|
||||
const PassInfo *PassInfoCache;
|
||||
intptr_t PassID;
|
||||
|
||||
// AnalysisImpls - This keeps track of which passes implement the interfaces
|
||||
// that are required by the current pass (to implement getAnalysis()).
|
||||
@ -87,7 +87,7 @@ class Pass {
|
||||
void operator=(const Pass&); // DO NOT IMPLEMENT
|
||||
Pass(const Pass &); // DO NOT IMPLEMENT
|
||||
public:
|
||||
Pass() : Resolver(0), PassInfoCache(0) {}
|
||||
Pass(intptr_t pid) : Resolver(0), PassID(pid) {}
|
||||
virtual ~Pass();
|
||||
|
||||
/// getPassName - Return a nice clean name for a pass. This usually
|
||||
@ -163,12 +163,12 @@ public:
|
||||
|
||||
template<typename AnalysisClass>
|
||||
static const PassInfo *getClassPassInfo() {
|
||||
return lookupPassInfo(typeid(AnalysisClass));
|
||||
return lookupPassInfo((intptr_t)&AnalysisClass::ID);
|
||||
}
|
||||
|
||||
// lookupPassInfo - Return the pass info object for the specified pass class,
|
||||
// or null if it is not known.
|
||||
static const PassInfo *lookupPassInfo(const std::type_info &TI);
|
||||
static const PassInfo *lookupPassInfo(intptr_t TI);
|
||||
|
||||
/// getAnalysisToUpdate<AnalysisType>() - This function is used by subclasses
|
||||
/// to get to the analysis information that might be around that needs to be
|
||||
@ -232,6 +232,7 @@ public:
|
||||
return PMT_ModulePassManager;
|
||||
}
|
||||
|
||||
ModulePass(intptr_t pid) : Pass(pid) {}
|
||||
// Force out-of-line virtual method.
|
||||
virtual ~ModulePass();
|
||||
};
|
||||
@ -256,6 +257,7 @@ public:
|
||||
///
|
||||
virtual bool runOnModule(Module &M) { return false; }
|
||||
|
||||
ImmutablePass(intptr_t pid) : ModulePass(pid) {}
|
||||
// Force out-of-line virtual method.
|
||||
virtual ~ImmutablePass();
|
||||
};
|
||||
@ -271,6 +273,8 @@ public:
|
||||
///
|
||||
class FunctionPass : public Pass {
|
||||
public:
|
||||
FunctionPass(intptr_t pid) : Pass(pid) {}
|
||||
|
||||
/// doInitialization - Virtual method overridden by subclasses to do
|
||||
/// any necessary per-module initialization.
|
||||
///
|
||||
@ -320,6 +324,8 @@ public:
|
||||
///
|
||||
class BasicBlockPass : public Pass {
|
||||
public:
|
||||
BasicBlockPass(intptr_t pid) : Pass(pid) {}
|
||||
|
||||
/// doInitialization - Virtual method overridden by subclasses to do
|
||||
/// any necessary per-module initialization.
|
||||
///
|
||||
|
@ -336,7 +336,9 @@ private:
|
||||
class FPPassManager : public ModulePass, public PMDataManager {
|
||||
|
||||
public:
|
||||
explicit FPPassManager(int Depth) : PMDataManager(Depth) { }
|
||||
static const int ID;
|
||||
explicit FPPassManager(int Depth)
|
||||
: ModulePass((intptr_t)&ID), PMDataManager(Depth) { }
|
||||
|
||||
/// run - Execute all of the passes scheduled for execution. Keep track of
|
||||
/// whether any of the passes modifies the module, and if so, return true.
|
||||
|
@ -37,19 +37,19 @@ class TargetMachine;
|
||||
class PassInfo {
|
||||
const char *PassName; // Nice name for Pass
|
||||
const char *PassArgument; // Command Line argument to run this pass
|
||||
const std::type_info &TypeInfo; // type_info object for this Pass class
|
||||
intptr_t PassID;
|
||||
bool IsCFGOnlyPass; // Pass only looks at the CFG.
|
||||
bool IsAnalysisGroup; // True if an analysis group.
|
||||
std::vector<const PassInfo*> ItfImpl;// Interfaces implemented by this pass
|
||||
|
||||
Pass *(*NormalCtor)(); // No argument ctor
|
||||
Pass *(*NormalCtor)();
|
||||
|
||||
public:
|
||||
/// PassInfo ctor - Do not call this directly, this should only be invoked
|
||||
/// through RegisterPass.
|
||||
PassInfo(const char *name, const char *arg, const std::type_info &ti,
|
||||
PassInfo(const char *name, const char *arg, intptr_t pi,
|
||||
Pass *(*normal)() = 0, bool isCFGOnly = false)
|
||||
: PassName(name), PassArgument(arg), TypeInfo(ti),
|
||||
: PassName(name), PassArgument(arg), PassID(pi),
|
||||
IsCFGOnlyPass(isCFGOnly), IsAnalysisGroup(false), NormalCtor(normal) {
|
||||
}
|
||||
|
||||
@ -65,8 +65,8 @@ public:
|
||||
const char *getPassArgument() const { return PassArgument; }
|
||||
|
||||
/// getTypeInfo - Return the type_info object for the pass...
|
||||
///
|
||||
const std::type_info &getTypeInfo() const { return TypeInfo; }
|
||||
/// TODO : Rename
|
||||
intptr_t getTypeInfo() const { return PassID; }
|
||||
|
||||
/// isAnalysisGroup - Return true if this is an analysis group, not a normal
|
||||
/// pass.
|
||||
@ -139,12 +139,12 @@ struct RegisterPassBase {
|
||||
|
||||
typedef Pass* (*NormalCtor_t)();
|
||||
|
||||
RegisterPassBase(const char *Name, const char *Arg, const std::type_info &TI,
|
||||
RegisterPassBase(const char *Name, const char *Arg, intptr_t TI,
|
||||
NormalCtor_t NormalCtor = 0, bool CFGOnly = false)
|
||||
: PIObj(Name, Arg, TI, NormalCtor, CFGOnly) {
|
||||
registerPass();
|
||||
}
|
||||
RegisterPassBase(const std::type_info &TI)
|
||||
RegisterPassBase(intptr_t TI)
|
||||
: PIObj("", "", TI) {
|
||||
// This ctor may only be used for analysis groups: it does not auto-register
|
||||
// the pass.
|
||||
@ -165,7 +165,7 @@ struct RegisterPass : public RegisterPassBase {
|
||||
|
||||
// Register Pass using default constructor...
|
||||
RegisterPass(const char *PassArg, const char *Name, bool CFGOnly = false)
|
||||
: RegisterPassBase(Name, PassArg, typeid(PassName),
|
||||
: RegisterPassBase(Name, PassArg, (intptr_t)&PassName::ID,
|
||||
(RegisterPassBase::NormalCtor_t)callDefaultCtor<PassName>, CFGOnly) {
|
||||
}
|
||||
};
|
||||
@ -195,8 +195,8 @@ class RegisterAGBase : public RegisterPassBase {
|
||||
const PassInfo *ImplementationInfo;
|
||||
bool isDefaultImplementation;
|
||||
protected:
|
||||
explicit RegisterAGBase(const std::type_info &Interface,
|
||||
const std::type_info *Pass = 0,
|
||||
explicit RegisterAGBase(intptr_t InterfaceID,
|
||||
intptr_t PassID = 0,
|
||||
bool isDefault = false);
|
||||
void setGroupName(const char *Name);
|
||||
};
|
||||
@ -204,12 +204,12 @@ protected:
|
||||
template<typename Interface, bool Default = false>
|
||||
struct RegisterAnalysisGroup : public RegisterAGBase {
|
||||
explicit RegisterAnalysisGroup(RegisterPassBase &RPB)
|
||||
: RegisterAGBase(typeid(Interface), &RPB.getPassInfo()->getTypeInfo(),
|
||||
: RegisterAGBase((intptr_t) &Interface::ID, RPB.getPassInfo()->getTypeInfo(),
|
||||
Default) {
|
||||
}
|
||||
|
||||
explicit RegisterAnalysisGroup(const char *Name)
|
||||
: RegisterAGBase(typeid(Interface)) {
|
||||
: RegisterAGBase((intptr_t) &Interface::ID) {
|
||||
setGroupName(Name);
|
||||
}
|
||||
};
|
||||
|
@ -108,14 +108,15 @@ public:
|
||||
///
|
||||
/// @note This has to exist, because this is a pass, but it should never be
|
||||
/// used.
|
||||
TargetData() {
|
||||
TargetData() : ImmutablePass((intptr_t)&ID) {
|
||||
assert(0 && "ERROR: Bad TargetData ctor used. "
|
||||
"Tool did not specify a TargetData to use?");
|
||||
abort();
|
||||
}
|
||||
|
||||
/// Constructs a TargetData from a specification string. See init().
|
||||
TargetData(const std::string &TargetDescription) {
|
||||
TargetData(const std::string &TargetDescription)
|
||||
: ImmutablePass((intptr_t)&ID) {
|
||||
init(TargetDescription);
|
||||
}
|
||||
|
||||
@ -123,7 +124,7 @@ public:
|
||||
TargetData(const Module *M);
|
||||
|
||||
TargetData(const TargetData &TD) :
|
||||
ImmutablePass(),
|
||||
ImmutablePass((intptr_t)&ID),
|
||||
LittleEndian(TD.isLittleEndian()),
|
||||
PointerMemSize(TD.PointerMemSize),
|
||||
PointerABIAlign(TD.PointerABIAlign),
|
||||
@ -200,6 +201,8 @@ public:
|
||||
/// specified global, returned in log form. This includes an explicitly
|
||||
/// requested alignment (if the global has one).
|
||||
unsigned getPreferredAlignmentLog(const GlobalVariable *GV) const;
|
||||
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
};
|
||||
|
||||
/// StructLayout - used to lazily calculate structure layout information for a
|
||||
|
@ -23,6 +23,9 @@ namespace llvm {
|
||||
/// this interface are expected to chain to other implementations, such that
|
||||
/// multiple profilers can be support simultaniously.
|
||||
struct RSProfilers : public ModulePass {
|
||||
static const int ID; // Pass identification, replacement for typeinfo
|
||||
RSProfilers() : ModulePass((intptr_t)&ID) {}
|
||||
|
||||
/// isProfiling - This method returns true if the value passed it was
|
||||
/// inserted by the profiler.
|
||||
virtual bool isProfiling(Value* v) = 0;
|
||||
|
@ -25,7 +25,9 @@ namespace llvm {
|
||||
struct UnifyFunctionExitNodes : public FunctionPass {
|
||||
BasicBlock *ReturnBlock, *UnwindBlock, *UnreachableBlock;
|
||||
public:
|
||||
UnifyFunctionExitNodes() : ReturnBlock(0), UnwindBlock(0) {}
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
UnifyFunctionExitNodes() : FunctionPass((intptr_t)&ID),
|
||||
ReturnBlock(0), UnwindBlock(0) {}
|
||||
|
||||
// We can preserve non-critical-edgeness when we unify function exit nodes
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
|
||||
|
@ -34,6 +34,7 @@ using namespace llvm;
|
||||
|
||||
// Register the AliasAnalysis interface, providing a nice name to refer to.
|
||||
namespace {
|
||||
const int AliasAnalysis::ID = 0;
|
||||
RegisterAnalysisGroup<AliasAnalysis> Z("Alias Analysis");
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,8 @@ namespace {
|
||||
const char *Name;
|
||||
Module *M;
|
||||
public:
|
||||
AliasAnalysisCounter() {
|
||||
static const int ID; // Class identification, replacement for typeinfo
|
||||
AliasAnalysisCounter() : ModulePass((intptr_t) &ID) {
|
||||
No = May = Must = 0;
|
||||
NoMR = JustRef = JustMod = MR = 0;
|
||||
}
|
||||
@ -107,6 +108,7 @@ namespace {
|
||||
}
|
||||
};
|
||||
|
||||
const int AliasAnalysisCounter::ID = 0;
|
||||
RegisterPass<AliasAnalysisCounter>
|
||||
X("count-aa", "Count Alias Analysis Query Responses");
|
||||
RegisterAnalysisGroup<AliasAnalysis> Y(X);
|
||||
|
@ -50,6 +50,9 @@ namespace {
|
||||
unsigned NoModRef, Mod, Ref, ModRef;
|
||||
|
||||
public:
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
AAEval() : FunctionPass((intptr_t)&ID) {}
|
||||
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.addRequired<AliasAnalysis>();
|
||||
AU.setPreservesAll();
|
||||
@ -70,6 +73,7 @@ namespace {
|
||||
bool doFinalization(Module &M);
|
||||
};
|
||||
|
||||
const int AAEval::ID = 0;
|
||||
RegisterPass<AAEval>
|
||||
X("aa-eval", "Exhaustive Alias Analysis Precision Evaluator");
|
||||
}
|
||||
|
@ -40,6 +40,9 @@ namespace {
|
||||
std::set<const Value*> Vals;
|
||||
|
||||
public:
|
||||
static const int ID; // Class identification, replacement for typeinfo
|
||||
AliasDebugger() : ModulePass((intptr_t)&ID) {}
|
||||
|
||||
bool runOnModule(Module &M) {
|
||||
InitializeAliasAnalysis(this); // set up super class
|
||||
|
||||
@ -119,6 +122,7 @@ namespace {
|
||||
|
||||
};
|
||||
|
||||
const int AliasDebugger::ID = 0;
|
||||
RegisterPass<AliasDebugger> X("debug-aa", "AA use debugger");
|
||||
RegisterAnalysisGroup<AliasAnalysis> Y(X);
|
||||
}
|
||||
|
@ -555,6 +555,9 @@ namespace {
|
||||
class VISIBILITY_HIDDEN AliasSetPrinter : public FunctionPass {
|
||||
AliasSetTracker *Tracker;
|
||||
public:
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
AliasSetPrinter() : FunctionPass((intptr_t)&ID) {}
|
||||
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.setPreservesAll();
|
||||
AU.addRequired<AliasAnalysis>();
|
||||
@ -570,5 +573,6 @@ namespace {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
const int AliasSetPrinter::ID = 0;
|
||||
RegisterPass<AliasSetPrinter> X("print-alias-sets", "Alias Set Printer");
|
||||
}
|
||||
|
@ -36,6 +36,9 @@ namespace {
|
||||
/// such it doesn't follow many of the rules that other alias analyses must.
|
||||
///
|
||||
struct VISIBILITY_HIDDEN NoAA : public ImmutablePass, public AliasAnalysis {
|
||||
static const int ID; // Class identification, replacement for typeinfo
|
||||
NoAA() : ImmutablePass((intptr_t)&ID) {}
|
||||
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.addRequired<TargetData>();
|
||||
}
|
||||
@ -74,6 +77,7 @@ namespace {
|
||||
};
|
||||
|
||||
// Register this pass...
|
||||
const int NoAA::ID = 0;
|
||||
RegisterPass<NoAA>
|
||||
U("no-aa", "No Alias Analysis (always returns 'may' alias)");
|
||||
|
||||
@ -88,6 +92,7 @@ namespace {
|
||||
/// Because it doesn't chain to a previous alias analysis (like -no-aa), it
|
||||
/// derives from the NoAA class.
|
||||
struct VISIBILITY_HIDDEN BasicAliasAnalysis : public NoAA {
|
||||
static const int ID; // Class identification, replacement for typeinfo
|
||||
AliasResult alias(const Value *V1, unsigned V1Size,
|
||||
const Value *V2, unsigned V2Size);
|
||||
|
||||
@ -119,6 +124,7 @@ namespace {
|
||||
};
|
||||
|
||||
// Register this pass...
|
||||
const int BasicAliasAnalysis::ID = 0;
|
||||
RegisterPass<BasicAliasAnalysis>
|
||||
X("basicaa", "Basic Alias Analysis (default AA impl)");
|
||||
|
||||
|
@ -91,6 +91,9 @@ struct DOTGraphTraits<const Function*> : public DefaultDOTGraphTraits {
|
||||
|
||||
namespace {
|
||||
struct VISIBILITY_HIDDEN CFGPrinter : public FunctionPass {
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
CFGPrinter() : FunctionPass((intptr_t)&ID) {}
|
||||
|
||||
virtual bool runOnFunction(Function &F) {
|
||||
std::string Filename = "cfg." + F.getName() + ".dot";
|
||||
cerr << "Writing '" << Filename << "'...";
|
||||
@ -111,10 +114,12 @@ namespace {
|
||||
}
|
||||
};
|
||||
|
||||
const int CFGPrinter::ID = 0;
|
||||
RegisterPass<CFGPrinter> P1("print-cfg",
|
||||
"Print CFG of function to 'dot' file");
|
||||
|
||||
struct VISIBILITY_HIDDEN CFGOnlyPrinter : public CFGPrinter {
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
virtual bool runOnFunction(Function &F) {
|
||||
bool OldCFGOnly = CFGOnly;
|
||||
CFGOnly = true;
|
||||
@ -129,6 +134,7 @@ namespace {
|
||||
}
|
||||
};
|
||||
|
||||
const int CFGOnlyPrinter::ID = 0;
|
||||
RegisterPass<CFGOnlyPrinter>
|
||||
P2("print-cfg-only",
|
||||
"Print CFG of function to 'dot' file (with no function bodies)");
|
||||
|
@ -75,12 +75,17 @@ STATISTIC(NumIndirectCallees , "Number of indirect callees found");
|
||||
namespace {
|
||||
class VISIBILITY_HIDDEN Andersens : public ModulePass, public AliasAnalysis,
|
||||
private InstVisitor<Andersens> {
|
||||
public:
|
||||
static const int ID; // Class identification, replacement for typeinfo
|
||||
Andersens() : ModulePass((intptr_t)&ID) {}
|
||||
private:
|
||||
/// Node class - This class is used to represent a memory object in the
|
||||
/// program, and is the primitive used to build the points-to graph.
|
||||
class Node {
|
||||
std::vector<Node*> Pointees;
|
||||
Value *Val;
|
||||
public:
|
||||
static const unsigned ID; // Pass identifcation, replacement for typeid
|
||||
Node() : Val(0) {}
|
||||
Node *setValue(Value *V) {
|
||||
assert(Val == 0 && "Value already set for this node!");
|
||||
@ -334,6 +339,7 @@ namespace {
|
||||
void visitInstruction(Instruction &I);
|
||||
};
|
||||
|
||||
const int Andersens::ID = 0;
|
||||
RegisterPass<Andersens> X("anders-aa",
|
||||
"Andersen's Interprocedural Alias Analysis");
|
||||
RegisterAnalysisGroup<AliasAnalysis> Y(X);
|
||||
|
@ -51,7 +51,9 @@ class VISIBILITY_HIDDEN BasicCallGraph : public CallGraph, public ModulePass {
|
||||
CallGraphNode *CallsExternalNode;
|
||||
|
||||
public:
|
||||
BasicCallGraph() : Root(0), ExternalCallingNode(0), CallsExternalNode(0) {}
|
||||
static const int ID; // Class identification, replacement for typeinfo
|
||||
BasicCallGraph() : ModulePass((intptr_t)&ID), Root(0),
|
||||
ExternalCallingNode(0), CallsExternalNode(0) {}
|
||||
|
||||
// runOnModule - Compute the call graph for the specified module.
|
||||
virtual bool runOnModule(Module &M) {
|
||||
@ -188,7 +190,9 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
const int CallGraph::ID = 0;
|
||||
RegisterAnalysisGroup<CallGraph> X("Call Graph");
|
||||
const int BasicCallGraph::ID = 0;
|
||||
RegisterPass<BasicCallGraph> Y("basiccg", "Basic CallGraph Construction");
|
||||
RegisterAnalysisGroup<CallGraph, true> Z(Y);
|
||||
|
||||
|
@ -30,7 +30,9 @@ using namespace llvm;
|
||||
class CGPassManager : public ModulePass, public PMDataManager {
|
||||
|
||||
public:
|
||||
CGPassManager(int Depth) : PMDataManager(Depth) { }
|
||||
static const int ID;
|
||||
CGPassManager(int Depth)
|
||||
: ModulePass((intptr_t)&ID), PMDataManager(Depth) { }
|
||||
|
||||
/// run - Execute all of the passes scheduled for execution. Keep track of
|
||||
/// whether any of the passes modifies the module, and if so, return true.
|
||||
@ -71,6 +73,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
const int CGPassManager::ID = 0;
|
||||
/// run - Execute all of the passes scheduled for execution. Keep track of
|
||||
/// whether any of the passes modifies the module, and if so, return true.
|
||||
bool CGPassManager::runOnModule(Module &M) {
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "llvm/Support/InstIterator.h"
|
||||
using namespace llvm;
|
||||
|
||||
const int FindUsedTypes::ID = 0;
|
||||
static RegisterPass<FindUsedTypes>
|
||||
X("printusedtypes", "Find Used Types");
|
||||
|
||||
|
@ -83,6 +83,9 @@ namespace {
|
||||
std::map<Function*, FunctionRecord> FunctionInfo;
|
||||
|
||||
public:
|
||||
static const int ID;
|
||||
GlobalsModRef() : ModulePass((intptr_t)&ID) {}
|
||||
|
||||
bool runOnModule(Module &M) {
|
||||
InitializeAliasAnalysis(this); // set up super class
|
||||
AnalyzeGlobals(M); // find non-addr taken globals
|
||||
@ -143,6 +146,7 @@ namespace {
|
||||
bool AnalyzeIndirectGlobalMemory(GlobalValue *GV);
|
||||
};
|
||||
|
||||
const int GlobalsModRef::ID = 0;
|
||||
RegisterPass<GlobalsModRef> X("globalsmodref-aa",
|
||||
"Simple mod/ref analysis for globals");
|
||||
RegisterAnalysisGroup<AliasAnalysis> Y(X);
|
||||
|
@ -51,6 +51,9 @@ namespace {
|
||||
abort();
|
||||
}
|
||||
public:
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
InstCount() : FunctionPass((intptr_t)&ID) {}
|
||||
|
||||
virtual bool runOnFunction(Function &F);
|
||||
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
@ -60,6 +63,7 @@ namespace {
|
||||
|
||||
};
|
||||
|
||||
const int InstCount::ID = 0;
|
||||
RegisterPass<InstCount> X("instcount",
|
||||
"Counts the various types of Instructions");
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "llvm/Analysis/IntervalIterator.h"
|
||||
using namespace llvm;
|
||||
|
||||
const int IntervalPartition::ID = 0;
|
||||
static RegisterPass<IntervalPartition>
|
||||
X("intervals", "Interval Partition Construction", true);
|
||||
|
||||
@ -88,7 +89,8 @@ bool IntervalPartition::runOnFunction(Function &F) {
|
||||
// existing interval graph. This takes an additional boolean parameter to
|
||||
// distinguish it from a copy constructor. Always pass in false for now.
|
||||
//
|
||||
IntervalPartition::IntervalPartition(IntervalPartition &IP, bool) {
|
||||
IntervalPartition::IntervalPartition(IntervalPartition &IP, bool)
|
||||
: FunctionPass((intptr_t) &ID) {
|
||||
Interval *FunctionStart = IP.getRootInterval();
|
||||
assert(FunctionStart && "Cannot operate on empty IntervalPartitions!");
|
||||
|
||||
|
@ -40,6 +40,8 @@ using namespace llvm;
|
||||
namespace {
|
||||
// FIXME: This should not be a FunctionPass.
|
||||
struct VISIBILITY_HIDDEN LoadVN : public FunctionPass, public ValueNumbering {
|
||||
static const int ID; // Class identification, replacement for typeinfo
|
||||
LoadVN() : FunctionPass((intptr_t)&ID) {}
|
||||
|
||||
/// Pass Implementation stuff. This doesn't do any analysis.
|
||||
///
|
||||
@ -81,6 +83,7 @@ namespace {
|
||||
std::vector<Value*> &RetVals) const;
|
||||
};
|
||||
|
||||
const int LoadVN::ID = 0;
|
||||
// Register this pass...
|
||||
RegisterPass<LoadVN> X("load-vn", "Load Value Numbering");
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <ostream>
|
||||
using namespace llvm;
|
||||
|
||||
const int LoopInfo::ID = 0;
|
||||
static RegisterPass<LoopInfo>
|
||||
X("loops", "Natural Loop Construction", true);
|
||||
|
||||
|
@ -20,9 +20,12 @@ using namespace llvm;
|
||||
//===----------------------------------------------------------------------===//
|
||||
// LPPassManager
|
||||
//
|
||||
|
||||
const int LPPassManager::ID = 0;
|
||||
/// LPPassManager manages FPPassManagers and CalLGraphSCCPasses.
|
||||
|
||||
LPPassManager::LPPassManager(int Depth) : PMDataManager(Depth) {
|
||||
LPPassManager::LPPassManager(int Depth)
|
||||
: FunctionPass((intptr_t)&ID), PMDataManager(Depth) {
|
||||
skipThisLoop = false;
|
||||
redoThisLoop = false;
|
||||
LI = NULL;
|
||||
|
@ -22,6 +22,9 @@ using namespace llvm;
|
||||
// PostDominatorTree Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
const int PostDominatorTree::ID = 0;
|
||||
const int PostDominanceFrontier::ID = 0;
|
||||
const int PostETForest::ID = 0;
|
||||
static RegisterPass<PostDominatorTree>
|
||||
F("postdomtree", "Post-Dominator Tree Construction", true);
|
||||
|
||||
|
@ -22,6 +22,7 @@ using namespace llvm;
|
||||
|
||||
// Register the ProfileInfo interface, providing a nice name to refer to.
|
||||
namespace {
|
||||
const int ProfileInfo::ID = 0;
|
||||
RegisterAnalysisGroup<ProfileInfo> Z("Profile Information");
|
||||
}
|
||||
|
||||
@ -84,8 +85,12 @@ unsigned ProfileInfo::getExecutionCount(BasicBlock *BB) const {
|
||||
|
||||
namespace {
|
||||
struct VISIBILITY_HIDDEN NoProfileInfo
|
||||
: public ImmutablePass, public ProfileInfo {};
|
||||
: public ImmutablePass, public ProfileInfo {
|
||||
static const int ID; // Class identification, replacement for typeinfo
|
||||
NoProfileInfo() : ImmutablePass((intptr_t)&ID) {}
|
||||
};
|
||||
|
||||
const int NoProfileInfo::ID = 0;
|
||||
// Register this pass...
|
||||
RegisterPass<NoProfileInfo>
|
||||
X("no-profile", "No Profile Information");
|
||||
|
@ -32,8 +32,9 @@ namespace {
|
||||
class VISIBILITY_HIDDEN LoaderPass : public ModulePass, public ProfileInfo {
|
||||
std::string Filename;
|
||||
public:
|
||||
static const int ID; // Class identification, replacement for typeinfo
|
||||
LoaderPass(const std::string &filename = "")
|
||||
: Filename(filename) {
|
||||
: ModulePass((intptr_t)&ID), Filename(filename) {
|
||||
if (filename.empty()) Filename = ProfileInfoFilename;
|
||||
}
|
||||
|
||||
@ -49,6 +50,7 @@ namespace {
|
||||
virtual bool runOnModule(Module &M);
|
||||
};
|
||||
|
||||
const int LoaderPass::ID = 0;
|
||||
RegisterPass<LoaderPass>
|
||||
X("profile-loader", "Load profile information from llvmprof.out");
|
||||
|
||||
|
@ -102,6 +102,7 @@ MaxBruteForceIterations("scalar-evolution-max-iterations", cl::ReallyHidden,
|
||||
cl::init(100));
|
||||
|
||||
namespace {
|
||||
const int ScalarEvolution::ID = 0;
|
||||
RegisterPass<ScalarEvolution>
|
||||
R("scalar-evolution", "Scalar Evolution Analysis");
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "llvm/Support/Compiler.h"
|
||||
using namespace llvm;
|
||||
|
||||
const int ValueNumbering::ID = 0;
|
||||
// Register the ValueNumbering interface, providing a nice name to refer to.
|
||||
static RegisterAnalysisGroup<ValueNumbering> X("Value Numbering");
|
||||
|
||||
@ -51,6 +52,9 @@ namespace {
|
||||
///
|
||||
struct VISIBILITY_HIDDEN BasicVN
|
||||
: public ImmutablePass, public ValueNumbering {
|
||||
static const int ID; // Class identification, replacement for typeinfo
|
||||
BasicVN() : ImmutablePass((intptr_t)&ID) {}
|
||||
|
||||
/// getEqualNumberNodes - Return nodes with the same value number as the
|
||||
/// specified Value. This fills in the argument vector with any equal
|
||||
/// values.
|
||||
@ -61,6 +65,7 @@ namespace {
|
||||
std::vector<Value*> &RetVals) const;
|
||||
};
|
||||
|
||||
const int BasicVN::ID = 0;
|
||||
// Register this pass...
|
||||
RegisterPass<BasicVN>
|
||||
X("basicvn", "Basic Value Numbering (default GVN impl)");
|
||||
|
@ -47,6 +47,7 @@ using namespace llvm;
|
||||
/// @brief The bytecode version number
|
||||
const unsigned BCVersionNum = 7;
|
||||
|
||||
const int WriteBytecodePass::ID = 0;
|
||||
static RegisterPass<WriteBytecodePass> X("emitbytecode", "Bytecode Writer");
|
||||
|
||||
STATISTIC(BytesWritten, "Number of bytecode bytes written");
|
||||
|
@ -32,9 +32,10 @@ using namespace llvm;
|
||||
static cl::opt<bool>
|
||||
AsmVerbose("asm-verbose", cl::Hidden, cl::desc("Add comments to directives."));
|
||||
|
||||
const int AsmPrinter::ID = 0;
|
||||
AsmPrinter::AsmPrinter(std::ostream &o, TargetMachine &tm,
|
||||
const TargetAsmInfo *T)
|
||||
: FunctionNumber(0), O(o), TM(tm), TAI(T)
|
||||
: MachineFunctionPass((intptr_t)&ID), FunctionNumber(0), O(o), TM(tm), TAI(T)
|
||||
{}
|
||||
|
||||
std::string AsmPrinter::getSectionForFunction(const Function &F) const {
|
||||
|
@ -39,6 +39,9 @@ static cl::opt<bool> EnableTailMerge("enable-tail-merge", cl::Hidden);
|
||||
|
||||
namespace {
|
||||
struct BranchFolder : public MachineFunctionPass {
|
||||
static const int ID;
|
||||
BranchFolder() : MachineFunctionPass((intptr_t)&ID) {}
|
||||
|
||||
virtual bool runOnMachineFunction(MachineFunction &MF);
|
||||
virtual const char *getPassName() const { return "Control Flow Optimizer"; }
|
||||
const TargetInstrInfo *TII;
|
||||
@ -64,6 +67,7 @@ namespace {
|
||||
MachineBasicBlock *TBB, MachineBasicBlock *FBB,
|
||||
const std::vector<MachineOperand> &Cond);
|
||||
};
|
||||
const int BranchFolder::ID = 0;
|
||||
}
|
||||
|
||||
FunctionPass *llvm::createBranchFoldingPass() { return new BranchFolder(); }
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include <list>
|
||||
using namespace llvm;
|
||||
|
||||
const int ELFWriter::ID = 0;
|
||||
/// AddELFWriter - Concrete function to add the ELF writer to the function pass
|
||||
/// manager.
|
||||
MachineCodeEmitter *llvm::AddELFWriter(FunctionPassManager &FPM,
|
||||
@ -176,7 +177,8 @@ bool ELFCodeEmitter::finishFunction(MachineFunction &F) {
|
||||
// ELFWriter Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
ELFWriter::ELFWriter(std::ostream &o, TargetMachine &tm) : O(o), TM(tm) {
|
||||
ELFWriter::ELFWriter(std::ostream &o, TargetMachine &tm)
|
||||
: MachineFunctionPass((intptr_t)&ID), O(o), TM(tm) {
|
||||
e_flags = 0; // e_flags defaults to 0, no flags.
|
||||
|
||||
is64Bit = TM.getTargetData()->getPointerSizeInBits() == 64;
|
||||
|
@ -30,6 +30,8 @@ namespace llvm {
|
||||
class ELFWriter : public MachineFunctionPass {
|
||||
friend class ELFCodeEmitter;
|
||||
public:
|
||||
static const int ID;
|
||||
|
||||
MachineCodeEmitter &getMachineCodeEmitter() const {
|
||||
return *(MachineCodeEmitter*)MCE;
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ STATISTIC(numFolded , "Number of loads/stores folded into instructions");
|
||||
STATISTIC(numAborts , "Number of times interval joining aborted");
|
||||
|
||||
namespace {
|
||||
const int LiveIntervals::ID = 0;
|
||||
RegisterPass<LiveIntervals> X("liveintervals", "Live Interval Analysis");
|
||||
|
||||
static cl::opt<bool>
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <algorithm>
|
||||
using namespace llvm;
|
||||
|
||||
const int LiveVariables::ID = 0;
|
||||
static RegisterPass<LiveVariables> X("livevars", "Live Variable Analysis");
|
||||
|
||||
void LiveVariables::VarInfo::dump() const {
|
||||
|
@ -317,7 +317,9 @@ void MachOCodeEmitter::emitJumpTables(MachineJumpTableInfo *MJTI) {
|
||||
// MachOWriter Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
MachOWriter::MachOWriter(std::ostream &o, TargetMachine &tm) : O(o), TM(tm) {
|
||||
const int MachOWriter::ID = 0;
|
||||
MachOWriter::MachOWriter(std::ostream &o, TargetMachine &tm)
|
||||
: MachineFunctionPass((intptr_t)&ID), O(o), TM(tm) {
|
||||
is64Bit = TM.getTargetData()->getPointerSizeInBits() == 64;
|
||||
isLittleEndian = TM.getTargetData()->isLittleEndian();
|
||||
|
||||
|
@ -84,6 +84,7 @@ namespace llvm {
|
||||
class MachOWriter : public MachineFunctionPass {
|
||||
friend class MachOCodeEmitter;
|
||||
public:
|
||||
static const int ID;
|
||||
MachineCodeEmitter &getMachineCodeEmitter() const {
|
||||
return *(MachineCodeEmitter*)MCE;
|
||||
}
|
||||
|
@ -44,11 +44,13 @@ void MachineFunctionPass::virtfn() {}
|
||||
|
||||
namespace {
|
||||
struct VISIBILITY_HIDDEN Printer : public MachineFunctionPass {
|
||||
static const int ID;
|
||||
|
||||
std::ostream *OS;
|
||||
const std::string Banner;
|
||||
|
||||
Printer (std::ostream *_OS, const std::string &_Banner) :
|
||||
OS (_OS), Banner (_Banner) { }
|
||||
Printer (std::ostream *_OS, const std::string &_Banner)
|
||||
: MachineFunctionPass((intptr_t)&ID), OS (_OS), Banner (_Banner) { }
|
||||
|
||||
const char *getPassName() const { return "MachineFunction Printer"; }
|
||||
|
||||
@ -62,6 +64,7 @@ namespace {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
const int Printer::ID = 0;
|
||||
}
|
||||
|
||||
/// Returns a newly-created MachineFunction Printer pass. The default output
|
||||
@ -74,6 +77,9 @@ FunctionPass *llvm::createMachineFunctionPrinterPass(std::ostream *OS,
|
||||
|
||||
namespace {
|
||||
struct VISIBILITY_HIDDEN Deleter : public MachineFunctionPass {
|
||||
static const int ID;
|
||||
Deleter() : MachineFunctionPass((intptr_t)&ID) {}
|
||||
|
||||
const char *getPassName() const { return "Machine Code Deleter"; }
|
||||
|
||||
bool runOnMachineFunction(MachineFunction &MF) {
|
||||
@ -82,6 +88,7 @@ namespace {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
const int Deleter::ID = 0;
|
||||
}
|
||||
|
||||
/// MachineCodeDeletion Pass - This pass deletes all of the machine code for
|
||||
|
@ -28,6 +28,7 @@ using namespace llvm::dwarf;
|
||||
|
||||
// Handle the Pass registration stuff necessary to use TargetData's.
|
||||
namespace {
|
||||
const int MachineModuleInfo::ID = 0;
|
||||
RegisterPass<MachineModuleInfo> X("machinemoduleinfo", "Module Information");
|
||||
}
|
||||
|
||||
@ -1462,7 +1463,8 @@ DebugScope::~DebugScope() {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
MachineModuleInfo::MachineModuleInfo()
|
||||
: DR()
|
||||
: ImmutablePass((intptr_t)&ID)
|
||||
, DR()
|
||||
, VR()
|
||||
, CompileUnits()
|
||||
, Directories()
|
||||
@ -1749,10 +1751,15 @@ Function *MachineModuleInfo::getPersonality() const {
|
||||
namespace llvm {
|
||||
|
||||
struct DebugLabelFolder : public MachineFunctionPass {
|
||||
static const int ID;
|
||||
DebugLabelFolder() : MachineFunctionPass((intptr_t)&ID) {}
|
||||
|
||||
virtual bool runOnMachineFunction(MachineFunction &MF);
|
||||
virtual const char *getPassName() const { return "Label Folder"; }
|
||||
};
|
||||
|
||||
const int DebugLabelFolder::ID = 0;
|
||||
|
||||
bool DebugLabelFolder::runOnMachineFunction(MachineFunction &MF) {
|
||||
// Get machine module info.
|
||||
MachineModuleInfo *MMI = getAnalysisToUpdate<MachineModuleInfo>();
|
||||
|
@ -33,6 +33,9 @@ STATISTIC(NumAtomic, "Number of atomic phis lowered");
|
||||
|
||||
namespace {
|
||||
struct VISIBILITY_HIDDEN PNE : public MachineFunctionPass {
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
PNE() : MachineFunctionPass((intptr_t)&ID) {}
|
||||
|
||||
bool runOnMachineFunction(MachineFunction &Fn) {
|
||||
analyzePHINodes(Fn);
|
||||
|
||||
@ -73,6 +76,7 @@ namespace {
|
||||
VRegPHIUse VRegPHIUseCount;
|
||||
};
|
||||
|
||||
const int PNE::ID = 0;
|
||||
RegisterPass<PNE> X("phi-node-elimination",
|
||||
"Eliminate PHI nodes for register allocation");
|
||||
}
|
||||
|
@ -32,6 +32,9 @@ using namespace llvm;
|
||||
|
||||
namespace {
|
||||
struct VISIBILITY_HIDDEN PEI : public MachineFunctionPass {
|
||||
static const int ID;
|
||||
PEI() : MachineFunctionPass((intptr_t)&ID) {}
|
||||
|
||||
const char *getPassName() const {
|
||||
return "Prolog/Epilog Insertion & Frame Finalization";
|
||||
}
|
||||
@ -98,6 +101,7 @@ namespace {
|
||||
void replaceFrameIndices(MachineFunction &Fn);
|
||||
void insertPrologEpilogCode(MachineFunction &Fn);
|
||||
};
|
||||
const int PEI::ID = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -48,6 +48,9 @@ namespace {
|
||||
static unsigned numIntervals = 0;
|
||||
|
||||
struct VISIBILITY_HIDDEN RA : public MachineFunctionPass {
|
||||
static const int ID;
|
||||
RA() : MachineFunctionPass((intptr_t)&ID) {}
|
||||
|
||||
typedef std::pair<LiveInterval*, LiveInterval::iterator> IntervalPtr;
|
||||
typedef std::vector<IntervalPtr> IntervalPtrs;
|
||||
private:
|
||||
@ -146,6 +149,7 @@ namespace {
|
||||
}
|
||||
}
|
||||
};
|
||||
const int RA::ID = 0;
|
||||
}
|
||||
|
||||
void RA::ComputeRelatedRegClasses() {
|
||||
|
@ -43,6 +43,10 @@ namespace {
|
||||
|
||||
|
||||
class VISIBILITY_HIDDEN RA : public MachineFunctionPass {
|
||||
public:
|
||||
static const int ID;
|
||||
RA() : MachineFunctionPass((intptr_t)&ID) {}
|
||||
private:
|
||||
const TargetMachine *TM;
|
||||
MachineFunction *MF;
|
||||
const MRegisterInfo *RegInfo;
|
||||
@ -224,6 +228,7 @@ namespace {
|
||||
void reloadPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator &I,
|
||||
unsigned PhysReg);
|
||||
};
|
||||
const int RA::ID = 0;
|
||||
}
|
||||
|
||||
/// getStackSpaceFor - This allocates space for the specified virtual register
|
||||
|
@ -38,6 +38,10 @@ namespace {
|
||||
createSimpleRegisterAllocator);
|
||||
|
||||
class VISIBILITY_HIDDEN RegAllocSimple : public MachineFunctionPass {
|
||||
public:
|
||||
static const int ID;
|
||||
RegAllocSimple() : MachineFunctionPass((intptr_t)&ID) {}
|
||||
private:
|
||||
MachineFunction *MF;
|
||||
const TargetMachine *TM;
|
||||
const MRegisterInfo *RegInfo;
|
||||
@ -90,7 +94,7 @@ namespace {
|
||||
void spillVirtReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
|
||||
unsigned VirtReg, unsigned PhysReg);
|
||||
};
|
||||
|
||||
const int RegAllocSimple::ID = 0;
|
||||
}
|
||||
|
||||
/// getStackSpaceFor - This allocates space for the specified virtual
|
||||
|
@ -5011,3 +5011,5 @@ SelectInlineAsmMemoryOperands(std::vector<SDOperand> &Ops, SelectionDAG &DAG) {
|
||||
if (e != InOps.size())
|
||||
Ops.push_back(InOps.back());
|
||||
}
|
||||
|
||||
const int SelectionDAGISel::ID = 0;
|
||||
|
@ -50,12 +50,16 @@ STATISTIC(NumConvertedTo3Addr, "Number of instructions promoted to 3-address");
|
||||
namespace {
|
||||
struct VISIBILITY_HIDDEN TwoAddressInstructionPass
|
||||
: public MachineFunctionPass {
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
TwoAddressInstructionPass() : MachineFunctionPass((intptr_t)&ID) {}
|
||||
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
|
||||
|
||||
/// runOnMachineFunction - pass entry point
|
||||
bool runOnMachineFunction(MachineFunction&);
|
||||
};
|
||||
|
||||
const int TwoAddressInstructionPass::ID = 0;
|
||||
RegisterPass<TwoAddressInstructionPass>
|
||||
X("twoaddressinstruction", "Two-Address instruction pass");
|
||||
}
|
||||
|
@ -34,7 +34,11 @@ using namespace llvm;
|
||||
namespace {
|
||||
class VISIBILITY_HIDDEN UnreachableBlockElim : public FunctionPass {
|
||||
virtual bool runOnFunction(Function &F);
|
||||
public:
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
UnreachableBlockElim() : FunctionPass((intptr_t)&ID) {}
|
||||
};
|
||||
const int UnreachableBlockElim::ID = 0;
|
||||
RegisterPass<UnreachableBlockElim>
|
||||
X("unreachableblockelim", "Remove unreachable blocks from the CFG");
|
||||
}
|
||||
|
@ -128,6 +128,9 @@ namespace {
|
||||
ARMFunctionInfo *AFI;
|
||||
bool isThumb;
|
||||
public:
|
||||
static const int ID;
|
||||
ARMConstantIslands() : MachineFunctionPass((intptr_t)&ID) {}
|
||||
|
||||
virtual bool runOnMachineFunction(MachineFunction &Fn);
|
||||
|
||||
virtual const char *getPassName() const {
|
||||
@ -171,6 +174,7 @@ namespace {
|
||||
void dumpBBs();
|
||||
void verify(MachineFunction &Fn);
|
||||
};
|
||||
const int ARMConstantIslands::ID = 0;
|
||||
}
|
||||
|
||||
/// verify - check BBOffsets, BBSizes, alignment of islands
|
||||
|
@ -38,6 +38,9 @@ STATISTIC(NumFSTMGened, "Number of fstm instructions generated");
|
||||
|
||||
namespace {
|
||||
struct VISIBILITY_HIDDEN ARMLoadStoreOpt : public MachineFunctionPass {
|
||||
static const int ID;
|
||||
ARMLoadStoreOpt() : MachineFunctionPass((intptr_t)&ID) {}
|
||||
|
||||
const TargetInstrInfo *TII;
|
||||
const MRegisterInfo *MRI;
|
||||
ARMFunctionInfo *AFI;
|
||||
@ -70,6 +73,7 @@ namespace {
|
||||
bool LoadStoreMultipleOpti(MachineBasicBlock &MBB);
|
||||
bool MergeReturnIntoLDM(MachineBasicBlock &MBB);
|
||||
};
|
||||
const int ARMLoadStoreOpt::ID = 0;
|
||||
}
|
||||
|
||||
/// createARMLoadStoreOptimizationPass - returns an instance of the load / store
|
||||
|
@ -22,6 +22,8 @@ using namespace llvm;
|
||||
|
||||
namespace {
|
||||
struct VISIBILITY_HIDDEN AlphaBSel : public MachineFunctionPass {
|
||||
static const int ID;
|
||||
AlphaBSel() : MachineFunctionPass((intptr_t)&ID) {}
|
||||
|
||||
virtual bool runOnMachineFunction(MachineFunction &Fn);
|
||||
|
||||
@ -29,6 +31,7 @@ namespace {
|
||||
return "Alpha Branch Selection";
|
||||
}
|
||||
};
|
||||
const int AlphaBSel::ID = 0;
|
||||
}
|
||||
|
||||
/// createAlphaBranchSelectionPass - returns an instance of the Branch Selection
|
||||
|
@ -36,11 +36,12 @@ namespace {
|
||||
int getMachineOpValue(MachineInstr &MI, MachineOperand &MO);
|
||||
|
||||
public:
|
||||
static const int ID;
|
||||
explicit AlphaCodeEmitter(TargetMachine &tm, MachineCodeEmitter &mce)
|
||||
: II(0), TM(tm), MCE(mce) {}
|
||||
: MachineFunctionPass((intptr_t)&ID), II(0), TM(tm), MCE(mce) {}
|
||||
AlphaCodeEmitter(TargetMachine &tm, MachineCodeEmitter &mce,
|
||||
const AlphaInstrInfo& ii)
|
||||
: II(&ii), TM(tm), MCE(mce) {}
|
||||
: MachineFunctionPass((intptr_t)&ID), II(&ii), TM(tm), MCE(mce) {}
|
||||
|
||||
bool runOnMachineFunction(MachineFunction &MF);
|
||||
|
||||
@ -60,6 +61,7 @@ namespace {
|
||||
void emitBasicBlock(MachineBasicBlock &MBB);
|
||||
|
||||
};
|
||||
const int AlphaCodeEmitter::ID = 0;
|
||||
}
|
||||
|
||||
/// createAlphaCodeEmitterPass - Return a pass that emits the collected Alpha code
|
||||
|
@ -37,7 +37,9 @@ namespace {
|
||||
///
|
||||
AlphaTargetMachine &TM;
|
||||
|
||||
AlphaLLRPPass(AlphaTargetMachine &tm) : TM(tm) { }
|
||||
static const int ID;
|
||||
AlphaLLRPPass(AlphaTargetMachine &tm)
|
||||
: MachineFunctionPass((intptr_t)&ID), TM(tm) { }
|
||||
|
||||
virtual const char *getPassName() const {
|
||||
return "Alpha NOP inserter";
|
||||
@ -152,6 +154,7 @@ namespace {
|
||||
return Changed;
|
||||
}
|
||||
};
|
||||
const int AlphaLLRPPass::ID = 0;
|
||||
} // end of anonymous namespace
|
||||
|
||||
FunctionPass *llvm::createAlphaLLRPPass(AlphaTargetMachine &tm) {
|
||||
|
@ -56,6 +56,10 @@ namespace {
|
||||
/// external functions with the same name.
|
||||
///
|
||||
class CBackendNameAllUsedStructsAndMergeFunctions : public ModulePass {
|
||||
public:
|
||||
static const int ID;
|
||||
CBackendNameAllUsedStructsAndMergeFunctions()
|
||||
: ModulePass((intptr_t)&ID) {}
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.addRequired<FindUsedTypes>();
|
||||
}
|
||||
@ -67,6 +71,8 @@ namespace {
|
||||
virtual bool runOnModule(Module &M);
|
||||
};
|
||||
|
||||
const int CBackendNameAllUsedStructsAndMergeFunctions::ID = 0;
|
||||
|
||||
/// CWriter - This class is the main chunk of code that converts an LLVM
|
||||
/// module to a C translation unit.
|
||||
class CWriter : public FunctionPass, public InstVisitor<CWriter> {
|
||||
@ -82,8 +88,10 @@ namespace {
|
||||
std::set<Function*> intrinsicPrototypesAlreadyGenerated;
|
||||
|
||||
public:
|
||||
CWriter(std::ostream &o) : Out(o), IL(0), Mang(0), LI(0), TheModule(0),
|
||||
TAsm(0), TD(0) {}
|
||||
static const int ID;
|
||||
CWriter(std::ostream &o)
|
||||
: FunctionPass((intptr_t)&ID), Out(o), IL(0), Mang(0), LI(0),
|
||||
TheModule(0), TAsm(0), TD(0) {}
|
||||
|
||||
virtual const char *getPassName() const { return "C backend"; }
|
||||
|
||||
@ -256,6 +264,8 @@ namespace {
|
||||
};
|
||||
}
|
||||
|
||||
const int CWriter::ID = 0;
|
||||
|
||||
/// This method inserts names for any unnamed structure types that are used by
|
||||
/// the program, and removes names from structure types that are not used by the
|
||||
/// program.
|
||||
|
@ -36,12 +36,14 @@ STATISTIC(StopBitsAdded, "Number of stop bits added");
|
||||
|
||||
namespace {
|
||||
struct IA64BundlingPass : public MachineFunctionPass {
|
||||
static const int ID;
|
||||
/// Target machine description which we query for reg. names, data
|
||||
/// layout, etc.
|
||||
///
|
||||
IA64TargetMachine &TM;
|
||||
|
||||
IA64BundlingPass(IA64TargetMachine &tm) : TM(tm) { }
|
||||
IA64BundlingPass(IA64TargetMachine &tm)
|
||||
: MachineFunctionPass((intptr_t)&ID), TM(tm) { }
|
||||
|
||||
virtual const char *getPassName() const {
|
||||
return "IA64 (Itanium) Bundling Pass";
|
||||
@ -61,6 +63,7 @@ namespace {
|
||||
// 'fallthrough' code
|
||||
std::set<unsigned> PendingRegWrites;
|
||||
};
|
||||
const int IA64BundlingPass::ID = 0;
|
||||
} // end of anonymous namespace
|
||||
|
||||
/// createIA64BundlingPass - Returns a pass that adds STOP (;;) instructions
|
||||
|
@ -80,6 +80,8 @@ bool MSILModule::runOnModule(Module &M) {
|
||||
return Changed;
|
||||
}
|
||||
|
||||
const int MSILModule::ID = 0;
|
||||
const int MSILWriter::ID = 0;
|
||||
|
||||
bool MSILWriter::runOnFunction(Function &F) {
|
||||
if (F.isDeclaration()) return false;
|
||||
|
@ -37,9 +37,10 @@ namespace {
|
||||
const TargetData*& TD;
|
||||
|
||||
public:
|
||||
static const int ID;
|
||||
MSILModule(const std::set<const Type *>*& _UsedTypes,
|
||||
const TargetData*& _TD)
|
||||
: UsedTypes(_UsedTypes), TD(_TD) {}
|
||||
: ModulePass((intptr_t)&ID), UsedTypes(_UsedTypes), TD(_TD) {}
|
||||
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.addRequired<FindUsedTypes>();
|
||||
@ -82,8 +83,8 @@ namespace {
|
||||
std::map<const GlobalVariable*,std::vector<StaticInitializer> >
|
||||
StaticInitList;
|
||||
const std::set<const Type *>* UsedTypes;
|
||||
|
||||
MSILWriter(std::ostream &o) : Out(o) {
|
||||
static const int ID;
|
||||
MSILWriter(std::ostream &o) : FunctionPass((intptr_t)&ID), Out(o) {
|
||||
UniqID = 0;
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,9 @@ STATISTIC(NumExpanded, "Number of branches expanded to long format");
|
||||
|
||||
namespace {
|
||||
struct VISIBILITY_HIDDEN PPCBSel : public MachineFunctionPass {
|
||||
static const int ID;
|
||||
PPCBSel() : MachineFunctionPass((intptr_t)&ID) {}
|
||||
|
||||
/// BlockSizes - The sizes of the basic blocks in the function.
|
||||
std::vector<unsigned> BlockSizes;
|
||||
|
||||
@ -41,6 +44,7 @@ namespace {
|
||||
return "PowerPC Branch Selector";
|
||||
}
|
||||
};
|
||||
const int PPCBSel::ID = 0;
|
||||
}
|
||||
|
||||
/// createPPCBranchSelectionPass - returns an instance of the Branch Selection
|
||||
|
@ -40,8 +40,9 @@ namespace {
|
||||
int getMachineOpValue(MachineInstr &MI, MachineOperand &MO);
|
||||
|
||||
public:
|
||||
static const int ID;
|
||||
PPCCodeEmitter(TargetMachine &T, MachineCodeEmitter &M)
|
||||
: TM(T), MCE(M) {}
|
||||
: MachineFunctionPass((intptr_t)&ID), TM(T), MCE(M) {}
|
||||
|
||||
const char *getPassName() const { return "PowerPC Machine Code Emitter"; }
|
||||
|
||||
@ -63,6 +64,7 @@ namespace {
|
||||
///
|
||||
unsigned getBinaryCodeForInstr(MachineInstr &MI);
|
||||
};
|
||||
const int PPCCodeEmitter::ID = 0;
|
||||
}
|
||||
|
||||
/// createPPCCodeEmitterPass - Return a pass that emits the collected PPC code
|
||||
|
@ -30,7 +30,9 @@ namespace {
|
||||
TargetMachine &TM;
|
||||
const TargetInstrInfo *TII;
|
||||
|
||||
Filler(TargetMachine &tm) : TM(tm), TII(tm.getInstrInfo()) { }
|
||||
static const int ID;
|
||||
Filler(TargetMachine &tm)
|
||||
: MachineFunctionPass((intptr_t)&ID), TM(tm), TII(tm.getInstrInfo()) { }
|
||||
|
||||
virtual const char *getPassName() const {
|
||||
return "SPARC Delay Slot Filler";
|
||||
@ -46,6 +48,7 @@ namespace {
|
||||
}
|
||||
|
||||
};
|
||||
const int Filler::ID = 0;
|
||||
} // end of anonymous namespace
|
||||
|
||||
/// createSparcDelaySlotFillerPass - Returns a pass that fills in delay
|
||||
|
@ -31,8 +31,10 @@ namespace {
|
||||
/// layout, etc.
|
||||
///
|
||||
TargetMachine &TM;
|
||||
|
||||
FPMover(TargetMachine &tm) : TM(tm) { }
|
||||
|
||||
static const int ID;
|
||||
FPMover(TargetMachine &tm)
|
||||
: MachineFunctionPass((intptr_t)&ID), TM(tm) { }
|
||||
|
||||
virtual const char *getPassName() const {
|
||||
return "Sparc Double-FP Move Fixer";
|
||||
@ -41,6 +43,7 @@ namespace {
|
||||
bool runOnMachineBasicBlock(MachineBasicBlock &MBB);
|
||||
bool runOnMachineFunction(MachineFunction &F);
|
||||
};
|
||||
const int FPMover::ID = 0;
|
||||
} // end of anonymous namespace
|
||||
|
||||
/// createSparcFPMoverPass - Returns a pass that turns FpMOVD
|
||||
|
@ -33,6 +33,7 @@ using namespace llvm;
|
||||
// Handle the Pass registration stuff necessary to use TargetData's.
|
||||
namespace {
|
||||
// Register the default SparcV9 implementation...
|
||||
const int TargetData::ID = 0;
|
||||
RegisterPass<TargetData> X("targetdata", "Target Data Layout");
|
||||
}
|
||||
|
||||
@ -221,7 +222,8 @@ void TargetData::init(const std::string &TargetDescription) {
|
||||
}
|
||||
}
|
||||
|
||||
TargetData::TargetData(const Module *M) {
|
||||
TargetData::TargetData(const Module *M)
|
||||
: ImmutablePass((intptr_t)&ID) {
|
||||
init(M->getDataLayout());
|
||||
}
|
||||
|
||||
|
@ -39,11 +39,14 @@ namespace {
|
||||
MachineCodeEmitter &MCE;
|
||||
bool Is64BitMode;
|
||||
public:
|
||||
static const int ID;
|
||||
explicit Emitter(TargetMachine &tm, MachineCodeEmitter &mce)
|
||||
: II(0), TD(0), TM(tm), MCE(mce), Is64BitMode(false) {}
|
||||
: MachineFunctionPass((intptr_t)&ID), II(0), TD(0), TM(tm),
|
||||
MCE(mce), Is64BitMode(false) {}
|
||||
Emitter(TargetMachine &tm, MachineCodeEmitter &mce,
|
||||
const X86InstrInfo &ii, const TargetData &td, bool is64)
|
||||
: II(&ii), TD(&td), TM(tm), MCE(mce), Is64BitMode(is64) {}
|
||||
: MachineFunctionPass((intptr_t)&ID), II(&ii), TD(&td), TM(tm),
|
||||
MCE(mce), Is64BitMode(is64) {}
|
||||
|
||||
bool runOnMachineFunction(MachineFunction &MF);
|
||||
|
||||
@ -79,6 +82,7 @@ namespace {
|
||||
bool isX86_64ExtendedReg(const MachineOperand &MO);
|
||||
unsigned determineREX(const MachineInstr &MI);
|
||||
};
|
||||
const int Emitter::ID = 0;
|
||||
}
|
||||
|
||||
/// createX86CodeEmitterPass - Return a pass that emits the collected X86 code
|
||||
|
@ -52,6 +52,9 @@ STATISTIC(NumFP , "Number of floating point instructions");
|
||||
|
||||
namespace {
|
||||
struct VISIBILITY_HIDDEN FPS : public MachineFunctionPass {
|
||||
static const int ID;
|
||||
FPS() : MachineFunctionPass((intptr_t)&ID) {}
|
||||
|
||||
virtual bool runOnMachineFunction(MachineFunction &MF);
|
||||
|
||||
virtual const char *getPassName() const { return "X86 FP Stackifier"; }
|
||||
@ -151,6 +154,7 @@ namespace {
|
||||
void handleCondMovFP(MachineBasicBlock::iterator &I);
|
||||
void handleSpecialFP(MachineBasicBlock::iterator &I);
|
||||
};
|
||||
const int FPS::ID = 0;
|
||||
}
|
||||
|
||||
FunctionPass *llvm::createX86FloatingPointStackifierPass() { return new FPS(); }
|
||||
|
@ -25,6 +25,9 @@ STATISTIC(HelloCounter, "Counts number of functions greeted");
|
||||
namespace {
|
||||
// Hello - The first implementation, without getAnalysisUsage.
|
||||
struct Hello : public FunctionPass {
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
Hello() : FunctionPass((intptr_t)&ID) {}
|
||||
|
||||
virtual bool runOnFunction(Function &F) {
|
||||
HelloCounter++;
|
||||
std::string fname = F.getName();
|
||||
@ -33,10 +36,15 @@ namespace {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
const int Hello::ID = 0;
|
||||
RegisterPass<Hello> X("hello", "Hello World Pass");
|
||||
|
||||
// Hello2 - The second implementation with getAnalysisUsage implemented.
|
||||
struct Hello2 : public FunctionPass {
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
Hello2() : FunctionPass((intptr_t)&ID) {}
|
||||
|
||||
virtual bool runOnFunction(Function &F) {
|
||||
HelloCounter++;
|
||||
std::string fname = F.getName();
|
||||
@ -50,6 +58,7 @@ namespace {
|
||||
AU.setPreservesAll();
|
||||
};
|
||||
};
|
||||
const int Hello2::ID = 0;
|
||||
RegisterPass<Hello2> Y("hello2",
|
||||
"Hello World Pass (with getAnalysisUsage implemented)");
|
||||
}
|
||||
|
@ -63,12 +63,16 @@ namespace {
|
||||
}
|
||||
|
||||
virtual bool runOnSCC(const std::vector<CallGraphNode *> &SCC);
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
ArgPromotion() : CallGraphSCCPass((intptr_t)&ID) {}
|
||||
|
||||
private:
|
||||
bool PromoteArguments(CallGraphNode *CGN);
|
||||
bool isSafeToPromoteArgument(Argument *Arg) const;
|
||||
Function *DoPromotion(Function *F, std::vector<Argument*> &ArgsToPromote);
|
||||
};
|
||||
|
||||
const int ArgPromotion::ID = 0;
|
||||
RegisterPass<ArgPromotion> X("argpromotion",
|
||||
"Promote 'by reference' arguments to scalars");
|
||||
}
|
||||
|
@ -29,12 +29,16 @@ STATISTIC(NumMerged, "Number of global constants merged");
|
||||
|
||||
namespace {
|
||||
struct VISIBILITY_HIDDEN ConstantMerge : public ModulePass {
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
ConstantMerge() : ModulePass((intptr_t)&ID) {}
|
||||
|
||||
// run - For this pass, process all of the globals in the module,
|
||||
// eliminating duplicate constants.
|
||||
//
|
||||
bool runOnModule(Module &M);
|
||||
};
|
||||
|
||||
const int ConstantMerge::ID = 0;
|
||||
RegisterPass<ConstantMerge>X("constmerge","Merge Duplicate Global Constants");
|
||||
}
|
||||
|
||||
|
@ -76,6 +76,8 @@ namespace {
|
||||
std::multimap<Function*, CallSite> CallSites;
|
||||
|
||||
public:
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
DAE() : ModulePass((intptr_t)&ID) {}
|
||||
bool runOnModule(Module &M);
|
||||
|
||||
virtual bool ShouldHackArguments() const { return false; }
|
||||
@ -93,14 +95,17 @@ namespace {
|
||||
|
||||
void RemoveDeadArgumentsFromFunction(Function *F);
|
||||
};
|
||||
const int DAE::ID = 0;
|
||||
RegisterPass<DAE> X("deadargelim", "Dead Argument Elimination");
|
||||
|
||||
/// DAH - DeadArgumentHacking pass - Same as dead argument elimination, but
|
||||
/// deletes arguments to functions which are external. This is only for use
|
||||
/// by bugpoint.
|
||||
struct DAH : public DAE {
|
||||
static const int ID;
|
||||
virtual bool ShouldHackArguments() const { return true; }
|
||||
};
|
||||
const int DAH::ID = 0;
|
||||
RegisterPass<DAH> Y("deadarghaX0r",
|
||||
"Dead Argument Hacking (BUGPOINT USE ONLY; DO NOT USE)");
|
||||
}
|
||||
|
@ -26,6 +26,9 @@ STATISTIC(NumKilled, "Number of unused typenames removed from symtab");
|
||||
|
||||
namespace {
|
||||
struct VISIBILITY_HIDDEN DTE : public ModulePass {
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
DTE() : ModulePass((intptr_t)&ID) {}
|
||||
|
||||
// doPassInitialization - For this pass, it removes global symbol table
|
||||
// entries for primitive types. These are never used for linking in GCC and
|
||||
// they make the output uglier to look at, so we nuke them.
|
||||
@ -40,6 +43,7 @@ namespace {
|
||||
AU.addRequired<FindUsedTypes>();
|
||||
}
|
||||
};
|
||||
const int DTE::ID = 0;
|
||||
RegisterPass<DTE> X("deadtypeelim", "Dead Type Elimination");
|
||||
}
|
||||
|
||||
|
@ -25,13 +25,16 @@ namespace {
|
||||
bool deleteFunc;
|
||||
bool reLink;
|
||||
public:
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
|
||||
/// FunctionExtractorPass - If deleteFn is true, this pass deletes as the
|
||||
/// specified function. Otherwise, it deletes as much of the module as
|
||||
/// possible, except for the function specified.
|
||||
///
|
||||
FunctionExtractorPass(Function *F = 0, bool deleteFn = true,
|
||||
bool relinkCallees = false)
|
||||
: Named(F), deleteFunc(deleteFn), reLink(relinkCallees) {}
|
||||
: ModulePass((intptr_t)&ID), Named(F), deleteFunc(deleteFn),
|
||||
reLink(relinkCallees) {}
|
||||
|
||||
bool runOnModule(Module &M) {
|
||||
if (Named == 0) {
|
||||
@ -131,6 +134,7 @@ namespace {
|
||||
}
|
||||
};
|
||||
|
||||
const int FunctionExtractorPass::ID = 0;
|
||||
RegisterPass<FunctionExtractorPass> X("extract", "Function Extractor");
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,9 @@ STATISTIC(NumVariables, "Number of global variables removed");
|
||||
|
||||
namespace {
|
||||
struct VISIBILITY_HIDDEN GlobalDCE : public ModulePass {
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
GlobalDCE() : ModulePass((intptr_t)&ID) {}
|
||||
|
||||
// run - Do the GlobalDCE pass on the specified module, optionally updating
|
||||
// the specified callgraph to reflect the changes.
|
||||
//
|
||||
@ -46,6 +49,7 @@ namespace {
|
||||
bool SafeToDestroyConstant(Constant* C);
|
||||
bool RemoveUnusedGlobalValue(GlobalValue &GV);
|
||||
};
|
||||
const int GlobalDCE::ID = 0;
|
||||
RegisterPass<GlobalDCE> X("globaldce", "Dead Global Elimination");
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,8 @@ namespace {
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.addRequired<TargetData>();
|
||||
}
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
GlobalOpt() : ModulePass((intptr_t)&ID) {}
|
||||
|
||||
bool runOnModule(Module &M);
|
||||
|
||||
@ -61,6 +63,7 @@ namespace {
|
||||
bool ProcessInternalGlobal(GlobalVariable *GV,Module::global_iterator &GVI);
|
||||
};
|
||||
|
||||
const int GlobalOpt::ID = 0;
|
||||
RegisterPass<GlobalOpt> X("globalopt", "Global Variable Optimizer");
|
||||
}
|
||||
|
||||
|
@ -33,11 +33,15 @@ namespace {
|
||||
/// IPCP - The interprocedural constant propagation pass
|
||||
///
|
||||
struct VISIBILITY_HIDDEN IPCP : public ModulePass {
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
IPCP() : ModulePass((intptr_t)&ID) {}
|
||||
|
||||
bool runOnModule(Module &M);
|
||||
private:
|
||||
bool PropagateConstantsIntoArguments(Function &F);
|
||||
bool PropagateConstantReturn(Function &F);
|
||||
};
|
||||
const int IPCP::ID = 0;
|
||||
RegisterPass<IPCP> X("ipconstprop", "Interprocedural constant propagation");
|
||||
}
|
||||
|
||||
|
@ -32,8 +32,12 @@ STATISTIC(NumBounce , "Number of bounce functions created");
|
||||
namespace {
|
||||
class VISIBILITY_HIDDEN IndMemRemPass : public ModulePass {
|
||||
public:
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
IndMemRemPass() : ModulePass((intptr_t)&ID) {}
|
||||
|
||||
virtual bool runOnModule(Module &M);
|
||||
};
|
||||
const int IndMemRemPass::ID = 0;
|
||||
RegisterPass<IndMemRemPass> X("indmemrem","Indirect Malloc and Free Removal");
|
||||
} // end anonymous namespace
|
||||
|
||||
|
@ -54,8 +54,10 @@ namespace {
|
||||
class VISIBILITY_HIDDEN SimpleInliner : public Inliner {
|
||||
std::map<const Function*, FunctionInfo> CachedFunctionInfo;
|
||||
public:
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
int getInlineCost(CallSite CS);
|
||||
};
|
||||
const int SimpleInliner::ID = 0;
|
||||
RegisterPass<SimpleInliner> X("inline", "Function Integration/Inlining");
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,9 @@ namespace {
|
||||
cl::desc("Control the amount of inlining to perform (default = 200)"));
|
||||
}
|
||||
|
||||
Inliner::Inliner() : InlineThreshold(InlineLimit) {}
|
||||
const int Inliner::ID = 0;
|
||||
Inliner::Inliner()
|
||||
: CallGraphSCCPass((intptr_t)&ID), InlineThreshold(InlineLimit) {}
|
||||
|
||||
/// getAnalysisUsage - For this class, we declare that we require and preserve
|
||||
/// the call graph. If the derived class implements this method, it should
|
||||
|
@ -27,6 +27,7 @@ namespace llvm {
|
||||
/// perform the inlining operations that does not depend on the policy.
|
||||
///
|
||||
struct Inliner : public CallGraphSCCPass {
|
||||
static const int ID;
|
||||
Inliner();
|
||||
|
||||
/// getAnalysisUsage - For this class, we declare that we require and preserve
|
||||
|
@ -46,16 +46,18 @@ namespace {
|
||||
std::set<std::string> ExternalNames;
|
||||
bool DontInternalize;
|
||||
public:
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
InternalizePass(bool InternalizeEverything = true);
|
||||
InternalizePass(const std::vector <const char *>& exportList);
|
||||
void LoadFile(const char *Filename);
|
||||
virtual bool runOnModule(Module &M);
|
||||
};
|
||||
const int InternalizePass::ID = 0;
|
||||
RegisterPass<InternalizePass> X("internalize", "Internalize Global Symbols");
|
||||
} // end anonymous namespace
|
||||
|
||||
InternalizePass::InternalizePass(bool InternalizeEverything)
|
||||
: DontInternalize(false){
|
||||
: ModulePass((intptr_t)&ID), DontInternalize(false){
|
||||
if (!APIFile.empty()) // If a filename is specified, use it
|
||||
LoadFile(APIFile.c_str());
|
||||
else if (!APIList.empty()) // Else, if a list is specified, use it.
|
||||
@ -66,7 +68,7 @@ InternalizePass::InternalizePass(bool InternalizeEverything)
|
||||
}
|
||||
|
||||
InternalizePass::InternalizePass(const std::vector<const char *>&exportList)
|
||||
: DontInternalize(false){
|
||||
: ModulePass((intptr_t)&ID), DontInternalize(false){
|
||||
for(std::vector<const char *>::const_iterator itr = exportList.begin();
|
||||
itr != exportList.end(); itr++) {
|
||||
ExternalNames.insert(*itr);
|
||||
|
@ -34,9 +34,11 @@ namespace {
|
||||
// Module passes to require FunctionPasses, so we can't get loop info if we're
|
||||
// not a function pass.
|
||||
struct VISIBILITY_HIDDEN LoopExtractor : public FunctionPass {
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
unsigned NumLoops;
|
||||
|
||||
LoopExtractor(unsigned numLoops = ~0) : NumLoops(numLoops) {}
|
||||
LoopExtractor(unsigned numLoops = ~0)
|
||||
: FunctionPass((intptr_t)&ID), NumLoops(numLoops) {}
|
||||
|
||||
virtual bool runOnFunction(Function &F);
|
||||
|
||||
@ -49,14 +51,17 @@ namespace {
|
||||
}
|
||||
};
|
||||
|
||||
const int LoopExtractor::ID = 0;
|
||||
RegisterPass<LoopExtractor>
|
||||
X("loop-extract", "Extract loops into new functions");
|
||||
|
||||
/// SingleLoopExtractor - For bugpoint.
|
||||
struct SingleLoopExtractor : public LoopExtractor {
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
SingleLoopExtractor() : LoopExtractor(1) {}
|
||||
};
|
||||
|
||||
const int SingleLoopExtractor::ID = 0;
|
||||
RegisterPass<SingleLoopExtractor>
|
||||
Y("loop-extract-single", "Extract at most one loop into a new function");
|
||||
} // End anonymous namespace
|
||||
@ -147,11 +152,15 @@ namespace {
|
||||
class BlockExtractorPass : public ModulePass {
|
||||
std::vector<BasicBlock*> BlocksToNotExtract;
|
||||
public:
|
||||
BlockExtractorPass(std::vector<BasicBlock*> &B) : BlocksToNotExtract(B) {}
|
||||
BlockExtractorPass() {}
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
BlockExtractorPass(std::vector<BasicBlock*> &B)
|
||||
: ModulePass((intptr_t)&ID), BlocksToNotExtract(B) {}
|
||||
BlockExtractorPass() : ModulePass((intptr_t)&ID) {}
|
||||
|
||||
bool runOnModule(Module &M);
|
||||
};
|
||||
|
||||
const int BlockExtractorPass::ID = 0;
|
||||
RegisterPass<BlockExtractorPass>
|
||||
XX("extract-blocks", "Extract Basic Blocks From Module (for bugpoint use)");
|
||||
}
|
||||
|
@ -109,6 +109,9 @@ namespace {
|
||||
|
||||
bool IsTransformableFunction(const std::string& Name);
|
||||
public:
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
LowerSetJmp() : ModulePass((intptr_t)&ID) {}
|
||||
|
||||
void visitCallInst(CallInst& CI);
|
||||
void visitInvokeInst(InvokeInst& II);
|
||||
void visitReturnInst(ReturnInst& RI);
|
||||
@ -118,6 +121,7 @@ namespace {
|
||||
bool doInitialization(Module& M);
|
||||
};
|
||||
|
||||
const int LowerSetJmp::ID = 0;
|
||||
RegisterPass<LowerSetJmp> X("lowersetjmp", "Lower Set Jump");
|
||||
} // end anonymous namespace
|
||||
|
||||
|
@ -35,6 +35,9 @@ STATISTIC(NumUnreach, "Number of noreturn calls optimized");
|
||||
|
||||
namespace {
|
||||
struct VISIBILITY_HIDDEN PruneEH : public CallGraphSCCPass {
|
||||
static const int ID; // Pass identifcation, replacement for typeid
|
||||
PruneEH() : CallGraphSCCPass((intptr_t)&ID) {}
|
||||
|
||||
/// DoesNotUnwind - This set contains all of the functions which we have
|
||||
/// determined cannot unwind.
|
||||
std::set<CallGraphNode*> DoesNotUnwind;
|
||||
@ -49,6 +52,8 @@ namespace {
|
||||
bool SimplifyFunction(Function *F);
|
||||
void DeleteBasicBlock(BasicBlock *BB);
|
||||
};
|
||||
|
||||
const int PruneEH::ID = 0;
|
||||
RegisterPass<PruneEH> X("prune-eh", "Remove unused exception handling info");
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user