+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
/* 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);
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
{
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
{
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. */
#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. */
/* 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));