mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-28 22:34:03 +08:00
[nvptx] Factor out write_fn_proto_1
Factor out write_fn_proto_1 from write_fn_proto. Tested check-gcc on nvptx. Tested libgomp on x86_64-linux with nvptx accelerator. gcc/ChangeLog: 2020-10-10 Tom de Vries <tdevries@suse.de> * config/nvptx/nvptx.c (write_fn_proto_1): New function, factored out of ... (write_fn_proto): ... here. Return void.
This commit is contained in:
parent
2137aa9241
commit
db52bcfe4a
@ -827,26 +827,12 @@ write_var_marker (FILE *file, bool is_defn, bool globalize, const char *name)
|
||||
fputs ("\n", file);
|
||||
}
|
||||
|
||||
/* Write a .func or .kernel declaration or definition along with
|
||||
a helper comment for use by ld. S is the stream to write to, DECL
|
||||
the decl for the function with name NAME. For definitions, emit
|
||||
a declaration too. */
|
||||
/* Helper function for write_fn_proto. */
|
||||
|
||||
static const char *
|
||||
write_fn_proto (std::stringstream &s, bool is_defn,
|
||||
const char *name, const_tree decl)
|
||||
static void
|
||||
write_fn_proto_1 (std::stringstream &s, bool is_defn,
|
||||
const char *name, const_tree decl)
|
||||
{
|
||||
if (is_defn)
|
||||
/* Emit a declaration. The PTX assembler gets upset without it. */
|
||||
name = write_fn_proto (s, false, name, decl);
|
||||
else
|
||||
{
|
||||
/* Avoid repeating the name replacement. */
|
||||
name = nvptx_name_replacement (name);
|
||||
if (name[0] == '*')
|
||||
name++;
|
||||
}
|
||||
|
||||
write_fn_marker (s, is_defn, TREE_PUBLIC (decl), name);
|
||||
|
||||
/* PTX declaration. */
|
||||
@ -929,8 +915,26 @@ write_fn_proto (std::stringstream &s, bool is_defn,
|
||||
s << ")";
|
||||
|
||||
s << (is_defn ? "\n" : ";\n");
|
||||
}
|
||||
|
||||
return name;
|
||||
/* Write a .func or .kernel declaration or definition along with
|
||||
a helper comment for use by ld. S is the stream to write to, DECL
|
||||
the decl for the function with name NAME. For definitions, emit
|
||||
a declaration too. */
|
||||
|
||||
static void
|
||||
write_fn_proto (std::stringstream &s, bool is_defn,
|
||||
const char *name, const_tree decl)
|
||||
{
|
||||
name = nvptx_name_replacement (name);
|
||||
if (name[0] == '*')
|
||||
name++;
|
||||
|
||||
if (is_defn)
|
||||
/* Emit a declaration. The PTX assembler gets upset without it. */
|
||||
write_fn_proto_1 (s, false, name, decl);
|
||||
|
||||
write_fn_proto_1 (s, is_defn, name, decl);
|
||||
}
|
||||
|
||||
/* Construct a function declaration from a call insn. This can be
|
||||
|
Loading…
Reference in New Issue
Block a user