Commit 515a7242 by Jim Wilson

(allocate_dynamic_stack_space): Test STACK_BOUNDARY against BIGGEST_ALIGNMENT at…

(allocate_dynamic_stack_space): Test STACK_BOUNDARY against BIGGEST_ALIGNMENT at run time instead of at compile time.

(allocate_dynamic_stack_space): Test STACK_BOUNDARY against
BIGGEST_ALIGNMENT at run time instead of at compile time.  Give
MUST_ALIGN macro a value, and test this value in if statements.

From-SVN: r9263
parent 4084f789
...@@ -949,24 +949,13 @@ allocate_dynamic_stack_space (size, target, known_align) ...@@ -949,24 +949,13 @@ allocate_dynamic_stack_space (size, target, known_align)
If we have to align, we must leave space in SIZE for the hole If we have to align, we must leave space in SIZE for the hole
that might result from the alignment operation. */ that might result from the alignment operation. */
#if defined (STACK_DYNAMIC_OFFSET) || defined(STACK_POINTER_OFFSET) || defined (ALLOCATE_OUTGOING_ARGS) #if defined (STACK_DYNAMIC_OFFSET) || defined (STACK_POINTER_OFFSET) || defined (ALLOCATE_OUTGOING_ARGS) || ! defined (STACK_BOUNDARY)
#define MUST_ALIGN #define MUST_ALIGN 1
#endif #else
#define MUST_ALIGN (STACK_BOUNDARY < BIGGEST_ALIGNMENT)
#if ! defined (MUST_ALIGN) && (!defined(STACK_BOUNDARY) || STACK_BOUNDARY < BIGGEST_ALIGNMENT)
#define MUST_ALIGN
#endif #endif
#ifdef MUST_ALIGN if (MUST_ALIGN)
#if 0 /* It turns out we must always make extra space, if MUST_ALIGN
because we must always round the address up at the end,
because we don't know whether the dynamic offset
will mess up the desired alignment. */
/* If we have to round the address up regardless of known_align,
make extra space regardless, also. */
if (known_align % BIGGEST_ALIGNMENT != 0)
#endif
{ {
if (GET_CODE (size) == CONST_INT) if (GET_CODE (size) == CONST_INT)
size = GEN_INT (INTVAL (size) size = GEN_INT (INTVAL (size)
...@@ -977,8 +966,6 @@ allocate_dynamic_stack_space (size, target, known_align) ...@@ -977,8 +966,6 @@ allocate_dynamic_stack_space (size, target, known_align)
NULL_RTX, 1, OPTAB_LIB_WIDEN); NULL_RTX, 1, OPTAB_LIB_WIDEN);
} }
#endif
#ifdef SETJMP_VIA_SAVE_AREA #ifdef SETJMP_VIA_SAVE_AREA
/* If setjmp restores regs from a save area in the stack frame, /* If setjmp restores regs from a save area in the stack frame,
avoid clobbering the reg save area. Note that the offset of avoid clobbering the reg save area. Note that the offset of
...@@ -1011,8 +998,8 @@ allocate_dynamic_stack_space (size, target, known_align) ...@@ -1011,8 +998,8 @@ allocate_dynamic_stack_space (size, target, known_align)
#ifdef STACK_BOUNDARY #ifdef STACK_BOUNDARY
/* If we added a variable amount to SIZE, /* If we added a variable amount to SIZE,
we can no longer assume it is aligned. */ we can no longer assume it is aligned. */
#if !defined (SETJMP_VIA_SAVE_AREA) && !defined (MUST_ALIGN) #if !defined (SETJMP_VIA_SAVE_AREA)
if (known_align % STACK_BOUNDARY != 0) if (! MUST_ALIGN && known_align % STACK_BOUNDARY != 0)
#endif #endif
size = round_push (size); size = round_push (size);
#endif #endif
...@@ -1054,12 +1041,7 @@ allocate_dynamic_stack_space (size, target, known_align) ...@@ -1054,12 +1041,7 @@ allocate_dynamic_stack_space (size, target, known_align)
emit_move_insn (target, virtual_stack_dynamic_rtx); emit_move_insn (target, virtual_stack_dynamic_rtx);
#endif #endif
#ifdef MUST_ALIGN if (MUST_ALIGN)
#if 0 /* Even if we know the stack pointer has enough alignment,
there's no way to tell whether virtual_stack_dynamic_rtx shares that
alignment, so we still need to round the address up. */
if (known_align % BIGGEST_ALIGNMENT != 0)
#endif
{ {
/* CEIL_DIV_EXPR needs to worry about the addition overflowing, /* CEIL_DIV_EXPR needs to worry about the addition overflowing,
but we know it can't. So add ourselves and then do TRUNC_DIV_EXPR. */ but we know it can't. So add ourselves and then do TRUNC_DIV_EXPR. */
...@@ -1073,7 +1055,6 @@ allocate_dynamic_stack_space (size, target, known_align) ...@@ -1073,7 +1055,6 @@ allocate_dynamic_stack_space (size, target, known_align)
GEN_INT (BIGGEST_ALIGNMENT / BITS_PER_UNIT), GEN_INT (BIGGEST_ALIGNMENT / BITS_PER_UNIT),
NULL_RTX, 1); NULL_RTX, 1);
} }
#endif
/* Some systems require a particular insn to refer to the stack /* Some systems require a particular insn to refer to the stack
to make the pages exist. */ to make the pages exist. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment