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.
Index: config/avr/avr.c
===================================================================
--- config/avr/avr.c (revision 178525)
+++ config/avr/avr.c (working copy)
@@ -522,6 +522,17 @@ sequent_regs_live (void)
for (reg = 0; reg < 18; ++reg)
{
+ if (fixed_regs[reg])
+ {
+ /* Don't recognize sequences that contain global register
+ variables. */
+
+ if (live_seq != 0)
+ return 0;
+ else
+ continue;
+ }
+
if (!call_used_regs[reg])
{
if (df_regs_ever_live_p (reg))