aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKai Tietz <ktietz@redhat.com>2011-03-25 17:10:56 +0100
committerKai Tietz <ktietz@gcc.gnu.org>2011-03-25 17:10:56 +0100
commit6510e8bbf0b5510ee5608d1c5f3bd9a470b7f989 (patch)
treeb72b471b6b2fce395c58167740ad401f4d7dc34d /gcc
parenta5205bd2e9f0e8b0131fe34e25a2a76167b60f59 (diff)
downloadgcc-6510e8bbf0b5510ee5608d1c5f3bd9a470b7f989.zip
gcc-6510e8bbf0b5510ee5608d1c5f3bd9a470b7f989.tar.gz
gcc-6510e8bbf0b5510ee5608d1c5f3bd9a470b7f989.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog25
-rw-r--r--gcc/config/i386/cygming.h4
-rw-r--r--gcc/config/i386/i386.c46
-rw-r--r--gcc/config/i386/i386.h11
-rw-r--r--gcc/config/i386/mingw32.h3
5 files changed, 63 insertions, 26 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2001e37..827a662 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,28 @@
+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.
diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h
index 6a6278a..db266b8 100644
--- a/gcc/config/i386/cygming.h
+++ b/gcc/config/i386/cygming.h
@@ -84,7 +84,7 @@ along with GCC; see the file COPYING3. If not see
(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.
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 415cefd..4e8ca69 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -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 fntype)
{
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 fndecl)
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 fndecl)
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 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
- 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 *cum, /* Argument info to initialize */
/* 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 type, gimple_seq *pre_p,
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_frame *frame)
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))
{
@@ -21877,8 +21884,7 @@ ix86_expand_call (rtx retval, rtx fnaddr, rtx callarg1,
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
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index f14a95d..12edeba 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -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. */
diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h
index 4f8a63a..d92a3e4 100644
--- a/gcc/config/i386/mingw32.h
+++ b/gcc/config/i386/mingw32.h
@@ -26,6 +26,9 @@ along with GCC; see the file COPYING3. If not see
#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() \