From patchwork Wed Sep 11 19:10:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 1161247 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-508902-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="kIGgtoFb"; 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 46TBLD0dLrz9s7T for ; Thu, 12 Sep 2019 05:10:11 +1000 (AEST) 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:subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=default; b=etSeZ8esQCZWLTMc4gC4fcXkQbivr l3QqJB5PR8s8O52jkqadk3t8aYbN5asTo7id8Ka7r6ONiDNhEJP1VsWmwPBmMEjs ZZT/fWmt92OBXh445h9/+gRCZPxGnwBxlMSZOg84OTJuz7lsGfwTBkLtww6cocK7 b8cWJyOBJo5Z/M= 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:subject:references:date:in-reply-to:message-id:mime-version :content-type; s=default; bh=a5Ms5ptAmZr/WptjdzeBjDTD1IU=; b=kIG gtoFbTz0o2gjrLe+us7W7P1lahA+fidY0BNEfby984mQxttOUx5hSoV2D8Re2GXN TaeNiHB2ElyQX+3nw2+KK9frtBMiFF/dgdXndS9hTGV+UCoJFQ8fZR25ixPJvq0j 8b4ryx9Jx1n24Mbzgg605V9vx/AFCGwXsgNRhs1Q= Received: (qmail 97473 invoked by alias); 11 Sep 2019 19:10:05 -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 97465 invoked by uid 89); 11 Sep 2019 19:10:04 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS autolearn=ham version=3.3.1 spammy=bitmap_view, bitmaps, bitmap_head X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.110.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 11 Sep 2019 19:10:03 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BB38128 for ; Wed, 11 Sep 2019 12:10:01 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.99.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6375A3F59C for ; Wed, 11 Sep 2019 12:10:01 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [13/32] Remove global call sets: DF (EH edges) References: Date: Wed, 11 Sep 2019 20:10:00 +0100 In-Reply-To: (Richard Sandiford's message of "Wed, 11 Sep 2019 20:02:26 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 X-IsSubscribed: yes The DF dense_invalidated_by_call and sparse_invalidated_by_call sets are actually only used on EH edges, and so are more the set of registers that are invalidated by a taken EH edge. Under the new order, that means that they describe eh_edge_abi. 2019-09-11 Richard Sandiford gcc/ * df-problems.c: Include regs.h and function-abi.h. (df_rd_problem_data): Rename sparse_invalidated_by_call to sparse_invalidated_by_eh and dense_invalidated_by_call to dense_invalidated_by_eh. (df_print_bb_index): Update accordingly. (df_rd_alloc, df_rd_start_dump, df_rd_confluence_n): Likewise. (df_lr_confluence_n): Use eh_edge_abi to get the set of registers that are clobbered by an EH edge. Clobber partially-clobbered registers as well as fully-clobbered ones. (df_md_confluence_n): Likewise. (df_rd_local_compute): Likewise. Update for changes to df_rd_problem_data. * df-scan.c (df_scan_start_dump): Use eh_edge_abi to get the set of registers that are clobbered by an EH edge. Includde partially- clobbered registers as well as fully-clobbered ones. Index: gcc/df-problems.c =================================================================== --- gcc/df-problems.c 2019-09-09 19:01:48.423021426 +0100 +++ gcc/df-problems.c 2019-09-11 19:48:07.405959747 +0100 @@ -36,6 +36,8 @@ Software Foundation; either version 3, o #include "valtrack.h" #include "dumpfile.h" #include "rtl-iter.h" +#include "regs.h" +#include "function-abi.h" /* Note that turning REG_DEAD_DEBUGGING on will cause gcc.c-torture/unsorted/dump-noaddr.c to fail because it prints @@ -139,18 +141,17 @@ df_print_bb_index (basic_block bb, FILE these along with the bitmap_clear_range call to remove ranges of bits without actually generating a knockout vector. - The kill and sparse_kill and the dense_invalidated_by_call and - sparse_invalidated_by_call both play this game. */ + The kill and sparse_kill and the dense_invalidated_by_eh and + sparse_invalidated_by_eh both play this game. */ /* Private data used to compute the solution for this problem. These data structures are not accessible outside of this module. */ class df_rd_problem_data { public: - /* The set of defs to regs invalidated by call. */ - bitmap_head sparse_invalidated_by_call; - /* The set of defs to regs invalidate by call for rd. */ - bitmap_head dense_invalidated_by_call; + /* The set of defs to regs invalidated by EH edges. */ + bitmap_head sparse_invalidated_by_eh; + bitmap_head dense_invalidated_by_eh; /* An obstack for the bitmaps we need for this problem. */ bitmap_obstack rd_bitmaps; }; @@ -187,8 +188,8 @@ df_rd_alloc (bitmap all_blocks) if (df_rd->problem_data) { problem_data = (class df_rd_problem_data *) df_rd->problem_data; - bitmap_clear (&problem_data->sparse_invalidated_by_call); - bitmap_clear (&problem_data->dense_invalidated_by_call); + bitmap_clear (&problem_data->sparse_invalidated_by_eh); + bitmap_clear (&problem_data->dense_invalidated_by_eh); } else { @@ -196,9 +197,9 @@ df_rd_alloc (bitmap all_blocks) df_rd->problem_data = problem_data; bitmap_obstack_initialize (&problem_data->rd_bitmaps); - bitmap_initialize (&problem_data->sparse_invalidated_by_call, + bitmap_initialize (&problem_data->sparse_invalidated_by_eh, &problem_data->rd_bitmaps); - bitmap_initialize (&problem_data->dense_invalidated_by_call, + bitmap_initialize (&problem_data->dense_invalidated_by_eh, &problem_data->rd_bitmaps); } @@ -391,8 +392,8 @@ df_rd_local_compute (bitmap all_blocks) bitmap_iterator bi; class df_rd_problem_data *problem_data = (class df_rd_problem_data *) df_rd->problem_data; - bitmap sparse_invalidated = &problem_data->sparse_invalidated_by_call; - bitmap dense_invalidated = &problem_data->dense_invalidated_by_call; + bitmap sparse_invalidated = &problem_data->sparse_invalidated_by_eh; + bitmap dense_invalidated = &problem_data->dense_invalidated_by_eh; bitmap_initialize (&seen_in_block, &df_bitmap_obstack); bitmap_initialize (&seen_in_insn, &df_bitmap_obstack); @@ -404,10 +405,13 @@ df_rd_local_compute (bitmap all_blocks) df_rd_bb_local_compute (bb_index); } - /* Set up the knockout bit vectors to be applied across EH_EDGES. */ + /* Set up the knockout bit vectors to be applied across EH_EDGES. + Conservatively treat partially-clobbered registers as surviving + across the EH edge, i.e. assume that definitions before the edge + is taken *might* reach uses after it has been taken. */ if (!(df->changeable_flags & DF_NO_HARD_REGS)) for (unsigned int regno = 0; regno < FIRST_PSEUDO_REGISTER; ++regno) - if (TEST_HARD_REG_BIT (regs_invalidated_by_call, regno)) + if (eh_edge_abi.clobbers_full_reg_p (regno)) { if (DF_DEFS_COUNT (regno) > DF_SPARSE_THRESHOLD) bitmap_set_bit (sparse_invalidated, regno); @@ -455,8 +459,8 @@ df_rd_confluence_n (edge e) { class df_rd_problem_data *problem_data = (class df_rd_problem_data *) df_rd->problem_data; - bitmap sparse_invalidated = &problem_data->sparse_invalidated_by_call; - bitmap dense_invalidated = &problem_data->dense_invalidated_by_call; + bitmap sparse_invalidated = &problem_data->sparse_invalidated_by_eh; + bitmap dense_invalidated = &problem_data->dense_invalidated_by_eh; bitmap_iterator bi; unsigned int regno; @@ -579,9 +583,9 @@ df_rd_start_dump (FILE *file) fprintf (file, ";; Reaching defs:\n"); fprintf (file, ";; sparse invalidated \t"); - dump_bitmap (file, &problem_data->sparse_invalidated_by_call); + dump_bitmap (file, &problem_data->sparse_invalidated_by_eh); fprintf (file, ";; dense invalidated \t"); - dump_bitmap (file, &problem_data->dense_invalidated_by_call); + dump_bitmap (file, &problem_data->dense_invalidated_by_eh); fprintf (file, ";; reg->defs[] map:\t"); for (regno = 0; regno < m; regno++) @@ -976,12 +980,15 @@ df_lr_confluence_n (edge e) bitmap op2 = &df_lr_get_bb_info (e->dest->index)->in; bool changed = false; - /* Call-clobbered registers die across exception and call edges. */ + /* Call-clobbered registers die across exception and call edges. + Conservatively treat partially-clobbered registers as surviving + across the edges; they might or might not, depending on what + mode they have. */ /* ??? Abnormal call edges ignored for the moment, as this gets confused by sibling call edges, which crashes reg-stack. */ if (e->flags & EDGE_EH) { - bitmap_view eh_kills (regs_invalidated_by_call); + bitmap_view eh_kills (eh_edge_abi.full_reg_clobbers ()); changed = bitmap_ior_and_compl_into (op1, op2, eh_kills); } else @@ -4636,7 +4643,10 @@ df_md_confluence_n (edge e) if (e->flags & EDGE_EH) { - bitmap_view eh_kills (regs_invalidated_by_call); + /* Conservatively treat partially-clobbered registers as surviving + across the edge; they might or might not, depending on what mode + they have. */ + bitmap_view eh_kills (eh_edge_abi.full_reg_clobbers ()); return bitmap_ior_and_compl_into (op1, op2, eh_kills); } else Index: gcc/df-scan.c =================================================================== --- gcc/df-scan.c 2019-09-11 19:47:24.410262730 +0100 +++ gcc/df-scan.c 2019-09-11 19:48:07.405959747 +0100 @@ -312,8 +312,9 @@ df_scan_start_dump (FILE *file ATTRIBUTE basic_block bb; rtx_insn *insn; - fprintf (file, ";; invalidated by call \t"); - df_print_regset (file, bitmap_view (regs_invalidated_by_call)); + fprintf (file, ";; fully invalidated by EH \t"); + df_print_regset + (file, bitmap_view (eh_edge_abi.full_reg_clobbers ())); fprintf (file, ";; hardware regs used \t"); df_print_regset (file, &df->hardware_regs_used); fprintf (file, ";; regular block artificial uses \t");