This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix AMD64 handling of functions with huge stack frames (take 2)
On Sun, Oct 26, 2003 at 05:57:01PM +0100, Jakub Jelinek wrote:
> Looks some at least minimal CSE pass when stack frames are big wouldn't
> hurt. reload1.c doesn't see that %rax + %rdx is actually
> (%rsp + 4294967296) + (-4294967296) == %rsp etc.
There is a reload_cse pass. But I would have expected these to be
handled directly by register elimination. We'd start with
(plus (reg fp) (const_int -4294967296))
and replace
(plus (plus (reg sp) (const_int 4294967296)) (const_int -4294967296))
and simplify. You might investigate where these are being created
and find out if there's something simple that can be done.
Oh, I bet the original doesn't appear in that form. I bet that we
split that out of the address early due to legitimate_address. I
suspect that this could be solved simply by allowing arbitrary
offsets from soft-frame-pointer and arg-pointer when non-strict.
> * reload1.c (struct elim_table): Change offset, initial_offset and
> previous_offset fields to HOST_WIDE_INT.
> (offsets_at): Change from int to HOST_WIDE_INT.
> (reload): Adjust offsets_at initialization.
> (eliminate_regs_in_insn): Change type of offset to HOST_WIDE_INT.
> (verify_initial_elim_offsets): Change type of t to HOST_WIDE_INT.
> * config/i386/i386.c (ix86_compute_frame_layout): Change offset type
> to HOST_WIDE_INT. Don't save regs using mov for huge frame sizes
> if TARGET_64BIT.
> (pro_epilogue_adjust_stack): New function.
> (ix86_expand_prologue, ix86_expand_epilogue): Use it.
> * config/i386/i386.md (pro_epilogue_adjust_stack): Remove.
> (pro_epilogue_adjust_stack_1): Remove * in front of name.
> (pro_epilogue_adjust_stack_rex64): Handle -2147483648 properly.
> (pro_epilogue_adjust_stack_rex64_2): New insn.
>
> * config/i386/i386.c (ix86_expand_epilogue): Fix comment typo.
>
> * config/i386/i386.c (ix86_expand_call): Replace 40 with
> FIRST_REX_INT_REG + 3 /* R11 */.
>
> * gcc.c-torture/compile/20031023-1.c: New test.
> * gcc.c-torture/compile/20031023-2.c: New test.
> * gcc.c-torture/compile/20031023-3.c: New test.
> * gcc.c-torture/compile/20031023-4.c: New test.
Ok.
r~