i386.h (FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN): New.
* config/i386/i386.h (FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN): New. * function.c (expand_main_function): Implement it. * doc/tm.texi: Document it. From-SVN: r44664
This commit is contained in:
parent
eac69b8a00
commit
1d48205639
@ -1,3 +1,9 @@
|
||||
2001-08-06 Richard Henderson <rth@redhat.com>
|
||||
|
||||
* config/i386/i386.h (FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN): New.
|
||||
* function.c (expand_main_function): Implement it.
|
||||
* doc/tm.texi: Document it.
|
||||
|
||||
2001-08-06 Stan Shebs <shebs@apple.com>
|
||||
|
||||
* doc/install.texi: Document powerpc-*-darwin* details.
|
||||
|
@ -640,6 +640,13 @@ extern int ix86_arch;
|
||||
aligned; the compiler cannot rely on having this alignment. */
|
||||
#define PREFERRED_STACK_BOUNDARY ix86_preferred_stack_boundary
|
||||
|
||||
/* As of July 2001, many runtimes to not align the stack properly when
|
||||
entering main. This causes expand_main_function to forcably align
|
||||
the stack, which results in aligned frames for functions called from
|
||||
main, though it does nothing for the alignment of main itself. */
|
||||
#define FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN \
|
||||
(ix86_preferred_stack_boundary > STACK_BOUNDARY)
|
||||
|
||||
/* Allocation boundary for the code of a function. */
|
||||
#define FUNCTION_BOUNDARY 16
|
||||
|
||||
|
@ -1028,6 +1028,12 @@ for the desired alignment (measured in bits). If @code{STACK_BOUNDARY} is
|
||||
also defined, this macro must evaluate to a value equal to or larger
|
||||
than @code{STACK_BOUNDARY}.
|
||||
|
||||
@findex FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN
|
||||
@item FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN
|
||||
A C expression that evaluates true if @code{PREFERRED_STACK_BOUNDARY} is
|
||||
not guaranteed by the runtime and we should emit code to align the stack
|
||||
at the beginning of @code{main}.
|
||||
|
||||
@cindex @code{PUSH_ROUNDING}, interaction with @code{PREFERRED_STACK_BOUNDARY}
|
||||
If @code{PUSH_ROUNDING} is not defined, the stack will always be aligned
|
||||
to the specified boundary. If @code{PUSH_ROUNDING} is defined and specifies
|
||||
|
@ -6315,10 +6315,35 @@ mark_varargs ()
|
||||
void
|
||||
expand_main_function ()
|
||||
{
|
||||
#if !defined (HAS_INIT_SECTION)
|
||||
#ifdef FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN
|
||||
if (FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN)
|
||||
{
|
||||
int align = PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT;
|
||||
rtx tmp;
|
||||
|
||||
/* Forcably align the stack. */
|
||||
#ifdef STACK_GROWS_DOWNWARD
|
||||
tmp = expand_binop (Pmode, and_optab, stack_pointer_rtx,
|
||||
GEN_INT (-align), stack_pointer_rtx, 1, OPTAB_WIDEN);
|
||||
#else
|
||||
tmp = expand_binop (Pmode, add_optab, stack_pointer_rtx,
|
||||
GEN_INT (align - 1), NULL_RTX, 1, OPTAB_WIDEN);
|
||||
tmp = expand_binop (Pmode, and_optab, tmp, GEN_INT (-align),
|
||||
stack_pointer_rtx, 1, OPTAB_WIDEN);
|
||||
#endif
|
||||
if (tmp != stack_pointer_rtx)
|
||||
emit_move_insn (stack_pointer_rtx, tmp);
|
||||
|
||||
/* Enlist allocate_dynamic_stack_space to pick up the pieces. */
|
||||
tmp = force_reg (Pmode, const0_rtx);
|
||||
allocate_dynamic_stack_space (tmp, NULL_RTX, BIGGEST_ALIGNMENT);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAS_INIT_SECTION
|
||||
emit_library_call (gen_rtx_SYMBOL_REF (Pmode, NAME__MAIN), 0,
|
||||
VOIDmode, 0);
|
||||
#endif /* not HAS_INIT_SECTION */
|
||||
#endif
|
||||
}
|
||||
|
||||
extern struct obstack permanent_obstack;
|
||||
|
Loading…
x
Reference in New Issue
Block a user