diff options
author | Kai Tietz <kai.tietz@onevision.com> | 2010-09-21 17:58:32 +0000 |
---|---|---|
committer | Kai Tietz <ktietz@gcc.gnu.org> | 2010-09-21 19:58:32 +0200 |
commit | f997b875dd00aaa75f85bbefa2e90ebfba7b6808 (patch) | |
tree | 3599c78b46a003a8baea2161bd8ba3af0dc92129 /gcc | |
parent | 54394f4d8db10c44648966a3d243aea627d668a5 (diff) | |
download | gcc-f997b875dd00aaa75f85bbefa2e90ebfba7b6808.zip gcc-f997b875dd00aaa75f85bbefa2e90ebfba7b6808.tar.gz gcc-f997b875dd00aaa75f85bbefa2e90ebfba7b6808.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 31 |
2 files changed, 29 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a0d6e78..07cea55 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index de1564a..4501efb 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -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,11 +9728,18 @@ 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_live ? eax : r10), gen_frame_mem (Pmode, t)); + } } gcc_assert (m->fs.sp_offset == frame.stack_pointer_offset); |