[PATCH] D131867: [AVR] Do not emit instructions invalid for attiny10

Ben Shi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 28 00:29:21 PST 2022


benshi001 added inline comments.


================
Comment at: llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp:1141-1147
+    // Add offset. The offset can be 0 when expanding this instruction from the
+    // more specific STWPtrRr instruction.
+    if (Imm != 0) {
+      buildMI(MBB, MBBI, AVR::SUBIWRdK, DstReg)
+          .addReg(DstReg, RegState::Kill)
+          .addImm(0x10000 - Imm);
     }
----------------
aykevl wrote:
> I've changed the behavior here slightly because that's what I did in the previous version of this patch and because it's more efficient. It's better to subtract and then add the pointer than to push, subtract, and pop the previous value.
That's good!


================
Comment at: llvm/lib/Target/AVR/AVRInstrInfo.td:1337
+  //   ld    Rd+1, P+
+  //   subiw P,    2
   let Constraints = "@earlyclobber $reg" in def LDWRdPtr
----------------
`subiw` is still a pseudo instruction, it would be better to give real instructions in this comment. 


================
Comment at: llvm/lib/Target/AVR/AVRInstrInfo.td:1418
+  //   ld    Rd+1, P+
+  //   subiw P,    q+2
   let Constraints = "@earlyclobber $dst" in def LDDWRdPtrQ
----------------
`subiw` is still a pseudo instruction, it would be better to give real instructions in this comment. 


================
Comment at: llvm/lib/Target/AVR/AVRInstrInfo.td:1555
+//   st    P+, Rr+1
+//   subiw P,  q+2
 def STWPtrRr : Pseudo<(outs),
----------------
The same suggestion as above.


================
Comment at: llvm/lib/Target/AVR/AVRInstrInfo.td:1667
+//   st    P+, Rr+1
+//   subiw P,  q+2
 def STDWPtrQRr : Pseudo<(outs),
----------------
The same suggestion as above.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131867



More information about the llvm-commits mailing list