summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-02-04 17:39:42 +0000
committerChris Lattner <sabre@nondot.org>2002-02-04 17:39:42 +0000
commit8a352d597c623d554533ba6ae8c07154c7c5d0a4 (patch)
treeb1c9ebb2e1d821b4ee39ee320790da786d2ee73f /llvm/lib/CodeGen
parent519af2962d70736c9545cc09622c973671266898 (diff)
downloadbcm5719-llvm-8a352d597c623d554533ba6ae8c07154c7c5d0a4.tar.gz
bcm5719-llvm-8a352d597c623d554533ba6ae8c07154c7c5d0a4.zip
Make LoopDeptCalculator be an internal artifact of how RegAlloc is implemented,
do not expose it. Additionally, have it be auto generated by the pass framework for us. llvm-svn: 1695
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp b/llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp
index 422541c5845..946a1e9c1b5 100644
--- a/llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp
+++ b/llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp
@@ -15,6 +15,7 @@
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineCodeForMethod.h"
#include "llvm/Analysis/LiveVar/MethodLiveVarInfo.h"
+#include "llvm/Analysis/LoopDepth.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/MachineFrameInfo.h"
#include "llvm/Method.h"
@@ -50,12 +51,19 @@ namespace {
MethodLiveVarInfo LVI(M); // Analyze live varaibles
LVI.analyze();
- PhyRegAlloc PRA(M, Target, &LVI); // allocate registers
+ PhyRegAlloc PRA(M, Target, &LVI,
+ &getAnalysis<cfg::LoopDepthCalculator>());
PRA.allocateRegisters();
if (DEBUG_RA) cerr << "\nRegister allocation complete!\n";
return false;
}
+
+ virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Requires,
+ Pass::AnalysisSet &Destroyed,
+ Pass::AnalysisSet &Provided) {
+ Requires.push_back(cfg::LoopDepthCalculator::ID);
+ }
};
}
@@ -68,13 +76,14 @@ MethodPass *getRegisterAllocator(TargetMachine &T) {
//----------------------------------------------------------------------------
PhyRegAlloc::PhyRegAlloc(Method *M,
const TargetMachine& tm,
- MethodLiveVarInfo *const Lvi)
+ MethodLiveVarInfo *Lvi,
+ cfg::LoopDepthCalculator *LDC)
: TM(tm), Meth(M),
mcInfo(MachineCodeForMethod::get(M)),
LVI(Lvi), LRI(M, tm, RegClassList),
MRI( tm.getRegInfo() ),
NumOfRegClasses(MRI.getNumOfRegClasses()),
- LoopDepthCalc(M) {
+ LoopDepthCalc(LDC) {
// create each RegisterClass and put in RegClassList
//
@@ -272,7 +281,7 @@ void PhyRegAlloc::buildInterferenceGraphs()
// find the 10^(loop_depth) of this BB
//
- BBLoopDepthCost = (unsigned) pow( 10.0, LoopDepthCalc.getLoopDepth(*BBI));
+ BBLoopDepthCost = (unsigned) pow( 10.0, LoopDepthCalc->getLoopDepth(*BBI));
// get the iterator for machine instructions
//
OpenPOWER on IntegriCloud