diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/builtins.c | 2 | ||||
-rw-r--r-- | gcc/calls.c | 11 | ||||
-rw-r--r-- | gcc/calls.h | 1 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 6 | ||||
-rw-r--r-- | gcc/df-scan.c | 3 |
6 files changed, 25 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7e803a3..9284a8c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2017-12-20 Tom de Vries <tom@codesourcery.com> + + PR middle-end/83423 + * config/i386/i386.c (ix86_static_chain): Move DECL_STATIC_CHAIN test ... + * calls.c (rtx_for_static_chain): ... here. New function. + * calls.h (rtx_for_static_chain): Declare. + * builtins.c (expand_builtin_setjmp_receiver): Use rtx_for_static_chain + instead of targetm.calls.static_chain. + * df-scan.c (df_get_entry_block_def_set): Same. + 2017-12-19 Tom de Vries <tom@codesourcery.com> PR tree-optimization/83493 diff --git a/gcc/builtins.c b/gcc/builtins.c index 6bff904..3e8ea95 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -878,7 +878,7 @@ expand_builtin_setjmp_receiver (rtx receiver_label) /* Mark the static chain as clobbered here so life information doesn't get messed up for it. */ - chain = targetm.calls.static_chain (current_function_decl, true); + chain = rtx_for_static_chain (current_function_decl, true); if (chain && REG_P (chain)) emit_clobber (chain); diff --git a/gcc/calls.c b/gcc/calls.c index da6c96b..6057aa6 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -2460,6 +2460,17 @@ rtx_for_function_call (tree fndecl, tree addr) return funexp; } +/* Return the static chain for this function, if any. */ + +rtx +rtx_for_static_chain (const_tree fndecl_or_type, bool incoming_p) +{ + if (DECL_P (fndecl_or_type) && !DECL_STATIC_CHAIN (fndecl_or_type)) + return NULL; + + return targetm.calls.static_chain (fndecl_or_type, incoming_p); +} + /* Internal state for internal_arg_pointer_based_exp and its helpers. */ static struct { diff --git a/gcc/calls.h b/gcc/calls.h index 641166e..1aab140 100644 --- a/gcc/calls.h +++ b/gcc/calls.h @@ -41,5 +41,6 @@ extern void maybe_warn_alloc_args_overflow (tree, tree, tree[2], int[2]); extern tree get_attr_nonstring_decl (tree, tree * = NULL); extern void maybe_warn_nonstring_arg (tree, tree); extern bool get_size_range (tree, tree[2], bool = false); +extern rtx rtx_for_static_chain (const_tree, bool); #endif // GCC_CALLS_H diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 85988cf..48d5640 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -29236,12 +29236,6 @@ ix86_static_chain (const_tree fndecl_or_type, bool incoming_p) { unsigned regno; - /* While this function won't be called by the middle-end when a static - chain isn't needed, it's also used throughout the backend so it's - easiest to keep this check centralized. */ - if (DECL_P (fndecl_or_type) && !DECL_STATIC_CHAIN (fndecl_or_type)) - return NULL; - if (TARGET_64BIT) { /* We always use R10 in 64-bit mode. */ diff --git a/gcc/df-scan.c b/gcc/df-scan.c index 429dab8..d0addd9 100644 --- a/gcc/df-scan.c +++ b/gcc/df-scan.c @@ -34,6 +34,7 @@ along with GCC; see the file COPYING3. If not see #include "regs.h" #include "emit-rtl.h" /* FIXME: Can go away once crtl is moved to rtl.h. */ #include "dumpfile.h" +#include "calls.h" /* The set of hard registers in eliminables[i].from. */ @@ -3518,7 +3519,7 @@ df_get_entry_block_def_set (bitmap entry_block_defs) /* If the function has an incoming STATIC_CHAIN, it has to show up in the entry def set. */ - r = targetm.calls.static_chain (current_function_decl, true); + r = rtx_for_static_chain (current_function_decl, true); if (r && REG_P (r)) bitmap_set_bit (entry_block_defs, REGNO (r)); |