This is an archive of the discontinued LLVM Phabricator instance.

[AVR] Use @earlyclobber instead of register scavenging
ClosedPublic

Authored by aykevl on Aug 13 2022, 1:04 PM.

Details

Summary

The code to support the case when the register allocator has assigned
the same register to the src and the dst register operand isn't actually
needed:

  • LDWRdPtr and LDDWRdPtrQ have an @earlyclobber on the output register, so the register allocator will make sure to allocate a different register for the output register.
  • LDDWRdYQ does not have an @earlyclobber, but the pointer register is the fixed Y register which is reserved. The register allocator won't use reserved registers for the output value.

This removes a special case in the code that makes the pseudo
instruction expansion pass more complicated than it needs to be.

I tested this locally with TinyGo and all test cases still pass, so that gives some confidence that this doesn't break anything.

Diff Detail

Event Timeline

aykevl created this revision.Aug 13 2022, 1:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 13 2022, 1:04 PM
Herald added subscribers: Jim, hiraditya. · View Herald Transcript
aykevl requested review of this revision.Aug 13 2022, 1:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 13 2022, 1:04 PM
aykevl edited the summary of this revision. (Show Details)Aug 13 2022, 1:05 PM

I forgot about D117957. This is a shorter version that doesn't include the LPM/ELPM changes.

This revision is now accepted and ready to land.Aug 13 2022, 7:46 PM
This revision was automatically updated to reflect the committed changes.
llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp