[llvm] f93114d - [RISCV] Use int64_t for offsets returned from CCState::AllocateStack. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 6 18:40:07 PDT 2024


Author: Craig Topper
Date: 2024-09-06T18:39:41-07:00
New Revision: f93114d7004ebf6443dd2b6e557b57209fd58852

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

LOG: [RISCV] Use int64_t for offsets returned from CCState::AllocateStack. NFC

AllocateStack returns int64_t and CCValAssign::getMem expects an
int64_t. The interfaces used unsigned prior to
da42b2846c82063bd1bce78d6a046f78f218eb72.

Offsets for RISC-V should be positive and less than 32-bits so this
shouldn't be a functional change.

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/RISCVCallingConv.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCVCallingConv.cpp b/llvm/lib/Target/RISCV/RISCVCallingConv.cpp
index d9d6307b01cdfc..8a78ed6f2f8068 100644
--- a/llvm/lib/Target/RISCV/RISCVCallingConv.cpp
+++ b/llvm/lib/Target/RISCV/RISCVCallingConv.cpp
@@ -377,7 +377,7 @@ bool llvm::CC_RISCV(unsigned ValNo, MVT ValVT, MVT LocVT,
     // cases.
     MCRegister Reg = State.AllocateReg(ArgGPRs);
     if (!Reg) {
-      unsigned StackOffset = State.AllocateStack(8, Align(8));
+      int64_t StackOffset = State.AllocateStack(8, Align(8));
       State.addLoc(
           CCValAssign::getMem(ValNo, ValVT, StackOffset, LocVT, LocInfo));
       return false;
@@ -389,7 +389,7 @@ bool llvm::CC_RISCV(unsigned ValNo, MVT ValVT, MVT LocVT,
       State.addLoc(
           CCValAssign::getCustomReg(ValNo, ValVT, HiReg, LocVT, LocInfo));
     } else {
-      unsigned StackOffset = State.AllocateStack(4, Align(4));
+      int64_t StackOffset = State.AllocateStack(4, Align(4));
       State.addLoc(
           CCValAssign::getCustomMem(ValNo, ValVT, StackOffset, LocVT, LocInfo));
     }
@@ -471,7 +471,7 @@ bool llvm::CC_RISCV(unsigned ValNo, MVT ValVT, MVT LocVT,
     Reg = State.AllocateReg(ArgGPRs);
   }
 
-  unsigned StackOffset =
+  int64_t StackOffset =
       Reg ? 0 : State.AllocateStack(StoreSizeBytes, StackAlign);
 
   // If we reach this point and PendingLocs is non-empty, we must be at the
@@ -586,19 +586,19 @@ bool llvm::CC_RISCV_FastCC(unsigned ValNo, MVT ValVT, MVT LocVT,
   }
 
   if (LocVT == MVT::f16 || LocVT == MVT::bf16) {
-    unsigned Offset2 = State.AllocateStack(2, Align(2));
+    int64_t Offset2 = State.AllocateStack(2, Align(2));
     State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset2, LocVT, LocInfo));
     return false;
   }
 
   if (LocVT == MVT::i32 || LocVT == MVT::f32) {
-    unsigned Offset4 = State.AllocateStack(4, Align(4));
+    int64_t Offset4 = State.AllocateStack(4, Align(4));
     State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset4, LocVT, LocInfo));
     return false;
   }
 
   if (LocVT == MVT::i64 || LocVT == MVT::f64) {
-    unsigned Offset5 = State.AllocateStack(8, Align(8));
+    int64_t Offset5 = State.AllocateStack(8, Align(8));
     State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset5, LocVT, LocInfo));
     return false;
   }
@@ -626,7 +626,7 @@ bool llvm::CC_RISCV_FastCC(unsigned ValNo, MVT ValVT, MVT LocVT,
       LocInfo = CCValAssign::Indirect;
       LocVT = Subtarget.getXLenVT();
       unsigned XLen = Subtarget.getXLen();
-      unsigned StackOffset = State.AllocateStack(XLen / 8, Align(XLen / 8));
+      int64_t StackOffset = State.AllocateStack(XLen / 8, Align(XLen / 8));
       State.addLoc(
           CCValAssign::getMem(ValNo, ValVT, StackOffset, LocVT, LocInfo));
       return false;
@@ -634,8 +634,7 @@ bool llvm::CC_RISCV_FastCC(unsigned ValNo, MVT ValVT, MVT LocVT,
 
     // Pass fixed-length vectors on the stack.
     auto StackAlign = MaybeAlign(ValVT.getScalarSizeInBits() / 8).valueOrOne();
-    unsigned StackOffset =
-        State.AllocateStack(ValVT.getStoreSize(), StackAlign);
+    int64_t StackOffset = State.AllocateStack(ValVT.getStoreSize(), StackAlign);
     State.addLoc(
         CCValAssign::getMem(ValNo, ValVT, StackOffset, LocVT, LocInfo));
     return false;


        


More information about the llvm-commits mailing list