mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 22:24:07 +00:00
Rename Method to Function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1957 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
#include "Support/GraphTraits.h"
|
#include "Support/GraphTraits.h"
|
||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
class Method;
|
class Function;
|
||||||
class Module;
|
class Module;
|
||||||
class CallGraphNode;
|
class CallGraphNode;
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ class CallGraphNode;
|
|||||||
class CallGraph : public Pass {
|
class CallGraph : public Pass {
|
||||||
Module *Mod; // The module this call graph represents
|
Module *Mod; // The module this call graph represents
|
||||||
|
|
||||||
typedef std::map<const Method *, CallGraphNode *> MethodMapTy;
|
typedef std::map<const Function *, CallGraphNode *> MethodMapTy;
|
||||||
MethodMapTy MethodMap; // Map from a method to its node
|
MethodMapTy MethodMap; // Map from a method to its node
|
||||||
|
|
||||||
// Root is root of the call graph, or the external node if a 'main' function
|
// Root is root of the call graph, or the external node if a 'main' function
|
||||||
@ -77,13 +77,13 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// Subscripting operators, return the call graph node for the provided method
|
// Subscripting operators, return the call graph node for the provided method
|
||||||
inline const CallGraphNode *operator[](const Method *M) const {
|
inline const CallGraphNode *operator[](const Function *F) const {
|
||||||
const_iterator I = MethodMap.find(M);
|
const_iterator I = MethodMap.find(F);
|
||||||
assert(I != MethodMap.end() && "Method not in callgraph!");
|
assert(I != MethodMap.end() && "Method not in callgraph!");
|
||||||
return I->second;
|
return I->second;
|
||||||
}
|
}
|
||||||
inline CallGraphNode *operator[](const Method *M) {
|
inline CallGraphNode *operator[](const Function *F) {
|
||||||
const_iterator I = MethodMap.find(M);
|
const_iterator I = MethodMap.find(F);
|
||||||
assert(I != MethodMap.end() && "Method not in callgraph!");
|
assert(I != MethodMap.end() && "Method not in callgraph!");
|
||||||
return I->second;
|
return I->second;
|
||||||
}
|
}
|
||||||
@ -92,7 +92,7 @@ public:
|
|||||||
// Methods to keep a call graph up to date with a method that has been
|
// Methods to keep a call graph up to date with a method that has been
|
||||||
// modified
|
// modified
|
||||||
//
|
//
|
||||||
void addMethodToModule(Method *Meth);
|
void addMethodToModule(Function *Meth);
|
||||||
|
|
||||||
|
|
||||||
// removeMethodFromModule - Unlink the method from this module, returning it.
|
// removeMethodFromModule - Unlink the method from this module, returning it.
|
||||||
@ -101,8 +101,8 @@ public:
|
|||||||
// methods (ie, there are no edges in it's CGN). The easiest way to do this
|
// methods (ie, there are no edges in it's CGN). The easiest way to do this
|
||||||
// is to dropAllReferences before calling this.
|
// is to dropAllReferences before calling this.
|
||||||
//
|
//
|
||||||
Method *removeMethodFromModule(CallGraphNode *CGN);
|
Function *removeMethodFromModule(CallGraphNode *CGN);
|
||||||
Method *removeMethodFromModule(Method *Meth) {
|
Function *removeMethodFromModule(Function *Meth) {
|
||||||
return removeMethodFromModule((*this)[Meth]);
|
return removeMethodFromModule((*this)[Meth]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,15 +135,15 @@ private:
|
|||||||
// Implementation of CallGraph construction
|
// Implementation of CallGraph construction
|
||||||
//
|
//
|
||||||
|
|
||||||
// getNodeFor - Return the node for the specified method or create one if it
|
// getNodeFor - Return the node for the specified function or create one if it
|
||||||
// does not already exist.
|
// does not already exist.
|
||||||
//
|
//
|
||||||
CallGraphNode *getNodeFor(Method *M);
|
CallGraphNode *getNodeFor(Function *F);
|
||||||
|
|
||||||
// addToCallGraph - Add a method to the call graph, and link the node to all
|
// addToCallGraph - Add a function to the call graph, and link the node to all
|
||||||
// of the methods that it calls.
|
// of the methods that it calls.
|
||||||
//
|
//
|
||||||
void addToCallGraph(Method *M);
|
void addToCallGraph(Function *F);
|
||||||
|
|
||||||
// destroy - Release memory for the call graph
|
// destroy - Release memory for the call graph
|
||||||
void destroy();
|
void destroy();
|
||||||
@ -154,7 +154,7 @@ private:
|
|||||||
// CallGraphNode class definition
|
// CallGraphNode class definition
|
||||||
//
|
//
|
||||||
class CallGraphNode {
|
class CallGraphNode {
|
||||||
Method *Meth;
|
Function *Meth;
|
||||||
std::vector<CallGraphNode*> CalledMethods;
|
std::vector<CallGraphNode*> CalledMethods;
|
||||||
|
|
||||||
CallGraphNode(const CallGraphNode &); // Do not implement
|
CallGraphNode(const CallGraphNode &); // Do not implement
|
||||||
@ -167,7 +167,7 @@ public:
|
|||||||
typedef std::vector<CallGraphNode*>::const_iterator const_iterator;
|
typedef std::vector<CallGraphNode*>::const_iterator const_iterator;
|
||||||
|
|
||||||
// getMethod - Return the method that this call graph node represents...
|
// getMethod - Return the method that this call graph node represents...
|
||||||
Method *getMethod() const { return Meth; }
|
Function *getMethod() const { return Meth; }
|
||||||
|
|
||||||
inline iterator begin() { return CalledMethods.begin(); }
|
inline iterator begin() { return CalledMethods.begin(); }
|
||||||
inline iterator end() { return CalledMethods.end(); }
|
inline iterator end() { return CalledMethods.end(); }
|
||||||
@ -193,7 +193,7 @@ private: // Stuff to construct the node, used by CallGraph
|
|||||||
friend class CallGraph;
|
friend class CallGraph;
|
||||||
|
|
||||||
// CallGraphNode ctor - Create a node for the specified method...
|
// CallGraphNode ctor - Create a node for the specified method...
|
||||||
inline CallGraphNode(Method *M) : Meth(M) {}
|
inline CallGraphNode(Function *F) : Meth(F) {}
|
||||||
|
|
||||||
// addCalledMethod add a method to the list of methods called by this one
|
// addCalledMethod add a method to the list of methods called by this one
|
||||||
void addCalledMethod(CallGraphNode *M) {
|
void addCalledMethod(CallGraphNode *M) {
|
||||||
|
@ -28,15 +28,15 @@ class constant_iterator
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline constant_iterator(const Method *M) : InstI(inst_begin(M)), OpIdx(0) {
|
inline constant_iterator(const Function *F) : InstI(inst_begin(F)), OpIdx(0) {
|
||||||
// Advance to first constant... if we are not already at constant or end
|
// Advance to first constant... if we are not already at constant or end
|
||||||
if (InstI != inst_end(M) && // InstI is valid?
|
if (InstI != inst_end(F) && // InstI is valid?
|
||||||
(InstI->getNumOperands() == 0 || !isAtConstant())) // Not at constant?
|
(InstI->getNumOperands() == 0 || !isAtConstant())) // Not at constant?
|
||||||
operator++();
|
operator++();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline constant_iterator(const Method *M, bool) // end ctor
|
inline constant_iterator(const Function *F, bool) // end ctor
|
||||||
: InstI(inst_end(M)), OpIdx(0) {
|
: InstI(inst_end(F)), OpIdx(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool operator==(const _Self& x) const { return OpIdx == x.OpIdx &&
|
inline bool operator==(const _Self& x) const { return OpIdx == x.OpIdx &&
|
||||||
@ -72,12 +72,12 @@ public:
|
|||||||
inline bool atEnd() const { return InstI.atEnd(); }
|
inline bool atEnd() const { return InstI.atEnd(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
inline constant_iterator constant_begin(const Method *M) {
|
inline constant_iterator constant_begin(const Function *F) {
|
||||||
return constant_iterator(M);
|
return constant_iterator(F);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline constant_iterator constant_end(const Method *M) {
|
inline constant_iterator constant_end(const Function *F) {
|
||||||
return constant_iterator(M, true);
|
return constant_iterator(F, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -55,8 +55,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
DomSetMapType Doms;
|
DomSetMapType Doms;
|
||||||
|
|
||||||
void calcForwardDominatorSet(Method *M);
|
void calcForwardDominatorSet(Function *F);
|
||||||
void calcPostDominatorSet(Method *M);
|
void calcPostDominatorSet(Function *F);
|
||||||
public:
|
public:
|
||||||
// DominatorSet ctor - Build either the dominator set or the post-dominator
|
// DominatorSet ctor - Build either the dominator set or the post-dominator
|
||||||
// set for a method...
|
// set for a method...
|
||||||
@ -66,7 +66,7 @@ public:
|
|||||||
|
|
||||||
DominatorSet(AnalysisID id) : DominatorBase(id == PostDomID) {}
|
DominatorSet(AnalysisID id) : DominatorBase(id == PostDomID) {}
|
||||||
|
|
||||||
virtual bool runOnMethod(Method *M);
|
virtual bool runOnMethod(Function *F);
|
||||||
|
|
||||||
// Accessor interface:
|
// Accessor interface:
|
||||||
typedef DomSetMapType::const_iterator const_iterator;
|
typedef DomSetMapType::const_iterator const_iterator;
|
||||||
@ -120,7 +120,7 @@ public:
|
|||||||
|
|
||||||
ImmediateDominators(AnalysisID id) : DominatorBase(id == PostDomID) {}
|
ImmediateDominators(AnalysisID id) : DominatorBase(id == PostDomID) {}
|
||||||
|
|
||||||
virtual bool runOnMethod(Method *M) {
|
virtual bool runOnMethod(Function *F) {
|
||||||
IDoms.clear(); // Reset from the last time we were run...
|
IDoms.clear(); // Reset from the last time we were run...
|
||||||
DominatorSet *DS;
|
DominatorSet *DS;
|
||||||
if (isPostDominator())
|
if (isPostDominator())
|
||||||
@ -213,7 +213,7 @@ public:
|
|||||||
DominatorTree(AnalysisID id) : DominatorBase(id == PostDomID) {}
|
DominatorTree(AnalysisID id) : DominatorBase(id == PostDomID) {}
|
||||||
~DominatorTree() { reset(); }
|
~DominatorTree() { reset(); }
|
||||||
|
|
||||||
virtual bool runOnMethod(Method *M) {
|
virtual bool runOnMethod(Function *F) {
|
||||||
reset();
|
reset();
|
||||||
DominatorSet *DS;
|
DominatorSet *DS;
|
||||||
if (isPostDominator())
|
if (isPostDominator())
|
||||||
@ -270,7 +270,7 @@ public:
|
|||||||
|
|
||||||
DominanceFrontier(AnalysisID id) : DominatorBase(id == PostDomID) {}
|
DominanceFrontier(AnalysisID id) : DominatorBase(id == PostDomID) {}
|
||||||
|
|
||||||
virtual bool runOnMethod(Method *M) {
|
virtual bool runOnMethod(Function *) {
|
||||||
Frontiers.clear();
|
Frontiers.clear();
|
||||||
DominatorTree *DT;
|
DominatorTree *DT;
|
||||||
if (isPostDominator())
|
if (isPostDominator())
|
||||||
|
@ -42,7 +42,7 @@ public:
|
|||||||
IntervalPartition(AnalysisID AID) : RootInterval(0) { assert(AID == ID); }
|
IntervalPartition(AnalysisID AID) : RootInterval(0) { assert(AID == ID); }
|
||||||
|
|
||||||
// run - Calculate the interval partition for this method
|
// run - Calculate the interval partition for this method
|
||||||
virtual bool runOnMethod(Method *M);
|
virtual bool runOnMethod(Function *F);
|
||||||
|
|
||||||
// IntervalPartition ctor - Build a reduced interval partition from an
|
// IntervalPartition ctor - Build a reduced interval partition from an
|
||||||
// existing interval graph. This takes an additional boolean parameter to
|
// existing interval graph. This takes an additional boolean parameter to
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
It must be called like:
|
It must be called like:
|
||||||
|
|
||||||
MethodLiveVarInfo MLVI( Mehtod *); // initializes data structures
|
MethodLiveVarInfo MLVI(Function *); // initializes data structures
|
||||||
MLVI.analyze(); // do the actural live variable anal
|
MLVI.analyze(); // do the actural live variable anal
|
||||||
|
|
||||||
After the analysis, getInSetOfBB or getOutSetofBB can be called to get
|
After the analysis, getInSetOfBB or getOutSetofBB can be called to get
|
||||||
@ -86,16 +86,16 @@ class MethodLiveVarInfo : public MethodPass {
|
|||||||
// Machine Instr to LiveVarSet Map for providing LVset AFTER each inst
|
// Machine Instr to LiveVarSet Map for providing LVset AFTER each inst
|
||||||
std::map<const MachineInstr *, const ValueSet *> MInst2LVSetAI;
|
std::map<const MachineInstr *, const ValueSet *> MInst2LVSetAI;
|
||||||
|
|
||||||
// Stored Method that the data is computed with respect to
|
// Stored Function that the data is computed with respect to
|
||||||
const Method *M;
|
const Function *M;
|
||||||
|
|
||||||
// --------- private methods -----------------------------------------
|
// --------- private methods -----------------------------------------
|
||||||
|
|
||||||
// constructs BBLiveVars and init Def and In sets
|
// constructs BBLiveVars and init Def and In sets
|
||||||
void constructBBs(const Method *M);
|
void constructBBs(const Function *F);
|
||||||
|
|
||||||
// do one backward pass over the CFG
|
// do one backward pass over the CFG
|
||||||
bool doSingleBackwardPass(const Method *M, unsigned int iter);
|
bool doSingleBackwardPass(const Function *F, unsigned int iter);
|
||||||
|
|
||||||
// calculates live var sets for instructions in a BB
|
// calculates live var sets for instructions in a BB
|
||||||
void calcLiveVarSetsForBB(const BasicBlock *BB);
|
void calcLiveVarSetsForBB(const BasicBlock *BB);
|
||||||
@ -108,7 +108,7 @@ public:
|
|||||||
// --------- Implement the MethodPass interface ----------------------
|
// --------- Implement the MethodPass interface ----------------------
|
||||||
|
|
||||||
// runOnMethod - Perform analysis, update internal data structures.
|
// runOnMethod - Perform analysis, update internal data structures.
|
||||||
virtual bool runOnMethod(Method *M);
|
virtual bool runOnMethod(Function *F);
|
||||||
|
|
||||||
// releaseMemory - After LiveVariable analysis has been used, forget!
|
// releaseMemory - After LiveVariable analysis has been used, forget!
|
||||||
virtual void releaseMemory();
|
virtual void releaseMemory();
|
||||||
|
@ -101,7 +101,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// runOnMethod - Pass framework implementation
|
// runOnMethod - Pass framework implementation
|
||||||
virtual bool runOnMethod(Method *M);
|
virtual bool runOnMethod(Function *F);
|
||||||
|
|
||||||
// getAnalysisUsageInfo - Provide loop info, require dominator set
|
// getAnalysisUsageInfo - Provide loop info, require dominator set
|
||||||
//
|
//
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
class Value;
|
class Value;
|
||||||
class Module;
|
class Module;
|
||||||
class Method;
|
class Function;
|
||||||
class MethodArgument;
|
class MethodArgument;
|
||||||
class BasicBlock;
|
class BasicBlock;
|
||||||
class Instruction;
|
class Instruction;
|
||||||
@ -34,7 +34,8 @@ class SlotCalculator {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
SlotCalculator(const Module *M, bool IgnoreNamed);
|
SlotCalculator(const Module *M, bool IgnoreNamed);
|
||||||
SlotCalculator(const Method *M, bool IgnoreNamed);// Start out in incorp state
|
// Start out in incorp state
|
||||||
|
SlotCalculator(const Function *M, bool IgnoreNamed);
|
||||||
inline ~SlotCalculator() {}
|
inline ~SlotCalculator() {}
|
||||||
|
|
||||||
// getValSlot returns < 0 on error!
|
// getValSlot returns < 0 on error!
|
||||||
@ -52,7 +53,7 @@ public:
|
|||||||
// If you'd like to deal with a method, use these two methods to get its data
|
// If you'd like to deal with a method, use these two methods to get its data
|
||||||
// into the SlotCalculator!
|
// into the SlotCalculator!
|
||||||
//
|
//
|
||||||
void incorporateMethod(const Method *M);
|
void incorporateMethod(const Function *F);
|
||||||
void purgeMethod();
|
void purgeMethod();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
class Pass;
|
class Pass;
|
||||||
class Module;
|
class Module;
|
||||||
class Method;
|
class Function;
|
||||||
|
|
||||||
// createVerifierPass - Check a module or method for validity. If errors are
|
// createVerifierPass - Check a module or method for validity. If errors are
|
||||||
// detected, error messages corresponding to the problem are printed to stderr.
|
// detected, error messages corresponding to the problem are printed to stderr.
|
||||||
@ -29,6 +29,6 @@ bool verifyModule(const Module *M);
|
|||||||
|
|
||||||
// verifyMethod - Check a method for errors, useful for use when debugging a
|
// verifyMethod - Check a method for errors, useful for use when debugging a
|
||||||
// pass.
|
// pass.
|
||||||
bool verifyMethod(const Method *M);
|
bool verifyMethod(const Function *M);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
class Module;
|
class Module;
|
||||||
class GlobalVariable;
|
class GlobalVariable;
|
||||||
class Method;
|
class Function;
|
||||||
class BasicBlock;
|
class BasicBlock;
|
||||||
class Instruction;
|
class Instruction;
|
||||||
class SlotCalculator;
|
class SlotCalculator;
|
||||||
@ -32,7 +32,7 @@ class SlotCalculator;
|
|||||||
//
|
//
|
||||||
void WriteToAssembly(const Module *Module, std::ostream &o);
|
void WriteToAssembly(const Module *Module, std::ostream &o);
|
||||||
void WriteToAssembly(const GlobalVariable *G, std::ostream &o);
|
void WriteToAssembly(const GlobalVariable *G, std::ostream &o);
|
||||||
void WriteToAssembly(const Method *Method, std::ostream &o);
|
void WriteToAssembly(const Function *F , std::ostream &o);
|
||||||
void WriteToAssembly(const BasicBlock *BB, std::ostream &o);
|
void WriteToAssembly(const BasicBlock *BB, std::ostream &o);
|
||||||
void WriteToAssembly(const Instruction *In, std::ostream &o);
|
void WriteToAssembly(const Instruction *In, std::ostream &o);
|
||||||
void WriteToAssembly(const Constant *V, std::ostream &o);
|
void WriteToAssembly(const Constant *V, std::ostream &o);
|
||||||
@ -58,7 +58,7 @@ std::ostream &WriteAsOperand(std::ostream &, const Value *, bool PrintTy = true,
|
|||||||
// suffix.
|
// suffix.
|
||||||
//
|
//
|
||||||
void WriteToVCG(const Module *Module, const std::string &Filename);
|
void WriteToVCG(const Module *Module, const std::string &Filename);
|
||||||
void WriteToVCG(const Method *Method, const std::string &Filename);
|
void WriteToVCG(const Function *Func, const std::string &Filename);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -74,8 +74,8 @@ inline std::ostream &operator<<(std::ostream &o, const GlobalVariable *G) {
|
|||||||
WriteToAssembly(G, o); return o;
|
WriteToAssembly(G, o); return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::ostream &operator<<(std::ostream &o, const Method *M) {
|
inline std::ostream &operator<<(std::ostream &o, const Function *F) {
|
||||||
WriteToAssembly(M, o); return o;
|
WriteToAssembly(F, o); return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::ostream &operator<<(std::ostream &o, const BasicBlock *B) {
|
inline std::ostream &operator<<(std::ostream &o, const BasicBlock *B) {
|
||||||
@ -103,7 +103,7 @@ inline std::ostream &operator<<(std::ostream &o, const Value *I) {
|
|||||||
case Value::MethodArgumentVal: return o << I->getType() << " "<< I->getName();
|
case Value::MethodArgumentVal: return o << I->getType() << " "<< I->getName();
|
||||||
case Value::InstructionVal:WriteToAssembly(cast<Instruction>(I) , o); break;
|
case Value::InstructionVal:WriteToAssembly(cast<Instruction>(I) , o); break;
|
||||||
case Value::BasicBlockVal: WriteToAssembly(cast<BasicBlock>(I) , o); break;
|
case Value::BasicBlockVal: WriteToAssembly(cast<BasicBlock>(I) , o); break;
|
||||||
case Value::MethodVal: WriteToAssembly(cast<Method>(I) , o); break;
|
case Value::MethodVal: WriteToAssembly(cast<Function>(I) , o); break;
|
||||||
case Value::GlobalVariableVal:
|
case Value::GlobalVariableVal:
|
||||||
WriteToAssembly(cast<GlobalVariable>(I), o); break;
|
WriteToAssembly(cast<GlobalVariable>(I), o); break;
|
||||||
case Value::ModuleVal: WriteToAssembly(cast<Module>(I) , o); break;
|
case Value::ModuleVal: WriteToAssembly(cast<Module>(I) , o); break;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
It must be called like:
|
It must be called like:
|
||||||
|
|
||||||
MethodLiveVarInfo MLVI( Mehtod *); // initializes data structures
|
MethodLiveVarInfo MLVI(Function *); // initializes data structures
|
||||||
MLVI.analyze(); // do the actural live variable anal
|
MLVI.analyze(); // do the actural live variable anal
|
||||||
|
|
||||||
After the analysis, getInSetOfBB or getOutSetofBB can be called to get
|
After the analysis, getInSetOfBB or getOutSetofBB can be called to get
|
||||||
@ -86,16 +86,16 @@ class MethodLiveVarInfo : public MethodPass {
|
|||||||
// Machine Instr to LiveVarSet Map for providing LVset AFTER each inst
|
// Machine Instr to LiveVarSet Map for providing LVset AFTER each inst
|
||||||
std::map<const MachineInstr *, const ValueSet *> MInst2LVSetAI;
|
std::map<const MachineInstr *, const ValueSet *> MInst2LVSetAI;
|
||||||
|
|
||||||
// Stored Method that the data is computed with respect to
|
// Stored Function that the data is computed with respect to
|
||||||
const Method *M;
|
const Function *M;
|
||||||
|
|
||||||
// --------- private methods -----------------------------------------
|
// --------- private methods -----------------------------------------
|
||||||
|
|
||||||
// constructs BBLiveVars and init Def and In sets
|
// constructs BBLiveVars and init Def and In sets
|
||||||
void constructBBs(const Method *M);
|
void constructBBs(const Function *F);
|
||||||
|
|
||||||
// do one backward pass over the CFG
|
// do one backward pass over the CFG
|
||||||
bool doSingleBackwardPass(const Method *M, unsigned int iter);
|
bool doSingleBackwardPass(const Function *F, unsigned int iter);
|
||||||
|
|
||||||
// calculates live var sets for instructions in a BB
|
// calculates live var sets for instructions in a BB
|
||||||
void calcLiveVarSetsForBB(const BasicBlock *BB);
|
void calcLiveVarSetsForBB(const BasicBlock *BB);
|
||||||
@ -108,7 +108,7 @@ public:
|
|||||||
// --------- Implement the MethodPass interface ----------------------
|
// --------- Implement the MethodPass interface ----------------------
|
||||||
|
|
||||||
// runOnMethod - Perform analysis, update internal data structures.
|
// runOnMethod - Perform analysis, update internal data structures.
|
||||||
virtual bool runOnMethod(Method *M);
|
virtual bool runOnMethod(Function *F);
|
||||||
|
|
||||||
// releaseMemory - After LiveVariable analysis has been used, forget!
|
// releaseMemory - After LiveVariable analysis has been used, forget!
|
||||||
virtual void releaseMemory();
|
virtual void releaseMemory();
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
class Constant;
|
class Constant;
|
||||||
class BasicBlock;
|
class BasicBlock;
|
||||||
class Method;
|
class Function;
|
||||||
class InstrTreeNode;
|
class InstrTreeNode;
|
||||||
class InstrForest;
|
class InstrForest;
|
||||||
|
|
||||||
@ -243,7 +243,7 @@ private:
|
|||||||
std::hash_set<InstructionNode*> treeRoots;
|
std::hash_set<InstructionNode*> treeRoots;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/*ctor*/ InstrForest (Method *M);
|
/*ctor*/ InstrForest (Function *F);
|
||||||
/*dtor*/ ~InstrForest ();
|
/*dtor*/ ~InstrForest ();
|
||||||
|
|
||||||
inline InstructionNode *getTreeNodeForInstr(Instruction* instr) {
|
inline InstructionNode *getTreeNodeForInstr(Instruction* instr) {
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#define LLVM_CODEGEN_INSTR_SELECTION_H
|
#define LLVM_CODEGEN_INSTR_SELECTION_H
|
||||||
|
|
||||||
#include "llvm/Instruction.h"
|
#include "llvm/Instruction.h"
|
||||||
class Method;
|
class Function;
|
||||||
class InstrForest;
|
class InstrForest;
|
||||||
class MachineInstr;
|
class MachineInstr;
|
||||||
class InstructionNode;
|
class InstructionNode;
|
||||||
@ -55,7 +55,7 @@ extern bool ThisIsAChainRule (int eruleno);
|
|||||||
// Implemented in machine-specific instruction selection file.
|
// Implemented in machine-specific instruction selection file.
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
bool SelectInstructionsForMethod (Method* method,
|
bool SelectInstructionsForMethod (Function* function,
|
||||||
TargetMachine &Target);
|
TargetMachine &Target);
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,14 +14,14 @@
|
|||||||
#include "Support/HashExtras.h"
|
#include "Support/HashExtras.h"
|
||||||
#include <ext/hash_set>
|
#include <ext/hash_set>
|
||||||
class Value;
|
class Value;
|
||||||
class Method;
|
class Function;
|
||||||
class Constant;
|
class Constant;
|
||||||
class Type;
|
class Type;
|
||||||
class TargetMachine;
|
class TargetMachine;
|
||||||
|
|
||||||
|
|
||||||
class MachineCodeForMethod : private Annotation {
|
class MachineCodeForMethod : private Annotation {
|
||||||
const Method* method;
|
const Function* method;
|
||||||
bool compiledAsLeaf;
|
bool compiledAsLeaf;
|
||||||
unsigned staticStackSize;
|
unsigned staticStackSize;
|
||||||
unsigned automaticVarsSize;
|
unsigned automaticVarsSize;
|
||||||
@ -33,7 +33,7 @@ class MachineCodeForMethod : private Annotation {
|
|||||||
std::hash_map<const Value*, int> offsets;
|
std::hash_map<const Value*, int> offsets;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/*ctor*/ MachineCodeForMethod(const Method* method,
|
/*ctor*/ MachineCodeForMethod(const Function* function,
|
||||||
const TargetMachine& target);
|
const TargetMachine& target);
|
||||||
|
|
||||||
// The next two methods are used to construct and to retrieve
|
// The next two methods are used to construct and to retrieve
|
||||||
@ -43,10 +43,10 @@ public:
|
|||||||
// This should not be called before "construct()"
|
// This should not be called before "construct()"
|
||||||
// for a given Method.
|
// for a given Method.
|
||||||
//
|
//
|
||||||
static MachineCodeForMethod& construct(const Method *method,
|
static MachineCodeForMethod& construct(const Function *method,
|
||||||
const TargetMachine &target);
|
const TargetMachine &target);
|
||||||
static void destruct(const Method *M);
|
static void destruct(const Function *F);
|
||||||
static MachineCodeForMethod& get(const Method* method);
|
static MachineCodeForMethod& get(const Function* function);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Accessors for global information about generated code for a method.
|
// Accessors for global information about generated code for a method.
|
||||||
|
@ -14,14 +14,14 @@
|
|||||||
#include "Support/HashExtras.h"
|
#include "Support/HashExtras.h"
|
||||||
#include <ext/hash_set>
|
#include <ext/hash_set>
|
||||||
class Value;
|
class Value;
|
||||||
class Method;
|
class Function;
|
||||||
class Constant;
|
class Constant;
|
||||||
class Type;
|
class Type;
|
||||||
class TargetMachine;
|
class TargetMachine;
|
||||||
|
|
||||||
|
|
||||||
class MachineCodeForMethod : private Annotation {
|
class MachineCodeForMethod : private Annotation {
|
||||||
const Method* method;
|
const Function* method;
|
||||||
bool compiledAsLeaf;
|
bool compiledAsLeaf;
|
||||||
unsigned staticStackSize;
|
unsigned staticStackSize;
|
||||||
unsigned automaticVarsSize;
|
unsigned automaticVarsSize;
|
||||||
@ -33,7 +33,7 @@ class MachineCodeForMethod : private Annotation {
|
|||||||
std::hash_map<const Value*, int> offsets;
|
std::hash_map<const Value*, int> offsets;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/*ctor*/ MachineCodeForMethod(const Method* method,
|
/*ctor*/ MachineCodeForMethod(const Function* function,
|
||||||
const TargetMachine& target);
|
const TargetMachine& target);
|
||||||
|
|
||||||
// The next two methods are used to construct and to retrieve
|
// The next two methods are used to construct and to retrieve
|
||||||
@ -43,10 +43,10 @@ public:
|
|||||||
// This should not be called before "construct()"
|
// This should not be called before "construct()"
|
||||||
// for a given Method.
|
// for a given Method.
|
||||||
//
|
//
|
||||||
static MachineCodeForMethod& construct(const Method *method,
|
static MachineCodeForMethod& construct(const Function *method,
|
||||||
const TargetMachine &target);
|
const TargetMachine &target);
|
||||||
static void destruct(const Method *M);
|
static void destruct(const Function *F);
|
||||||
static MachineCodeForMethod& get(const Method* method);
|
static MachineCodeForMethod& get(const Function* function);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Accessors for global information about generated code for a method.
|
// Accessors for global information about generated code for a method.
|
||||||
|
@ -452,7 +452,7 @@ std::ostream& operator<< (std::ostream& os, const MachineInstr& minstr);
|
|||||||
std::ostream& operator<< (std::ostream& os, const MachineOperand& mop);
|
std::ostream& operator<< (std::ostream& os, const MachineOperand& mop);
|
||||||
|
|
||||||
|
|
||||||
void PrintMachineInstructions(const Method *method);
|
void PrintMachineInstructions(const Function *F);
|
||||||
|
|
||||||
|
|
||||||
//**************************************************************************/
|
//**************************************************************************/
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
class Value;
|
class Value;
|
||||||
class BasicBlock;
|
class BasicBlock;
|
||||||
class Method;
|
class Function;
|
||||||
class Module;
|
class Module;
|
||||||
class AnalysisID;
|
class AnalysisID;
|
||||||
class Pass;
|
class Pass;
|
||||||
@ -105,7 +105,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
friend class PassManagerT<Module>;
|
friend class PassManagerT<Module>;
|
||||||
friend class PassManagerT<Method>;
|
friend class PassManagerT<Function>;
|
||||||
friend class PassManagerT<BasicBlock>;
|
friend class PassManagerT<BasicBlock>;
|
||||||
virtual void addToPassManager(PassManagerT<Module> *PM, AnalysisSet &Req,
|
virtual void addToPassManager(PassManagerT<Module> *PM, AnalysisSet &Req,
|
||||||
AnalysisSet &Destroyed, AnalysisSet &Provided);
|
AnalysisSet &Destroyed, AnalysisSet &Provided);
|
||||||
@ -129,7 +129,7 @@ struct MethodPass : public Pass {
|
|||||||
// runOnMethod - Virtual method overriden by subclasses to do the per-method
|
// runOnMethod - Virtual method overriden by subclasses to do the per-method
|
||||||
// processing of the pass.
|
// processing of the pass.
|
||||||
//
|
//
|
||||||
virtual bool runOnMethod(Method *M) = 0;
|
virtual bool runOnMethod(Function *M) = 0;
|
||||||
|
|
||||||
// doFinalization - Virtual method overriden by subclasses to do any post
|
// doFinalization - Virtual method overriden by subclasses to do any post
|
||||||
// processing needed after all passes have run.
|
// processing needed after all passes have run.
|
||||||
@ -143,15 +143,15 @@ struct MethodPass : public Pass {
|
|||||||
|
|
||||||
// run - On a method, we simply initialize, run the method, then finalize.
|
// run - On a method, we simply initialize, run the method, then finalize.
|
||||||
//
|
//
|
||||||
bool run(Method *M);
|
bool run(Function *M);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class PassManagerT<Module>;
|
friend class PassManagerT<Module>;
|
||||||
friend class PassManagerT<Method>;
|
friend class PassManagerT<Function>;
|
||||||
friend class PassManagerT<BasicBlock>;
|
friend class PassManagerT<BasicBlock>;
|
||||||
virtual void addToPassManager(PassManagerT<Module> *PM, AnalysisSet &Req,
|
virtual void addToPassManager(PassManagerT<Module> *PM, AnalysisSet &Req,
|
||||||
AnalysisSet &Dest, AnalysisSet &Prov);
|
AnalysisSet &Dest, AnalysisSet &Prov);
|
||||||
virtual void addToPassManager(PassManagerT<Method> *PM,AnalysisSet &Req,
|
virtual void addToPassManager(PassManagerT<Function> *PM,AnalysisSet &Req,
|
||||||
AnalysisSet &Dest, AnalysisSet &Prov);
|
AnalysisSet &Dest, AnalysisSet &Prov);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ struct BasicBlockPass : public MethodPass {
|
|||||||
// To run this pass on a method, we simply call runOnBasicBlock once for each
|
// To run this pass on a method, we simply call runOnBasicBlock once for each
|
||||||
// method.
|
// method.
|
||||||
//
|
//
|
||||||
virtual bool runOnMethod(Method *BB);
|
virtual bool runOnMethod(Function *F);
|
||||||
|
|
||||||
// To run directly on the basic block, we initialize, runOnBasicBlock, then
|
// To run directly on the basic block, we initialize, runOnBasicBlock, then
|
||||||
// finalize.
|
// finalize.
|
||||||
@ -184,9 +184,9 @@ struct BasicBlockPass : public MethodPass {
|
|||||||
bool run(BasicBlock *BB);
|
bool run(BasicBlock *BB);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class PassManagerT<Method>;
|
friend class PassManagerT<Function>;
|
||||||
friend class PassManagerT<BasicBlock>;
|
friend class PassManagerT<BasicBlock>;
|
||||||
virtual void addToPassManager(PassManagerT<Method> *PM, AnalysisSet &,
|
virtual void addToPassManager(PassManagerT<Function> *PM, AnalysisSet &,
|
||||||
AnalysisSet &, AnalysisSet &);
|
AnalysisSet &, AnalysisSet &);
|
||||||
virtual void addToPassManager(PassManagerT<BasicBlock> *PM, AnalysisSet &,
|
virtual void addToPassManager(PassManagerT<BasicBlock> *PM, AnalysisSet &,
|
||||||
AnalysisSet &, AnalysisSet &);
|
AnalysisSet &, AnalysisSet &);
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
class Value;
|
class Value;
|
||||||
class Module;
|
class Module;
|
||||||
class Method;
|
class Function;
|
||||||
class MethodArgument;
|
class MethodArgument;
|
||||||
class BasicBlock;
|
class BasicBlock;
|
||||||
class Instruction;
|
class Instruction;
|
||||||
@ -34,7 +34,8 @@ class SlotCalculator {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
SlotCalculator(const Module *M, bool IgnoreNamed);
|
SlotCalculator(const Module *M, bool IgnoreNamed);
|
||||||
SlotCalculator(const Method *M, bool IgnoreNamed);// Start out in incorp state
|
// Start out in incorp state
|
||||||
|
SlotCalculator(const Function *M, bool IgnoreNamed);
|
||||||
inline ~SlotCalculator() {}
|
inline ~SlotCalculator() {}
|
||||||
|
|
||||||
// getValSlot returns < 0 on error!
|
// getValSlot returns < 0 on error!
|
||||||
@ -52,7 +53,7 @@ public:
|
|||||||
// If you'd like to deal with a method, use these two methods to get its data
|
// If you'd like to deal with a method, use these two methods to get its data
|
||||||
// into the SlotCalculator!
|
// into the SlotCalculator!
|
||||||
//
|
//
|
||||||
void incorporateMethod(const Method *M);
|
void incorporateMethod(const Function *F);
|
||||||
void purgeMethod();
|
void purgeMethod();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -18,7 +18,7 @@ class MachineInstr;
|
|||||||
class TargetMachine;
|
class TargetMachine;
|
||||||
class Value;
|
class Value;
|
||||||
class Instruction;
|
class Instruction;
|
||||||
class Method;
|
class Function;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// Data types used to define information about a single machine instruction
|
// Data types used to define information about a single machine instruction
|
||||||
@ -248,7 +248,7 @@ public:
|
|||||||
// The generated instructions are returned in `minstrVec'.
|
// The generated instructions are returned in `minstrVec'.
|
||||||
// Any temp. registers (TmpInstruction) created are returned in `tempVec'.
|
// Any temp. registers (TmpInstruction) created are returned in `tempVec'.
|
||||||
//
|
//
|
||||||
virtual void CreateCodeToLoadConst(Method* method,
|
virtual void CreateCodeToLoadConst(Function* method,
|
||||||
Value* val,
|
Value* val,
|
||||||
Instruction* dest,
|
Instruction* dest,
|
||||||
std::vector<MachineInstr*>& minstrVec,
|
std::vector<MachineInstr*>& minstrVec,
|
||||||
@ -260,7 +260,7 @@ public:
|
|||||||
// The generated instructions are returned in `minstrVec'.
|
// The generated instructions are returned in `minstrVec'.
|
||||||
// Any temp. registers (TmpInstruction) created are returned in `tempVec'.
|
// Any temp. registers (TmpInstruction) created are returned in `tempVec'.
|
||||||
//
|
//
|
||||||
virtual void CreateCodeToCopyIntToFloat(Method* method,
|
virtual void CreateCodeToCopyIntToFloat(Function* method,
|
||||||
Value* val,
|
Value* val,
|
||||||
Instruction* dest,
|
Instruction* dest,
|
||||||
std::vector<MachineInstr*>& minstVec,
|
std::vector<MachineInstr*>& minstVec,
|
||||||
@ -271,7 +271,7 @@ public:
|
|||||||
// `val' to an integer value `dest' by copying to memory and back.
|
// `val' to an integer value `dest' by copying to memory and back.
|
||||||
// See the previous function for information about return values.
|
// See the previous function for information about return values.
|
||||||
//
|
//
|
||||||
virtual void CreateCodeToCopyFloatToInt(Method* method,
|
virtual void CreateCodeToCopyFloatToInt(Function* method,
|
||||||
Value* val,
|
Value* val,
|
||||||
Instruction* dest,
|
Instruction* dest,
|
||||||
std::vector<MachineInstr*>& minstVec,
|
std::vector<MachineInstr*>& minstVec,
|
||||||
@ -281,7 +281,7 @@ public:
|
|||||||
|
|
||||||
// create copy instruction(s)
|
// create copy instruction(s)
|
||||||
virtual void CreateCopyInstructionsByType(const TargetMachine& target,
|
virtual void CreateCopyInstructionsByType(const TargetMachine& target,
|
||||||
Method* method,
|
Function* method,
|
||||||
Value* src,
|
Value* src,
|
||||||
Instruction* dest,
|
Instruction* dest,
|
||||||
std::vector<MachineInstr*>& minstrVec)
|
std::vector<MachineInstr*>& minstrVec)
|
||||||
|
@ -18,7 +18,7 @@ class MachineInstr;
|
|||||||
class TargetMachine;
|
class TargetMachine;
|
||||||
class Value;
|
class Value;
|
||||||
class Instruction;
|
class Instruction;
|
||||||
class Method;
|
class Function;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// Data types used to define information about a single machine instruction
|
// Data types used to define information about a single machine instruction
|
||||||
@ -248,7 +248,7 @@ public:
|
|||||||
// The generated instructions are returned in `minstrVec'.
|
// The generated instructions are returned in `minstrVec'.
|
||||||
// Any temp. registers (TmpInstruction) created are returned in `tempVec'.
|
// Any temp. registers (TmpInstruction) created are returned in `tempVec'.
|
||||||
//
|
//
|
||||||
virtual void CreateCodeToLoadConst(Method* method,
|
virtual void CreateCodeToLoadConst(Function* method,
|
||||||
Value* val,
|
Value* val,
|
||||||
Instruction* dest,
|
Instruction* dest,
|
||||||
std::vector<MachineInstr*>& minstrVec,
|
std::vector<MachineInstr*>& minstrVec,
|
||||||
@ -260,7 +260,7 @@ public:
|
|||||||
// The generated instructions are returned in `minstrVec'.
|
// The generated instructions are returned in `minstrVec'.
|
||||||
// Any temp. registers (TmpInstruction) created are returned in `tempVec'.
|
// Any temp. registers (TmpInstruction) created are returned in `tempVec'.
|
||||||
//
|
//
|
||||||
virtual void CreateCodeToCopyIntToFloat(Method* method,
|
virtual void CreateCodeToCopyIntToFloat(Function* method,
|
||||||
Value* val,
|
Value* val,
|
||||||
Instruction* dest,
|
Instruction* dest,
|
||||||
std::vector<MachineInstr*>& minstVec,
|
std::vector<MachineInstr*>& minstVec,
|
||||||
@ -271,7 +271,7 @@ public:
|
|||||||
// `val' to an integer value `dest' by copying to memory and back.
|
// `val' to an integer value `dest' by copying to memory and back.
|
||||||
// See the previous function for information about return values.
|
// See the previous function for information about return values.
|
||||||
//
|
//
|
||||||
virtual void CreateCodeToCopyFloatToInt(Method* method,
|
virtual void CreateCodeToCopyFloatToInt(Function* method,
|
||||||
Value* val,
|
Value* val,
|
||||||
Instruction* dest,
|
Instruction* dest,
|
||||||
std::vector<MachineInstr*>& minstVec,
|
std::vector<MachineInstr*>& minstVec,
|
||||||
@ -281,7 +281,7 @@ public:
|
|||||||
|
|
||||||
// create copy instruction(s)
|
// create copy instruction(s)
|
||||||
virtual void CreateCopyInstructionsByType(const TargetMachine& target,
|
virtual void CreateCopyInstructionsByType(const TargetMachine& target,
|
||||||
Method* method,
|
Function* method,
|
||||||
Value* src,
|
Value* src,
|
||||||
Instruction* dest,
|
Instruction* dest,
|
||||||
std::vector<MachineInstr*>& minstrVec)
|
std::vector<MachineInstr*>& minstrVec)
|
||||||
|
@ -17,7 +17,7 @@ class IGNode;
|
|||||||
class Type;
|
class Type;
|
||||||
class Value;
|
class Value;
|
||||||
class LiveRangeInfo;
|
class LiveRangeInfo;
|
||||||
class Method;
|
class Function;
|
||||||
class Instruction;
|
class Instruction;
|
||||||
class LiveRange;
|
class LiveRange;
|
||||||
class AddedInstrns;
|
class AddedInstrns;
|
||||||
@ -108,7 +108,7 @@ public:
|
|||||||
// method args and return values etc.) with specific hardware registers
|
// method args and return values etc.) with specific hardware registers
|
||||||
// as required. See SparcRegInfo.cpp for the implementation for Sparc.
|
// as required. See SparcRegInfo.cpp for the implementation for Sparc.
|
||||||
//
|
//
|
||||||
virtual void suggestRegs4MethodArgs(const Method *Meth,
|
virtual void suggestRegs4MethodArgs(const Function *Func,
|
||||||
LiveRangeInfo &LRI) const = 0;
|
LiveRangeInfo &LRI) const = 0;
|
||||||
|
|
||||||
virtual void suggestRegs4CallArgs(const MachineInstr *CallI,
|
virtual void suggestRegs4CallArgs(const MachineInstr *CallI,
|
||||||
@ -117,7 +117,7 @@ public:
|
|||||||
virtual void suggestReg4RetValue(const MachineInstr *RetI,
|
virtual void suggestReg4RetValue(const MachineInstr *RetI,
|
||||||
LiveRangeInfo &LRI) const = 0;
|
LiveRangeInfo &LRI) const = 0;
|
||||||
|
|
||||||
virtual void colorMethodArgs(const Method *Meth, LiveRangeInfo &LRI,
|
virtual void colorMethodArgs(const Function *Func, LiveRangeInfo &LRI,
|
||||||
AddedInstrns *FirstAI) const = 0;
|
AddedInstrns *FirstAI) const = 0;
|
||||||
|
|
||||||
virtual void colorCallArgs(const MachineInstr *CalI,
|
virtual void colorCallArgs(const MachineInstr *CalI,
|
||||||
|
@ -88,7 +88,7 @@ private:
|
|||||||
// transformMethod - This transforms the instructions of the method to use the
|
// transformMethod - This transforms the instructions of the method to use the
|
||||||
// new types.
|
// new types.
|
||||||
//
|
//
|
||||||
void transformMethod(Method *M);
|
void transformMethod(Function *F);
|
||||||
|
|
||||||
// removeDeadGlobals - This removes the old versions of methods that are no
|
// removeDeadGlobals - This removes the old versions of methods that are no
|
||||||
// longer needed.
|
// longer needed.
|
||||||
|
@ -14,9 +14,9 @@ namespace cfg { class IntervalPartition; }
|
|||||||
struct InductionVariableCannonicalize : public MethodPass {
|
struct InductionVariableCannonicalize : public MethodPass {
|
||||||
// doInductionVariableCannonicalize - Simplify induction variables in loops
|
// doInductionVariableCannonicalize - Simplify induction variables in loops
|
||||||
//
|
//
|
||||||
static bool doIt(Method *M, cfg::IntervalPartition &IP);
|
static bool doIt(Function *M, cfg::IntervalPartition &IP);
|
||||||
|
|
||||||
virtual bool runOnMethod(Method *M);
|
virtual bool runOnMethod(Function *M);
|
||||||
|
|
||||||
// getAnalysisUsageInfo - Declare that we need IntervalPartitions
|
// getAnalysisUsageInfo - Declare that we need IntervalPartitions
|
||||||
void getAnalysisUsageInfo(Pass::AnalysisSet &Required,
|
void getAnalysisUsageInfo(Pass::AnalysisSet &Required,
|
||||||
|
@ -23,11 +23,11 @@ public:
|
|||||||
//
|
//
|
||||||
// If there are no return stmts in the Method, a null pointer is returned.
|
// If there are no return stmts in the Method, a null pointer is returned.
|
||||||
//
|
//
|
||||||
static bool doit(Method *M, BasicBlock *&ExitNode);
|
static bool doit(Function *F, BasicBlock *&ExitNode);
|
||||||
|
|
||||||
|
|
||||||
virtual bool runOnMethod(Method *M) {
|
virtual bool runOnMethod(Function *F) {
|
||||||
return doit(M, ExitNode);
|
return doit(F, ExitNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
BasicBlock *getExitNode() const { return ExitNode; }
|
BasicBlock *getExitNode() const { return ExitNode; }
|
||||||
|
@ -23,7 +23,8 @@ class MethodArgument;
|
|||||||
class Instruction;
|
class Instruction;
|
||||||
class BasicBlock;
|
class BasicBlock;
|
||||||
class GlobalValue;
|
class GlobalValue;
|
||||||
class Method;
|
class Function;
|
||||||
|
typedef Function Method;
|
||||||
class GlobalVariable;
|
class GlobalVariable;
|
||||||
class Module;
|
class Module;
|
||||||
class SymbolTable;
|
class SymbolTable;
|
||||||
@ -274,10 +275,10 @@ template <> inline bool isa<BasicBlock, const Value*>(const Value *Val) {
|
|||||||
template <> inline bool isa<BasicBlock, Value*>(Value *Val) {
|
template <> inline bool isa<BasicBlock, Value*>(Value *Val) {
|
||||||
return Val->getValueType() == Value::BasicBlockVal;
|
return Val->getValueType() == Value::BasicBlockVal;
|
||||||
}
|
}
|
||||||
template <> inline bool isa<Method, const Value*>(const Value *Val) {
|
template <> inline bool isa<Function, const Value*>(const Value *Val) {
|
||||||
return Val->getValueType() == Value::MethodVal;
|
return Val->getValueType() == Value::MethodVal;
|
||||||
}
|
}
|
||||||
template <> inline bool isa<Method, Value*>(Value *Val) {
|
template <> inline bool isa<Function, Value*>(Value *Val) {
|
||||||
return Val->getValueType() == Value::MethodVal;
|
return Val->getValueType() == Value::MethodVal;
|
||||||
}
|
}
|
||||||
template <> inline bool isa<GlobalVariable, const Value*>(const Value *Val) {
|
template <> inline bool isa<GlobalVariable, const Value*>(const Value *Val) {
|
||||||
@ -287,10 +288,10 @@ template <> inline bool isa<GlobalVariable, Value*>(Value *Val) {
|
|||||||
return Val->getValueType() == Value::GlobalVariableVal;
|
return Val->getValueType() == Value::GlobalVariableVal;
|
||||||
}
|
}
|
||||||
template <> inline bool isa<GlobalValue, const Value*>(const Value *Val) {
|
template <> inline bool isa<GlobalValue, const Value*>(const Value *Val) {
|
||||||
return isa<GlobalVariable>(Val) || isa<Method>(Val);
|
return isa<GlobalVariable>(Val) || isa<Function>(Val);
|
||||||
}
|
}
|
||||||
template <> inline bool isa<GlobalValue, Value*>(Value *Val) {
|
template <> inline bool isa<GlobalValue, Value*>(Value *Val) {
|
||||||
return isa<GlobalVariable>(Val) || isa<Method>(Val);
|
return isa<GlobalVariable>(Val) || isa<Function>(Val);
|
||||||
}
|
}
|
||||||
template <> inline bool isa<Module, const Value*>(const Value *Val) {
|
template <> inline bool isa<Module, const Value*>(const Value *Val) {
|
||||||
return Val->getValueType() == Value::ModuleVal;
|
return Val->getValueType() == Value::ModuleVal;
|
||||||
|
@ -205,8 +205,8 @@ public:
|
|||||||
// getCalledMethod - Return the method called, or null if this is an indirect
|
// getCalledMethod - Return the method called, or null if this is an indirect
|
||||||
// method invocation...
|
// method invocation...
|
||||||
//
|
//
|
||||||
inline const Method *getCalledMethod() const {
|
inline const Function *getCalledMethod() const {
|
||||||
return dyn_cast<Method>(Operands[0].get());
|
return dyn_cast<Function>(Operands[0].get());
|
||||||
}
|
}
|
||||||
inline Method *getCalledMethod() {
|
inline Method *getCalledMethod() {
|
||||||
return dyn_cast<Method>(Operands[0].get());
|
return dyn_cast<Method>(Operands[0].get());
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
#include "llvm/Analysis/LiveVar/ValueSet.h"
|
#include "llvm/Analysis/LiveVar/ValueSet.h"
|
||||||
#include "llvm/Annotation.h"
|
#include "llvm/Annotation.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
class Method;
|
|
||||||
class BasicBlock;
|
class BasicBlock;
|
||||||
class Value;
|
class Value;
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ LEVEL = ../..
|
|||||||
|
|
||||||
LIBRARYNAME = analysis
|
LIBRARYNAME = analysis
|
||||||
|
|
||||||
DIRS = LiveVar IPA
|
DIRS = LiveVar IPA DataStructure
|
||||||
|
|
||||||
include $(LEVEL)/Makefile.common
|
include $(LEVEL)/Makefile.common
|
||||||
|
|
||||||
|
@ -27,12 +27,6 @@
|
|||||||
#define BCR_TRACE(n, X)
|
#define BCR_TRACE(n, X)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class BasicBlock;
|
|
||||||
class Method;
|
|
||||||
class Module;
|
|
||||||
class Type;
|
|
||||||
class PointerType;
|
|
||||||
|
|
||||||
typedef unsigned char uchar;
|
typedef unsigned char uchar;
|
||||||
|
|
||||||
struct RawInst { // The raw fields out of the bytecode stream...
|
struct RawInst { // The raw fields out of the bytecode stream...
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
class Value;
|
class Value;
|
||||||
class Module;
|
class Module;
|
||||||
class Method;
|
class Function;
|
||||||
class MethodArgument;
|
class MethodArgument;
|
||||||
class BasicBlock;
|
class BasicBlock;
|
||||||
class Instruction;
|
class Instruction;
|
||||||
@ -34,7 +34,8 @@ class SlotCalculator {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
SlotCalculator(const Module *M, bool IgnoreNamed);
|
SlotCalculator(const Module *M, bool IgnoreNamed);
|
||||||
SlotCalculator(const Method *M, bool IgnoreNamed);// Start out in incorp state
|
// Start out in incorp state
|
||||||
|
SlotCalculator(const Function *M, bool IgnoreNamed);
|
||||||
inline ~SlotCalculator() {}
|
inline ~SlotCalculator() {}
|
||||||
|
|
||||||
// getValSlot returns < 0 on error!
|
// getValSlot returns < 0 on error!
|
||||||
@ -52,7 +53,7 @@ public:
|
|||||||
// If you'd like to deal with a method, use these two methods to get its data
|
// If you'd like to deal with a method, use these two methods to get its data
|
||||||
// into the SlotCalculator!
|
// into the SlotCalculator!
|
||||||
//
|
//
|
||||||
void incorporateMethod(const Method *M);
|
void incorporateMethod(const Function *F);
|
||||||
void purgeMethod();
|
void purgeMethod();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -28,7 +28,7 @@ class Value;
|
|||||||
class Instruction;
|
class Instruction;
|
||||||
class TerminatorInst;
|
class TerminatorInst;
|
||||||
class BasicBlock;
|
class BasicBlock;
|
||||||
class Method;
|
class Function;
|
||||||
class TargetMachine;
|
class TargetMachine;
|
||||||
class SchedGraphEdge;
|
class SchedGraphEdge;
|
||||||
class SchedGraphNode;
|
class SchedGraphNode;
|
||||||
@ -339,7 +339,7 @@ class SchedGraphSet :
|
|||||||
private std::hash_map<const BasicBlock*, SchedGraph*>
|
private std::hash_map<const BasicBlock*, SchedGraph*>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
const Method* method;
|
const Function* method;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef std::hash_map<const BasicBlock*, SchedGraph*> map_base;
|
typedef std::hash_map<const BasicBlock*, SchedGraph*> map_base;
|
||||||
@ -347,7 +347,7 @@ public:
|
|||||||
using map_base::const_iterator;
|
using map_base::const_iterator;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/*ctor*/ SchedGraphSet (const Method* _method,
|
/*ctor*/ SchedGraphSet (const Function * function,
|
||||||
const TargetMachine& target);
|
const TargetMachine& target);
|
||||||
/*dtor*/ ~SchedGraphSet ();
|
/*dtor*/ ~SchedGraphSet ();
|
||||||
|
|
||||||
@ -379,7 +379,7 @@ private:
|
|||||||
//
|
//
|
||||||
// Graph builder
|
// Graph builder
|
||||||
//
|
//
|
||||||
void buildGraphsForMethod (const Method *method,
|
void buildGraphsForMethod (const Function *F,
|
||||||
const TargetMachine& target);
|
const TargetMachine& target);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
#include <ext/hash_set>
|
#include <ext/hash_set>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
class Method;
|
class Function;
|
||||||
class MachineInstr;
|
class MachineInstr;
|
||||||
class SchedulingManager;
|
class SchedulingManager;
|
||||||
class MethodLiveVarInfo;
|
class MethodLiveVarInfo;
|
||||||
@ -125,7 +125,8 @@ private:
|
|||||||
|
|
||||||
class SchedPriorities: public NonCopyable {
|
class SchedPriorities: public NonCopyable {
|
||||||
public:
|
public:
|
||||||
SchedPriorities(const Method *M, const SchedGraph *G, MethodLiveVarInfo &LVI);
|
SchedPriorities(const Function *F, const SchedGraph *G,
|
||||||
|
MethodLiveVarInfo &LVI);
|
||||||
|
|
||||||
|
|
||||||
// This must be called before scheduling begins.
|
// This must be called before scheduling begins.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//===-- LiveRangeInfo.h - Track all LiveRanges for a Method ------*- C++ -*-==//
|
//===-- LiveRangeInfo.h - Track all LiveRanges for a Function ----*- C++ -*-==//
|
||||||
//
|
//
|
||||||
// This file contains the class LiveRangeInfo which constructs and keeps
|
// This file contains the class LiveRangeInfo which constructs and keeps
|
||||||
// the LiveRangMap which contains all the live ranges used in a method.
|
// the LiveRangMap which contains all the live ranges used in a method.
|
||||||
@ -28,7 +28,7 @@ class RegClass;
|
|||||||
class MachineRegInfo;
|
class MachineRegInfo;
|
||||||
class TargetMachine;
|
class TargetMachine;
|
||||||
class Value;
|
class Value;
|
||||||
class Method;
|
class Function;
|
||||||
class Instruction;
|
class Instruction;
|
||||||
|
|
||||||
typedef std::hash_map<const Value*, LiveRange*> LiveRangeMapType;
|
typedef std::hash_map<const Value*, LiveRange*> LiveRangeMapType;
|
||||||
@ -42,7 +42,7 @@ typedef std::vector<const MachineInstr*> CallRetInstrListType;
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
class LiveRangeInfo {
|
class LiveRangeInfo {
|
||||||
const Method *const Meth; // Method for which live range info is held
|
const Function *const Meth; // Func for which live range info is held
|
||||||
LiveRangeMapType LiveRangeMap; // A map from Value * to LiveRange * to
|
LiveRangeMapType LiveRangeMap; // A map from Value * to LiveRange * to
|
||||||
// record all live ranges in a method
|
// record all live ranges in a method
|
||||||
// created by constructLiveRanges
|
// created by constructLiveRanges
|
||||||
@ -64,11 +64,11 @@ class LiveRangeInfo {
|
|||||||
|
|
||||||
void suggestRegs4CallRets();
|
void suggestRegs4CallRets();
|
||||||
|
|
||||||
const Method* getMethod() { return Meth; }
|
const Function *getMethod() { return Meth; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
LiveRangeInfo(const Method *M,
|
LiveRangeInfo(const Function *F,
|
||||||
const TargetMachine& tm,
|
const TargetMachine& tm,
|
||||||
std::vector<RegClass *> & RCList);
|
std::vector<RegClass *> & RCList);
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ class Value;
|
|||||||
class Instruction;
|
class Instruction;
|
||||||
class TerminatorInst;
|
class TerminatorInst;
|
||||||
class BasicBlock;
|
class BasicBlock;
|
||||||
class Method;
|
class Function;
|
||||||
class TargetMachine;
|
class TargetMachine;
|
||||||
class SchedGraphEdge;
|
class SchedGraphEdge;
|
||||||
class SchedGraphNode;
|
class SchedGraphNode;
|
||||||
@ -339,7 +339,7 @@ class SchedGraphSet :
|
|||||||
private std::hash_map<const BasicBlock*, SchedGraph*>
|
private std::hash_map<const BasicBlock*, SchedGraph*>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
const Method* method;
|
const Function* method;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef std::hash_map<const BasicBlock*, SchedGraph*> map_base;
|
typedef std::hash_map<const BasicBlock*, SchedGraph*> map_base;
|
||||||
@ -347,7 +347,7 @@ public:
|
|||||||
using map_base::const_iterator;
|
using map_base::const_iterator;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/*ctor*/ SchedGraphSet (const Method* _method,
|
/*ctor*/ SchedGraphSet (const Function * function,
|
||||||
const TargetMachine& target);
|
const TargetMachine& target);
|
||||||
/*dtor*/ ~SchedGraphSet ();
|
/*dtor*/ ~SchedGraphSet ();
|
||||||
|
|
||||||
@ -379,7 +379,7 @@ private:
|
|||||||
//
|
//
|
||||||
// Graph builder
|
// Graph builder
|
||||||
//
|
//
|
||||||
void buildGraphsForMethod (const Method *method,
|
void buildGraphsForMethod (const Function *F,
|
||||||
const TargetMachine& target);
|
const TargetMachine& target);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
#include <ext/hash_set>
|
#include <ext/hash_set>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
class Method;
|
class Function;
|
||||||
class MachineInstr;
|
class MachineInstr;
|
||||||
class SchedulingManager;
|
class SchedulingManager;
|
||||||
class MethodLiveVarInfo;
|
class MethodLiveVarInfo;
|
||||||
@ -125,7 +125,8 @@ private:
|
|||||||
|
|
||||||
class SchedPriorities: public NonCopyable {
|
class SchedPriorities: public NonCopyable {
|
||||||
public:
|
public:
|
||||||
SchedPriorities(const Method *M, const SchedGraph *G, MethodLiveVarInfo &LVI);
|
SchedPriorities(const Function *F, const SchedGraph *G,
|
||||||
|
MethodLiveVarInfo &LVI);
|
||||||
|
|
||||||
|
|
||||||
// This must be called before scheduling begins.
|
// This must be called before scheduling begins.
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
#include "llvm/Analysis/LiveVar/ValueSet.h"
|
#include "llvm/Analysis/LiveVar/ValueSet.h"
|
||||||
#include "llvm/Annotation.h"
|
#include "llvm/Annotation.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
class Method;
|
|
||||||
class BasicBlock;
|
class BasicBlock;
|
||||||
class Value;
|
class Value;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//===-- LiveRangeInfo.h - Track all LiveRanges for a Method ------*- C++ -*-==//
|
//===-- LiveRangeInfo.h - Track all LiveRanges for a Function ----*- C++ -*-==//
|
||||||
//
|
//
|
||||||
// This file contains the class LiveRangeInfo which constructs and keeps
|
// This file contains the class LiveRangeInfo which constructs and keeps
|
||||||
// the LiveRangMap which contains all the live ranges used in a method.
|
// the LiveRangMap which contains all the live ranges used in a method.
|
||||||
@ -28,7 +28,7 @@ class RegClass;
|
|||||||
class MachineRegInfo;
|
class MachineRegInfo;
|
||||||
class TargetMachine;
|
class TargetMachine;
|
||||||
class Value;
|
class Value;
|
||||||
class Method;
|
class Function;
|
||||||
class Instruction;
|
class Instruction;
|
||||||
|
|
||||||
typedef std::hash_map<const Value*, LiveRange*> LiveRangeMapType;
|
typedef std::hash_map<const Value*, LiveRange*> LiveRangeMapType;
|
||||||
@ -42,7 +42,7 @@ typedef std::vector<const MachineInstr*> CallRetInstrListType;
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
class LiveRangeInfo {
|
class LiveRangeInfo {
|
||||||
const Method *const Meth; // Method for which live range info is held
|
const Function *const Meth; // Func for which live range info is held
|
||||||
LiveRangeMapType LiveRangeMap; // A map from Value * to LiveRange * to
|
LiveRangeMapType LiveRangeMap; // A map from Value * to LiveRange * to
|
||||||
// record all live ranges in a method
|
// record all live ranges in a method
|
||||||
// created by constructLiveRanges
|
// created by constructLiveRanges
|
||||||
@ -64,11 +64,11 @@ class LiveRangeInfo {
|
|||||||
|
|
||||||
void suggestRegs4CallRets();
|
void suggestRegs4CallRets();
|
||||||
|
|
||||||
const Method* getMethod() { return Meth; }
|
const Function *getMethod() { return Meth; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
LiveRangeInfo(const Method *M,
|
LiveRangeInfo(const Function *F,
|
||||||
const TargetMachine& tm,
|
const TargetMachine& tm,
|
||||||
std::vector<RegClass *> & RCList);
|
std::vector<RegClass *> & RCList);
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
#include "llvm/iOperators.h"
|
#include "llvm/iOperators.h"
|
||||||
#include "llvm/iPHINode.h"
|
#include "llvm/iPHINode.h"
|
||||||
|
|
||||||
class Method;
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
||||||
//get the code to be inserted on the edge
|
//get the code to be inserted on the edge
|
||||||
|
@ -25,13 +25,14 @@
|
|||||||
template class ValueHolder<MethodArgument, Method, Method>;
|
template class ValueHolder<MethodArgument, Method, Method>;
|
||||||
template class ValueHolder<BasicBlock , Method, Method>;
|
template class ValueHolder<BasicBlock , Method, Method>;
|
||||||
|
|
||||||
Method::Method(const MethodType *Ty, bool isInternal, const std::string &name)
|
Function::Function(const MethodType *Ty, bool isInternal,
|
||||||
|
const std::string &name)
|
||||||
: GlobalValue(PointerType::get(Ty), Value::MethodVal, isInternal, name),
|
: GlobalValue(PointerType::get(Ty), Value::MethodVal, isInternal, name),
|
||||||
SymTabValue(this), BasicBlocks(this), ArgumentList(this, this) {
|
SymTabValue(this), BasicBlocks(this), ArgumentList(this, this) {
|
||||||
assert(::isa<MethodType>(Ty) && "Method signature must be of method type!");
|
assert(::isa<MethodType>(Ty) && "Method signature must be of method type!");
|
||||||
}
|
}
|
||||||
|
|
||||||
Method::~Method() {
|
Function::~Function() {
|
||||||
dropAllReferences(); // After this it is safe to delete instructions.
|
dropAllReferences(); // After this it is safe to delete instructions.
|
||||||
|
|
||||||
// TODO: Should remove from the end, not the beginning of vector!
|
// TODO: Should remove from the end, not the beginning of vector!
|
||||||
@ -45,7 +46,7 @@ Method::~Method() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Specialize setName to take care of symbol table majik
|
// Specialize setName to take care of symbol table majik
|
||||||
void Method::setName(const std::string &name, SymbolTable *ST) {
|
void Function::setName(const std::string &name, SymbolTable *ST) {
|
||||||
Module *P;
|
Module *P;
|
||||||
assert((ST == 0 || (!getParent() || ST == getParent()->getSymbolTable())) &&
|
assert((ST == 0 || (!getParent() || ST == getParent()->getSymbolTable())) &&
|
||||||
"Invalid symtab argument!");
|
"Invalid symtab argument!");
|
||||||
@ -54,18 +55,18 @@ void Method::setName(const std::string &name, SymbolTable *ST) {
|
|||||||
if (P && getName() != "") P->getSymbolTableSure()->insert(this);
|
if (P && getName() != "") P->getSymbolTableSure()->insert(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Method::setParent(Module *parent) {
|
void Function::setParent(Module *parent) {
|
||||||
Parent = parent;
|
Parent = parent;
|
||||||
|
|
||||||
// Relink symbol tables together...
|
// Relink symbol tables together...
|
||||||
setParentSymTab(Parent ? Parent->getSymbolTableSure() : 0);
|
setParentSymTab(Parent ? Parent->getSymbolTableSure() : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MethodType *Method::getMethodType() const {
|
const MethodType *Function::getMethodType() const {
|
||||||
return cast<MethodType>(cast<PointerType>(getType())->getElementType());
|
return cast<MethodType>(cast<PointerType>(getType())->getElementType());
|
||||||
}
|
}
|
||||||
|
|
||||||
const Type *Method::getReturnType() const {
|
const Type *Function::getReturnType() const {
|
||||||
return getMethodType()->getReturnType();
|
return getMethodType()->getReturnType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +78,7 @@ const Type *Method::getReturnType() const {
|
|||||||
// valid on an object that has "dropped all references", except operator
|
// valid on an object that has "dropped all references", except operator
|
||||||
// delete.
|
// delete.
|
||||||
//
|
//
|
||||||
void Method::dropAllReferences() {
|
void Function::dropAllReferences() {
|
||||||
for_each(begin(), end(), std::mem_fun(&BasicBlock::dropAllReferences));
|
for_each(begin(), end(), std::mem_fun(&BasicBlock::dropAllReferences));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,7 +347,7 @@ template<> struct PassManagerTraits<BasicBlock> : public BasicBlockPass {
|
|||||||
typedef PassClass BatcherClass;
|
typedef PassClass BatcherClass;
|
||||||
|
|
||||||
// ParentClass - The type of the parent PassManager...
|
// ParentClass - The type of the parent PassManager...
|
||||||
typedef PassManagerT<Method> ParentClass;
|
typedef PassManagerT<Function> ParentClass;
|
||||||
|
|
||||||
// PMType - The type of the passmanager that subclasses this class
|
// PMType - The type of the passmanager that subclasses this class
|
||||||
typedef PassManagerT<BasicBlock> PMType;
|
typedef PassManagerT<BasicBlock> PMType;
|
||||||
@ -371,12 +371,12 @@ template<> struct PassManagerTraits<BasicBlock> : public BasicBlockPass {
|
|||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// PassManagerTraits<Method> Specialization
|
// PassManagerTraits<Function> Specialization
|
||||||
//
|
//
|
||||||
// This pass manager is used to group together all of the MethodPass's
|
// This pass manager is used to group together all of the MethodPass's
|
||||||
// into a single unit.
|
// into a single unit.
|
||||||
//
|
//
|
||||||
template<> struct PassManagerTraits<Method> : public MethodPass {
|
template<> struct PassManagerTraits<Function> : public MethodPass {
|
||||||
// PassClass - The type of passes tracked by this PassManager
|
// PassClass - The type of passes tracked by this PassManager
|
||||||
typedef MethodPass PassClass;
|
typedef MethodPass PassClass;
|
||||||
|
|
||||||
@ -390,20 +390,20 @@ template<> struct PassManagerTraits<Method> : public MethodPass {
|
|||||||
typedef PassManagerT<Module> ParentClass;
|
typedef PassManagerT<Module> ParentClass;
|
||||||
|
|
||||||
// PMType - The type of the passmanager that subclasses this class
|
// PMType - The type of the passmanager that subclasses this class
|
||||||
typedef PassManagerT<Method> PMType;
|
typedef PassManagerT<Function> PMType;
|
||||||
|
|
||||||
// runPass - Specify how the pass should be run on the UnitType
|
// runPass - Specify how the pass should be run on the UnitType
|
||||||
static bool runPass(PassClass *P, Method *M) {
|
static bool runPass(PassClass *P, Function *M) {
|
||||||
return P->runOnMethod(M);
|
return P->runOnMethod(M);
|
||||||
}
|
}
|
||||||
|
|
||||||
// getPMName() - Return the name of the unit the PassManager operates on for
|
// getPMName() - Return the name of the unit the PassManager operates on for
|
||||||
// debugging.
|
// debugging.
|
||||||
const char *getPMName() const { return "Method"; }
|
const char *getPMName() const { return "Function"; }
|
||||||
|
|
||||||
// Implement the MethodPass interface...
|
// Implement the MethodPass interface...
|
||||||
virtual bool doInitialization(Module *M);
|
virtual bool doInitialization(Module *M);
|
||||||
virtual bool runOnMethod(Method *M);
|
virtual bool runOnMethod(Function *M);
|
||||||
virtual bool doFinalization(Module *M);
|
virtual bool doFinalization(Module *M);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -422,7 +422,7 @@ template<> struct PassManagerTraits<Module> : public Pass {
|
|||||||
typedef MethodPass SubPassClass;
|
typedef MethodPass SubPassClass;
|
||||||
|
|
||||||
// BatcherClass - The type to use for collation of subtypes...
|
// BatcherClass - The type to use for collation of subtypes...
|
||||||
typedef PassManagerT<Method> BatcherClass;
|
typedef PassManagerT<Function> BatcherClass;
|
||||||
|
|
||||||
// ParentClass - The type of the parent PassManager...
|
// ParentClass - The type of the parent PassManager...
|
||||||
typedef AnalysisResolver ParentClass;
|
typedef AnalysisResolver ParentClass;
|
||||||
@ -467,20 +467,20 @@ inline bool PassManagerTraits<BasicBlock>::doFinalization(Module *M) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// PassManagerTraits<Method> Implementations
|
// PassManagerTraits<Function> Implementations
|
||||||
//
|
//
|
||||||
inline bool PassManagerTraits<Method>::doInitialization(Module *M) {
|
inline bool PassManagerTraits<Function>::doInitialization(Module *M) {
|
||||||
bool Changed = false;
|
bool Changed = false;
|
||||||
for (unsigned i = 0, e = ((PMType*)this)->Passes.size(); i != e; ++i)
|
for (unsigned i = 0, e = ((PMType*)this)->Passes.size(); i != e; ++i)
|
||||||
((PMType*)this)->Passes[i]->doInitialization(M);
|
((PMType*)this)->Passes[i]->doInitialization(M);
|
||||||
return Changed;
|
return Changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool PassManagerTraits<Method>::runOnMethod(Method *M) {
|
inline bool PassManagerTraits<Function>::runOnMethod(Function *M) {
|
||||||
return ((PMType*)this)->runOnUnit(M);
|
return ((PMType*)this)->runOnUnit(M);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool PassManagerTraits<Method>::doFinalization(Module *M) {
|
inline bool PassManagerTraits<Function>::doFinalization(Module *M) {
|
||||||
bool Changed = false;
|
bool Changed = false;
|
||||||
for (unsigned i = 0, e = ((PMType*)this)->Passes.size(); i != e; ++i)
|
for (unsigned i = 0, e = ((PMType*)this)->Passes.size(); i != e; ++i)
|
||||||
((PMType*)this)->Passes[i]->doFinalization(M);
|
((PMType*)this)->Passes[i]->doFinalization(M);
|
||||||
|
Reference in New Issue
Block a user