From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 2F22E3858D37; Sat, 10 Oct 2020 21:34:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2F22E3858D37 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Tom de Vries To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-3777] [nvptx] Factor out write_fn_proto_1 X-Act-Checkin: gcc X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 2137aa92412da363d52ef699987441be28b239d0 X-Git-Newrev: db52bcfe4a0ef1bae9ed52b4e51af085f71c984d Message-Id: <20201010213455.2F22E3858D37@sourceware.org> Date: Sat, 10 Oct 2020 21:34:55 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Oct 2020 21:34:55 -0000 https://gcc.gnu.org/g:db52bcfe4a0ef1bae9ed52b4e51af085f71c984d commit r11-3777-gdb52bcfe4a0ef1bae9ed52b4e51af085f71c984d Author: Tom de Vries Date: Sat Oct 10 17:08:04 2020 +0200 [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 * config/nvptx/nvptx.c (write_fn_proto_1): New function, factored out of ... (write_fn_proto): ... here. Return void. Diff: --- gcc/config/nvptx/nvptx.c | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index afac1bda45d..0c1d6d112ec 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -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