Commit 6510e8bb by Kai Tietz Committed by Kai Tietz

cygming.h (DWARF_FRAME_REGISTERS): Adjust comment.

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.

From-SVN: r171459
parent a5205bd2
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> 2011-03-25 Richard Guenther <rguenther@suse.de>
* tree-flow.h (verify_stmts): Rename to verify_gimple_in_cfg. * tree-flow.h (verify_stmts): Rename to verify_gimple_in_cfg.
......
...@@ -84,7 +84,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -84,7 +84,7 @@ along with GCC; see the file COPYING3. If not see
(TARGET_64BIT ? dbx64_register_map[(n)] \ (TARGET_64BIT ? dbx64_register_map[(n)] \
: svr4_dbx_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 #undef DWARF_FRAME_REGISTERS
#define DWARF_FRAME_REGISTERS (TARGET_64BIT ? 33 : 17) #define DWARF_FRAME_REGISTERS (TARGET_64BIT ? 33 : 17)
...@@ -262,7 +262,7 @@ do { \ ...@@ -262,7 +262,7 @@ do { \
#define CHECK_STACK_LIMIT 4000 #define CHECK_STACK_LIMIT 4000
#undef STACK_BOUNDARY #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, /* By default, target has a 80387, uses IEEE compatible arithmetic,
returns float values in the 387 and needs stack probes. returns float values in the 387 and needs stack probes.
......
...@@ -4347,8 +4347,8 @@ ix86_conditional_register_usage (void) ...@@ -4347,8 +4347,8 @@ ix86_conditional_register_usage (void)
if (j != INVALID_REGNUM) if (j != INVALID_REGNUM)
fixed_regs[j] = call_used_regs[j] = 1; fixed_regs[j] = call_used_regs[j] = 1;
/* The MS_ABI changes the set of call-used registers. */ /* The 64-bit MS_ABI changes the set of call-used registers. */
if (TARGET_64BIT && ix86_cfun_abi () == MS_ABI) if (TARGET_64BIT_MS_ABI)
{ {
call_used_regs[SI_REG] = 0; call_used_regs[SI_REG] = 0;
call_used_regs[DI_REG] = 0; call_used_regs[DI_REG] = 0;
...@@ -5607,11 +5607,18 @@ ix86_keep_aggregate_return_pointer (tree fntype) ...@@ -5607,11 +5607,18 @@ ix86_keep_aggregate_return_pointer (tree fntype)
{ {
tree attr; tree attr;
attr = lookup_attribute ("callee_pop_aggregate_return", if (!TARGET_64BIT)
TYPE_ATTRIBUTES (fntype)); {
if (attr) attr = lookup_attribute ("callee_pop_aggregate_return",
return (TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (attr))) == 0); 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; return KEEP_AGGREGATE_RETURN_POINTER != 0;
} }
...@@ -5748,7 +5755,7 @@ ix86_reg_parm_stack_space (const_tree fndecl) ...@@ -5748,7 +5755,7 @@ ix86_reg_parm_stack_space (const_tree fndecl)
call_abi = ix86_function_abi (fndecl); call_abi = ix86_function_abi (fndecl);
else else
call_abi = ix86_function_type_abi (fndecl); call_abi = ix86_function_type_abi (fndecl);
if (call_abi == MS_ABI) if (TARGET_64BIT && call_abi == MS_ABI)
return 32; return 32;
return 0; return 0;
} }
...@@ -5758,7 +5765,7 @@ ix86_reg_parm_stack_space (const_tree fndecl) ...@@ -5758,7 +5765,7 @@ ix86_reg_parm_stack_space (const_tree fndecl)
enum calling_abi enum calling_abi
ix86_function_type_abi (const_tree fntype) ix86_function_type_abi (const_tree fntype)
{ {
if (TARGET_64BIT && fntype != NULL) if (fntype != NULL)
{ {
enum calling_abi abi = ix86_abi; enum calling_abi abi = ix86_abi;
if (abi == SYSV_ABI) if (abi == SYSV_ABI)
...@@ -5800,7 +5807,7 @@ ix86_function_abi (const_tree fndecl) ...@@ -5800,7 +5807,7 @@ ix86_function_abi (const_tree fndecl)
enum calling_abi enum calling_abi
ix86_cfun_abi (void) ix86_cfun_abi (void)
{ {
if (! cfun || ! TARGET_64BIT) if (! cfun)
return ix86_abi; return ix86_abi;
return cfun->machine->call_abi; return cfun->machine->call_abi;
} }
...@@ -5863,9 +5870,9 @@ ix86_call_abi_override (const_tree fndecl) ...@@ -5863,9 +5870,9 @@ ix86_call_abi_override (const_tree fndecl)
cfun->machine->call_abi = ix86_function_type_abi (TREE_TYPE (fndecl)); cfun->machine->call_abi = ix86_function_type_abi (TREE_TYPE (fndecl));
} }
/* MS and SYSV ABI have different set of call used registers. Avoid expensive /* 64-bit MS and SYSV ABI have different set of call used registers. Avoid
re-initialization of init_regs each time we switch function context since expensive re-initialization of init_regs each time we switch function context
this is needed only during RTL expansion. */ since this is needed only during RTL expansion. */
static void static void
ix86_maybe_switch_abi (void) ix86_maybe_switch_abi (void)
{ {
...@@ -5931,7 +5938,7 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, /* Argument info to initialize */ ...@@ -5931,7 +5938,7 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, /* Argument info to initialize */
/* Set up the number of registers to use for passing arguments. */ /* 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 " sorry ("ms_abi attribute requires -maccumulate-outgoing-args "
"or subtarget optimization implying it"); "or subtarget optimization implying it");
cum->nregs = ix86_regparm; cum->nregs = ix86_regparm;
...@@ -8179,7 +8186,7 @@ ix86_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p, ...@@ -8179,7 +8186,7 @@ ix86_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
case V4DFmode: case V4DFmode:
case V4DImode: case V4DImode:
/* Unnamed 256bit vector mode parameters are passed on stack. */ /* Unnamed 256bit vector mode parameters are passed on stack. */
if (ix86_cfun_abi () == SYSV_ABI) if (!TARGET_64BIT_MS_ABI)
{ {
container = NULL; container = NULL;
break; break;
...@@ -9095,7 +9102,7 @@ ix86_nsaved_sseregs (void) ...@@ -9095,7 +9102,7 @@ ix86_nsaved_sseregs (void)
int nregs = 0; int nregs = 0;
int regno; int regno;
if (ix86_cfun_abi () != MS_ABI) if (!TARGET_64BIT_MS_ABI)
return 0; return 0;
for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
if (SSE_REGNO_P (regno) && ix86_save_reg (regno, true)) if (SSE_REGNO_P (regno) && ix86_save_reg (regno, true))
...@@ -9207,9 +9214,9 @@ ix86_compute_frame_layout (struct ix86_frame *frame) ...@@ -9207,9 +9214,9 @@ ix86_compute_frame_layout (struct ix86_frame *frame)
stack_alignment_needed = crtl->stack_alignment_needed / BITS_PER_UNIT; stack_alignment_needed = crtl->stack_alignment_needed / BITS_PER_UNIT;
preferred_alignment = crtl->preferred_stack_boundary / 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 /* 64-bit MS ABI seem to require stack alignment to be always 16 except for
prologues and leaf. */ function prologues and leaf. */
if ((ix86_cfun_abi () == MS_ABI && preferred_alignment < 16) if ((TARGET_64BIT_MS_ABI && preferred_alignment < 16)
&& (!current_function_is_leaf || cfun->calls_alloca != 0 && (!current_function_is_leaf || cfun->calls_alloca != 0
|| ix86_current_function_calls_tls_descriptor)) || ix86_current_function_calls_tls_descriptor))
{ {
...@@ -21877,8 +21884,7 @@ ix86_expand_call (rtx retval, rtx fnaddr, rtx callarg1, ...@@ -21877,8 +21884,7 @@ ix86_expand_call (rtx retval, rtx fnaddr, rtx callarg1,
pop = gen_rtx_SET (VOIDmode, stack_pointer_rtx, pop); pop = gen_rtx_SET (VOIDmode, stack_pointer_rtx, pop);
call = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, call, pop)); call = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, call, pop));
} }
if (TARGET_64BIT if (TARGET_64BIT_MS_ABI
&& ix86_cfun_abi () == MS_ABI
&& (!callarg2 || INTVAL (callarg2) != -2)) && (!callarg2 || INTVAL (callarg2) != -2))
{ {
/* We need to represent that SI and DI registers are clobbered /* We need to represent that SI and DI registers are clobbered
...@@ -497,6 +497,9 @@ extern tree x86_mfence; ...@@ -497,6 +497,9 @@ extern tree x86_mfence;
/* For the Windows 64-bit ABI. */ /* For the Windows 64-bit ABI. */
#define TARGET_64BIT_MS_ABI (TARGET_64BIT && ix86_cfun_abi () == MS_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. */ /* This is re-defined by cygming.h. */
#define TARGET_SEH 0 #define TARGET_SEH 0
...@@ -1439,12 +1442,12 @@ enum reg_class ...@@ -1439,12 +1442,12 @@ enum reg_class
No space will be pushed onto the stack for each call; instead, the No space will be pushed onto the stack for each call; instead, the
function prologue should increase the stack frame size by this amount. function prologue should increase the stack frame size by this amount.
MS ABI seem to require 16 byte alignment everywhere except for function 64-bit MS ABI seem to require 16 byte alignment everywhere except for
prologue and apilogue. This is not possible without function prologue and apilogue. This is not possible without
ACCUMULATE_OUTGOING_ARGS. */ ACCUMULATE_OUTGOING_ARGS. */
#define 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 /* If defined, a C expression whose value is nonzero when we want to use PUSH
instructions to pass outgoing arguments. */ instructions to pass outgoing arguments. */
...@@ -1470,7 +1473,7 @@ enum reg_class ...@@ -1470,7 +1473,7 @@ enum reg_class
#define REG_PARM_STACK_SPACE(FNDECL) ix86_reg_parm_stack_space (FNDECL) #define REG_PARM_STACK_SPACE(FNDECL) ix86_reg_parm_stack_space (FNDECL)
#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) \ #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 /* Define how to find the value returned by a library function
assuming the value has mode MODE. */ assuming the value has mode MODE. */
......
...@@ -26,6 +26,9 @@ along with GCC; see the file COPYING3. If not see ...@@ -26,6 +26,9 @@ along with GCC; see the file COPYING3. If not see
#define TARGET_VERSION fprintf (stderr," (x86 MinGW)"); #define TARGET_VERSION fprintf (stderr," (x86 MinGW)");
#endif #endif
#undef DEFAULT_ABI
#define DEFAULT_ABI MS_ABI
/* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS /* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS
is for compatibility with native compiler. */ is for compatibility with native compiler. */
#define EXTRA_OS_CPP_BUILTINS() \ #define EXTRA_OS_CPP_BUILTINS() \
......
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