diff options
author | Jan Hubicka <jh@suse.cz> | 2008-12-18 14:48:36 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2008-12-18 13:48:36 +0000 |
commit | 877a0b76e1f1b0efde5b7e9fe8c88b62b8abdc83 (patch) | |
tree | f029c9d38fce226b2b2a474b1cacb84982907f60 | |
parent | 02b47899e14982d742b91de30d3129b2719c59d0 (diff) | |
download | gcc-877a0b76e1f1b0efde5b7e9fe8c88b62b8abdc83.zip gcc-877a0b76e1f1b0efde5b7e9fe8c88b62b8abdc83.tar.gz gcc-877a0b76e1f1b0efde5b7e9fe8c88b62b8abdc83.tar.bz2 |
i386.h (CONDITIONAL_REGISTER_USAGE): Initialize for current function ABI.
* i386.h (CONDITIONAL_REGISTER_USAGE): Initialize for current function
ABI.
* i386.c (ix86_call_abi_override): Do not trigger target re-init and
do not try to modify call used regs.
(ix86_maybe_switch_abi): New function.
(TARGET_EXPAND_TO_RTL_HOOK): New macro.
Co-Authored-By: Kai Tietz <kai.tietz@onevision.com>
From-SVN: r142810
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 36 | ||||
-rw-r--r-- | gcc/config/i386/i386.h | 4 |
3 files changed, 28 insertions, 22 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7862b10..a798d85 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2008-12-18 Jan Hubicka <jh@suse.cz> + Kai Tietz <kai.tietz@onevision.com> + + * i386.h (CONDITIONAL_REGISTER_USAGE): Initialize for current function + ABI. + * i386.c (ix86_call_abi_override): Do not trigger target re-init and + do not try to modify call used regs. + (ix86_maybe_switch_abi): New function. + (TARGET_EXPAND_TO_RTL_HOOK): New macro. + 2008-12-18 Kenneth Zadeck <zadeck@naturalbridge.com> PR rtl-optimization/37922 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 12e9e5a..824a11d 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -4600,9 +4600,7 @@ extern void init_regs (void); /* Implementation of call abi switching target hook. Specific to FNDECL the specific call register sets are set. See also CONDITIONAL_REGISTER_USAGE - for more details. - To prevent redudant calls of costy function init_regs (), it checks not to - reset register usage for default abi. */ + for more details. */ void ix86_call_abi_override (const_tree fndecl) { @@ -4610,24 +4608,17 @@ ix86_call_abi_override (const_tree fndecl) cfun->machine->call_abi = DEFAULT_ABI; else cfun->machine->call_abi = ix86_function_type_abi (TREE_TYPE (fndecl)); - if (TARGET_64BIT && cfun->machine->call_abi == MS_ABI) - { - if (call_used_regs[4 /*RSI*/] != 0 || call_used_regs[5 /*RDI*/] != 0) - { - call_used_regs[4 /*RSI*/] = 0; - call_used_regs[5 /*RDI*/] = 0; - init_regs (); - } - } - else if (TARGET_64BIT) - { - if (call_used_regs[4 /*RSI*/] != 1 || call_used_regs[5 /*RDI*/] != 1) - { - call_used_regs[4 /*RSI*/] = 1; - call_used_regs[5 /*RDI*/] = 1; - init_regs (); - } - } +} + +/* 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) +{ + if (TARGET_64BIT && + call_used_regs[4 /*RSI*/] == (cfun->machine->call_abi == MS_ABI)) + init_regs (); } /* Initialize a variable CUM of type CUMULATIVE_ARGS @@ -29243,6 +29234,9 @@ ix86_enum_va_list (int idx, const char **pname, tree *ptree) #undef TARGET_OPTION_CAN_INLINE_P #define TARGET_OPTION_CAN_INLINE_P ix86_can_inline_p +#undef TARGET_EXPAND_TO_RTL_HOOK +#define TARGET_EXPAND_TO_RTL_HOOK ix86_maybe_switch_abi + struct gcc_target targetm = TARGET_INITIALIZER; #include "gt-i386.h" diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 32f793b..a1da0a75 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -964,7 +964,9 @@ do { \ for (i = FIRST_REX_SSE_REG; i <= LAST_REX_SSE_REG; i++) \ reg_names[i] = ""; \ } \ - if (TARGET_64BIT && DEFAULT_ABI == MS_ABI) \ + if (TARGET_64BIT \ + && ((cfun && cfun->machine->call_abi == MS_ABI) \ + || (!cfun && DEFAULT_ABI == MS_ABI))) \ { \ call_used_regs[4 /*RSI*/] = 0; \ call_used_regs[5 /*RDI*/] = 0; \ |