From patchwork Mon Jun 8 23:46:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 1305443 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49gqfY2lFqz9sWQ for ; Tue, 9 Jun 2020 09:46:59 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A3E923851C0A; Mon, 8 Jun 2020 23:46:55 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from rock.gnat.com (rock.gnat.com [IPv6:2620:20:4000:0:a9e:1ff:fe9b:1d1]) by sourceware.org (Postfix) with ESMTP id D31F2385DC00 for ; Mon, 8 Jun 2020 23:46:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D31F2385DC00 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oliva@adacore.com Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 8534511766C; Mon, 8 Jun 2020 19:46:52 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id DNgg5Wp2VNZo; Mon, 8 Jun 2020 19:46:52 -0400 (EDT) Received: from free.home (tron.gnat.com [IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPS id 4AB83117618; Mon, 8 Jun 2020 19:46:52 -0400 (EDT) Received: from livre.home (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 058NkjAh884497 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 8 Jun 2020 20:46:45 -0300 From: Alexandre Oliva To: gcc-patches@gcc.gnu.org Subject: avoid line breaks in -fverbose-asm tree exprs Organization: Free thinker, does not speak for AdaCore Date: Mon, 08 Jun 2020 20:46:45 -0300 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" An asm operand with a "VIEW_CONVERT_EXPR" will output the definition of the struct as asm code. Oops. I hoped setting print_rtx_head would affect print_mem_expr, just because it's in print-rtl rather than tree-pretty-print, but it didn't help. I've thus arranged for print_mem_expr to "obey" print_rtx_head by enabling TDF_SLIM. Regstrapped on x86_64-linux-gnu. Ok to install? Another alternative that occurred to me was to get print_rtx_head printed by e.g. pp_newline, or otherwise get print-rtl and pretty-print infrastructure to both use the same line-leading infrastructure. I think that would be a much bigger undertaking, so I figured I'd ask whether that would be desirable, before taking it up. Thoughts? for gcc/ChangeLog * final.c (output_asm_operand_names): Set print_rtx_head around print_mem_expr. * print-rtl.c (print_mem_expr): Enable TDF_SLIM in dump_flags when print_rtx_head is nonempty. --- final.c | 3 +++ print-rtl.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git gcc/final.c gcc/final.c index a360196..482801db 100644 --- gcc/final.c +++ gcc/final.c @@ -3706,9 +3706,12 @@ output_asm_operand_names (rtx *operands, int *oporder, int nops) wrote = 1; if (expr) { + const char *saved_print_rtx_head = print_rtx_head; fprintf (asm_out_file, "%s", addressp ? "*" : ""); + print_rtx_head = ASM_COMMENT_START; print_mem_expr (asm_out_file, expr); + print_rtx_head = saved_print_rtx_head; wrote = 1; } else if (REG_P (op) && ORIGINAL_REGNO (op) diff --git gcc/print-rtl.c gcc/print-rtl.c index 611ea07..0563540 100644 --- gcc/print-rtl.c +++ gcc/print-rtl.c @@ -182,8 +182,12 @@ rtx_reuse_manager::set_seen_def (int reuse_id) void print_mem_expr (FILE *outfile, const_tree expr) { + dump_flags_t save_dump_flags = dump_flags; + if (*print_rtx_head) + dump_flags |= TDF_SLIM; fputc (' ', outfile); print_generic_expr (outfile, CONST_CAST_TREE (expr), dump_flags); + dump_flags = save_dump_flags; } #endif