[PATCH] D145471: [RISCV] Set how many bytes load from or store to stack slot

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 7 18:59:07 PST 2023


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVInstrInfo.cpp:82
+                                             int &FrameIndex,
+                                             unsigned &MemBytes) const {
   switch (MI.getOpcode()) {
----------------
kito-cheng wrote:
> We might need to init MemByte to 0?
> 
> ```
>   /// Optional extension of isLoadFromStackSlot that returns the number of
>   /// bytes loaded from the stack. This must be implemented if a backend
>   /// supports partial stack slot spills/loads to further disambiguate
>   /// what the load does.
>   virtual unsigned isLoadFromStackSlot(const MachineInstr &MI, 
>                                        int &FrameIndex,
>                                        unsigned &MemBytes) const {
>     MemBytes = 0; 
>     return isLoadFromStackSlot(MI, FrameIndex);
>   }
> 
> ```
Do the callers care in the cases this function returns 0? Looks like MemBytes will be explicitly set on any path that returns a non-zero value.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145471/new/

https://reviews.llvm.org/D145471



More information about the llvm-commits mailing list