Commit 7c6d4120 by Richard Kenner

(make_function_rtl, make_decl_rtl): Add a prefix when flag_prefix_function_name_usage is set.

(make_function_rtl, make_decl_rtl): Add a prefix when
flag_prefix_function_name_usage is set.
(assemble_name): Strip the CHKR_PREFIX.

From-SVN: r14619
parent 0844ee7f
...@@ -60,6 +60,18 @@ Boston, MA 02111-1307, USA. */ ...@@ -60,6 +60,18 @@ Boston, MA 02111-1307, USA. */
#define ASM_STABS_OP ".stabs" #define ASM_STABS_OP ".stabs"
#endif #endif
/* Define the prefix to use when check_memory_usage_flag is enable. */
#ifdef NO_DOLLAR_IN_LABEL
#ifdef NO_DOT_IN_LABEL
#define CHKR_PREFIX "chkr_prefix_"
#else /* !NO_DOT_IN_LABEL */
#define CHKR_PREFIX "chkr."
#endif
#else /* !NO_DOLLAR_IN_LABLE */
#define CHKR_PREFIX "chkr$"
#endif
#define CHKR_PREFIX_SIZE (sizeof (CHKR_PREFIX) - 1)
/* This macro gets just the user-specified name /* This macro gets just the user-specified name
out of the string in a SYMBOL_REF. On most machines, out of the string in a SYMBOL_REF. On most machines,
we discard the * if any and that's all. */ we discard the * if any and that's all. */
...@@ -472,6 +484,7 @@ make_function_rtl (decl) ...@@ -472,6 +484,7 @@ make_function_rtl (decl)
tree decl; tree decl;
{ {
char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
char *new_name = name;
if (output_bytecode) if (output_bytecode)
{ {
...@@ -495,6 +508,20 @@ make_function_rtl (decl) ...@@ -495,6 +508,20 @@ make_function_rtl (decl)
name = obstack_copy0 (saveable_obstack, label, strlen (label)); name = obstack_copy0 (saveable_obstack, label, strlen (label));
var_labelno++; var_labelno++;
} }
else
{
/* When -fprefix-function-name is used, every function name is
prefixed. Even static functions are prefixed because they
could be declared latter. Note that a nested function name
is not prefixed. */
if (flag_prefix_function_name)
{
new_name = (char *) alloca (strlen (name) + CHKR_PREFIX_SIZE + 1);
strcpy (new_name, CHKR_PREFIX);
strcpy (new_name + CHKR_PREFIX_SIZE, name);
name = obstack_copy0 (saveable_obstack, new_name, strlen (new_name));
}
}
if (DECL_RTL (decl) == 0) if (DECL_RTL (decl) == 0)
{ {
...@@ -760,6 +787,20 @@ make_decl_rtl (decl, asmspec, top_level) ...@@ -760,6 +787,20 @@ make_decl_rtl (decl, asmspec, top_level)
if (name == 0) if (name == 0)
abort (); abort ();
/* When -fprefix-function-name is used, the functions
names are prefixed. Only nested function names are not
prefixed. */
if (flag_prefix_function_name && TREE_CODE (decl) == FUNCTION_DECL)
{
char *new_name;
new_name = (char *) alloca (strlen (name) + CHKR_PREFIX_SIZE
+ 1);
strcpy (new_name, CHKR_PREFIX);
strcpy (new_name + CHKR_PREFIX_SIZE, name);
name = obstack_copy0 (saveable_obstack,
new_name, strlen (new_name));
}
DECL_RTL (decl) = gen_rtx (MEM, DECL_MODE (decl), DECL_RTL (decl) = gen_rtx (MEM, DECL_MODE (decl),
gen_rtx (SYMBOL_REF, Pmode, name)); gen_rtx (SYMBOL_REF, Pmode, name));
...@@ -1759,6 +1800,9 @@ assemble_name (file, name) ...@@ -1759,6 +1800,9 @@ assemble_name (file, name)
tree id; tree id;
STRIP_NAME_ENCODING (real_name, name); STRIP_NAME_ENCODING (real_name, name);
if (flag_prefix_function_name
&& ! bcmp (real_name, CHKR_PREFIX, CHKR_PREFIX_SIZE))
real_name = real_name + CHKR_PREFIX_SIZE;
id = maybe_get_identifier (real_name); id = maybe_get_identifier (real_name);
if (id) if (id)
......
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