return name;
}
+/* Return NULL if NAME contains no dot. Otherwise return a copy of NAME
+ with the dots replaced with dollar signs. */
+
+static char *
+nvptx_replace_dot (const char *name)
+{
+ if (strchr (name, '.') == NULL)
+ return NULL;
+
+ char *p = xstrdup (name);
+ for (size_t i = 0; i < strlen (p); ++i)
+ if (p[i] == '.')
+ p[i] = '$';
+ return p;
+}
+
/* If MODE should be treated as two registers of an inner mode, return
that inner mode. Otherwise return VOIDmode. */
write_fn_proto (std::stringstream &s, bool is_defn,
const char *name, const_tree decl)
{
- name = nvptx_name_replacement (name);
+ const char *replacement = nvptx_name_replacement (name);
+ char *replaced_dots = NULL;
+ if (replacement != name)
+ name = replacement;
+ else
+ {
+ replaced_dots = nvptx_replace_dot (name);
+ if (replaced_dots)
+ name = replaced_dots;
+ }
if (name[0] == '*')
name++;
write_fn_proto_1 (s, false, name, decl);
write_fn_proto_1 (s, is_defn, name, decl);
+
+ if (replaced_dots)
+ XDELETE (replaced_dots);
}
/* Construct a function declaration from a call insn. This can be
write_fn_proto_from_insn (std::stringstream &s, const char *name,
rtx result, rtx pat)
{
+ char *replaced_dots = NULL;
+
if (!name)
{
s << "\t.callprototype ";
}
else
{
- name = nvptx_name_replacement (name);
+ const char *replacement = nvptx_name_replacement (name);
+ if (replacement != name)
+ name = replacement;
+ else
+ {
+ replaced_dots = nvptx_replace_dot (name);
+ if (replaced_dots)
+ name = replaced_dots;
+ }
write_fn_marker (s, false, true, name);
s << "\t.extern .func ";
}
write_return_mode (s, true, GET_MODE (result));
s << name;
+ if (replaced_dots)
+ XDELETE (replaced_dots);
int arg_end = XVECLEN (pat, 0);
for (int i = 1; i < arg_end; i++)
if (decl)
{
+ char *replaced_dots = NULL;
const char *name = get_fnname_from_decl (decl);
- name = nvptx_name_replacement (name);
+ const char *replacement = nvptx_name_replacement (name);
+ if (replacement != name)
+ name = replacement;
+ else
+ {
+ replaced_dots = nvptx_replace_dot (name);
+ if (replaced_dots)
+ name = replaced_dots;
+ }
assemble_name (asm_out_file, name);
+ if (replaced_dots)
+ XDELETE (replaced_dots);
}
else
output_address (VOIDmode, callee);