[llvm-branch-commits] [llvm] [AMDGPU] Physical register tracking in GCN trackers. (PR #184275)
Dhruva Chakrabarti via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Mar 5 12:50:32 PST 2026
================
@@ -320,12 +320,47 @@ class GCNRPTracker {
protected:
const LiveIntervals &LIS;
+
+ // Virtual register tracking
LiveRegSet VirtLiveRegs;
GCNRegPressure CurVirtPressure, MaxVirtPressure;
+
+ // Physical register tracking: Maintain clean separation between virtual and
+ // physical registers. Tracking physical registers can be turned OFF with an
+ // option. Using llvm::LiveRegSet for consistency with the generic tracker.
+ llvm::LiveRegSet PhysLiveRegs;
+ GCNRegPressure CurPhysPressure, MaxPhysPressure;
+
+ // Flag to control whether physical register tracking is active.
+ // Set to true when GCNTrackers are enabled, false otherwise.
+ bool TrackPhysRegs = false;
+
const MachineInstr *LastTrackedMI = nullptr;
mutable const MachineRegisterInfo *MRI = nullptr;
- GCNRPTracker(const LiveIntervals &LIS_) : LIS(LIS_) {}
+ GCNRPTracker(const LiveIntervals &LIS, const MachineRegisterInfo &MRI)
+ : LIS(LIS), MRI(&MRI) {
+ setPhysRegTracking();
+ if (TrackPhysRegs)
+ PhysLiveRegs.init(MRI);
+ }
+
+ // Copy constructor - PhysLiveRegs must be initialized then copied.
+ GCNRPTracker(const GCNRPTracker &Other)
+ : LIS(Other.LIS), VirtLiveRegs(Other.VirtLiveRegs),
+ CurVirtPressure(Other.CurVirtPressure),
+ MaxVirtPressure(Other.MaxVirtPressure),
+ CurPhysPressure(Other.CurPhysPressure),
+ MaxPhysPressure(Other.MaxPhysPressure),
+ TrackPhysRegs(Other.TrackPhysRegs), LastTrackedMI(Other.LastTrackedMI),
+ MRI(Other.MRI) {
+ // Initialize PhysLiveRegs with proper universe, then copy contents.
+ if (MRI) {
----------------
dhruvachak wrote:
Changed.
https://github.com/llvm/llvm-project/pull/184275
More information about the llvm-branch-commits
mailing list