[llvm-bugs] [Bug 39553] New: Fix "LLVM ERROR: ran out of registers during register allocation" for LDDWRdPtrQ with the Z register
llvm-bugs at lists.llvm.org
Sun Nov 4 20:51:14 PST 2018
Bug ID: 39553
Summary: Fix "LLVM ERROR: ran out of registers during register
allocation" for LDDWRdPtrQ with the Z register
Component: Backend: AVR
Assignee: unassignedbugs at nondot.org
Reporter: me at dylanmckay.io
CC: llvm-bugs at lists.llvm.org
We have an AVR-specific workaround for a limitation of the register
allocator that only exposes itself on targets with high register
contention like AVR, which only has three pointer registers.
The three pointer registers are X, Y, and Z.
In most nontrivial functions, Y is reserved for the frame pointer,
as per the calling convention. This leaves X and Z. Some instructions,
such as LPM ("load program memory"), are only defined for the Z
register. Sometimes this just leaves X.
When the backend generates a LDDWRdPtrQ instruction with Z as the
destination pointer, it usually trips up the register allocator
with this error message:
LLVM ERROR: ran out of registers during register allocation
Here is a description from the author Peter Nimmervoll
As far as I understand the problem occurs when LDDWRdPtrQ uses
the ptrdispregs register class as target register. This should work, but
the allocator can't deal with this for some reason. So from my testing,
it seams like (and I might be totally wrong on this) the allocator reserves
the Z register for the ICALL instruction and then the register class
ptrdispregs only has 1 register left and we can't use Y for source and
destination. Removing the Z register from DREGS fixes the problem but
removing Y register does not.
More information about the original bug and its investigation can be found on
the avr-rust issue
tracker at https://github.com/avr-rust/rust/issues/37.
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-bugs