<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Missing register aliases for AVR for compatibility with gcc-avr's inline assembly"
href="https://bugs.llvm.org/show_bug.cgi?id=52215">52215</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Missing register aliases for AVR for compatibility with gcc-avr's inline assembly
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>12.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</td>
</tr>
<tr>
<th>OS</th>
<td>other
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Backend: AVR
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>marian.buschsieweke@ovgu.de
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>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).
<a href="https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libgcc/config/avr/lib1funcs.S;h=ac101b49f03e340e93e16283eb47146ef47290c2;hb=HEAD">https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libgcc/config/avr/lib1funcs.S;h=ac101b49f03e340e93e16283eb47146ef47290c2;hb=HEAD</a></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>