aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorUros Bizjak <ubizjak@gmail.com>2015-07-24 21:03:45 +0200
committerUros Bizjak <uros@gcc.gnu.org>2015-07-24 21:03:45 +0200
commit36b7d827dbcae9727c83ca10424d657109caa12b (patch)
tree206e3692017451bc51e4e95f727a232995b40546 /gcc/config
parent484d5dde41d1db66e36999fe01e190adf688d417 (diff)
downloadgcc-36b7d827dbcae9727c83ca10424d657109caa12b.zip
gcc-36b7d827dbcae9727c83ca10424d657109caa12b.tar.gz
gcc-36b7d827dbcae9727c83ca10424d657109caa12b.tar.bz2
i386.c (ix86_call_abi_override): Call ix86_function_abi.
* config/i386/i386.c (ix86_call_abi_override): Call ix86_function_abi. (ix86_function_abi): Cleanup. From-SVN: r226187
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/i386/i386.c89
1 files changed, 38 insertions, 51 deletions
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index d6b4508..468cb19 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -6316,43 +6316,51 @@ ix86_reg_parm_stack_space (const_tree fndecl)
return 0;
}
-/* Returns value SYSV_ABI, MS_ABI dependent on fntype, specifying the
- call abi used. */
+/* We add this as a workaround in order to use libc_has_function
+ hook in i386.md. */
+bool
+ix86_libc_has_function (enum function_class fn_class)
+{
+ return targetm.libc_has_function (fn_class);
+}
+
+/* Returns value SYSV_ABI, MS_ABI dependent on fntype,
+ specifying the call abi used. */
enum calling_abi
ix86_function_type_abi (const_tree fntype)
{
- if (fntype != NULL_TREE && TYPE_ATTRIBUTES (fntype) != NULL_TREE)
+ enum calling_abi abi = ix86_abi;
+
+ if (fntype == NULL_TREE || TYPE_ATTRIBUTES (fntype) == NULL_TREE)
+ return abi;
+
+ if (abi == SYSV_ABI
+ && lookup_attribute ("ms_abi", TYPE_ATTRIBUTES (fntype)))
{
- enum calling_abi abi = ix86_abi;
- if (abi == SYSV_ABI)
- {
- if (lookup_attribute ("ms_abi", TYPE_ATTRIBUTES (fntype)))
- {
- if (TARGET_X32)
- {
- static bool warned = false;
- if (!warned)
- {
- error ("X32 does not support ms_abi attribute");
- warned = true;
- }
- }
- abi = MS_ABI;
- }
- }
- else if (lookup_attribute ("sysv_abi", TYPE_ATTRIBUTES (fntype)))
- abi = SYSV_ABI;
- return abi;
+ if (TARGET_X32)
+ error ("X32 does not support ms_abi attribute");
+
+ abi = MS_ABI;
}
- return ix86_abi;
+ else if (abi == MS_ABI
+ && lookup_attribute ("sysv_abi", TYPE_ATTRIBUTES (fntype)))
+ abi = SYSV_ABI;
+
+ return abi;
}
-/* We add this as a workaround in order to use libc_has_function
- hook in i386.md. */
-bool
-ix86_libc_has_function (enum function_class fn_class)
+static enum calling_abi
+ix86_function_abi (const_tree fndecl)
{
- return targetm.libc_has_function (fn_class);
+ return fndecl ? ix86_function_type_abi (TREE_TYPE (fndecl)) : ix86_abi;
+}
+
+/* Returns value SYSV_ABI, MS_ABI dependent on cfun,
+ specifying the call abi used. */
+enum calling_abi
+ix86_cfun_abi (void)
+{
+ return cfun ? cfun->machine->call_abi : ix86_abi;
}
static bool
@@ -6369,24 +6377,6 @@ ix86_function_ms_hook_prologue (const_tree fn)
return false;
}
-static enum calling_abi
-ix86_function_abi (const_tree fndecl)
-{
- if (! fndecl)
- return ix86_abi;
- return ix86_function_type_abi (TREE_TYPE (fndecl));
-}
-
-/* Returns value SYSV_ABI, MS_ABI dependent on cfun, specifying the
- call abi used. */
-enum calling_abi
-ix86_cfun_abi (void)
-{
- if (! cfun)
- return ix86_abi;
- return cfun->machine->call_abi;
-}
-
/* Write the extra assembler code needed to declare a function properly. */
void
@@ -6439,10 +6429,7 @@ extern void init_regs (void);
void
ix86_call_abi_override (const_tree fndecl)
{
- if (fndecl == NULL_TREE)
- cfun->machine->call_abi = ix86_abi;
- else
- cfun->machine->call_abi = ix86_function_type_abi (TREE_TYPE (fndecl));
+ cfun->machine->call_abi = ix86_function_abi (fndecl);
}
/* 64-bit MS and SYSV ABI have different set of call used registers. Avoid