mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-09-27 15:57:13 +00:00
s/Method/Function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2180 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
75cf7cf00d
commit
b7653df085
@ -36,7 +36,7 @@ typedef std::vector<unsigned> ReservedColorListType;
|
|||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
class RegClass {
|
class RegClass {
|
||||||
const Method *const Meth; // Method we are working on
|
const Function *const Meth; // Function we are working on
|
||||||
const MachineRegClassInfo *const MRC; // corresponding MRC
|
const MachineRegClassInfo *const MRC; // corresponding MRC
|
||||||
const unsigned RegClassID; // my int ID
|
const unsigned RegClassID; // my int ID
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ class RegClass {
|
|||||||
const ReservedColorListType *const ReservedColorList;
|
const ReservedColorListType *const ReservedColorList;
|
||||||
//
|
//
|
||||||
// for passing registers that are pre-allocated and cannot be used by the
|
// for passing registers that are pre-allocated and cannot be used by the
|
||||||
// register allocator for this method.
|
// register allocator for this function.
|
||||||
|
|
||||||
bool *IsColorUsedArr;
|
bool *IsColorUsedArr;
|
||||||
//
|
//
|
||||||
@ -69,14 +69,13 @@ class RegClass {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
RegClass(const Method *const M,
|
RegClass(const Function *M,
|
||||||
const MachineRegClassInfo *const MRC,
|
const MachineRegClassInfo *MRC,
|
||||||
const ReservedColorListType *const RCL = NULL);
|
const ReservedColorListType *RCL = 0);
|
||||||
|
|
||||||
~RegClass() { delete[] IsColorUsedArr; };
|
~RegClass() { delete[] IsColorUsedArr; }
|
||||||
|
|
||||||
inline void createInterferenceGraph()
|
inline void createInterferenceGraph() { IG.createGraph(); }
|
||||||
{ IG.createGraph(); }
|
|
||||||
|
|
||||||
inline InterferenceGraph &getIG() { return IG; }
|
inline InterferenceGraph &getIG() { return IG; }
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ struct InstVisitor {
|
|||||||
// Define visitors for modules, methods and basic blocks...
|
// Define visitors for modules, methods and basic blocks...
|
||||||
//
|
//
|
||||||
void visit(Module *M) { visit(M->begin(), M->end()); }
|
void visit(Module *M) { visit(M->begin(), M->end()); }
|
||||||
void visit(Method *M) { visit(M->begin(), M->end()); }
|
void visit(Function *F) { visit(F->begin(), F->end()); }
|
||||||
void visit(BasicBlock *BB) { visit(BB->begin(), BB->end()); }
|
void visit(BasicBlock *BB) { visit(BB->begin(), BB->end()); }
|
||||||
|
|
||||||
// visit - Finally, code to visit an instruction...
|
// visit - Finally, code to visit an instruction...
|
||||||
|
@ -208,8 +208,8 @@ public:
|
|||||||
inline const Function *getCalledFunction() const {
|
inline const Function *getCalledFunction() const {
|
||||||
return dyn_cast<Function>(Operands[0].get());
|
return dyn_cast<Function>(Operands[0].get());
|
||||||
}
|
}
|
||||||
inline Method *getCalledFunction() {
|
inline Function *getCalledFunction() {
|
||||||
return dyn_cast<Method>(Operands[0].get());
|
return dyn_cast<Function>(Operands[0].get());
|
||||||
}
|
}
|
||||||
|
|
||||||
// getCalledValue - Get a pointer to a method that is invoked by this inst.
|
// getCalledValue - Get a pointer to a method that is invoked by this inst.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//===-- MethodLiveVarInfo.cpp - Live Variable Analysis for a Method -------===//
|
//===-- MethodLiveVarInfo.cpp - Live Variable Analysis for a Function -----===//
|
||||||
//
|
//
|
||||||
// This is the interface to method level live variable information that is
|
// This is the interface to method level live variable information that is
|
||||||
// provided by live variable analysis.
|
// provided by live variable analysis.
|
||||||
@ -42,7 +42,7 @@ const ValueSet &MethodLiveVarInfo::getInSetOfBB(const BasicBlock *BB) const {
|
|||||||
// Performs live var analysis for a method
|
// Performs live var analysis for a method
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool MethodLiveVarInfo::runOnMethod(Method *Meth) {
|
bool MethodLiveVarInfo::runOnMethod(Function *Meth) {
|
||||||
M = Meth;
|
M = Meth;
|
||||||
if (DEBUG_LV) std::cerr << "Analysing live variables ...\n";
|
if (DEBUG_LV) std::cerr << "Analysing live variables ...\n";
|
||||||
|
|
||||||
@ -62,10 +62,10 @@ bool MethodLiveVarInfo::runOnMethod(Method *Meth) {
|
|||||||
// constructs BBLiveVars and init Def and In sets
|
// constructs BBLiveVars and init Def and In sets
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void MethodLiveVarInfo::constructBBs(const Method *M) {
|
void MethodLiveVarInfo::constructBBs(const Function *M) {
|
||||||
unsigned int POId = 0; // Reverse Depth-first Order ID
|
unsigned int POId = 0; // Reverse Depth-first Order ID
|
||||||
|
|
||||||
for(po_iterator<const Method*> BBI = po_begin(M), BBE = po_end(M);
|
for(po_iterator<const Function*> BBI = po_begin(M), BBE = po_end(M);
|
||||||
BBI != BBE; ++BBI, ++POId) {
|
BBI != BBE; ++BBI, ++POId) {
|
||||||
const BasicBlock *BB = *BBI; // get the current BB
|
const BasicBlock *BB = *BBI; // get the current BB
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ void MethodLiveVarInfo::constructBBs(const Method *M) {
|
|||||||
// However, LV info is not correct for those blocks (they are not
|
// However, LV info is not correct for those blocks (they are not
|
||||||
// analyzed)
|
// analyzed)
|
||||||
//
|
//
|
||||||
for (Method::const_iterator BBRI = M->begin(), BBRE = M->end();
|
for (Function::const_iterator BBRI = M->begin(), BBRE = M->end();
|
||||||
BBRI != BBRE; ++BBRI, ++POId)
|
BBRI != BBRE; ++BBRI, ++POId)
|
||||||
if (!BBLiveVar::GetFromBB(*BBRI)) // Not yet processed?
|
if (!BBLiveVar::GetFromBB(*BBRI)) // Not yet processed?
|
||||||
BBLiveVar::CreateOnBB(*BBRI, POId);
|
BBLiveVar::CreateOnBB(*BBRI, POId);
|
||||||
@ -94,11 +94,11 @@ void MethodLiveVarInfo::constructBBs(const Method *M) {
|
|||||||
// do one backward pass over the CFG (for iterative analysis)
|
// do one backward pass over the CFG (for iterative analysis)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool MethodLiveVarInfo::doSingleBackwardPass(const Method *M, unsigned int iter) {
|
bool MethodLiveVarInfo::doSingleBackwardPass(const Function *M, unsigned int iter) {
|
||||||
if (DEBUG_LV) std::cerr << "\n After Backward Pass " << iter << "...\n";
|
if (DEBUG_LV) std::cerr << "\n After Backward Pass " << iter << "...\n";
|
||||||
|
|
||||||
bool NeedAnotherIteration = false;
|
bool NeedAnotherIteration = false;
|
||||||
for (po_iterator<const Method*> BBI = po_begin(M); BBI != po_end(M) ; ++BBI) {
|
for (po_iterator<const Function*> BBI = po_begin(M); BBI != po_end(M) ; ++BBI) {
|
||||||
BBLiveVar *LVBB = BBLiveVar::GetFromBB(*BBI);
|
BBLiveVar *LVBB = BBLiveVar::GetFromBB(*BBI);
|
||||||
assert(LVBB && "BasicBlock information not set for block!");
|
assert(LVBB && "BasicBlock information not set for block!");
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ bool MethodLiveVarInfo::doSingleBackwardPass(const Method *M, unsigned int iter)
|
|||||||
void MethodLiveVarInfo::releaseMemory() {
|
void MethodLiveVarInfo::releaseMemory() {
|
||||||
// First remove all BBLiveVar annotations created in constructBBs().
|
// First remove all BBLiveVar annotations created in constructBBs().
|
||||||
if (M)
|
if (M)
|
||||||
for (Method::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
|
for (Function::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
|
||||||
BBLiveVar::RemoveFromBB(*I);
|
BBLiveVar::RemoveFromBB(*I);
|
||||||
M = 0;
|
M = 0;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ bool cfg::Loop::contains(const BasicBlock *BB) const {
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// cfg::LoopInfo implementation
|
// cfg::LoopInfo implementation
|
||||||
//
|
//
|
||||||
bool cfg::LoopInfo::runOnMethod(Method *M) {
|
bool cfg::LoopInfo::runOnMethod(Function *F) {
|
||||||
BBMap.clear(); // Reset internal state of analysis
|
BBMap.clear(); // Reset internal state of analysis
|
||||||
TopLevelLoops.clear();
|
TopLevelLoops.clear();
|
||||||
Calculate(getAnalysis<DominatorSet>()); // Update
|
Calculate(getAnalysis<DominatorSet>()); // Update
|
||||||
|
@ -1504,13 +1504,13 @@ namespace {
|
|||||||
Destroyed.push_back(MethodLiveVarInfo::ID);
|
Destroyed.push_back(MethodLiveVarInfo::ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool runOnMethod(Method *M);
|
bool runOnMethod(Function *F);
|
||||||
};
|
};
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
InstructionSchedulingWithSSA::runOnMethod(Method *M)
|
InstructionSchedulingWithSSA::runOnMethod(Function *M)
|
||||||
{
|
{
|
||||||
if (SchedDebugLevel == Sched_Disable)
|
if (SchedDebugLevel == Sched_Disable)
|
||||||
return false;
|
return false;
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
using std::cerr;
|
using std::cerr;
|
||||||
|
|
||||||
SchedPriorities::SchedPriorities(const Method *method, const SchedGraph *G,
|
SchedPriorities::SchedPriorities(const Function *, const SchedGraph *G,
|
||||||
MethodLiveVarInfo &LVI)
|
MethodLiveVarInfo &LVI)
|
||||||
: curTime(0), graph(G), methodLiveVarInfo(LVI),
|
: curTime(0), graph(G), methodLiveVarInfo(LVI),
|
||||||
nodeDelayVec(G->getNumNodes(), INVALID_LATENCY), // make errors obvious
|
nodeDelayVec(G->getNumNodes(), INVALID_LATENCY), // make errors obvious
|
||||||
|
@ -62,7 +62,7 @@ typedef std::hash_map<const MachineInstr *, AddedInstrns *> AddedInstrMapType;
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// class PhyRegAlloc:
|
// class PhyRegAlloc:
|
||||||
// Main class the register allocator. Call allocateRegisters() to allocate
|
// Main class the register allocator. Call allocateRegisters() to allocate
|
||||||
// registers for a Method.
|
// registers for a Function.
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ class PhyRegAlloc: public NonCopyable {
|
|||||||
|
|
||||||
std::vector<RegClass *> RegClassList; // vector of register classes
|
std::vector<RegClass *> RegClassList; // vector of register classes
|
||||||
const TargetMachine &TM; // target machine
|
const TargetMachine &TM; // target machine
|
||||||
const Method* Meth; // name of the method we work on
|
const Function *Meth; // name of the function we work on
|
||||||
MachineCodeForMethod &mcInfo; // descriptor for method's native code
|
MachineCodeForMethod &mcInfo; // descriptor for method's native code
|
||||||
MethodLiveVarInfo *const LVI; // LV information for this method
|
MethodLiveVarInfo *const LVI; // LV information for this method
|
||||||
// (already computed for BBs)
|
// (already computed for BBs)
|
||||||
@ -85,7 +85,7 @@ class PhyRegAlloc: public NonCopyable {
|
|||||||
// currently not used
|
// currently not used
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PhyRegAlloc(Method *M, const TargetMachine& TM, MethodLiveVarInfo *Lvi,
|
PhyRegAlloc(Function *F, const TargetMachine& TM, MethodLiveVarInfo *Lvi,
|
||||||
cfg::LoopInfo *LoopDepthCalc);
|
cfg::LoopInfo *LoopDepthCalc);
|
||||||
~PhyRegAlloc();
|
~PhyRegAlloc();
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ typedef std::vector<unsigned> ReservedColorListType;
|
|||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
class RegClass {
|
class RegClass {
|
||||||
const Method *const Meth; // Method we are working on
|
const Function *const Meth; // Function we are working on
|
||||||
const MachineRegClassInfo *const MRC; // corresponding MRC
|
const MachineRegClassInfo *const MRC; // corresponding MRC
|
||||||
const unsigned RegClassID; // my int ID
|
const unsigned RegClassID; // my int ID
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ class RegClass {
|
|||||||
const ReservedColorListType *const ReservedColorList;
|
const ReservedColorListType *const ReservedColorList;
|
||||||
//
|
//
|
||||||
// for passing registers that are pre-allocated and cannot be used by the
|
// for passing registers that are pre-allocated and cannot be used by the
|
||||||
// register allocator for this method.
|
// register allocator for this function.
|
||||||
|
|
||||||
bool *IsColorUsedArr;
|
bool *IsColorUsedArr;
|
||||||
//
|
//
|
||||||
@ -69,14 +69,13 @@ class RegClass {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
RegClass(const Method *const M,
|
RegClass(const Function *M,
|
||||||
const MachineRegClassInfo *const MRC,
|
const MachineRegClassInfo *MRC,
|
||||||
const ReservedColorListType *const RCL = NULL);
|
const ReservedColorListType *RCL = 0);
|
||||||
|
|
||||||
~RegClass() { delete[] IsColorUsedArr; };
|
~RegClass() { delete[] IsColorUsedArr; }
|
||||||
|
|
||||||
inline void createInterferenceGraph()
|
inline void createInterferenceGraph() { IG.createGraph(); }
|
||||||
{ IG.createGraph(); }
|
|
||||||
|
|
||||||
inline InterferenceGraph &getIG() { return IG; }
|
inline InterferenceGraph &getIG() { return IG; }
|
||||||
|
|
||||||
|
@ -1504,13 +1504,13 @@ namespace {
|
|||||||
Destroyed.push_back(MethodLiveVarInfo::ID);
|
Destroyed.push_back(MethodLiveVarInfo::ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool runOnMethod(Method *M);
|
bool runOnMethod(Function *F);
|
||||||
};
|
};
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
InstructionSchedulingWithSSA::runOnMethod(Method *M)
|
InstructionSchedulingWithSSA::runOnMethod(Function *M)
|
||||||
{
|
{
|
||||||
if (SchedDebugLevel == Sched_Disable)
|
if (SchedDebugLevel == Sched_Disable)
|
||||||
return false;
|
return false;
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
using std::cerr;
|
using std::cerr;
|
||||||
|
|
||||||
SchedPriorities::SchedPriorities(const Method *method, const SchedGraph *G,
|
SchedPriorities::SchedPriorities(const Function *, const SchedGraph *G,
|
||||||
MethodLiveVarInfo &LVI)
|
MethodLiveVarInfo &LVI)
|
||||||
: curTime(0), graph(G), methodLiveVarInfo(LVI),
|
: curTime(0), graph(G), methodLiveVarInfo(LVI),
|
||||||
nodeDelayVec(G->getNumNodes(), INVALID_LATENCY), // make errors obvious
|
nodeDelayVec(G->getNumNodes(), INVALID_LATENCY), // make errors obvious
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//===-- MethodLiveVarInfo.cpp - Live Variable Analysis for a Method -------===//
|
//===-- MethodLiveVarInfo.cpp - Live Variable Analysis for a Function -----===//
|
||||||
//
|
//
|
||||||
// This is the interface to method level live variable information that is
|
// This is the interface to method level live variable information that is
|
||||||
// provided by live variable analysis.
|
// provided by live variable analysis.
|
||||||
@ -42,7 +42,7 @@ const ValueSet &MethodLiveVarInfo::getInSetOfBB(const BasicBlock *BB) const {
|
|||||||
// Performs live var analysis for a method
|
// Performs live var analysis for a method
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool MethodLiveVarInfo::runOnMethod(Method *Meth) {
|
bool MethodLiveVarInfo::runOnMethod(Function *Meth) {
|
||||||
M = Meth;
|
M = Meth;
|
||||||
if (DEBUG_LV) std::cerr << "Analysing live variables ...\n";
|
if (DEBUG_LV) std::cerr << "Analysing live variables ...\n";
|
||||||
|
|
||||||
@ -62,10 +62,10 @@ bool MethodLiveVarInfo::runOnMethod(Method *Meth) {
|
|||||||
// constructs BBLiveVars and init Def and In sets
|
// constructs BBLiveVars and init Def and In sets
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void MethodLiveVarInfo::constructBBs(const Method *M) {
|
void MethodLiveVarInfo::constructBBs(const Function *M) {
|
||||||
unsigned int POId = 0; // Reverse Depth-first Order ID
|
unsigned int POId = 0; // Reverse Depth-first Order ID
|
||||||
|
|
||||||
for(po_iterator<const Method*> BBI = po_begin(M), BBE = po_end(M);
|
for(po_iterator<const Function*> BBI = po_begin(M), BBE = po_end(M);
|
||||||
BBI != BBE; ++BBI, ++POId) {
|
BBI != BBE; ++BBI, ++POId) {
|
||||||
const BasicBlock *BB = *BBI; // get the current BB
|
const BasicBlock *BB = *BBI; // get the current BB
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ void MethodLiveVarInfo::constructBBs(const Method *M) {
|
|||||||
// However, LV info is not correct for those blocks (they are not
|
// However, LV info is not correct for those blocks (they are not
|
||||||
// analyzed)
|
// analyzed)
|
||||||
//
|
//
|
||||||
for (Method::const_iterator BBRI = M->begin(), BBRE = M->end();
|
for (Function::const_iterator BBRI = M->begin(), BBRE = M->end();
|
||||||
BBRI != BBRE; ++BBRI, ++POId)
|
BBRI != BBRE; ++BBRI, ++POId)
|
||||||
if (!BBLiveVar::GetFromBB(*BBRI)) // Not yet processed?
|
if (!BBLiveVar::GetFromBB(*BBRI)) // Not yet processed?
|
||||||
BBLiveVar::CreateOnBB(*BBRI, POId);
|
BBLiveVar::CreateOnBB(*BBRI, POId);
|
||||||
@ -94,11 +94,11 @@ void MethodLiveVarInfo::constructBBs(const Method *M) {
|
|||||||
// do one backward pass over the CFG (for iterative analysis)
|
// do one backward pass over the CFG (for iterative analysis)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool MethodLiveVarInfo::doSingleBackwardPass(const Method *M, unsigned int iter) {
|
bool MethodLiveVarInfo::doSingleBackwardPass(const Function *M, unsigned int iter) {
|
||||||
if (DEBUG_LV) std::cerr << "\n After Backward Pass " << iter << "...\n";
|
if (DEBUG_LV) std::cerr << "\n After Backward Pass " << iter << "...\n";
|
||||||
|
|
||||||
bool NeedAnotherIteration = false;
|
bool NeedAnotherIteration = false;
|
||||||
for (po_iterator<const Method*> BBI = po_begin(M); BBI != po_end(M) ; ++BBI) {
|
for (po_iterator<const Function*> BBI = po_begin(M); BBI != po_end(M) ; ++BBI) {
|
||||||
BBLiveVar *LVBB = BBLiveVar::GetFromBB(*BBI);
|
BBLiveVar *LVBB = BBLiveVar::GetFromBB(*BBI);
|
||||||
assert(LVBB && "BasicBlock information not set for block!");
|
assert(LVBB && "BasicBlock information not set for block!");
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ bool MethodLiveVarInfo::doSingleBackwardPass(const Method *M, unsigned int iter)
|
|||||||
void MethodLiveVarInfo::releaseMemory() {
|
void MethodLiveVarInfo::releaseMemory() {
|
||||||
// First remove all BBLiveVar annotations created in constructBBs().
|
// First remove all BBLiveVar annotations created in constructBBs().
|
||||||
if (M)
|
if (M)
|
||||||
for (Method::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
|
for (Function::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
|
||||||
BBLiveVar::RemoveFromBB(*I);
|
BBLiveVar::RemoveFromBB(*I);
|
||||||
M = 0;
|
M = 0;
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ typedef std::hash_map<const MachineInstr *, AddedInstrns *> AddedInstrMapType;
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// class PhyRegAlloc:
|
// class PhyRegAlloc:
|
||||||
// Main class the register allocator. Call allocateRegisters() to allocate
|
// Main class the register allocator. Call allocateRegisters() to allocate
|
||||||
// registers for a Method.
|
// registers for a Function.
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ class PhyRegAlloc: public NonCopyable {
|
|||||||
|
|
||||||
std::vector<RegClass *> RegClassList; // vector of register classes
|
std::vector<RegClass *> RegClassList; // vector of register classes
|
||||||
const TargetMachine &TM; // target machine
|
const TargetMachine &TM; // target machine
|
||||||
const Method* Meth; // name of the method we work on
|
const Function *Meth; // name of the function we work on
|
||||||
MachineCodeForMethod &mcInfo; // descriptor for method's native code
|
MachineCodeForMethod &mcInfo; // descriptor for method's native code
|
||||||
MethodLiveVarInfo *const LVI; // LV information for this method
|
MethodLiveVarInfo *const LVI; // LV information for this method
|
||||||
// (already computed for BBs)
|
// (already computed for BBs)
|
||||||
@ -85,7 +85,7 @@ class PhyRegAlloc: public NonCopyable {
|
|||||||
// currently not used
|
// currently not used
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PhyRegAlloc(Method *M, const TargetMachine& TM, MethodLiveVarInfo *Lvi,
|
PhyRegAlloc(Function *F, const TargetMachine& TM, MethodLiveVarInfo *Lvi,
|
||||||
cfg::LoopInfo *LoopDepthCalc);
|
cfg::LoopInfo *LoopDepthCalc);
|
||||||
~PhyRegAlloc();
|
~PhyRegAlloc();
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ typedef std::vector<unsigned> ReservedColorListType;
|
|||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
class RegClass {
|
class RegClass {
|
||||||
const Method *const Meth; // Method we are working on
|
const Function *const Meth; // Function we are working on
|
||||||
const MachineRegClassInfo *const MRC; // corresponding MRC
|
const MachineRegClassInfo *const MRC; // corresponding MRC
|
||||||
const unsigned RegClassID; // my int ID
|
const unsigned RegClassID; // my int ID
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ class RegClass {
|
|||||||
const ReservedColorListType *const ReservedColorList;
|
const ReservedColorListType *const ReservedColorList;
|
||||||
//
|
//
|
||||||
// for passing registers that are pre-allocated and cannot be used by the
|
// for passing registers that are pre-allocated and cannot be used by the
|
||||||
// register allocator for this method.
|
// register allocator for this function.
|
||||||
|
|
||||||
bool *IsColorUsedArr;
|
bool *IsColorUsedArr;
|
||||||
//
|
//
|
||||||
@ -69,14 +69,13 @@ class RegClass {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
RegClass(const Method *const M,
|
RegClass(const Function *M,
|
||||||
const MachineRegClassInfo *const MRC,
|
const MachineRegClassInfo *MRC,
|
||||||
const ReservedColorListType *const RCL = NULL);
|
const ReservedColorListType *RCL = 0);
|
||||||
|
|
||||||
~RegClass() { delete[] IsColorUsedArr; };
|
~RegClass() { delete[] IsColorUsedArr; }
|
||||||
|
|
||||||
inline void createInterferenceGraph()
|
inline void createInterferenceGraph() { IG.createGraph(); }
|
||||||
{ IG.createGraph(); }
|
|
||||||
|
|
||||||
inline InterferenceGraph &getIG() { return IG; }
|
inline InterferenceGraph &getIG() { return IG; }
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ public:
|
|||||||
// returned in `minstrVec'. Any temporary registers (TmpInstruction)
|
// returned in `minstrVec'. Any temporary registers (TmpInstruction)
|
||||||
// created are returned in `tempVec'.
|
// 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,
|
||||||
@ -139,7 +139,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*>& minstr,
|
std::vector<MachineInstr*>& minstr,
|
||||||
@ -150,7 +150,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*>& minstr,
|
std::vector<MachineInstr*>& minstr,
|
||||||
@ -159,7 +159,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*>& minstr) const;
|
std::vector<MachineInstr*>& minstr) const;
|
||||||
@ -353,7 +353,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.
|
||||||
//
|
//
|
||||||
void suggestRegs4MethodArgs(const Method *Meth,
|
void suggestRegs4MethodArgs(const Function *Meth,
|
||||||
LiveRangeInfo& LRI) const;
|
LiveRangeInfo& LRI) const;
|
||||||
|
|
||||||
void suggestRegs4CallArgs(const MachineInstr *CallMI,
|
void suggestRegs4CallArgs(const MachineInstr *CallMI,
|
||||||
@ -364,7 +364,7 @@ public:
|
|||||||
LiveRangeInfo& LRI) const;
|
LiveRangeInfo& LRI) const;
|
||||||
|
|
||||||
|
|
||||||
void colorMethodArgs(const Method *Meth, LiveRangeInfo &LRI,
|
void colorMethodArgs(const Function *Meth, LiveRangeInfo &LRI,
|
||||||
AddedInstrns *FirstAI) const;
|
AddedInstrns *FirstAI) const;
|
||||||
|
|
||||||
void colorCallArgs(const MachineInstr *CallMI, LiveRangeInfo &LRI,
|
void colorCallArgs(const MachineInstr *CallMI, LiveRangeInfo &LRI,
|
||||||
|
@ -334,14 +334,14 @@ void UltraSparcRegInfo::suggestReg4CallAddr(const MachineInstr * CallMI,
|
|||||||
// If the arg is passed on stack due to the lack of regs, NOTHING will be
|
// If the arg is passed on stack due to the lack of regs, NOTHING will be
|
||||||
// done - it will be colored (or spilled) as a normal live range.
|
// done - it will be colored (or spilled) as a normal live range.
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void UltraSparcRegInfo::suggestRegs4MethodArgs(const Method *Meth,
|
void UltraSparcRegInfo::suggestRegs4MethodArgs(const Function *Meth,
|
||||||
LiveRangeInfo& LRI) const
|
LiveRangeInfo& LRI) const
|
||||||
{
|
{
|
||||||
|
|
||||||
// get the argument list
|
// get the argument list
|
||||||
const Method::ArgumentListType& ArgList = Meth->getArgumentList();
|
const Function::ArgumentListType& ArgList = Meth->getArgumentList();
|
||||||
// get an iterator to arg list
|
// get an iterator to arg list
|
||||||
Method::ArgumentListType::const_iterator ArgIt = ArgList.begin();
|
Function::ArgumentListType::const_iterator ArgIt = ArgList.begin();
|
||||||
|
|
||||||
// for each argument
|
// for each argument
|
||||||
for( unsigned argNo=0; ArgIt != ArgList.end() ; ++ArgIt, ++argNo) {
|
for( unsigned argNo=0; ArgIt != ArgList.end() ; ++ArgIt, ++argNo) {
|
||||||
@ -383,15 +383,14 @@ void UltraSparcRegInfo::suggestRegs4MethodArgs(const Method *Meth,
|
|||||||
// the correct hardware registers if they did not receive the correct
|
// the correct hardware registers if they did not receive the correct
|
||||||
// (suggested) color through graph coloring.
|
// (suggested) color through graph coloring.
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void UltraSparcRegInfo::colorMethodArgs(const Method *Meth,
|
void UltraSparcRegInfo::colorMethodArgs(const Function *Meth,
|
||||||
LiveRangeInfo &LRI,
|
LiveRangeInfo &LRI,
|
||||||
AddedInstrns *FirstAI) const {
|
AddedInstrns *FirstAI) const {
|
||||||
|
|
||||||
// get the argument list
|
// get the argument list
|
||||||
const Method::ArgumentListType& ArgList = Meth->getArgumentList();
|
const Function::ArgumentListType& ArgList = Meth->getArgumentList();
|
||||||
// get an iterator to arg list
|
// get an iterator to arg list
|
||||||
Method::ArgumentListType::const_iterator ArgIt = ArgList.begin();
|
Function::ArgumentListType::const_iterator ArgIt = ArgList.begin();
|
||||||
|
|
||||||
MachineInstr *AdMI;
|
MachineInstr *AdMI;
|
||||||
|
|
||||||
|
|
||||||
@ -399,7 +398,7 @@ void UltraSparcRegInfo::colorMethodArgs(const Method *Meth,
|
|||||||
for( unsigned argNo=0; ArgIt != ArgList.end() ; ++ArgIt, ++argNo) {
|
for( unsigned argNo=0; ArgIt != ArgList.end() ; ++ArgIt, ++argNo) {
|
||||||
|
|
||||||
// get the LR of arg
|
// get the LR of arg
|
||||||
LiveRange *const LR = LRI.getLiveRangeForValue((const Value *) *ArgIt);
|
LiveRange *LR = LRI.getLiveRangeForValue(*ArgIt);
|
||||||
assert( LR && "No live range found for method arg");
|
assert( LR && "No live range found for method arg");
|
||||||
|
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ struct FreeMachineCodeForFunction : public MethodPass {
|
|||||||
I != E; ++I)
|
I != E; ++I)
|
||||||
MachineCodeForInstruction::get(*I).dropAllReferences();
|
MachineCodeForInstruction::get(*I).dropAllReferences();
|
||||||
|
|
||||||
for (Method::iterator FI = F->begin(), FE = F->end(); FI != FE; ++FI)
|
for (Function::iterator FI = F->begin(), FE = F->end(); FI != FE; ++FI)
|
||||||
for (BasicBlock::iterator I = (*FI)->begin(), E = (*FI)->end();
|
for (BasicBlock::iterator I = (*FI)->begin(), E = (*FI)->end();
|
||||||
I != E; ++I)
|
I != E; ++I)
|
||||||
freeMachineCode(*I);
|
freeMachineCode(*I);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//===-- BasicBlock.cpp - Implement BasicBlock related functions --*- C++ -*--=//
|
//===-- BasicBlock.cpp - Implement BasicBlock related functions --*- C++ -*--=//
|
||||||
//
|
//
|
||||||
// This file implements the Method class for the VMCore library.
|
// This file implements the BasicBlock class for the VMCore library.
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
@ -15,9 +15,9 @@
|
|||||||
// Instantiate Templates - This ugliness is the price we have to pay
|
// Instantiate Templates - This ugliness is the price we have to pay
|
||||||
// for having a ValueHolderImpl.h file seperate from ValueHolder.h! :(
|
// for having a ValueHolderImpl.h file seperate from ValueHolder.h! :(
|
||||||
//
|
//
|
||||||
template class ValueHolder<Instruction, BasicBlock, Method>;
|
template class ValueHolder<Instruction, BasicBlock, Function>;
|
||||||
|
|
||||||
BasicBlock::BasicBlock(const std::string &name, Method *Parent)
|
BasicBlock::BasicBlock(const std::string &name, Function *Parent)
|
||||||
: Value(Type::LabelTy, Value::BasicBlockVal, name), InstList(this, 0),
|
: Value(Type::LabelTy, Value::BasicBlockVal, name), InstList(this, 0),
|
||||||
machineInstrVec(new MachineCodeForBasicBlock) {
|
machineInstrVec(new MachineCodeForBasicBlock) {
|
||||||
if (Parent)
|
if (Parent)
|
||||||
@ -32,7 +32,7 @@ BasicBlock::~BasicBlock() {
|
|||||||
|
|
||||||
// Specialize setName to take care of symbol table majik
|
// Specialize setName to take care of symbol table majik
|
||||||
void BasicBlock::setName(const std::string &name, SymbolTable *ST) {
|
void BasicBlock::setName(const std::string &name, SymbolTable *ST) {
|
||||||
Method *P;
|
Function *P;
|
||||||
assert((ST == 0 || (!getParent() || ST == getParent()->getSymbolTable())) &&
|
assert((ST == 0 || (!getParent() || ST == getParent()->getSymbolTable())) &&
|
||||||
"Invalid symtab argument!");
|
"Invalid symtab argument!");
|
||||||
if ((P = getParent()) && hasName()) P->getSymbolTable()->remove(this);
|
if ((P = getParent()) && hasName()) P->getSymbolTable()->remove(this);
|
||||||
@ -40,7 +40,7 @@ void BasicBlock::setName(const std::string &name, SymbolTable *ST) {
|
|||||||
if (P && hasName()) P->getSymbolTable()->insert(this);
|
if (P && hasName()) P->getSymbolTable()->insert(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BasicBlock::setParent(Method *parent) {
|
void BasicBlock::setParent(Function *parent) {
|
||||||
if (getParent() && hasName())
|
if (getParent() && hasName())
|
||||||
getParent()->getSymbolTable()->remove(this);
|
getParent()->getSymbolTable()->remove(this);
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ namespace { // Anonymous namespace for class
|
|||||||
verifySymbolTable(M->getSymbolTable());
|
verifySymbolTable(M->getSymbolTable());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool runOnMethod(Method *M) { verifyMethod(M); return false; }
|
bool runOnMethod(Function *F) { verifyMethod(F); return false; }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user