From patchwork Tue Jan 8 22:38:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 1022167 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-493672-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="sTz5ZaWy"; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="dzQhJaeT"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43Z6cZ1LRqz9sCX for ; Wed, 9 Jan 2019 09:38:53 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; q=dns; s=default; b=KeTv38RXehzw AgsxH7S5gWVMXfmPdJSn0CQfZ9ynSpJZZ4qQb43tS/4nDNkVRJxtxaSodXzDpX5e jf+AAzduuzEFwqX2oHjjzw8B8q4hFy+Qgf0Twu7AY1NqHrZPBTEJmub3J9UVEg8i 8/BUGs8VPEe/tPdaXeqd631N8z9MHbM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; s=default; bh=OWOXcWxSDo7/bYLEN4 MKzEyj4BE=; b=sTz5ZaWymY3B0d3LP5meYuEmivWnvB3m4X9+psdWWFgAnV3wQi gflTh+oRUSePwrPj2q34yUSkGXsHmytRBQZUq6kddXGP0byWREx+DELyY1O7wYs3 wdqMJReN7GSi/23OUx2yWdUozpmw8OIalXs/gCJ0UNRzsjUQKJh7qwKq4= Received: (qmail 117672 invoked by alias); 8 Jan 2019 22:38:45 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 117643 invoked by uid 89); 8 Jan 2019 22:38:44 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, FREEMAIL_FROM, FROM_LOCAL_NOVOWEL, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, HK_RANDOM_ENVFROM, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-spam-relays-external:470, H*RU:470, xstr, Hx-spam-relays-external:209.85.167.67 X-HELO: mail-lf1-f67.google.com Received: from mail-lf1-f67.google.com (HELO mail-lf1-f67.google.com) (209.85.167.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 08 Jan 2019 22:38:34 +0000 Received: by mail-lf1-f67.google.com with SMTP id y11so4187626lfj.4 for ; Tue, 08 Jan 2019 14:38:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=GK8tPS4cyIMce1aa9VYA8thMCMpCfjmQMl48Pnb/7jo=; b=dzQhJaeTG6+JpgtEdc/IehHxxZ4RJnt1Q/7n8GxQFEfUTzWwvmDXyV0mUFKo6LKzBI ju6dMhaPZbIok2pb1Mvfegro4nF4MAP7opxM3mIR5P8pMBZK3d9EqeVmZehQQfTw/o9o UqK5s30I6M1X2dqCR5qBtqQjPlWVxriDiRoTE+LKtiwsSYlAFOiYr++reDWO8gcuEjEl niiWVCfbEsOK8FM1+74GLbjBacHaAkalHuG6uFfRUYTGFZDcVg+/K/8IivKXKVgVHaKv P1EzVBGKuH9Uw1Ab5w10ER84jb1dBF17z8B0y6LxJGQ1itwAF3ezFZ61qKZNe10/lk7e /LyA== Received: from octofox.cadence.com (jcmvbkbc-1-pt.tunnel.tserv24.sto1.ipv6.he.net. [2001:470:27:1fa::2]) by smtp.gmail.com with ESMTPSA id s127sm13586411lfe.8.2019.01.08.14.38.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Jan 2019 14:38:30 -0800 (PST) From: Max Filippov To: gcc-patches@gcc.gnu.org Cc: linux-xtensa@linux-xtensa.org, Sterling Augustine , Max Filippov Subject: [RFC] moving assemble_start_function / assemble_end_function to output_mi_thunk Date: Tue, 8 Jan 2019 14:38:07 -0800 Message-Id: <20190108223807.13269-1-jcmvbkbc@gmail.com> X-IsSubscribed: yes Hello, I'm implementing MI thunk generation for the xtensa target and I've got an issue that when my code generates a constant it is missing in the resulting assembly. This happens because a constant pool output happens inside the assemble_start_function, which is called before the thunk function body has a chance to be generated. The following patch moves assemble_start_function / assemble_end_function pair to the backend for all targets that define TARGET_ASM_OUTPUT_MI_THUNK to allow calling assemble_start_function after the function body is ready. Is it OK, or should I try to fix it differently? ---8<--- From bad901880a3f9fc69726aa082e2b2c674bacca94 Mon Sep 17 00:00:00 2001 From: Max Filippov Date: Mon, 7 Jan 2019 18:22:12 -0800 Subject: [PATCH] gcc: move assemble_start_function / assemble_end_function to output_mi_thunk Let backends call assemble_start_function after they have generated thunk function body so that a constant pool could be output if it is required. gcc/ 2019-01-08 Max Filippov * cgraphunit.c (cgraph_node::expand_thunk): Remove assemble_start_function and assemble_end_function calls. * config/alpha/alpha.c (alpha_output_mi_thunk_osf): Call assemble_start_function and assemble_end_function. * config/arc/arc.c (arc_output_mi_thunk): Likewise. * config/arm/arm.c (arm_output_mi_thunk): Likewise. * config/bfin/bfin.c (bfin_output_mi_thunk): Likewise. * config/c6x/c6x.c (c6x_output_mi_thunk): Likewise. * config/cris/cris.c (cris_asm_output_mi_thunk): Likewise. * config/csky/csky.c (csky_output_mi_thunk): Likewise. * config/epiphany/epiphany.c (epiphany_output_mi_thunk): Likewise. * config/frv/frv.c (frv_asm_output_mi_thunk): Likewise. * config/i386/i386.c (x86_output_mi_thunk): Likewise. * config/ia64/ia64.c (ia64_output_mi_thunk): Likewise. * config/m68k/m68k.c (m68k_output_mi_thunk): Likewise. * config/microblaze/microblaze.c (microblaze_asm_output_mi_thunk): Likewise. * config/mips/mips.c (mips_output_mi_thunk): Likewise. * config/mmix/mmix.c (mmix_asm_output_mi_thunk): Likewise. * config/mn10300/mn10300.c (mn10300_asm_output_mi_thunk): Likewise. * config/nds32/nds32.c (nds32_asm_output_mi_thunk): Likewise. * config/nios2/nios2.c (nios2_asm_output_mi_thunk): Likewise. * config/or1k/or1k.c (or1k_output_mi_thunk): Likewise. * config/pa/pa.c (pa_asm_output_mi_thunk): Likewise. * config/riscv/riscv.c (riscv_output_mi_thunk): Likewise. * config/rs6000/rs6000.c (rs6000_output_mi_thunk): Likewise. * config/s390/s390.c (s390_output_mi_thunk): Likewise. * config/sh/sh.c (sh_output_mi_thunk): Likewise. * config/sparc/sparc.c (sparc_output_mi_thunk): Likewise. * config/spu/spu.c (spu_output_mi_thunk): Likewise. * config/stormy16/stormy16.c (xstormy16_asm_output_mi_thunk): Likewise. * config/tilegx/tilegx.c (tilegx_output_mi_thunk): Likewise. * config/tilepro/tilepro.c (tilepro_asm_output_mi_thunk): Likewise. * config/vax/vax.c (vax_output_mi_thunk): Likewise. --- gcc/cgraphunit.c | 4 ---- gcc/config/alpha/alpha.c | 3 +++ gcc/config/arc/arc.c | 4 ++++ gcc/config/arm/arm.c | 4 ++++ gcc/config/bfin/bfin.c | 3 +++ gcc/config/c6x/c6x.c | 3 +++ gcc/config/cris/cris.c | 4 ++++ gcc/config/csky/csky.c | 3 +++ gcc/config/epiphany/epiphany.c | 3 +++ gcc/config/frv/frv.c | 4 ++++ gcc/config/i386/i386.c | 5 ++++- gcc/config/ia64/ia64.c | 3 +++ gcc/config/m68k/m68k.c | 3 +++ gcc/config/microblaze/microblaze.c | 3 +++ gcc/config/mips/mips.c | 3 +++ gcc/config/mmix/mmix.c | 6 +++++- gcc/config/mn10300/mn10300.c | 3 +++ gcc/config/nds32/nds32.c | 3 +++ gcc/config/nios2/nios2.c | 3 +++ gcc/config/or1k/or1k.c | 5 ++++- gcc/config/pa/pa.c | 3 +++ gcc/config/riscv/riscv.c | 3 +++ gcc/config/rs6000/rs6000.c | 3 +++ gcc/config/s390/s390.c | 3 +++ gcc/config/sh/sh.c | 3 +++ gcc/config/sparc/sparc.c | 3 +++ gcc/config/spu/spu.c | 3 +++ gcc/config/stormy16/stormy16.c | 3 +++ gcc/config/tilegx/tilegx.c | 3 +++ gcc/config/tilepro/tilepro.c | 3 +++ gcc/config/vax/vax.c | 4 ++++ 31 files changed, 99 insertions(+), 7 deletions(-) ---8<--- Thanks. -- Max diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index e6b1296abfb5..1c070ee95cd7 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -1786,7 +1786,6 @@ cgraph_node::expand_thunk (bool output_asm_thunks, bool force_gimple_thunk) && targetm.asm_out.can_output_mi_thunk (thunk_fndecl, fixed_offset, virtual_value, alias)) { - const char *fnname; tree fn_block; tree restype = TREE_TYPE (TREE_TYPE (thunk_fndecl)); @@ -1810,7 +1809,6 @@ cgraph_node::expand_thunk (bool output_asm_thunks, bool force_gimple_thunk) = build_decl (DECL_SOURCE_LOCATION (thunk_fndecl), RESULT_DECL, 0, restype); DECL_CONTEXT (DECL_RESULT (thunk_fndecl)) = thunk_fndecl; - fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk_fndecl)); /* The back end expects DECL_INITIAL to contain a BLOCK, so we create one. */ @@ -1824,12 +1822,10 @@ cgraph_node::expand_thunk (bool output_asm_thunks, bool force_gimple_thunk) insn_locations_init (); set_curr_insn_location (DECL_SOURCE_LOCATION (thunk_fndecl)); prologue_location = curr_insn_location (); - assemble_start_function (thunk_fndecl, fnname); targetm.asm_out.output_mi_thunk (asm_out_file, thunk_fndecl, fixed_offset, virtual_value, alias); - assemble_end_function (thunk_fndecl, fnname); insn_locations_finalize (); init_insn_lengths (); free_after_compilation (cfun); diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 993d2324464b..4292a4080b69 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -8402,6 +8402,7 @@ alpha_output_mi_thunk_osf (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset, tree function) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk_fndecl)); HOST_WIDE_INT hi, lo; rtx this_rtx, funexp; rtx_insn *insn; @@ -8482,9 +8483,11 @@ alpha_output_mi_thunk_osf (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, assemble_start_function and assemble_end_function. */ insn = get_insns (); shorten_branches (insn); + assemble_start_function (thunk_fndecl, fnname); final_start_function (insn, file, 1); final (insn, file, 1); final_end_function (); + assemble_end_function (thunk_fndecl, fnname); } #endif /* TARGET_ABI_OSF */ diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index 5af3ee6c9e03..862353363fba 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -7304,6 +7304,7 @@ arc_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED, HOST_WIDE_INT vcall_offset, tree function) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk)); int mi_delta = delta; const char *const mi_op = mi_delta < 0 ? "sub" : "add"; int shift = 0; @@ -7311,6 +7312,8 @@ arc_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED, = aggregate_value_p (TREE_TYPE (TREE_TYPE (function)), function) ? 1 : 0; rtx fnaddr; + assemble_start_function (thunk, fnname); + if (mi_delta < 0) mi_delta = - mi_delta; @@ -7374,6 +7377,7 @@ arc_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED, fputs ("@plt\n", file); } fputc ('\n', file); + assemble_end_function (thunk, fnname); } /* Return true if a 32 bit "long_call" should be generated for diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 509f287aa636..60f6625d7637 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -26847,10 +26847,14 @@ static void arm_output_mi_thunk (FILE *file, tree thunk, HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset, tree function) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk)); + + assemble_start_function (thunk, fnname); if (TARGET_32BIT) arm32_output_mi_thunk (file, thunk, delta, vcall_offset, function); else arm_thumb1_mi_thunk (file, thunk, delta, vcall_offset, function); + assemble_end_function (thunk, fnname); } int diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c index 1d98e55c84da..4bf662ae3273 100644 --- a/gcc/config/bfin/bfin.c +++ b/gcc/config/bfin/bfin.c @@ -4973,10 +4973,12 @@ bfin_output_mi_thunk (FILE *file ATTRIBUTE_UNUSED, tree thunk ATTRIBUTE_UNUSED, HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset, tree function) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk)); rtx xops[3]; /* The this parameter is passed as the first argument. */ rtx this_rtx = gen_rtx_REG (Pmode, REG_R0); + assemble_start_function (thunk, fnname); /* Adjust the this parameter by a fixed constant. */ if (delta) { @@ -5031,6 +5033,7 @@ bfin_output_mi_thunk (FILE *file ATTRIBUTE_UNUSED, xops[0] = XEXP (DECL_RTL (function), 0); if (1 || !flag_pic || (*targetm.binds_local_p) (function)) output_asm_insn ("jump.l\t%P0", xops); + assemble_end_function (thunk, fnname); } /* Codes for all the Blackfin builtins. */ diff --git a/gcc/config/c6x/c6x.c b/gcc/config/c6x/c6x.c index 38fbd7e3fa93..cf769cf41fec 100644 --- a/gcc/config/c6x/c6x.c +++ b/gcc/config/c6x/c6x.c @@ -768,10 +768,12 @@ c6x_output_mi_thunk (FILE *file ATTRIBUTE_UNUSED, tree thunk ATTRIBUTE_UNUSED, HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset, tree function) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk)); rtx xops[5]; /* The this parameter is passed as the first argument. */ rtx this_rtx = gen_rtx_REG (Pmode, REG_A4); + assemble_start_function (thunk, fnname); c6x_current_insn = NULL; xops[4] = XEXP (DECL_RTL (function), 0); @@ -850,6 +852,7 @@ c6x_output_mi_thunk (FILE *file ATTRIBUTE_UNUSED, output_asm_insn ("nop 4", xops); output_asm_insn ("add .d1 %2, %1, %2", xops); } + assemble_end_function (thunk, fnname); } /* Return true if EXP goes in small data/bss. */ diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c index c652cb34558e..b915a6717637 100644 --- a/gcc/config/cris/cris.c +++ b/gcc/config/cris/cris.c @@ -2762,6 +2762,9 @@ cris_asm_output_mi_thunk (FILE *stream, HOST_WIDE_INT vcall_offset ATTRIBUTE_UNUSED, tree funcdecl) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunkdecl)); + + assemble_start_function (thunkdecl, fnname); /* Make sure unwind info is emitted for the thunk if needed. */ final_start_function (emit_barrier (), stream, 1); @@ -2804,6 +2807,7 @@ cris_asm_output_mi_thunk (FILE *stream, } final_end_function (); + assemble_end_function (thunkdecl, fnname); } /* Boilerplate emitted at start of file. diff --git a/gcc/config/csky/csky.c b/gcc/config/csky/csky.c index a9e196ba3f1d..77b21be5c4ff 100644 --- a/gcc/config/csky/csky.c +++ b/gcc/config/csky/csky.c @@ -1967,11 +1967,13 @@ csky_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED, HOST_WIDE_INT vcall_offset, tree function) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk)); const char *thiz = "a0"; const char *reg0 = "t0"; const char *reg1 = "t1"; int maxoff = 4096; /* Constant range for addi/subi. */ + assemble_start_function (thunk, fnname); final_start_function (emit_barrier (), file, 1); rtx fnaddr = XEXP (DECL_RTL (function), 0); @@ -2047,6 +2049,7 @@ csky_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED, fprintf (file, "\n"); final_end_function (); + assemble_end_function (thunk, fnname); } diff --git a/gcc/config/epiphany/epiphany.c b/gcc/config/epiphany/epiphany.c index f33562f33887..b3cb6980ba5a 100644 --- a/gcc/config/epiphany/epiphany.c +++ b/gcc/config/epiphany/epiphany.c @@ -2892,11 +2892,13 @@ epiphany_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED, HOST_WIDE_INT vcall_offset, tree function) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk)); int this_regno = aggregate_value_p (TREE_TYPE (TREE_TYPE (function)), function) ? 1 : 0; const char *this_name = reg_names[this_regno]; const char *fname; + assemble_start_function (thunk, fnname); /* We use IP and R16 as a scratch registers. */ gcc_assert (call_used_regs [GPR_IP]); gcc_assert (call_used_regs [GPR_16]); @@ -2954,6 +2956,7 @@ epiphany_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED, assemble_name (file, fname); fputc ('\n', file); } + assemble_end_function (thunk, fnname); } void diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c index f031bfa881d8..f0f1565c0028 100644 --- a/gcc/config/frv/frv.c +++ b/gcc/config/frv/frv.c @@ -1938,11 +1938,14 @@ frv_asm_output_mi_thunk (FILE *file, HOST_WIDE_INT vcall_offset ATTRIBUTE_UNUSED, tree function) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk_fndecl)); const char *name_func = XSTR (XEXP (DECL_RTL (function), 0), 0); const char *name_arg0 = reg_names[FIRST_ARG_REGNUM]; const char *name_jmp = reg_names[JUMP_REGNO]; const char *parallel = (frv_issue_rate () > 1 ? ".p" : ""); + assemble_start_function (thunk_fndecl, fnname); + /* Do the add using an addi if possible. */ if (IN_RANGE (delta, -2048, 2047)) fprintf (file, "\taddi %s,#%d,%s\n", name_arg0, (int) delta, name_arg0); @@ -2018,6 +2021,7 @@ frv_asm_output_mi_thunk (FILE *file, /* Jump to the function address. */ fprintf (file, "\tjmpl @(%s,%s)\n", name_jmp, reg_names[GPR_FIRST+0]); + assemble_end_function (thunk_fndecl, fnname); } diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 61dbc95c086f..264d84dc284e 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -41384,9 +41384,10 @@ x86_can_output_mi_thunk (const_tree, HOST_WIDE_INT, HOST_WIDE_INT vcall_offset, *(*this + vcall_offset) should be added to THIS. */ static void -x86_output_mi_thunk (FILE *file, tree, HOST_WIDE_INT delta, +x86_output_mi_thunk (FILE *file, tree thunk_fndecl, HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset, tree function) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk_fndecl)); rtx this_param = x86_this_parameter (function); rtx this_reg, tmp, fnaddr; unsigned int tmp_regno; @@ -41566,9 +41567,11 @@ x86_output_mi_thunk (FILE *file, tree, HOST_WIDE_INT delta, Note that use_thunk calls assemble_start_function et al. */ insn = get_insns (); shorten_branches (insn); + assemble_start_function (thunk_fndecl, fnname); final_start_function (insn, file, 1); final (insn, file, 1); final_end_function (); + assemble_end_function (thunk_fndecl, fnname); } static void diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index f121cee19971..ec7374071445 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -10913,6 +10913,7 @@ ia64_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED, HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset, tree function) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk)); rtx this_rtx, funexp; rtx_insn *insn; unsigned int this_parmno; @@ -11038,9 +11039,11 @@ ia64_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED, emit_all_insn_group_barriers (NULL); insn = get_insns (); shorten_branches (insn); + assemble_start_function (thunk, fnname); final_start_function (insn, file, 1); final (insn, file, 1); final_end_function (); + assemble_end_function (thunk, fnname); reload_completed = 0; epilogue_completed = 0; diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c index ea4154583b1c..a594d1108672 100644 --- a/gcc/config/m68k/m68k.c +++ b/gcc/config/m68k/m68k.c @@ -5071,6 +5071,7 @@ m68k_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED, HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset, tree function) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk)); rtx this_slot, offset, addr, mem, tmp; rtx_insn *insn; @@ -5147,9 +5148,11 @@ m68k_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED, /* Run just enough of rest_of_compilation. */ insn = get_insns (); split_all_insns_noflow (); + assemble_start_function (thunk, fnname); final_start_function (insn, file, 1); final (insn, file, 1); final_end_function (); + assemble_end_function (thunk, fnname); /* Clean up the vars set above. */ reload_completed = 0; diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c index 6c4a62c3113a..fcb9e5aa15fc 100644 --- a/gcc/config/microblaze/microblaze.c +++ b/gcc/config/microblaze/microblaze.c @@ -3309,6 +3309,7 @@ microblaze_asm_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset, tree function) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk_fndecl)); rtx this_rtx, funexp; rtx_insn *insn; @@ -3364,9 +3365,11 @@ microblaze_asm_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, "borrowed" from rs6000.c. */ insn = get_insns (); shorten_branches (insn); + assemble_start_function (thunk_fndecl, fnname); final_start_function (insn, file, 1); final (insn, file, 1); final_end_function (); + assemble_end_function (thunk_fndecl, fnname); reload_completed = 0; epilogue_completed = 0; diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 55b44078518c..71cca20c26d0 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -19403,6 +19403,7 @@ mips_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset, tree function) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk_fndecl)); rtx this_rtx, temp1, temp2, fnaddr; rtx_insn *insn; bool use_sibcall_p; @@ -19515,9 +19516,11 @@ mips_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, split_all_insns_noflow (); mips16_lay_out_constants (true); shorten_branches (insn); + assemble_start_function (thunk_fndecl, fnname); final_start_function (insn, file, 1); final (insn, file, 1); final_end_function (); + assemble_end_function (thunk_fndecl, fnname); /* Clean up the vars set above. Note that final_end_function resets the global pointer for us. */ diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c index 0225f806fb5d..921a771bcf0f 100644 --- a/gcc/config/mmix/mmix.c +++ b/gcc/config/mmix/mmix.c @@ -915,7 +915,7 @@ mmix_target_asm_function_epilogue (FILE *stream) static void mmix_asm_output_mi_thunk (FILE *stream, - tree fndecl ATTRIBUTE_UNUSED, + tree thunk_fndecl ATTRIBUTE_UNUSED, HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset ATTRIBUTE_UNUSED, tree func) @@ -924,6 +924,9 @@ mmix_asm_output_mi_thunk (FILE *stream, location of structure to return as invisible first argument), you need to tweak this code too. */ const char *regname = reg_names[MMIX_FIRST_INCOMING_ARG_REGNUM]; + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk_fndecl)); + + assemble_start_function (thunk_fndecl, fnname); if (delta >= 0 && delta < 65536) fprintf (stream, "\tINCL %s,%d\n", regname, (int)delta); @@ -938,6 +941,7 @@ mmix_asm_output_mi_thunk (FILE *stream, fprintf (stream, "\tJMP "); assemble_name (stream, XSTR (XEXP (DECL_RTL (func), 0), 0)); fprintf (stream, "\n"); + assemble_end_function (thunk_fndecl, fnname); } /* FUNCTION_PROFILER. */ diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c index a7e5e6b24f5c..28edf4cd39d8 100644 --- a/gcc/config/mn10300/mn10300.c +++ b/gcc/config/mn10300/mn10300.c @@ -2585,8 +2585,10 @@ mn10300_asm_output_mi_thunk (FILE * file, HOST_WIDE_INT vcall_offset, tree function) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk_fndecl)); const char * _this; + assemble_start_function (thunk_fndecl, fnname); /* Get the register holding the THIS parameter. Handle the case where there is a hidden first argument for a returned structure. */ if (aggregate_value_p (TREE_TYPE (TREE_TYPE (function)), function)) @@ -2613,6 +2615,7 @@ mn10300_asm_output_mi_thunk (FILE * file, fputs ("\tjmp ", file); assemble_name (file, XSTR (XEXP (DECL_RTL (function), 0), 0)); putc ('\n', file); + assemble_end_function (thunk_fndecl, fnname); } /* Return true if mn10300_output_mi_thunk would be able to output the diff --git a/gcc/config/nds32/nds32.c b/gcc/config/nds32/nds32.c index 1ae34fc11f01..c52522538151 100644 --- a/gcc/config/nds32/nds32.c +++ b/gcc/config/nds32/nds32.c @@ -2227,8 +2227,10 @@ nds32_asm_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED, HOST_WIDE_INT vcall_offset ATTRIBUTE_UNUSED, tree function) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk)); int this_regno; + assemble_start_function (thunk, fnname); /* Make sure unwind info is emitted for the thunk if needed. */ final_start_function (emit_barrier (), file, 1); @@ -2299,6 +2301,7 @@ nds32_asm_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED, } final_end_function (); + assemble_end_function (thunk, fnname); } /* -- Permitting tail calls. */ diff --git a/gcc/config/nios2/nios2.c b/gcc/config/nios2/nios2.c index e266924cfdb4..735302f3033a 100644 --- a/gcc/config/nios2/nios2.c +++ b/gcc/config/nios2/nios2.c @@ -4468,6 +4468,7 @@ nios2_asm_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset, tree function) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk_fndecl)); rtx this_rtx, funexp; rtx_insn *insn; @@ -4521,9 +4522,11 @@ nios2_asm_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, assemble_start_function and assemble_end_function. */ insn = get_insns (); shorten_branches (insn); + assemble_start_function (thunk_fndecl, fnname); final_start_function (insn, file, 1); final (insn, file, 1); final_end_function (); + assemble_end_function (thunk_fndecl, fnname); /* Stop pretending to be a post-reload pass. */ reload_completed = 0; diff --git a/gcc/config/or1k/or1k.c b/gcc/config/or1k/or1k.c index d1b90cb0168b..06487cec98d6 100644 --- a/gcc/config/or1k/or1k.c +++ b/gcc/config/or1k/or1k.c @@ -2028,10 +2028,11 @@ or1k_expand_atomic_op_qihi (rtx_code code, rtx mem, rtx val, (*THIS + VCALL_OFFSET) should be additionally added to THIS. */ static void -or1k_output_mi_thunk (FILE *file, tree /* thunk_fndecl */, +or1k_output_mi_thunk (FILE *file, tree thunk_fndecl, HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset, tree function) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk_fndecl)); rtx this_rtx, funexp; rtx_insn *insn; @@ -2115,9 +2116,11 @@ or1k_output_mi_thunk (FILE *file, tree /* thunk_fndecl */, assemble_start_function and assemble_end_function. */ insn = get_insns (); shorten_branches (insn); + assemble_start_function (thunk_fndecl, fnname); final_start_function (insn, file, 1); final (insn, file, 1); final_end_function (); + assemble_end_function (thunk_fndecl, fnname); reload_completed = 0; epilogue_completed = 0; diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 2bf48e40a673..da110b6bda38 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -8369,6 +8369,7 @@ pa_asm_output_mi_thunk (FILE *file, tree thunk_fndecl, HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset ATTRIBUTE_UNUSED, tree function) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk_fndecl)); static unsigned int current_thunk_number; int val_14 = VAL_14_BITS_P (delta); unsigned int old_last_address = last_address, nbytes = 0; @@ -8379,6 +8380,7 @@ pa_asm_output_mi_thunk (FILE *file, tree thunk_fndecl, HOST_WIDE_INT delta, xoperands[1] = XEXP (DECL_RTL (thunk_fndecl), 0); xoperands[2] = GEN_INT (delta); + assemble_start_function (thunk_fndecl, fnname); final_start_function (emit_barrier (), file, 1); /* Output the thunk. We know that the function is in the same @@ -8596,6 +8598,7 @@ pa_asm_output_mi_thunk (FILE *file, tree thunk_fndecl, HOST_WIDE_INT delta, if (old_last_address > last_address) last_address = UINT_MAX; update_total_code_bytes (nbytes); + assemble_end_function (thunk_fndecl, fnname); } /* Only direct calls to static functions are allowed to be sibling (tail) diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c index 7c1319e36de2..9729bbf45f6f 100644 --- a/gcc/config/riscv/riscv.c +++ b/gcc/config/riscv/riscv.c @@ -4201,6 +4201,7 @@ riscv_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset, tree function) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk_fndecl)); rtx this_rtx, temp1, temp2, fnaddr; rtx_insn *insn; @@ -4260,9 +4261,11 @@ riscv_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, insn = get_insns (); split_all_insns_noflow (); shorten_branches (insn); + assemble_start_function (thunk_fndecl, fnname); final_start_function (insn, file, 1); final (insn, file, 1); final_end_function (); + assemble_end_function (thunk_fndecl, fnname); /* Clean up the vars set above. Note that final_end_function resets the global pointer for us. */ diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index f327c2730777..55cdfc48f6cd 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -29410,6 +29410,7 @@ rs6000_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset, tree function) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk_fndecl)); rtx this_rtx, funexp; rtx_insn *insn; @@ -29483,9 +29484,11 @@ rs6000_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, assemble_start_function and assemble_end_function. */ insn = get_insns (); shorten_branches (insn); + assemble_start_function (thunk_fndecl, fnname); final_start_function (insn, file, 1); final (insn, file, 1); final_end_function (); + assemble_end_function (thunk_fndecl, fnname); reload_completed = 0; epilogue_completed = 0; diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 62868995ca6e..d858436fc0f1 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -12743,9 +12743,11 @@ s390_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED, HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset, tree function) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk)); rtx op[10]; int nonlocal = 0; + assemble_start_function (thunk, fnname); /* Make sure unwind info is emitted for the thunk if needed. */ final_start_function (emit_barrier (), file, 1); @@ -12999,6 +13001,7 @@ s390_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED, } } final_end_function (); + assemble_end_function (thunk, fnname); } /* Output either an indirect jump or a an indirect call diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 4a0d5bae57bf..78f6c38fa0d5 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -10796,6 +10796,7 @@ sh_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset, tree function) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk_fndecl)); CUMULATIVE_ARGS cum; int structure_value_byref = 0; rtx this_rtx, this_value, sibcall, funexp; @@ -10953,9 +10954,11 @@ sh_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, sh_reorg (); shorten_branches (insns); + assemble_start_function (thunk_fndecl, fnname); final_start_function (insns, file, 1); final (insns, file, 1); final_end_function (); + assemble_end_function (thunk_fndecl, fnname); reload_completed = 0; epilogue_completed = 0; diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index adbef1ab18f5..81b4cf5c551e 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -12261,6 +12261,7 @@ sparc_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset, tree function) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk_fndecl)); rtx this_rtx, funexp; rtx_insn *insn; unsigned int int_arg_first; @@ -12449,9 +12450,11 @@ sparc_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, assemble_start_function and assemble_end_function. */ insn = get_insns (); shorten_branches (insn); + assemble_start_function (thunk_fndecl, fnname); final_start_function (insn, file, 1); final (insn, file, 1); final_end_function (); + assemble_end_function (thunk_fndecl, fnname); reload_completed = 0; epilogue_completed = 0; diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c index 45dd2dc20096..d056503c5186 100644 --- a/gcc/config/spu/spu.c +++ b/gcc/config/spu/spu.c @@ -7043,8 +7043,10 @@ spu_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED, HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset, tree function) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk)); rtx op[8]; + assemble_start_function (thunk, fnname); /* Make sure unwind info is emitted for the thunk if needed. */ final_start_function (emit_barrier (), file, 1); @@ -7116,6 +7118,7 @@ spu_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED, output_asm_insn ("br\t%0", op); final_end_function (); + assemble_end_function (thunk, fnname); } /* Canonicalize a comparison from one we don't have to one we do have. */ diff --git a/gcc/config/stormy16/stormy16.c b/gcc/config/stormy16/stormy16.c index 6fbbbe2e9944..cebc09e1e930 100644 --- a/gcc/config/stormy16/stormy16.c +++ b/gcc/config/stormy16/stormy16.c @@ -1512,8 +1512,10 @@ xstormy16_asm_output_mi_thunk (FILE *file, HOST_WIDE_INT vcall_offset ATTRIBUTE_UNUSED, tree function) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk_fndecl)); int regnum = FIRST_ARGUMENT_REGISTER; + assemble_start_function (thunk_fndecl, fnname); /* There might be a hidden first argument for a returned structure. */ if (aggregate_value_p (TREE_TYPE (TREE_TYPE (function)), function)) regnum += 1; @@ -1522,6 +1524,7 @@ xstormy16_asm_output_mi_thunk (FILE *file, fputs ("\tjmpf ", file); assemble_name (file, XSTR (XEXP (DECL_RTL (function), 0), 0)); putc ('\n', file); + assemble_end_function (thunk_fndecl, fnname); } /* The purpose of this function is to override the default behavior of diff --git a/gcc/config/tilegx/tilegx.c b/gcc/config/tilegx/tilegx.c index 14d817160ac1..c212aafe27db 100644 --- a/gcc/config/tilegx/tilegx.c +++ b/gcc/config/tilegx/tilegx.c @@ -4920,6 +4920,7 @@ tilegx_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset, tree function) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk_fndecl)); rtx this_rtx, funexp, addend; rtx_insn *insn; @@ -5000,9 +5001,11 @@ tilegx_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, */ insn = get_insns (); shorten_branches (insn); + assemble_start_function (thunk_fndecl, fnname); final_start_function (insn, file, 1); final (insn, file, 1); final_end_function (); + assemble_end_function (thunk_fndecl, fnname); /* Stop pretending to be a post-reload pass. */ reload_completed = 0; diff --git a/gcc/config/tilepro/tilepro.c b/gcc/config/tilepro/tilepro.c index 65380b5d04a8..034f61bb0ed7 100644 --- a/gcc/config/tilepro/tilepro.c +++ b/gcc/config/tilepro/tilepro.c @@ -4368,6 +4368,7 @@ tilepro_asm_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset, tree function) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk_fndecl)); rtx this_rtx, funexp; rtx_insn *insn; @@ -4423,9 +4424,11 @@ tilepro_asm_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, */ insn = get_insns (); shorten_branches (insn); + assemble_start_function (thunk_fndecl, fnname); final_start_function (insn, file, 1); final (insn, file, 1); final_end_function (); + assemble_end_function (thunk_fndecl, fnname); /* Stop pretending to be a post-reload pass. */ reload_completed = 0; diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c index 631c598d3b2f..94fcb0b488de 100644 --- a/gcc/config/vax/vax.c +++ b/gcc/config/vax/vax.c @@ -1049,11 +1049,15 @@ vax_output_mi_thunk (FILE * file, HOST_WIDE_INT vcall_offset ATTRIBUTE_UNUSED, tree function) { + const char *fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk)); + + assemble_start_function (thunk, fnname); fprintf (file, "\t.word 0x0ffc\n\taddl2 $" HOST_WIDE_INT_PRINT_DEC, delta); asm_fprintf (file, ",4(%Rap)\n"); fprintf (file, "\tjmp "); assemble_name (file, XSTR (XEXP (DECL_RTL (function), 0), 0)); fprintf (file, "+2\n"); + assemble_end_function (thunk, fnname); } static rtx