gcc-patches@gcc.gnu.org
[Top] [All Lists]

Re: [cft] aligning main's stack frame: take 3

Subject: Re: [cft] aligning main's stack frame: take 3
From: Stuart Hastings
Date: Fri, 12 May 2006 12:02:40 -0700
Responding to: http://gcc.gnu.org/ml/gcc-patches/2006-04/msg00539.html

Patch history URL: http://gcc.gnu.org/ml/gcc-patches/2006-03/ msg01263.html

On Apr 14, 2006, at 11:26 AM, Richard Henderson wrote:

On Mon, Apr 03, 2006 at 09:27:58AM -0700, Stuart Hastings wrote:
        http://gcc.gnu.org/ml/gcc-patches/2006-03/msg01263.html

(1) I don't think your handling of regparm interaction is correct.
You should be generating an error for functions with 3 regparm
parameters, and the attribute set.

Fixed.

(2) You can choose *any* register that's free on function entry
and function exit.  So a nested function returning void and no
regparm could choose either eax or edx.  The register is *not*
handled like the pic register and reserved for the life of the
function -- your documentation is incorrect on that score.

Fixed.

(3) I'm not sure of the utility of the command line option.  Since
this isn't an alternate entry point, but rather an alternate
prologue, the overhead for compiling all functions with this could
be severe.

I agree, but my customer /asked/ for the commandline option, and is currently relying upon it.

Bootstrapped, DejaGnu on Darwin/x86, no regressions.

2006-05-12  Stuart Hastings  <stuart@xxxxxxxxx>

        * gcc/config/i386/i386.opt (-mstackrealign): New flag.
        * gcc/config/i386/i386.c (force_align_arg_pointer): New
        attribute.  (ix86_handle_cconv_attribute): Emit error when
force_align_arg_pointer attribute collides with too many regparms.
        (ix86_function_regparm): Limit regparms when used with
force_align_arg_pointer attribute. (ix86_internal_arg_pointer):
        Support stack-realigning prologue in non-main functions.  Emit
        warning for nested functions under -mstackrealign, emit error
        for nested functions with force_align_arg_pointer attribute.
        * gcc/doc/extend.texi (force_align_arg_pointer): Document it.
        * gcc/doc/invoke.texi (-mstackrealign): Document it.
        * testsuite/gcc.target/i386/20060512-1.c: New.
        * testsuite/gcc.target/i386/20060512-2.c: New.
        * testsuite/gcc.target/i386/20060512-3.c: New.
        * testsuite/gcc.target/i386/20060512-4.c: New.

Attachment: gcc.fsf.stkalign4.diffs.txt
Description: Text document


:ADDPATCH x86:

O.K?  (If O.K., where?)

stuart hastings
Apple Computer
<Prev in Thread] Current Thread [Next in Thread>