[PATCH] D123528: [AVR] Always expand STDSPQRr & STDWSPQRr

Patryk Wychowaniec via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 4 09:59:35 PDT 2022


Patryk27 marked 9 inline comments as done.
Patryk27 added a comment.

Thanks for the review - I've applied all the changes :-)



================
Comment at: llvm/lib/Target/AVR/AVRFrameLowering.cpp:369
-      // instructions.
-      fixStackStores(MBB, MI, TII, AVR::R31R30);
-    } else {
----------------
benshi001 wrote:
> benshi001 wrote:
> > benshi001 wrote:
> > > I do not think the removal of `fixStackStores` at here is good, since we seperate the preparation of `R31R30` and the substitution of `STDWSPQRr`-> `STDWPtrQRr`. It makes the code hard to understand, and I also concern there might be other issues introduced.
> > > 
> > > So I suggest we keep this `fixStackStores` call.
> > I suggest a moderate way:
> > 
> > Keep the second `fixStackStores` (with R31R30) and remove the first one (R29R28). And in the `expand<AVR::STDWSPQRr>`, add an extra line 
> > 
> > ```
> > assert(STI.getFrameLowering()->hasReservedCallFrame(MF) &&
> >        "unexpected STDWSPQRr pseudo instruction");
> > ```
> Then we only substitute `SP` with `R29R28`.
Sure, that's a nice approach! 


================
Comment at: llvm/test/CodeGen/AVR/stdwstk.ll:2
+; RUN: llc < %s -march=avr -mcpu=atmega328 -O1 | FileCheck %s
+; CHECK-NOT: stdwstk
+
----------------
benshi001 wrote:
> benshi001 wrote:
> > I perfer the `.mir` tests in your previous https://reviews.llvm.org/D114611.
> > 
> > It would be better to seperate to STDWSPQRr.mir and STDSPQRr.mir.
> Sorry, igmore this comment.
I'd love to add those somehow, but since expanding those opcodes reads `hasReservedCallFrame()`, we'd have to make those two *.mir tests execute `AVRFrameAnalyzer`, which seems clumsy to implement & use.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123528



More information about the llvm-commits mailing list