This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/65249] unable to find a register to spill in class 'R0_REGS' when compiling protobuf on sh4
- From: "olegendo at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 28 Feb 2015 13:36:58 +0000
- Subject: [Bug target/65249] unable to find a register to spill in class 'R0_REGS' when compiling protobuf on sh4
- Auto-submitted: auto-generated
- References: <bug-65249-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65249
--- Comment #4 from Oleg Endo <olegendo at gcc dot gnu.org> ---
For some reason r0 is live throughout the whole basic block where the problem
occures. The basic block starts with:
(note 36 35 38 5 [bb 5] NOTE_INSN_BASIC_BLOCK)
(note 38 36 39 5 NOTE_INSN_DELETED)
(note 39 38 70 5 NOTE_INSN_DELETED)
(insn 70 39 133 5 (set (reg:SI 0 r0)
(const_int 0 [0])) ccdkVmsq_1.out:48 252 {movsi_ie}
(nil))
When using LRA, r0 is spilled to stack, and PIC_REG (r12) is copied to r0 for
the mem load. r0 is then reloaded from stack, but rematerialized and converted
into a load of constant.
mov r12,r2
add r11,r2
mov #0,r0 <<<<
mov.l .L25,r1
mov.l @r2,r2
mov.l r0,@r15 <<<<
mov r12,r0 <<<<
mov.l @(60,r10),r3
mov.l @r2,r7
cmp/eq r3,r7
mov #0,r3
mov #0,r7
mov.l @(r0,r1),r1 <<<<
bf/s .L16
mov #0,r0 <<<<
add #12,r15
...
If I'm not mistaken, the above can be done better as:
mov r11,r0
mov.l @(r0,r12),r2
mov.l .L25,r0
mov.l @(60,r10),r3
mov.l @r2,r7
cmp/eq r3,r7
mov #0,r3
mov #0,r7
mov.l @(r0,r12),r1
bf/s .L16
mov #0,r0
add #12,r15
...