[llvm] d46902e - [Hexagon] Simplify an array of physical register ids. NFC (#128066)

via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 20 23:24:18 PST 2025


Author: Craig Topper
Date: 2025-02-20T23:24:15-08:00
New Revision: d46902e31b29974e56285bbc6932c90656f6dd12

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

LOG: [Hexagon] Simplify an array of physical register ids. NFC (#128066)

Make the array const. Use MCPhysReg, which is uint16_t, to reduce its
size. Remove NoRegister terminator by using a range-based for loop to
access.

Added: 
    

Modified: 
    llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp b/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp
index a35f7a3350f8c..eddf7500f0974 100644
--- a/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp
@@ -1076,20 +1076,18 @@ void HexagonFrameLowering::insertCFIInstructionsAt(MachineBasicBlock &MBB,
         .addCFIIndex(MF.addFrameInst(OffR30));
   }
 
-  static Register RegsToMove[] = {
+  static const MCPhysReg RegsToMove[] = {
     Hexagon::R1,  Hexagon::R0,  Hexagon::R3,  Hexagon::R2,
     Hexagon::R17, Hexagon::R16, Hexagon::R19, Hexagon::R18,
     Hexagon::R21, Hexagon::R20, Hexagon::R23, Hexagon::R22,
     Hexagon::R25, Hexagon::R24, Hexagon::R27, Hexagon::R26,
     Hexagon::D0,  Hexagon::D1,  Hexagon::D8,  Hexagon::D9,
-    Hexagon::D10, Hexagon::D11, Hexagon::D12, Hexagon::D13,
-    Hexagon::NoRegister
+    Hexagon::D10, Hexagon::D11, Hexagon::D12, Hexagon::D13
   };
 
   const std::vector<CalleeSavedInfo> &CSI = MFI.getCalleeSavedInfo();
 
-  for (unsigned i = 0; RegsToMove[i] != Hexagon::NoRegister; ++i) {
-    Register Reg = RegsToMove[i];
+  for (MCPhysReg Reg : RegsToMove) {
     auto IfR = [Reg] (const CalleeSavedInfo &C) -> bool {
       return C.getReg() == Reg;
     };


        


More information about the llvm-commits mailing list