Commit dd292d0a by Mark Mitchell Committed by Paul Brook

calls.c (initialize_argument_information): Add CALL_FROM_THUNK_P parameter.

	* calls.c (initialize_argument_information): Add CALL_FROM_THUNK_P
	parameter.  Use it instead of current_function_is_thunk.
	* function.h (struct function): Update documentation for is_thunk.
	* tree.h (CALL_FROM_THUNK_P): New macro.
	* config/alpha/alpha.c (alpha_sa_mask): Do not check
	no_new_pseudos when testing current_function_is_thunk.
	* config/rs6000/rs6000.c (rs6000_ra_ever_killed): Likeiwse.

	* decl.c (cxx_push_function_context): Do not set
	current_function_is_thunk.
	* method.c (use_thunk): Set CALL_FROM_THUNK on the call to the
	actual function.

From-SVN: r77244
parent 18d0ecb6
2004-02-04 Mark Mitchell <mark@codesourcery.com>
* calls.c (initialize_argument_information): Add CALL_FROM_THUNK_P
parameter. Use it instead of current_function_is_thunk.
* function.h (struct function): Update documentation for is_thunk.
* tree.h (CALL_FROM_THUNK_P): New macro.
* config/alpha/alpha.c (alpha_sa_mask): Do not check
no_new_pseudos when testing current_function_is_thunk.
* config/rs6000/rs6000.c (rs6000_ra_ever_killed): Likeiwse.
2004-02-04 Kazu Hirata <kazu@cs.umass.edu> 2004-02-04 Kazu Hirata <kazu@cs.umass.edu>
* doc/tm.texi: Replace SETUP_INCOMING_VARARGS with * doc/tm.texi: Replace SETUP_INCOMING_VARARGS with
......
...@@ -133,7 +133,8 @@ static int compute_argument_block_size (int, struct args_size *, int); ...@@ -133,7 +133,8 @@ static int compute_argument_block_size (int, struct args_size *, int);
static void initialize_argument_information (int, struct arg_data *, static void initialize_argument_information (int, struct arg_data *,
struct args_size *, int, tree, struct args_size *, int, tree,
tree, CUMULATIVE_ARGS *, int, tree, CUMULATIVE_ARGS *, int,
rtx *, int *, int *, int *); rtx *, int *, int *, int *,
bool);
static void compute_argument_addresses (struct arg_data *, rtx, int); static void compute_argument_addresses (struct arg_data *, rtx, int);
static rtx rtx_for_function_call (tree, tree); static rtx rtx_for_function_call (tree, tree);
static void load_register_parameters (struct arg_data *, int, rtx *, int, static void load_register_parameters (struct arg_data *, int, rtx *, int,
...@@ -1023,7 +1024,10 @@ store_unaligned_arguments_into_pseudos (struct arg_data *args, int num_actuals) ...@@ -1023,7 +1024,10 @@ store_unaligned_arguments_into_pseudos (struct arg_data *args, int num_actuals)
and may be modified by this routine. and may be modified by this routine.
OLD_PENDING_ADJ, MUST_PREALLOCATE and FLAGS are pointers to integer OLD_PENDING_ADJ, MUST_PREALLOCATE and FLAGS are pointers to integer
flags which may may be modified by this routine. */ flags which may may be modified by this routine.
CALL_FROM_THUNK_P is true if this call is the jump from a thunk to
the thunked-to function. */
static void static void
initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED, initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
...@@ -1034,7 +1038,8 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED, ...@@ -1034,7 +1038,8 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
CUMULATIVE_ARGS *args_so_far, CUMULATIVE_ARGS *args_so_far,
int reg_parm_stack_space, int reg_parm_stack_space,
rtx *old_stack_level, int *old_pending_adj, rtx *old_stack_level, int *old_pending_adj,
int *must_preallocate, int *ecf_flags) int *must_preallocate, int *ecf_flags,
bool call_from_thunk_p)
{ {
/* 1 if scanning parms front to back, -1 if scanning back to front. */ /* 1 if scanning parms front to back, -1 if scanning back to front. */
int inc; int inc;
...@@ -1107,7 +1112,7 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED, ...@@ -1107,7 +1112,7 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
{ {
/* If we're compiling a thunk, pass through invisible /* If we're compiling a thunk, pass through invisible
references instead of making a copy. */ references instead of making a copy. */
if (current_function_is_thunk if (call_from_thunk_p
#ifdef FUNCTION_ARG_CALLEE_COPIES #ifdef FUNCTION_ARG_CALLEE_COPIES
|| (FUNCTION_ARG_CALLEE_COPIES (*args_so_far, TYPE_MODE (type), || (FUNCTION_ARG_CALLEE_COPIES (*args_so_far, TYPE_MODE (type),
type, argpos < n_named_args) type, argpos < n_named_args)
...@@ -2444,7 +2449,8 @@ expand_call (tree exp, rtx target, int ignore) ...@@ -2444,7 +2449,8 @@ expand_call (tree exp, rtx target, int ignore)
n_named_args, actparms, fndecl, n_named_args, actparms, fndecl,
&args_so_far, reg_parm_stack_space, &args_so_far, reg_parm_stack_space,
&old_stack_level, &old_pending_adj, &old_stack_level, &old_pending_adj,
&must_preallocate, &flags); &must_preallocate, &flags,
CALL_FROM_THUNK_P (exp));
if (args_size.var) if (args_size.var)
{ {
......
...@@ -6735,13 +6735,10 @@ alpha_sa_mask (unsigned long *imaskP, unsigned long *fmaskP) ...@@ -6735,13 +6735,10 @@ alpha_sa_mask (unsigned long *imaskP, unsigned long *fmaskP)
unsigned long fmask = 0; unsigned long fmask = 0;
unsigned int i; unsigned int i;
/* Irritatingly, there are two kinds of thunks -- those created with /* When outputting a thunk, we don't have valid register life info,
TARGET_ASM_OUTPUT_MI_THUNK and those with DECL_THUNK_P that go but assemble_start_function wants to output .frame and .mask
through the regular part of the compiler. In the directives. */
TARGET_ASM_OUTPUT_MI_THUNK case we don't have valid register life if (current_function_is_thunk)
info, but assemble_start_function wants to output .frame and
.mask directives. */
if (current_function_is_thunk && !no_new_pseudos)
{ {
*imaskP = 0; *imaskP = 0;
*fmaskP = 0; *fmaskP = 0;
......
...@@ -11000,11 +11000,7 @@ rs6000_ra_ever_killed (void) ...@@ -11000,11 +11000,7 @@ rs6000_ra_ever_killed (void)
rtx reg; rtx reg;
rtx insn; rtx insn;
/* Irritatingly, there are two kinds of thunks -- those created with if (current_function_is_thunk)
TARGET_ASM_OUTPUT_MI_THUNK and those with DECL_THUNK_P that go
through the regular part of the compiler. This is a very hacky
way to tell them apart. */
if (current_function_is_thunk && !no_new_pseudos)
return 0; return 0;
/* regs_ever_live has LR marked as used if any sibcalls are present, /* regs_ever_live has LR marked as used if any sibcalls are present,
......
2004-02-04 Mark Mitchell <mark@codesourcery.com>
* decl.c (cxx_push_function_context): Do not set
current_function_is_thunk.
* method.c (use_thunk): Set CALL_FROM_THUNK on the call to the
actual function.
2003-02-04 Giovanni Bajo <giovannibajo@gcc.gnu.org> 2003-02-04 Giovanni Bajo <giovannibajo@gcc.gnu.org>
PR c++/13997 PR c++/13997
......
...@@ -11197,8 +11197,6 @@ cxx_push_function_context (struct function * f) ...@@ -11197,8 +11197,6 @@ cxx_push_function_context (struct function * f)
{ {
tree fn = f->decl; tree fn = f->decl;
current_function_is_thunk = DECL_THUNK_P (fn);
if (DECL_SAVED_FUNCTION_DATA (fn)) if (DECL_SAVED_FUNCTION_DATA (fn))
{ {
/* If we already parsed this function, and we're just expanding it /* If we already parsed this function, and we're just expanding it
......
...@@ -487,6 +487,7 @@ use_thunk (tree thunk_fndecl, bool emit_p) ...@@ -487,6 +487,7 @@ use_thunk (tree thunk_fndecl, bool emit_p)
t = tree_cons (NULL_TREE, a, t); t = tree_cons (NULL_TREE, a, t);
t = nreverse (t); t = nreverse (t);
t = build_call (alias, t); t = build_call (alias, t);
CALL_FROM_THUNK_P (t) = 1;
if (VOID_TYPE_P (TREE_TYPE (t))) if (VOID_TYPE_P (TREE_TYPE (t)))
finish_expr_stmt (t); finish_expr_stmt (t);
......
...@@ -457,9 +457,10 @@ struct function GTY(()) ...@@ -457,9 +457,10 @@ struct function GTY(())
/* Nonzero if the function being compiled issues a computed jump. */ /* Nonzero if the function being compiled issues a computed jump. */
unsigned int has_computed_jump : 1; unsigned int has_computed_jump : 1;
/* Nonzero if the current function is a thunk (a lightweight function that /* Nonzero if the current function is a thunk, i.e., a lightweight
just adjusts one of its arguments and forwards to another function), so function implemented by the output_mi_thunk hook) that just
we should try to cut corners where we can. */ adjusts one of its arguments and forwards to another
function. */
unsigned int is_thunk : 1; unsigned int is_thunk : 1;
/* This bit is used by the exception handling logic. It is set if all /* This bit is used by the exception handling logic. It is set if all
......
...@@ -210,6 +210,8 @@ struct tree_common GTY(()) ...@@ -210,6 +210,8 @@ struct tree_common GTY(())
TREE_PROTECTED in TREE_PROTECTED in
BLOCK BLOCK
..._DECL ..._DECL
CALL_FROM_THUNK_P in
CALL_EXPR
side_effects_flag: side_effects_flag:
...@@ -265,6 +267,7 @@ struct tree_common GTY(()) ...@@ -265,6 +267,7 @@ struct tree_common GTY(())
TREE_DEPRECATED in TREE_DEPRECATED in
..._DECL ..._DECL
*/ */
/* Define accessors for the fields that all tree nodes have /* Define accessors for the fields that all tree nodes have
...@@ -623,6 +626,10 @@ extern void tree_operand_check_failed (int, enum tree_code, ...@@ -623,6 +626,10 @@ extern void tree_operand_check_failed (int, enum tree_code,
argument list. */ argument list. */
#define CALL_EXPR_HAS_RETURN_SLOT_ADDR(NODE) ((NODE)->common.private_flag) #define CALL_EXPR_HAS_RETURN_SLOT_ADDR(NODE) ((NODE)->common.private_flag)
/* In a CALL_EXPR, means that the call is the jump from a thunk to the
thunked-to function. */
#define CALL_FROM_THUNK_P(NODE) ((NODE)->common.protected_flag)
/* In a type, nonzero means that all objects of the type are guaranteed by the /* In a type, nonzero means that all objects of the type are guaranteed by the
language or front-end to be properly aligned, so we can indicate that a MEM language or front-end to be properly aligned, so we can indicate that a MEM
of this type is aligned at least to the alignment of the type, even if it of this type is aligned at least to the alignment of the type, even if it
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment