aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Bosscher <stevenb@suse.de>2004-01-13 01:58:45 +0000
committerSteven Bosscher <stevenb@suse.de>2004-01-13 01:58:45 +0000
commitf95d47539966ff6e495e45ae7d5b77d8a076c10e (patch)
tree620724275961c3e490611bea34f8d2c8cba0a9dd
parenteafd99e4be47f63bdec7da303bc5f03c006024dc (diff)
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". git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@75784 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog13
-rw-r--r--gcc/config/alpha/alpha.c2
-rw-r--r--gcc/config/avr/avr.c9
-rw-r--r--gcc/config/c4x/c4x.c18
-rw-r--r--gcc/config/ip2k/ip2k.c2
-rw-r--r--gcc/config/mips/mips.c2
-rw-r--r--gcc/config/pdp11/pdp11.c3
-rw-r--r--gcc/function.c9
-rw-r--r--gcc/function.h7
-rw-r--r--gcc/gcse.c10
-rw-r--r--gcc/graph.c16
11 files changed, 56 insertions, 35 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 043b8fafcf6..ee83e98ffe0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index 87408d6f5f7..e25ece23030 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -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];
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index 6ec10ba493e..198c56895d3 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -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;
diff --git a/gcc/config/c4x/c4x.c b/gcc/config/c4x/c4x.c
index 9eaa87194d2..28e13359f94 100644
--- a/gcc/config/c4x/c4x.c
+++ b/gcc/config/c4x/c4x.c
@@ -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),
diff --git a/gcc/config/ip2k/ip2k.c b/gcc/config/ip2k/ip2k.c
index cb73b39234b..6f32c43d07c 100644
--- a/gcc/config/ip2k/ip2k.c
+++ b/gcc/config/ip2k/ip2k.c
@@ -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. */
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 66bc05344fb..477f98964aa 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -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)
{
diff --git a/gcc/config/pdp11/pdp11.c b/gcc/config/pdp11/pdp11.c
index 02565432cda..049b541a4ac 100644
--- a/gcc/config/pdp11/pdp11.c
+++ b/gcc/config/pdp11/pdp11.c
@@ -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 */
diff --git a/gcc/function.c b/gcc/function.c
index 30ede39ef02..02f095a19b3 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -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"
diff --git a/gcc/function.h b/gcc/function.h
index 89a1465ad0a..088fbbb5320 100644
--- a/gcc/function.h
+++ b/gcc/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);
diff --git a/gcc/gcse.c b/gcc/gcse.c
index 55f6d1bed72..f3656c19d47 100644
--- a/gcc/gcse.c
+++ b/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);
}
diff --git a/gcc/graph.c b/gcc/graph.c
index d82dd917ce9..26c866d8291 100644
--- a/gcc/graph.c
+++ b/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;