[llvm] 3b5413c - [CodeGen] Use MCRegister in DbgVariableLocation. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 15 00:49:31 PDT 2025


Author: Craig Topper
Date: 2025-03-15T00:46:17-07:00
New Revision: 3b5413c77fd5ce2488e3f45c1ba967e3d3dfa2c8

URL: https://github.com/llvm/llvm-project/commit/3b5413c77fd5ce2488e3f45c1ba967e3d3dfa2c8
DIFF: https://github.com/llvm/llvm-project/commit/3b5413c77fd5ce2488e3f45c1ba967e3d3dfa2c8.diff

LOG: [CodeGen] Use MCRegister in DbgVariableLocation. NFC

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/DebugHandlerBase.h
    llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
    llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/DebugHandlerBase.h b/llvm/include/llvm/CodeGen/DebugHandlerBase.h
index f669bd311ff56..3da7ea5f31231 100644
--- a/llvm/include/llvm/CodeGen/DebugHandlerBase.h
+++ b/llvm/include/llvm/CodeGen/DebugHandlerBase.h
@@ -30,7 +30,7 @@ class MachineModuleInfo;
 /// Represents the location at which a variable is stored.
 struct DbgVariableLocation {
   /// Base register.
-  unsigned Register;
+  MCRegister Register;
 
   /// Chain of offsetted loads necessary to load the value if it lives in
   /// memory. Every load except for the last is pointer-sized.

diff  --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index 5c3b900ca29b6..475e1c0a80bd4 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -1361,7 +1361,7 @@ void CodeViewDebug::calculateRanges(
     }
 
     // We can only handle a register or an offseted load of a register.
-    if (Location->Register == 0 || Location->LoadChain.size() > 1)
+    if (!Location->Register || Location->LoadChain.size() > 1)
       continue;
 
     // Codeview can only express byte-aligned offsets, ensure that we have a

diff  --git a/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp b/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
index 533c554facedd..0f3ff985974ce 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
@@ -39,7 +39,7 @@ DbgVariableLocation::extractFromMachineInstruction(
     return std::nullopt;
   if (!Instruction.getDebugOperand(0).isReg())
     return std::nullopt;
-  Location.Register = Instruction.getDebugOperand(0).getReg();
+  Location.Register = Instruction.getDebugOperand(0).getReg().asMCReg();
   Location.FragmentInfo.reset();
   // We only handle expressions generated by DIExpression::appendOffset,
   // which doesn't require a full stack machine.


        


More information about the llvm-commits mailing list