aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/RegAllocBasic.cpp
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2012-02-21 04:51:23 +0000
committerAndrew Trick <atrick@apple.com>2012-02-21 04:51:23 +0000
commitda84e6468304500dc65813aee8728bee18ac6578 (patch)
tree82aa6ab0593f8013f860f9141b97bafadbc89db4 /llvm/lib/CodeGen/RegAllocBasic.cpp
parent5c714e79859116672383af512efc032dc1cb5ca7 (diff)
downloadllvm-da84e6468304500dc65813aee8728bee18ac6578.zip
llvm-da84e6468304500dc65813aee8728bee18ac6578.tar.gz
llvm-da84e6468304500dc65813aee8728bee18ac6578.tar.bz2
Clear virtual registers after they are no longer referenced.
Passes after RegAlloc should be able to rely on MRI->getNumVirtRegs() == 0. This makes sharing code for pre/postRA passes more robust. Now, to check if a pass is running before the RA pipeline begins, use MRI->isSSA(). To check if a pass is running after the RA pipeline ends, use !MRI->getNumVirtRegs(). PEI resets virtual regs when it's done scavenging. PTX will either have to provide its own PEI pass or assign physregs. llvm-svn: 151032
Diffstat (limited to 'llvm/lib/CodeGen/RegAllocBasic.cpp')
-rw-r--r--llvm/lib/CodeGen/RegAllocBasic.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/RegAllocBasic.cpp b/llvm/lib/CodeGen/RegAllocBasic.cpp
index 18d6f47..d1b289b 100644
--- a/llvm/lib/CodeGen/RegAllocBasic.cpp
+++ b/llvm/lib/CodeGen/RegAllocBasic.cpp
@@ -342,7 +342,10 @@ bool RABasic::runOnMachineFunction(MachineFunction &mf) {
// Write out new DBG_VALUE instructions.
getAnalysis<LiveDebugVariables>().emitDebugValues(VRM);
- // The pass output is in VirtRegMap. Release all the transient data.
+ // All machine operands and other references to virtual registers have been
+ // replaced. Remove the virtual registers and release all the transient data.
+ VRM->clearAllVirt();
+ MRI->clearVirtRegs();
releaseMemory();
return true;