[Patch,AVR]: Fix PR target/50289
Georg-Johann Lay
avr@gjlay.de
Mon Sep 5 09:46:00 GMT 2011
PR50289 is a minor issue with -mcall-prologues and global register variables
resp. fixed registers: Such registers shall be omitted in function
prologue/epilogue.
For test program
void bar (long long, long long, void*);
register char x asm ("7");
void foo (char a)
{
asm volatile ("":::"6");
bar (0, 0, &a);
}
however, avr.c:sequent_regs_live() generates a register sequence that covers
fixed R7, i.e. prologue saves R7...R17, Y and reads
foo:
ldi r26,lo8(1)
ldi r27,hi8(1)
ldi r30,lo8(gs(1f))
ldi r31,hi8(gs(1f))
rjmp __prologue_saves__+((18 - 13) * 2)
1:
/* prologue: function */
With the patch no sequences are generated that contain fixed regsisters, i.e.
prologue for the example reads now
foo:
push r6 ; 31 pushqi1/1 [length = 1]
push r8 ; 32 pushqi1/1 [length = 1]
push r9 ; 33 pushqi1/1 [length = 1]
push r10 ; 34 pushqi1/1 [length = 1]
push r11 ; 35 pushqi1/1 [length = 1]
push r12 ; 36 pushqi1/1 [length = 1]
push r13 ; 37 pushqi1/1 [length = 1]
push r14 ; 38 pushqi1/1 [length = 1]
push r15 ; 39 pushqi1/1 [length = 1]
push r16 ; 40 pushqi1/1 [length = 1]
push r17 ; 41 pushqi1/1 [length = 1]
push r28 ; 42 pushqi1/1 [length = 1]
push r29 ; 43 pushqi1/1 [length = 1]
push __tmp_reg__ ; 47 *addhi3_sp_R_pc2 [length = 1]
in r28,__SP_L__ ; 48 *movhi_sp/2 [length = 2]
in r29,__SP_H__
/* prologue: function */
Ok to install?
Johann
PR target/50289
* config/avr/avr.c (sequent_regs_live): Don't recognize sequences
that contain global register variable.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr50289.diff
Type: text/x-patch
Size: 584 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110905/1b95cde9/attachment.bin>
More information about the Gcc-patches
mailing list