summaryrefslogtreecommitdiff
path: root/lib/CodeGen/LiveStackAnalysis.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2009-05-03 18:32:42 +0000
committerEvan Cheng <evan.cheng@apple.com>2009-05-03 18:32:42 +0000
commitc781a243a3d17e7e763515794168d8fa6043f565 (patch)
treedcaf1b9201cdb221cb2206858891575d2b241bbb /lib/CodeGen/LiveStackAnalysis.cpp
parent87e3caf81939db20d2359bd38df2ed206040026d (diff)
downloadllvm-c781a243a3d17e7e763515794168d8fa6043f565.tar.gz
llvm-c781a243a3d17e7e763515794168d8fa6043f565.tar.bz2
llvm-c781a243a3d17e7e763515794168d8fa6043f565.tar.xz
In some rare cases, the register allocator can spill registers but end up not utilizing registers at all. The fundamental problem is linearscan's backtracking can end up freeing more than one allocated registers. However, reloads and restores might be folded into uses / defs and freed registers might not be used at all.
VirtRegMap keeps track of allocations so it knows what's not used. As a horrible hack, the stack coloring can color spill slots with *free* registers. That is, it replace reload and spills with copies from and to the free register. It unfold instructions that load and store the spill slot and replace them with register using variants. Not yet enabled. This is part 1. More coming. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70787 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveStackAnalysis.cpp')
-rw-r--r--lib/CodeGen/LiveStackAnalysis.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/CodeGen/LiveStackAnalysis.cpp b/lib/CodeGen/LiveStackAnalysis.cpp
index 2baf699c66..c68a2d9a80 100644
--- a/lib/CodeGen/LiveStackAnalysis.cpp
+++ b/lib/CodeGen/LiveStackAnalysis.cpp
@@ -32,7 +32,8 @@ void LiveStacks::getAnalysisUsage(AnalysisUsage &AU) const {
void LiveStacks::releaseMemory() {
// Release VNInfo memroy regions after all VNInfo objects are dtor'd.
VNInfoAllocator.Reset();
- s2iMap.clear();
+ S2IMap.clear();
+ S2RCMap.clear();
}
bool LiveStacks::runOnMachineFunction(MachineFunction &) {
@@ -42,10 +43,15 @@ bool LiveStacks::runOnMachineFunction(MachineFunction &) {
}
/// print - Implement the dump method.
-void LiveStacks::print(std::ostream &O, const Module* ) const {
+void LiveStacks::print(std::ostream &O, const Module*) const {
O << "********** INTERVALS **********\n";
for (const_iterator I = begin(), E = end(); I != E; ++I) {
I->second.print(O);
- O << "\n";
+ int Slot = I->first;
+ const TargetRegisterClass *RC = getIntervalRegClass(Slot);
+ if (RC)
+ O << " [" << RC->getName() << "]\n";
+ else
+ O << " [Unknown]\n";
}
}