diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-05-20 02:44:36 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-05-20 02:44:36 +0000 |
commit | e1b93d2e86a3396b1b1d3d761f0335b17c5f54b8 (patch) | |
tree | baf7f73e8698d519e385115cb764c5a09bffcff3 /lib/CodeGen/RegisterCoalescer.cpp | |
parent | 92a05fa4507102e1891f1de3523fb5aaf0d9398c (diff) | |
download | llvm-e1b93d2e86a3396b1b1d3d761f0335b17c5f54b8.tar.gz llvm-e1b93d2e86a3396b1b1d3d761f0335b17c5f54b8.tar.bz2 llvm-e1b93d2e86a3396b1b1d3d761f0335b17c5f54b8.tar.xz |
Eliminate some uses of struct LiveRange.
That struct ought to be a LiveInterval implementation detail.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157143 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegisterCoalescer.cpp')
-rw-r--r-- | lib/CodeGen/RegisterCoalescer.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/lib/CodeGen/RegisterCoalescer.cpp b/lib/CodeGen/RegisterCoalescer.cpp index 7831906c62..c7dcde6c22 100644 --- a/lib/CodeGen/RegisterCoalescer.cpp +++ b/lib/CodeGen/RegisterCoalescer.cpp @@ -1212,7 +1212,7 @@ static bool RegistersDefinedFromSameValue(LiveIntervals &li, const TargetRegisterInfo &tri, CoalescerPair &CP, VNInfo *VNI, - LiveRange *LR, + VNInfo *OtherVNI, SmallVector<MachineInstr*, 8> &DupCopies) { // FIXME: This is very conservative. For example, we don't handle // physical registers. @@ -1236,8 +1236,7 @@ static bool RegistersDefinedFromSameValue(LiveIntervals &li, std::swap(A, B); assert(Dst == A); - VNInfo *Other = LR->valno; - const MachineInstr *OtherMI = li.getInstructionFromIndex(Other->def); + const MachineInstr *OtherMI = li.getInstructionFromIndex(OtherVNI->def); if (!OtherMI || !OtherMI->isFullCopy()) return false; @@ -1259,7 +1258,7 @@ static bool RegistersDefinedFromSameValue(LiveIntervals &li, LiveInterval &SrcInt = li.getInterval(Src); // getVNInfoBefore returns NULL for undef copies. In this case, the // optimization is still safe. - if (SrcInt.getVNInfoBefore(Other->def) != SrcInt.getVNInfoBefore(VNI->def)) + if (SrcInt.getVNInfoBefore(OtherVNI->def) != SrcInt.getVNInfoBefore(VNI->def)) return false; DupCopies.push_back(MI); @@ -1304,17 +1303,19 @@ bool RegisterCoalescer::joinIntervals(CoalescerPair &CP) { continue; // Figure out the value # from the RHS. - LiveRange *lr = RHS.getLiveRangeContaining(VNI->def.getPrevSlot()); + VNInfo *OtherVNI = RHS.getVNInfoBefore(VNI->def); // The copy could be to an aliased physreg. - if (!lr) continue; + if (!OtherVNI) + continue; // DstReg is known to be a register in the LHS interval. If the src is // from the RHS interval, we can use its value #. if (!CP.isCoalescable(MI) && - !RegistersDefinedFromSameValue(*LIS, *TRI, CP, VNI, lr, DupCopies)) + !RegistersDefinedFromSameValue(*LIS, *TRI, CP, VNI, OtherVNI, + DupCopies)) continue; - LHSValsDefinedFromRHS[VNI] = lr->valno; + LHSValsDefinedFromRHS[VNI] = OtherVNI; DeadCopies.push_back(MI); } @@ -1331,17 +1332,19 @@ bool RegisterCoalescer::joinIntervals(CoalescerPair &CP) { continue; // Figure out the value # from the LHS. - LiveRange *lr = LHS.getLiveRangeContaining(VNI->def.getPrevSlot()); + VNInfo *OtherVNI = LHS.getVNInfoBefore(VNI->def); // The copy could be to an aliased physreg. - if (!lr) continue; + if (!OtherVNI) + continue; // DstReg is known to be a register in the RHS interval. If the src is // from the LHS interval, we can use its value #. if (!CP.isCoalescable(MI) && - !RegistersDefinedFromSameValue(*LIS, *TRI, CP, VNI, lr, DupCopies)) + !RegistersDefinedFromSameValue(*LIS, *TRI, CP, VNI, OtherVNI, + DupCopies)) continue; - RHSValsDefinedFromLHS[VNI] = lr->valno; + RHSValsDefinedFromLHS[VNI] = OtherVNI; DeadCopies.push_back(MI); } |