diff options
author | Stanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com> | 2018-06-04 17:21:54 +0000 |
---|---|---|
committer | Stanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com> | 2018-06-04 17:21:54 +0000 |
commit | 28624f94d5ab0f122996c7f83e2f723690395bde (patch) | |
tree | 1ddbe4572890ab8aa56ff030523fb1b453e5dfb6 /llvm/lib/Target/AMDGPU/GCNRegPressure.cpp | |
parent | c418b5cc25531f0551d4924f44bbbaa29c82ea14 (diff) | |
download | bcm5719-llvm-28624f94d5ab0f122996c7f83e2f723690395bde.tar.gz bcm5719-llvm-28624f94d5ab0f122996c7f83e2f723690395bde.zip |
[AMDGPU] Factored out common part of GCNRPTracker::reset()
Differential Revision: https://reviews.llvm.org/D47664
llvm-svn: 333931
Diffstat (limited to 'llvm/lib/Target/AMDGPU/GCNRegPressure.cpp')
-rw-r--r-- | llvm/lib/Target/AMDGPU/GCNRegPressure.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp b/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp index 4e569a27e97..53b552adb2d 100644 --- a/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp +++ b/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp @@ -284,18 +284,27 @@ GCNRPTracker::LiveRegSet llvm::getLiveRegs(SlotIndex SI, return LiveRegs; } -void GCNUpwardRPTracker::reset(const MachineInstr &MI, - const LiveRegSet *LiveRegsCopy) { - MRI = &MI.getParent()->getParent()->getRegInfo(); +void GCNRPTracker::reset(const MachineInstr &MI, + const LiveRegSet *LiveRegsCopy, + bool After) { + const MachineFunction &MF = *MI.getMF(); + MRI = &MF.getRegInfo(); if (LiveRegsCopy) { if (&LiveRegs != LiveRegsCopy) LiveRegs = *LiveRegsCopy; } else { - LiveRegs = getLiveRegsAfter(MI, LIS); + LiveRegs = After ? getLiveRegsAfter(MI, LIS) + : getLiveRegsBefore(MI, LIS); } + MaxPressure = CurPressure = getRegPressure(*MRI, LiveRegs); } +void GCNUpwardRPTracker::reset(const MachineInstr &MI, + const LiveRegSet *LiveRegsCopy) { + GCNRPTracker::reset(MI, LiveRegsCopy, true); +} + void GCNUpwardRPTracker::recede(const MachineInstr &MI) { assert(MRI && "call reset first"); @@ -349,13 +358,7 @@ bool GCNDownwardRPTracker::reset(const MachineInstr &MI, NextMI = skipDebugInstructionsForward(NextMI, MBBEnd); if (NextMI == MBBEnd) return false; - if (LiveRegsCopy) { - if (&LiveRegs != LiveRegsCopy) - LiveRegs = *LiveRegsCopy; - } else { - LiveRegs = getLiveRegsBefore(*NextMI, LIS); - } - MaxPressure = CurPressure = getRegPressure(*MRI, LiveRegs); + GCNRPTracker::reset(*NextMI, LiveRegsCopy, false); return true; } |