+2011-03-25 Kai Tietz <ktietz@redhat.com>
+
+ * config/i386/cygming.h (DWARF_FRAME_REGISTERS): Adjust comment.
+ (STACK_BOUNDARY): Check for bit-ness in case of MS_ABI.
+ * config/i386/i386.c (ix86_conditional_register_usage): Adjust
+ comment and use macro TARGET_64BIT_MS_ABI instead.
+ (ix86_keep_aggregate_return_pointer): Optimize for 64-bit case
+ and change default behavior for 32-bit MS_ABI.
+ (ix86_reg_parm_stack_space): Check additionally for bit-ness.
+ (ix86_function_type_abi): Allow check for ms_abi/sysv_abi for
+ 32-bit, too.
+ (ix86_cfun_abi): Likewise.
+ (ix86_maybe_switch_abi): Adjust comment.
+ (init_cumulative_args): Check for bit-ness in MS_ABI case.
+ (ix86_gimplify_va_arg): Check just for not TARGET_64BIT_MS_ABI
+ instead of checking for SYSV_ABI.
+ (ix86_nsaved_sseregs): Likewise.
+ (ix86_compute_frame_layout): Set only for 64-bit MS_ABI alignment
+ to 16 bytes.
+ (ix86_expand_call): Use TARGET_64BIT_MS_ABI macro.
+ * config/i386.h (TARGET_32BIT_MS_ABI): New macro.
+ (ACCUMULATE_OUTGOING_ARGS): Check explicit for 64-bit MS_ABI.
+ (OUTGOING_REG_PARM_STACK_SPACE): Likewise.
+ * config/mingw32.h (DEFAULT_ABI): Change default always to MS_ABI.
+
2011-03-25 Richard Guenther <rguenther@suse.de>
* tree-flow.h (verify_stmts): Rename to verify_gimple_in_cfg.
(TARGET_64BIT ? dbx64_register_map[(n)] \
: svr4_dbx_register_map[(n)])
-/* The MS_ABI changes the set of call-used registers. */
+/* The 64-bit MS_ABI changes the set of call-used registers. */
#undef DWARF_FRAME_REGISTERS
#define DWARF_FRAME_REGISTERS (TARGET_64BIT ? 33 : 17)
#define CHECK_STACK_LIMIT 4000
#undef STACK_BOUNDARY
-#define STACK_BOUNDARY (ix86_abi == MS_ABI ? 128 : BITS_PER_WORD)
+#define STACK_BOUNDARY (TARGET_64BIT && ix86_abi == MS_ABI ? 128 : BITS_PER_WORD)
/* By default, target has a 80387, uses IEEE compatible arithmetic,
returns float values in the 387 and needs stack probes.
if (j != INVALID_REGNUM)
fixed_regs[j] = call_used_regs[j] = 1;
- /* The MS_ABI changes the set of call-used registers. */
- if (TARGET_64BIT && ix86_cfun_abi () == MS_ABI)
+ /* The 64-bit MS_ABI changes the set of call-used registers. */
+ if (TARGET_64BIT_MS_ABI)
{
call_used_regs[SI_REG] = 0;
call_used_regs[DI_REG] = 0;
{
tree attr;
- attr = lookup_attribute ("callee_pop_aggregate_return",
- TYPE_ATTRIBUTES (fntype));
- if (attr)
- return (TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (attr))) == 0);
+ if (!TARGET_64BIT)
+ {
+ attr = lookup_attribute ("callee_pop_aggregate_return",
+ TYPE_ATTRIBUTES (fntype));
+ if (attr)
+ return (TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (attr))) == 0);
+ /* For 32-bit MS-ABI the default is to keep aggregate
+ return pointer. */
+ if (ix86_function_type_abi (fntype) == MS_ABI)
+ return true;
+ }
return KEEP_AGGREGATE_RETURN_POINTER != 0;
}
call_abi = ix86_function_abi (fndecl);
else
call_abi = ix86_function_type_abi (fndecl);
- if (call_abi == MS_ABI)
+ if (TARGET_64BIT && call_abi == MS_ABI)
return 32;
return 0;
}
enum calling_abi
ix86_function_type_abi (const_tree fntype)
{
- if (TARGET_64BIT && fntype != NULL)
+ if (fntype != NULL)
{
enum calling_abi abi = ix86_abi;
if (abi == SYSV_ABI)
enum calling_abi
ix86_cfun_abi (void)
{
- if (! cfun || ! TARGET_64BIT)
+ if (! cfun)
return ix86_abi;
return cfun->machine->call_abi;
}
cfun->machine->call_abi = ix86_function_type_abi (TREE_TYPE (fndecl));
}
-/* MS and SYSV ABI have different set of call used registers. Avoid expensive
- re-initialization of init_regs each time we switch function context since
- this is needed only during RTL expansion. */
+/* 64-bit MS and SYSV ABI have different set of call used registers. Avoid
+ expensive re-initialization of init_regs each time we switch function context
+ since this is needed only during RTL expansion. */
static void
ix86_maybe_switch_abi (void)
{
/* Set up the number of registers to use for passing arguments. */
- if (cum->call_abi == MS_ABI && !ACCUMULATE_OUTGOING_ARGS)
+ if (TARGET_64BIT && cum->call_abi == MS_ABI && !ACCUMULATE_OUTGOING_ARGS)
sorry ("ms_abi attribute requires -maccumulate-outgoing-args "
"or subtarget optimization implying it");
cum->nregs = ix86_regparm;
case V4DFmode:
case V4DImode:
/* Unnamed 256bit vector mode parameters are passed on stack. */
- if (ix86_cfun_abi () == SYSV_ABI)
+ if (!TARGET_64BIT_MS_ABI)
{
container = NULL;
break;
int nregs = 0;
int regno;
- if (ix86_cfun_abi () != MS_ABI)
+ if (!TARGET_64BIT_MS_ABI)
return 0;
for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
if (SSE_REGNO_P (regno) && ix86_save_reg (regno, true))
stack_alignment_needed = crtl->stack_alignment_needed / BITS_PER_UNIT;
preferred_alignment = crtl->preferred_stack_boundary / BITS_PER_UNIT;
- /* MS ABI seem to require stack alignment to be always 16 except for function
- prologues and leaf. */
- if ((ix86_cfun_abi () == MS_ABI && preferred_alignment < 16)
+ /* 64-bit MS ABI seem to require stack alignment to be always 16 except for
+ function prologues and leaf. */
+ if ((TARGET_64BIT_MS_ABI && preferred_alignment < 16)
&& (!current_function_is_leaf || cfun->calls_alloca != 0
|| ix86_current_function_calls_tls_descriptor))
{
pop = gen_rtx_SET (VOIDmode, stack_pointer_rtx, pop);
call = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, call, pop));
}
- if (TARGET_64BIT
- && ix86_cfun_abi () == MS_ABI
+ if (TARGET_64BIT_MS_ABI
&& (!callarg2 || INTVAL (callarg2) != -2))
{
/* We need to represent that SI and DI registers are clobbered
/* For the Windows 64-bit ABI. */
#define TARGET_64BIT_MS_ABI (TARGET_64BIT && ix86_cfun_abi () == MS_ABI)
+/* For the Windows 32-bit ABI. */
+#define TARGET_32BIT_MS_ABI (!TARGET_64BIT && ix86_cfun_abi () == MS_ABI)
+
/* This is re-defined by cygming.h. */
#define TARGET_SEH 0
No space will be pushed onto the stack for each call; instead, the
function prologue should increase the stack frame size by this amount.
- MS ABI seem to require 16 byte alignment everywhere except for function
- prologue and apilogue. This is not possible without
+ 64-bit MS ABI seem to require 16 byte alignment everywhere except for
+ function prologue and apilogue. This is not possible without
ACCUMULATE_OUTGOING_ARGS. */
#define ACCUMULATE_OUTGOING_ARGS \
- (TARGET_ACCUMULATE_OUTGOING_ARGS || ix86_cfun_abi () == MS_ABI)
+ (TARGET_ACCUMULATE_OUTGOING_ARGS || TARGET_64BIT_MS_ABI)
/* If defined, a C expression whose value is nonzero when we want to use PUSH
instructions to pass outgoing arguments. */
#define REG_PARM_STACK_SPACE(FNDECL) ix86_reg_parm_stack_space (FNDECL)
#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) \
- (ix86_function_type_abi (FNTYPE) == MS_ABI)
+ (TARGET_64BIT && ix86_function_type_abi (FNTYPE) == MS_ABI)
/* Define how to find the value returned by a library function
assuming the value has mode MODE. */