===================================================================
@@ -84,7 +84,7 @@ along with GCC; see the file COPYING3.
(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)
@@ -262,7 +262,7 @@ do { \
#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.
===================================================================
@@ -4347,8 +4347,8 @@ ix86_conditional_register_usage (void)
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;
@@ -5607,11 +5607,18 @@ ix86_keep_aggregate_return_pointer (tree
{
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;
}
@@ -5748,7 +5755,7 @@ ix86_reg_parm_stack_space (const_tree fn
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;
}
@@ -5758,7 +5765,7 @@ ix86_reg_parm_stack_space (const_tree fn
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)
@@ -5800,7 +5807,7 @@ ix86_function_abi (const_tree fndecl)
enum calling_abi
ix86_cfun_abi (void)
{
- if (! cfun || ! TARGET_64BIT)
+ if (! cfun)
return ix86_abi;
return cfun->machine->call_abi;
}
@@ -5863,9 +5870,9 @@ ix86_call_abi_override (const_tree fndec
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)
{
@@ -5931,7 +5938,7 @@ init_cumulative_args (CUMULATIVE_ARGS *c
/* 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;
@@ -8179,7 +8186,7 @@ ix86_gimplify_va_arg (tree valist, tree
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;
@@ -9095,7 +9102,7 @@ ix86_nsaved_sseregs (void)
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))
@@ -9207,9 +9214,9 @@ ix86_compute_frame_layout (struct ix86_f
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))
{
@@ -21873,8 +21880,7 @@ ix86_expand_call (rtx retval, rtx fnaddr
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
===================================================================
@@ -497,6 +497,9 @@ extern tree x86_mfence;
/* 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
@@ -1439,12 +1442,12 @@ enum reg_class
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. */
@@ -1470,7 +1473,7 @@ enum reg_class
#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. */
===================================================================
@@ -26,6 +26,9 @@ along with GCC; see the file COPYING3.
#define TARGET_VERSION fprintf (stderr," (x86 MinGW)");
#endif
+#undef DEFAULT_ABI
+#define DEFAULT_ABI MS_ABI
+
/* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS
is for compatibility with native compiler. */
#define EXTRA_OS_CPP_BUILTINS() \