From c781a243a3d17e7e763515794168d8fa6043f565 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Sun, 3 May 2009 18:32:42 +0000 Subject: 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 --- lib/CodeGen/LiveStackAnalysis.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'lib/CodeGen/LiveStackAnalysis.cpp') 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"; } } -- cgit v1.2.3