[cft] aligning main's stack frame: take 2

Stuart Hastings stuart@apple.com
Tue Feb 14 17:17:00 GMT 2006


This is a followup to

	http://gcc.gnu.org/ml/gcc-patches/2006-02/threads.html#00854

Here is a slightly more expansive patch.  This version adds a  
commandline option named -mstackrealign, testcases for same, and some  
documentation.  The commandline option generates a warning when it  
encounters a nested function.  The attribute gives a hard error if  
applied to a nested function.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gcc.fsf.stkalign2.diffs.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20060214/8dbcc40d/attachment.txt>
-------------- next part --------------

Q: The attribute takes its name from a GCC internal field  
("force_align_arg_pointer").  Should it be renamed to be consistent  
with the commandline option ("-mstackrealign")?

Here are the testcases; two are from the previous patch, and the two  
more that test the -mstackrealign option:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20060210-1.c
Type: application/octet-stream
Size: 742 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20060214/8dbcc40d/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20060210-2.c
Type: application/octet-stream
Size: 428 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20060214/8dbcc40d/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20060210-3.c
Type: application/octet-stream
Size: 728 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20060214/8dbcc40d/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20060210-4.c
Type: application/octet-stream
Size: 399 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20060214/8dbcc40d/attachment-0003.obj>
-------------- next part --------------

At Apple, they say "eating your own dogfood" to mean "use your own  
products"  (this is supposed to be a Good Thing :-).  Accordingly, I  
bootstrapped this with -mdogf^W-mstackrealign turned on.  ;-)

Bootstrapped on Darwin/x86 with BOOT_CFLAGS="-g -O2 -mstackrealign",  
DejaGnu, no regressions.

2006-02-14  Stuart Hastings  <stuart@apple.com>

	* gcc/config/i386/i386.opt (-mstackrealign) New option.
	(force_align_arg_pointer) New variable.
   	* gcc/config/i386/i386.c (ix86_force_align_arg_pointer_string): New.
	(ix86_attribute_table): Use it in new attribute:  
force_align_arg_pointer.
	(ix86_function_regparm): Account for the stack alignment register.
	(ix86_internal_arg_pointer): Enabled by -mstackrealign or attribute  
force_align_arg_pointer.
	* gcc/doc/extend.texi (force_align_arg_pointer): Document new  
attribute.
	* gcc/doc/invoke.texi (-mstackrealign): Document new commandline  
option.
	* testsuite/gcc.target/i386/20060210-1.c, 20060210-2.c,  
20060210-3.c, 20060210-4.c: New.

O.K. to commit onto the trunk?

stuart hastings
Apple Computer


More information about the Gcc-patches mailing list