re PR target/45694 ([MinGW64] fortran host associated variables+optimization==failure?)

2010-09-21  Kai Tietz  <kai.tietz@onevision.com>

        PR target/45694
        * config/i386/i386.c (ix86_expand_prologue): Save r10 in case that
        static chain-register is used for 64-bit.

From-SVN: r164489
This commit is contained in:
Kai Tietz 2010-09-21 17:58:32 +00:00 committed by Kai Tietz
parent 54394f4d8d
commit f997b875dd
2 changed files with 29 additions and 8 deletions

View File

@ -1,3 +1,9 @@
2010-09-21 Kai Tietz <kai.tietz@onevision.com>
PR target/45694
* config/i386/i386.c (ix86_expand_prologue): Save r10 in case that
static chain-register is used for 64-bit.
2010-09-21 Richard Guenther <rguenther@suse.de>
* dwarf2out.c (is_cu_die): New function.

View File

@ -9692,19 +9692,27 @@ ix86_expand_prologue (void)
}
else
{
rtx eax = gen_rtx_REG (Pmode, AX_REG);
bool eax_live;
rtx eax = gen_rtx_REG (Pmode, AX_REG);;
rtx r10 = NULL;
bool eax_live = false;
bool r10_live = false;
if (cfun->machine->call_abi == MS_ABI)
eax_live = false;
else
eax_live = ix86_eax_live_at_start_p ();
if (TARGET_64BIT)
r10_live = (DECL_STATIC_CHAIN (current_function_decl) != 0);
if (!TARGET_64BIT_MS_ABI)
eax_live = ix86_eax_live_at_start_p ();
if (eax_live)
{
emit_insn (gen_push (eax));
allocate -= UNITS_PER_WORD;
}
if (r10_live)
{
r10 = gen_rtx_REG (Pmode, R10_REG);
emit_insn (gen_push (r10));
allocate -= UNITS_PER_WORD;
}
emit_move_insn (eax, GEN_INT (allocate));
@ -9720,10 +9728,17 @@ ix86_expand_prologue (void)
}
m->fs.sp_offset += allocate;
if (eax_live)
if (r10_live && eax_live)
{
t = choose_baseaddr (m->fs.sp_offset - allocate);
emit_move_insn (r10, gen_frame_mem (Pmode, t));
t = choose_baseaddr (m->fs.sp_offset - allocate - UNITS_PER_WORD);
emit_move_insn (eax, gen_frame_mem (Pmode, t));
}
else if (eax_live || r10_live)
{
t = choose_baseaddr (m->fs.sp_offset - allocate);
emit_move_insn (eax, gen_frame_mem (Pmode, t));
emit_move_insn ((eax_live ? eax : r10), gen_frame_mem (Pmode, t));
}
}
gcc_assert (m->fs.sp_offset == frame.stack_pointer_offset);