2010-08-04 Richard Henderson <rth@redhat.com>
+ * config/i386/i386.c (ix86_using_red_zone): New.
+ (ix86_compute_frame_layout, ix86_add_cfa_restore_note,
+ ix86_expand_prologue, ix86_force_to_memory): Use it.
+
* config/i386/i386.c (ix86_expand_prologue): Simplify logic
saving the int registers.
"bdver1"
};
\f
+/* Return true if a red-zone is in use. */
+
+static inline bool
+ix86_using_red_zone (void)
+{
+ return TARGET_RED_ZONE && !TARGET_64BIT_MS_ABI;
+}
+
/* Implement TARGET_HANDLE_OPTION. */
static bool
|| (TARGET_64BIT && frame->to_allocate >= (HOST_WIDE_INT) 0x80000000))
frame->save_regs_using_mov = false;
- if (!TARGET_64BIT_MS_ABI && TARGET_RED_ZONE
+ if (ix86_using_red_zone ()
&& current_function_sp_is_unchanging
&& current_function_is_leaf
&& !ix86_current_function_calls_tls_descriptor)
static void
ix86_add_cfa_restore_note (rtx insn, rtx reg, HOST_WIDE_INT red_offset)
{
- if (TARGET_RED_ZONE
- && !TARGET_64BIT_MS_ABI
+ if (ix86_using_red_zone ()
&& red_offset + RED_ZONE_SIZE >= 0
&& crtl->args.pops_args < 65536)
return;
at least on x86_64 the stack probe can turn into a call that clobbers
a red zone location */
if (!int_registers_saved
- && (TARGET_RED_ZONE && !TARGET_64BIT_MS_ABI)
+ && ix86_using_red_zone ()
&& (! TARGET_STACK_PROBE || allocate < CHECK_STACK_LIMIT))
{
ix86_emit_save_regs_using_mov ((frame_pointer_needed
rtx result;
gcc_assert (reload_completed);
- if (!TARGET_64BIT_MS_ABI && TARGET_RED_ZONE)
+ if (ix86_using_red_zone ())
{
result = gen_rtx_MEM (mode,
gen_rtx_PLUS (Pmode,
GEN_INT (-RED_ZONE_SIZE)));
emit_move_insn (result, operand);
}
- else if ((TARGET_64BIT_MS_ABI || !TARGET_RED_ZONE) && TARGET_64BIT)
+ else if (TARGET_64BIT)
{
switch (mode)
{
void
ix86_free_from_memory (enum machine_mode mode)
{
- if (!TARGET_RED_ZONE || TARGET_64BIT_MS_ABI)
+ if (!ix86_using_red_zone ())
{
int size;