re PR c++/13376 (Incorrect dumps of RTL for passes that use current_function_name)
PR c++/13376 * function.h (struct function): Kill `name' field. (current_function_name): Make it an extern function. * function.c (current_function_name): New function. * graph.c: Update all uses of current_function_name. * gcse.c: Likewise. * config/alpha/alpha.c, config/avr/avr.c, config/c4x/c4x.c, config/mips/mips.c, config/pdp11/pdp11.c: Likewise. * config/ip2k/ip2k.c (function_prologue): Use MAIN_NAME_P instead of a strcmp with "main". From-SVN: r75784
This commit is contained in:
parent
e4a32afbe1
commit
faed5cc356
|
@ -1,3 +1,16 @@
|
|||
2004-01-13 Steven Bosscher <stevenb@suse.de>
|
||||
|
||||
PR c++/13376
|
||||
* function.h (struct function): Kill `name' field.
|
||||
(current_function_name): Make it an extern function.
|
||||
* function.c (current_function_name): New function.
|
||||
* graph.c: Update all uses of current_function_name.
|
||||
* gcse.c: Likewise.
|
||||
* config/alpha/alpha.c, config/avr/avr.c, config/c4x/c4x.c,
|
||||
config/mips/mips.c, config/pdp11/pdp11.c: Likewise.
|
||||
* config/ip2k/ip2k.c (function_prologue): Use MAIN_NAME_P
|
||||
instead of a strcmp with "main".
|
||||
|
||||
2004-01-13 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* c-decl.c (diagnose_mismatched_decls): Fix warning calls.
|
||||
|
|
|
@ -9739,7 +9739,7 @@ unicosmk_add_call_info_word (rtx x)
|
|||
++machine->ciw_count;
|
||||
|
||||
return GEN_INT (machine->ciw_count
|
||||
+ strlen (current_function_name)/8 + 5);
|
||||
+ strlen (current_function_name ())/8 + 5);
|
||||
}
|
||||
|
||||
static char unicosmk_section_buf[100];
|
||||
|
|
|
@ -662,13 +662,14 @@ avr_output_function_prologue (FILE *file, HOST_WIDE_INT size)
|
|||
}
|
||||
else if (minimize && (frame_pointer_needed || live_seq > 6))
|
||||
{
|
||||
const char *cfun_name = current_function_name ();
|
||||
fprintf (file, ("\t"
|
||||
AS1 (ldi, r26) ",lo8(" HOST_WIDE_INT_PRINT_DEC ")" CR_TAB
|
||||
AS1 (ldi, r27) ",hi8(" HOST_WIDE_INT_PRINT_DEC ")" CR_TAB), size, size);
|
||||
|
||||
fprintf (file, (AS2 (ldi, r30, pm_lo8(.L_%s_body)) CR_TAB
|
||||
AS2 (ldi, r31, pm_hi8(.L_%s_body)) CR_TAB)
|
||||
,current_function_name, current_function_name);
|
||||
AS2 (ldi, r31, pm_hi8(.L_%s_body)) CR_TAB),
|
||||
cfun_name, cfun_name);
|
||||
|
||||
prologue_size += 4;
|
||||
|
||||
|
@ -684,7 +685,7 @@ avr_output_function_prologue (FILE *file, HOST_WIDE_INT size)
|
|||
(18 - live_seq) * 2);
|
||||
++prologue_size;
|
||||
}
|
||||
fprintf (file, ".L_%s_body:\n", current_function_name);
|
||||
fprintf (file, ".L_%s_body:\n", cfun_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -871,7 +872,7 @@ avr_output_function_epilogue (FILE *file, HOST_WIDE_INT size)
|
|||
|
||||
out:
|
||||
fprintf (file, "/* epilogue end (size=%d) */\n", epilogue_size);
|
||||
fprintf (file, "/* function %s size %d (%d) */\n", current_function_name,
|
||||
fprintf (file, "/* function %s size %d (%d) */\n", current_function_name (),
|
||||
prologue_size + function_size + epilogue_size, function_size);
|
||||
commands_in_file += prologue_size + function_size + epilogue_size;
|
||||
commands_in_prologues += prologue_size;
|
||||
|
|
|
@ -791,18 +791,20 @@ c4x_naked_function_p (void)
|
|||
int
|
||||
c4x_interrupt_function_p (void)
|
||||
{
|
||||
const char *cfun_name;
|
||||
if (lookup_attribute ("interrupt",
|
||||
TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl))))
|
||||
return 1;
|
||||
|
||||
/* Look for TI style c_intnn. */
|
||||
return current_function_name[0] == 'c'
|
||||
&& current_function_name[1] == '_'
|
||||
&& current_function_name[2] == 'i'
|
||||
&& current_function_name[3] == 'n'
|
||||
&& current_function_name[4] == 't'
|
||||
&& ISDIGIT (current_function_name[5])
|
||||
&& ISDIGIT (current_function_name[6]);
|
||||
cfun_name = current_function_name ();
|
||||
return cfun_name[0] == 'c'
|
||||
&& cfun_name[1] == '_'
|
||||
&& cfun_name[2] == 'i'
|
||||
&& cfun_name[3] == 'n'
|
||||
&& cfun_name[4] == 't'
|
||||
&& ISDIGIT (cfun_name[5])
|
||||
&& ISDIGIT (cfun_name[6]);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -846,7 +848,7 @@ c4x_expand_prologue (void)
|
|||
storage! */
|
||||
if (size > 32767)
|
||||
error ("ISR %s requires %d words of local vars, max is 32767",
|
||||
current_function_name, size);
|
||||
current_function_name (), size);
|
||||
|
||||
insn = emit_insn (gen_addqi3 (gen_rtx_REG (QImode, SP_REGNO),
|
||||
gen_rtx_REG (QImode, SP_REGNO),
|
||||
|
|
|
@ -202,7 +202,7 @@ function_prologue (FILE *file, HOST_WIDE_INT size)
|
|||
}
|
||||
|
||||
leaf_func_p = leaf_function_p ();
|
||||
main_p = ! strcmp ("main", current_function_name);
|
||||
main_p = MAIN_NAME_P (DECL_NAME (current_function_decl));
|
||||
|
||||
/* For now, we compute all these facts about the function, but don't
|
||||
take any action based on the information. */
|
||||
|
|
|
@ -7659,7 +7659,7 @@ build_mips16_function_stub (FILE *file)
|
|||
build_function_type (void_type_node, NULL_TREE));
|
||||
DECL_SECTION_NAME (stubdecl) = build_string (strlen (secname), secname);
|
||||
|
||||
fprintf (file, "\t# Stub function for %s (", current_function_name);
|
||||
fprintf (file, "\t# Stub function for %s (", current_function_name ());
|
||||
need_comma = 0;
|
||||
for (f = (unsigned int) current_function_args_info.fp_code; f != 0; f >>= 2)
|
||||
{
|
||||
|
|
|
@ -148,7 +148,8 @@ pdp11_output_function_prologue (FILE *stream, HOST_WIDE_INT size)
|
|||
int via_ac = -1;
|
||||
|
||||
fprintf (stream,
|
||||
"\n\t; /* function prologue %s*/\n", current_function_name);
|
||||
"\n\t; /* function prologue %s*/\n",
|
||||
current_function_name ());
|
||||
|
||||
/* if we are outputting code for main,
|
||||
the switch FPU to right mode if TARGET_FPU */
|
||||
|
|
|
@ -6408,8 +6408,6 @@ allocate_struct_function (tree fndecl)
|
|||
DECL_SAVED_INSNS (fndecl) = cfun;
|
||||
cfun->decl = fndecl;
|
||||
|
||||
current_function_name = (*lang_hooks.decl_printable_name) (fndecl, 2);
|
||||
|
||||
result = DECL_RESULT (fndecl);
|
||||
if (aggregate_value_p (result, fndecl))
|
||||
{
|
||||
|
@ -8070,4 +8068,11 @@ init_function_once (void)
|
|||
VARRAY_INT_INIT (sibcall_epilogue, 0, "sibcall_epilogue");
|
||||
}
|
||||
|
||||
/* Returns the name of the current function. */
|
||||
const char *
|
||||
current_function_name (void)
|
||||
{
|
||||
return (*lang_hooks.decl_printable_name) (cfun->decl, 2);
|
||||
}
|
||||
|
||||
#include "gt-function.h"
|
||||
|
|
|
@ -183,9 +183,6 @@ struct function GTY(())
|
|||
|
||||
/* For function.c. */
|
||||
|
||||
/* Name of this function. */
|
||||
const char *name;
|
||||
|
||||
/* Points to the FUNCTION_DECL of this function. */
|
||||
tree decl;
|
||||
|
||||
|
@ -534,7 +531,6 @@ extern int virtuals_instantiated;
|
|||
extern int trampolines_created;
|
||||
|
||||
/* For backward compatibility... eventually these should all go away. */
|
||||
#define current_function_name (cfun->name)
|
||||
#define current_function_pops_args (cfun->pops_args)
|
||||
#define current_function_returns_struct (cfun->returns_struct)
|
||||
#define current_function_returns_pcc_struct (cfun->returns_pcc_struct)
|
||||
|
@ -638,6 +634,9 @@ extern rtx get_arg_pointer_save_area (struct function *);
|
|||
|
||||
extern void init_virtual_regs (struct emit_status *);
|
||||
|
||||
/* Returns the name of the current function. */
|
||||
extern const char *current_function_name (void);
|
||||
|
||||
/* Called once, at initialization, to initialize function.c. */
|
||||
extern void init_function_once (void);
|
||||
|
||||
|
|
10
gcc/gcse.c
10
gcc/gcse.c
|
@ -855,7 +855,7 @@ gcse_main (rtx f, FILE *file)
|
|||
if (file)
|
||||
{
|
||||
fprintf (file, "GCSE of %s: %d basic blocks, ",
|
||||
current_function_name, n_basic_blocks);
|
||||
current_function_name (), n_basic_blocks);
|
||||
fprintf (file, "%d pass%s, %d bytes\n\n",
|
||||
pass, pass > 1 ? "es" : "", max_pass_bytes);
|
||||
}
|
||||
|
@ -3614,7 +3614,7 @@ one_classic_gcse_pass (int pass)
|
|||
{
|
||||
fprintf (gcse_file, "\n");
|
||||
fprintf (gcse_file, "GCSE of %s, pass %d: %d bytes needed, %d substs,",
|
||||
current_function_name, pass, bytes_used, gcse_subst_count);
|
||||
current_function_name (), pass, bytes_used, gcse_subst_count);
|
||||
fprintf (gcse_file, "%d insns created\n", gcse_create_count);
|
||||
}
|
||||
|
||||
|
@ -4686,7 +4686,7 @@ one_cprop_pass (int pass, int cprop_jumps, int bypass_jumps)
|
|||
if (gcse_file)
|
||||
{
|
||||
fprintf (gcse_file, "CPROP of %s, pass %d: %d bytes needed, ",
|
||||
current_function_name, pass, bytes_used);
|
||||
current_function_name (), pass, bytes_used);
|
||||
fprintf (gcse_file, "%d const props, %d copy props\n\n",
|
||||
const_prop_count, copy_prop_count);
|
||||
}
|
||||
|
@ -5788,7 +5788,7 @@ one_pre_gcse_pass (int pass)
|
|||
if (gcse_file)
|
||||
{
|
||||
fprintf (gcse_file, "\nPRE GCSE of %s, pass %d: %d bytes needed, ",
|
||||
current_function_name, pass, bytes_used);
|
||||
current_function_name (), pass, bytes_used);
|
||||
fprintf (gcse_file, "%d substs, %d insns created\n",
|
||||
gcse_subst_count, gcse_create_count);
|
||||
}
|
||||
|
@ -8017,7 +8017,7 @@ bypass_jumps (FILE *file)
|
|||
if (file)
|
||||
{
|
||||
fprintf (file, "BYPASS of %s: %d basic blocks, ",
|
||||
current_function_name, n_basic_blocks);
|
||||
current_function_name (), n_basic_blocks);
|
||||
fprintf (file, "%d bytes\n\n", bytes_used);
|
||||
}
|
||||
|
||||
|
|
16
gcc/graph.c
16
gcc/graph.c
|
@ -55,7 +55,7 @@ start_fct (FILE *fp)
|
|||
case vcg:
|
||||
fprintf (fp, "\
|
||||
graph: { title: \"%s\"\nfolding: 1\nhidden: 2\nnode: { title: \"%s.0\" }\n",
|
||||
current_function_name, current_function_name);
|
||||
current_function_name (), current_function_name ());
|
||||
break;
|
||||
case no_graph:
|
||||
break;
|
||||
|
@ -71,7 +71,7 @@ start_bb (FILE *fp, int bb)
|
|||
fprintf (fp, "\
|
||||
graph: {\ntitle: \"%s.BB%d\"\nfolding: 1\ncolor: lightblue\n\
|
||||
label: \"basic block %d",
|
||||
current_function_name, bb, bb);
|
||||
current_function_name (), bb, bb);
|
||||
break;
|
||||
case no_graph:
|
||||
break;
|
||||
|
@ -113,8 +113,8 @@ node_data (FILE *fp, rtx tmp_rtx)
|
|||
case vcg:
|
||||
fprintf (fp, "\
|
||||
edge: { sourcename: \"%s.0\" targetname: \"%s.%d\" }\n",
|
||||
current_function_name,
|
||||
current_function_name, XINT (tmp_rtx, 0));
|
||||
current_function_name (),
|
||||
current_function_name (), XINT (tmp_rtx, 0));
|
||||
break;
|
||||
case no_graph:
|
||||
break;
|
||||
|
@ -126,7 +126,7 @@ edge: { sourcename: \"%s.0\" targetname: \"%s.%d\" }\n",
|
|||
case vcg:
|
||||
fprintf (fp, "node: {\n title: \"%s.%d\"\n color: %s\n \
|
||||
label: \"%s %d\n",
|
||||
current_function_name, XINT (tmp_rtx, 0),
|
||||
current_function_name (), XINT (tmp_rtx, 0),
|
||||
GET_CODE (tmp_rtx) == NOTE ? "lightgrey"
|
||||
: GET_CODE (tmp_rtx) == INSN ? "green"
|
||||
: GET_CODE (tmp_rtx) == JUMP_INSN ? "darkgreen"
|
||||
|
@ -178,8 +178,8 @@ draw_edge (FILE *fp, int from, int to, int bb_edge, int class)
|
|||
color = "color: green ";
|
||||
fprintf (fp,
|
||||
"edge: { sourcename: \"%s.%d\" targetname: \"%s.%d\" %s",
|
||||
current_function_name, from,
|
||||
current_function_name, to, color);
|
||||
current_function_name (), from,
|
||||
current_function_name (), to, color);
|
||||
if (class)
|
||||
fprintf (fp, "class: %d ", class);
|
||||
fputs ("}\n", fp);
|
||||
|
@ -209,7 +209,7 @@ end_fct (FILE *fp)
|
|||
{
|
||||
case vcg:
|
||||
fprintf (fp, "node: { title: \"%s.999999\" label: \"END\" }\n}\n",
|
||||
current_function_name);
|
||||
current_function_name ());
|
||||
break;
|
||||
case no_graph:
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue