[PATCH] D117725: [AVR] Fix atomicrmw result value

Ayke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 22 11:05:27 PST 2022


aykevl added inline comments.


================
Comment at: llvm/lib/Target/AVR/AVRISelLowering.cpp:1705
+  MachineBasicBlock::iterator I(MI);
+  const Register SCRATCH_REGISTER = AVR::R0;
+  const unsigned SREG_ADDR = 0x3f;
----------------
benshi001 wrote:
> Also, do we need to make a helper function `int getRegScratch(void)` in `AVRSubtarget.h`, just like I have done as `getIORegRAMPZ(void)` ? The new helper function will return r16 for avr-tiny devices.
> 
> Also, do we need a helper function `int getIORegSREG(void)` instead of hard coded `0x3f` ?
See my comment in D117426.


================
Comment at: llvm/lib/Target/AVR/AVRISelLowering.cpp:1733
+  Register Result = MRI.createVirtualRegister(RC);
+  BuildMI(*BB, I, dl, TII.get(Opcode), Result)
+      .addReg(MI.getOperand(0).getReg())
----------------
benshi001 wrote:
> Do we need a flag `RegState::Define` for `Result` ?
No, because `BuildMI` will always set `RegState::Define` for the last parameter (`Result` in this case).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117725



More information about the llvm-commits mailing list