Thanks!<div><br></div><div>-eric<br><br><div class="gmail_quote">On Wed, Feb 13, 2013 at 12:23 PM, Manman Ren <span dir="ltr"><<a href="mailto:mren@apple.com" target="_blank">mren@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: mren<br>
Date: Wed Feb 13 14:23:48 2013<br>
New Revision: 175072<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=175072&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=175072&view=rev</a><br>
Log:<br>
Clean up LDV, no functionality change.<br>
<br>
Remove dead functions: renameRegister<br>
Move private member variables from LDV to Impl<br>
Remove ssp/uwtable from testing case<br>
<br>
Modified:<br>
llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp<br>
llvm/trunk/lib/CodeGen/LiveDebugVariables.h<br>
llvm/trunk/test/DebugInfo/X86/misched-dbg-value.ll<br>
<br>
Modified: llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp?rev=175072&r1=175071&r2=175072&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp?rev=175072&r1=175071&r2=175072&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp Wed Feb 13 14:23:48 2013<br>
@@ -64,8 +64,7 @@ void LiveDebugVariables::getAnalysisUsag<br>
MachineFunctionPass::getAnalysisUsage(AU);<br>
}<br>
<br>
-LiveDebugVariables::LiveDebugVariables() : MachineFunctionPass(ID), pImpl(0),<br>
- EmitDone(false), ModifiedMF(false) {<br>
+LiveDebugVariables::LiveDebugVariables() : MachineFunctionPass(ID), pImpl(0) {<br>
initializeLiveDebugVariablesPass(*PassRegistry::getPassRegistry());<br>
}<br>
<br>
@@ -248,10 +247,6 @@ public:<br>
LiveIntervals &LIS, MachineDominatorTree &MDT,<br>
UserValueScopes &UVS);<br>
<br>
- /// renameRegister - Update locations to rewrite OldReg as NewReg:SubIdx.<br>
- void renameRegister(unsigned OldReg, unsigned NewReg, unsigned SubIdx,<br>
- const TargetRegisterInfo *TRI);<br>
-<br>
/// splitRegister - Replace OldReg ranges with NewRegs ranges where NewRegs is<br>
/// live. Returns true if any changes were made.<br>
bool splitRegister(unsigned OldLocNo, ArrayRef<LiveInterval*> NewRegs);<br>
@@ -287,6 +282,11 @@ class LDVImpl {<br>
MachineDominatorTree *MDT;<br>
const TargetRegisterInfo *TRI;<br>
<br>
+ /// Whether emitDebugValues is called.<br>
+ bool EmitDone;<br>
+ /// Whether the machine function is modified during the pass.<br>
+ bool ModifiedMF;<br>
+<br>
/// userValues - All allocated UserValue instances.<br>
SmallVector<UserValue*, 8> userValues;<br>
<br>
@@ -321,23 +321,26 @@ class LDVImpl {<br>
void computeIntervals();<br>
<br>
public:<br>
- LDVImpl(LiveDebugVariables *ps) : pass(*ps) {}<br>
+ LDVImpl(LiveDebugVariables *ps) : pass(*ps), EmitDone(false),<br>
+ ModifiedMF(false) {}<br>
bool runOnMachineFunction(MachineFunction &mf);<br>
<br>
- /// clear - Relase all memory.<br>
+ /// clear - Release all memory.<br>
void clear() {<br>
DeleteContainerPointers(userValues);<br>
userValues.clear();<br>
virtRegToEqClass.clear();<br>
userVarMap.clear();<br>
+ // Make sure we call emitDebugValues if the machine function was modified.<br>
+ assert((!ModifiedMF || EmitDone) &&<br>
+ "Dbg values are not emitted in LDV");<br>
+ EmitDone = false;<br>
+ ModifiedMF = false;<br>
}<br>
<br>
/// mapVirtReg - Map virtual register to an equivalence class.<br>
void mapVirtReg(unsigned VirtReg, UserValue *EC);<br>
<br>
- /// renameRegister - Replace all references to OldReg with NewReg:SubIdx.<br>
- void renameRegister(unsigned OldReg, unsigned NewReg, unsigned SubIdx);<br>
-<br>
/// splitRegister - Replace all references to OldReg with NewRegs.<br>
void splitRegister(unsigned OldReg, ArrayRef<LiveInterval*> NewRegs);<br>
<br>
@@ -694,6 +697,7 @@ bool LDVImpl::runOnMachineFunction(Machi<br>
computeIntervals();<br>
DEBUG(print(dbgs()));<br>
LS.releaseMemory();<br>
+ ModifiedMF = Changed;<br>
return Changed;<br>
}<br>
<br>
@@ -702,17 +706,12 @@ bool LiveDebugVariables::runOnMachineFun<br>
return false;<br>
if (!pImpl)<br>
pImpl = new LDVImpl(this);<br>
- ModifiedMF = static_cast<LDVImpl*>(pImpl)->runOnMachineFunction(mf);<br>
- return ModifiedMF;<br>
+ return static_cast<LDVImpl*>(pImpl)->runOnMachineFunction(mf);<br>
}<br>
<br>
void LiveDebugVariables::releaseMemory() {<br>
- if (pImpl) {<br>
+ if (pImpl)<br>
static_cast<LDVImpl*>(pImpl)->clear();<br>
- // Make sure we call emitDebugValues if the machine function was modified.<br>
- assert((!ModifiedMF || EmitDone) &&<br>
- "Dbg values are not emitted in LDV");<br>
- }<br>
}<br>
<br>
LiveDebugVariables::~LiveDebugVariables() {<br>
@@ -720,45 +719,6 @@ LiveDebugVariables::~LiveDebugVariables(<br>
delete static_cast<LDVImpl*>(pImpl);<br>
}<br>
<br>
-void UserValue::<br>
-renameRegister(unsigned OldReg, unsigned NewReg, unsigned SubIdx,<br>
- const TargetRegisterInfo *TRI) {<br>
- for (unsigned i = locations.size(); i; --i) {<br>
- unsigned LocNo = i - 1;<br>
- MachineOperand &Loc = locations[LocNo];<br>
- if (!Loc.isReg() || Loc.getReg() != OldReg)<br>
- continue;<br>
- if (TargetRegisterInfo::isPhysicalRegister(NewReg))<br>
- Loc.substPhysReg(NewReg, *TRI);<br>
- else<br>
- Loc.substVirtReg(NewReg, SubIdx, *TRI);<br>
- coalesceLocation(LocNo);<br>
- }<br>
-}<br>
-<br>
-void LDVImpl::<br>
-renameRegister(unsigned OldReg, unsigned NewReg, unsigned SubIdx) {<br>
- UserValue *UV = lookupVirtReg(OldReg);<br>
- if (!UV)<br>
- return;<br>
-<br>
- if (TargetRegisterInfo::isVirtualRegister(NewReg))<br>
- mapVirtReg(NewReg, UV);<br>
- if (OldReg != NewReg)<br>
- virtRegToEqClass.erase(OldReg);<br>
-<br>
- do {<br>
- UV->renameRegister(OldReg, NewReg, SubIdx, TRI);<br>
- UV = UV->getNext();<br>
- } while (UV);<br>
-}<br>
-<br>
-void LiveDebugVariables::<br>
-renameRegister(unsigned OldReg, unsigned NewReg, unsigned SubIdx) {<br>
- if (pImpl)<br>
- static_cast<LDVImpl*>(pImpl)->renameRegister(OldReg, NewReg, SubIdx);<br>
-}<br>
-<br>
//===----------------------------------------------------------------------===//<br>
// Live Range Splitting<br>
//===----------------------------------------------------------------------===//<br>
@@ -1017,13 +977,12 @@ void LDVImpl::emitDebugValues(VirtRegMap<br>
userValues[i]->rewriteLocations(*VRM, *TRI);<br>
userValues[i]->emitDebugValues(VRM, *LIS, *TII);<br>
}<br>
+ EmitDone = true;<br>
}<br>
<br>
void LiveDebugVariables::emitDebugValues(VirtRegMap *VRM) {<br>
- if (pImpl) {<br>
+ if (pImpl)<br>
static_cast<LDVImpl*>(pImpl)->emitDebugValues(VRM);<br>
- EmitDone = true;<br>
- }<br>
}<br>
<br>
<br>
<br>
Modified: llvm/trunk/lib/CodeGen/LiveDebugVariables.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveDebugVariables.h?rev=175072&r1=175071&r2=175072&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveDebugVariables.h?rev=175072&r1=175071&r2=175072&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/LiveDebugVariables.h (original)<br>
+++ llvm/trunk/lib/CodeGen/LiveDebugVariables.h Wed Feb 13 14:23:48 2013<br>
@@ -31,10 +31,6 @@ class VirtRegMap;<br>
<br>
class LiveDebugVariables : public MachineFunctionPass {<br>
void *pImpl;<br>
- /// Whether emitDebugValues is called.<br>
- bool EmitDone;<br>
- /// Whether the machine function is modified during the pass.<br>
- bool ModifiedMF;<br>
public:<br>
static char ID; // Pass identification, replacement for typeid<br>
<br>
<br>
Modified: llvm/trunk/test/DebugInfo/X86/misched-dbg-value.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/misched-dbg-value.ll?rev=175072&r1=175071&r2=175072&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/misched-dbg-value.ll?rev=175072&r1=175071&r2=175072&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/DebugInfo/X86/misched-dbg-value.ll (original)<br>
+++ llvm/trunk/test/DebugInfo/X86/misched-dbg-value.ll Wed Feb 13 14:23:48 2013<br>
@@ -33,7 +33,7 @@<br>
@PtrGlb = common global %struct.Record* null, align 8<br>
@PtrGlbNext = common global %struct.Record* null, align 8<br>
<br>
-define void @Proc8(i32* nocapture %Array1Par, [51 x i32]* nocapture %Array2Par, i32 %IntParI1, i32 %IntParI2) nounwind optsize ssp uwtable {<br>
+define void @Proc8(i32* nocapture %Array1Par, [51 x i32]* nocapture %Array2Par, i32 %IntParI1, i32 %IntParI2) nounwind optsize {<br>
entry:<br>
tail call void @llvm.dbg.value(metadata !{i32* %Array1Par}, i64 0, metadata !23), !dbg !64<br>
tail call void @llvm.dbg.value(metadata !{[51 x i32]* %Array2Par}, i64 0, metadata !24), !dbg !65<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>