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

Kito Cheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 7 23:13:24 PST 2023


kito-cheng added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVInstrInfo.cpp:82
+                                             int &FrameIndex,
+                                             unsigned &MemBytes) const {
   switch (MI.getOpcode()) {
----------------
Jim wrote:
> craig.topper wrote:
> > 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.
> It seems caller doesn't care MemBytes if the return value is zero (means it's not a load from or store to stack slot instruction).
I am OK without init that to 0


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