[llvm] [AMDGPU] Add register usage diagnostics at the point of maximum register pressure. (PR #161850)

Tony Linthicum via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 8 08:32:16 PDT 2025


================
@@ -138,6 +143,18 @@ struct GCNRegPressure {
 
   void dump() const;
 
+  static RegKind getRegKind(unsigned Reg, const MachineRegisterInfo &MRI) {
+    const TargetRegisterInfo *TRI = MRI.getTargetRegisterInfo();
+    const SIRegisterInfo *STI = static_cast<const SIRegisterInfo *>(TRI);
+    return (RegKind)getRegKind(MRI.getRegClass(Reg), STI);
+  }
+
+  static const char *getName(RegKind Kind) {
+    const char *Names[] = {"SGPR", "VGPR", "AGPR", "AVGPR"};
----------------
tlinthic wrote:

Minor comment ... maybe this array should be defined closer to the enum so that it's more obvious in the future that it needs to change if more RegKinds are added.

https://github.com/llvm/llvm-project/pull/161850


More information about the llvm-commits mailing list