-
Notifications
You must be signed in to change notification settings - Fork 11.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing register aliases for AVR for compatibility with gcc-avr's inline assembly #51557
Comments
This issue is fixed in https://reviews.llvm.org/D119807, It needs someone to approve. |
This issue was not resolved in time for 14.0.0 and will need to be fixed in the next release (14.0.1). If you disagree with this or you feel there was a mistake, please change the milestone back to 'LLVM 14.0.0 Release' so we can discuss. |
Can anybody help me review my patch? The code owner of AVR and other AVR contributors do not give me any feedback. Actually this is a simple change. I am quite sure my solution is correct. |
fixed and committed as d7afea9 |
/cherry-pick d7afea9 |
Failed to cherry-pick: d7afea9 https://github.com/llvm/llvm-project/actions/runs/2100362322 Please manually backport the fix and push it to your github fork. Once this is done, please add a comment like this:
|
This is a feature, so no need to back port. |
@benshi001 Ok. |
Extended Description
E.g. the avr-libc but also other AVR code written for gcc-avr heavily uses the following aliases:
tmp_reg
SREG
zero_reg
SP_H
SP_L
also the aliases RAMPZ and EIND are occasionally used.
See [1] for their definitions.
This is the first time I looked into the LLVM source code, so I might be talking nonsense here. I tried to fix this by amending lib/Target/AVR/AVRRegisterInfo.td like this:
-def R0 : AVRReg<0, "r0">, DwarfRegNum<[0]>;
-def R1 : AVRReg<1, "r1">, DwarfRegNum<[1]>;
+def R0 : AVRReg<0, "r0", [], ["tmp_reg"]>, DwarfRegNum<[0]>;
+def R1 : AVRReg<1, "r1", [], ["zero_reg"]>, DwarfRegNum<[1]>;
etc. - but to no avail.
I also tried to just emit assignments for the alias via
void AVRAsmPrinter::emitStartOfAsmFile(Module &M)
, but this didn't work for me either.I think that adding the aliases should be relatively trivial for someone with same basic understanding of the LLVM code - which I sadly lack.
Also note that according to [1] the AVRtiny family has a different mapping (e.g. tmp_reg usually is r0, but on AVRtiny it is r16).
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libgcc/config/avr/lib1funcs.S;h=ac101b49f03e340e93e16283eb47146ef47290c2;hb=HEAD
The text was updated successfully, but these errors were encountered: