From patchwork Sun Nov 12 12:08:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lehua Ding X-Patchwork-Id: 164246 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp659548vqg; Sun, 12 Nov 2023 04:09:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IEi4CCQZXMJ+XGgjIQdKqLV2F9S7u41TjGp4ubrNQXUzl3N3AczUQaRakxjwM+RbU+XYVKI X-Received: by 2002:a05:6870:470d:b0:1e9:b537:51ef with SMTP id b13-20020a056870470d00b001e9b53751efmr4102643oaq.31.1699790951403; Sun, 12 Nov 2023 04:09:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699790951; cv=pass; d=google.com; s=arc-20160816; b=UvOqO5xaBxVQ39YIDOGHzKB6XVanjZMOrRf7Da+JDFFJYNvqdBOvtAl8KNQzUDDVPb 3oN+/ixvm7mwukTgExUk2oUZAmo3h7TKapDpIJP4+gpai14gmB4DeqNMsKKW9hcTGcXo P4jUQg/1/BuJruj0BpO8ksryz8HfNkjb1fUdMWQbC+BXvhT0enJb/BPCOA5jfbi6gl7Z Z1QpJjyCQoT9NG+M1Ove2Ll5O0wllRxgID3WiROPjvUr966S8B1C4YzMQUulLFcbZokl x1kO6iL57MO3uJjFI2yStUuDhmLsd2v+eBxLuW8kVX/gzVtkhCqH4YMvXv0AOTYMWoO5 gtjg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:feedback-id :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-filter:dmarc-filter :delivered-to; bh=nKM6Ct8t3HDu0M+BpP5/VGPHnAtv1BTzcw/KOZDOINA=; fh=9Ok8HNl3eD0lUFF4nhUPZJmQfyAUbHnIPw/rSVNIfK0=; b=K4joa6a/czCOJc5l1RlNqXt6KFd3xMTexDJQc7MxUMvIrf63ZXDiKF99QZVoBaPBMH /GOrM6quIspOdY3Z+jCz+PlKNbZtwbUbIlglRj6pLqi8W62/QVeRPv1ucURtkgnsm2kO r702VgoMBQXAgZVSR+E1kCxNfQyvN2jsJ/+srO6cStgGEnApteUXnlRhlNCOb8uVa+Ie wOZGPJOSms35ELW1hZFAbbkIc0CKrqz2VW/uTklN9OjLc9NsJ0HyMvs/6iU/fWb06ats WuHJsqVh4HIVfa7aQlOPoegSLUG9L2g/p4fdSWIPUygtFPA/qvOLT48ZKYV+SJrW7J9c NASA== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id az14-20020a05620a170e00b00773f574d0fdsi2967603qkb.669.2023.11.12.04.09.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Nov 2023 04:09:11 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 81060385703A for ; Sun, 12 Nov 2023 12:08:59 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtpbgsg2.qq.com (smtpbgsg2.qq.com [54.254.200.128]) by sourceware.org (Postfix) with ESMTPS id 77F9D3858D35 for ; Sun, 12 Nov 2023 12:08:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 77F9D3858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivai.ai Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivai.ai ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 77F9D3858D35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=54.254.200.128 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699790915; cv=none; b=RX6VUV2JknbykgwDPOW5dz/NBYASqhyHbEOob3iTYiQwezZ0dYnxWd04Mgki6JboF3yD1m/GctvDGtr9SnOJrv6j5WLBWwujW3P/jnUIGEpyL9s9bXlNtWtyWoksdHKCCW2lrT3+Jek7reGQQMlU7HLK9vmSZlOP+NB/HhQYtO0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699790915; c=relaxed/simple; bh=bhszhFXrqon2ISNTkcnO4WA2wV5klMmEKWQgsIcSOjo=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=iuXXKrk+dIiitCym0pZqO+L7xOIK2roPpLzKTYAqSOoUjuydXPixQFHitJKrQ1tPKvIXjy29AjlQw7WUhhACoxAZ61wJ57zbA+DL1R82OQwbiO/XRoIv8fhQ0T1vVByNi5/QGKJ+hMKNw0cdIoJCLR2g+IckywiLYI1WrFRD+Qw= ARC-Authentication-Results: i=1; server2.sourceware.org X-QQ-mid: bizesmtp67t1699790905ty5rjd9q Received: from rios-cad121.hadoop.rioslab.org ( [58.60.1.9]) by bizesmtp.qq.com (ESMTP) with id ; Sun, 12 Nov 2023 20:08:25 +0800 (CST) X-QQ-SSF: 01400000000000C0F000000A0000000 X-QQ-FEAT: +s1mbd4gJMpTi86lOMy0TINlHVNKrjcUfWTkrNEyZyK3JQ+sOhdHHkihJXiKU 4AXB/xzG7yqXmy0W4ncaKuyABtQbWgxMvLsjPfNgxTj3P1cw204MmLBTLn0/XDVCXo0Zbug 9XuE5sCSpnhORJmiBShlxjb3LZtVNvys3tIfEDKygPFSHFLcNvoIO0hAmuk5HHzmHUkgi2Q 3Wsxw8Id2vxXSej1pOimAO4qJZLph39Weqt2u9BMooBhTNDqF7m0FE5l7VeXXjObk2XCn9h mmU/S0WxhhGCrr8g9HhD9wA9BzCIAD0nuM7yqMJTnY4iFN1/wnD1B5wGDV0VVyeDMZIMbQo yMDeA5M/X/79kFkI1bB4Q3Dyw2OPEup9qTJKA4QrxFG+EsSEfBMChZBtLF3rBWlHnrug68H 3HAGO6o6/jc= X-QQ-GoodBg: 2 X-BIZMAIL-ID: 7242735660438849757 From: Lehua Ding To: gcc-patches@gcc.gnu.org Cc: vmakarov@redhat.com, richard.sandiford@arm.com, juzhe.zhong@rivai.ai, lehua.ding@rivai.ai Subject: [PATCH V3 2/7] ira: Switch to live_subreg data Date: Sun, 12 Nov 2023 20:08:12 +0800 Message-Id: <20231112120817.2635864-3-lehua.ding@rivai.ai> X-Mailer: git-send-email 2.36.3 In-Reply-To: <20231112120817.2635864-1-lehua.ding@rivai.ai> References: <20231112120817.2635864-1-lehua.ding@rivai.ai> MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:rivai.ai:qybglogicsvrgz:qybglogicsvrgz6a-0 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, URIBL_SBL_A autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782359996218709735 X-GMAIL-MSGID: 1782359996218709735 This patch switch the use of live_reg data to live_subreg data. gcc/ChangeLog: * ira-build.cc (create_bb_allocnos): Switch. (create_loop_allocnos): Ditto. * ira-color.cc (ira_loop_edge_freq): Ditto. * ira-emit.cc (generate_edge_moves): Ditto. (add_ranges_and_copies): Ditto. * ira-lives.cc (process_out_of_region_eh_regs): Ditto. (add_conflict_from_region_landing_pads): Ditto. (process_bb_node_lives): Ditto. * ira.cc (find_moveable_pseudos): Ditto. (interesting_dest_for_shprep_1): Ditto. (allocate_initial_values): Ditto. (ira): Ditto. --- gcc/ira-build.cc | 7 ++++--- gcc/ira-color.cc | 8 ++++---- gcc/ira-emit.cc | 12 ++++++------ gcc/ira-lives.cc | 7 ++++--- gcc/ira.cc | 16 +++++++++------- 5 files changed, 27 insertions(+), 23 deletions(-) diff --git a/gcc/ira-build.cc b/gcc/ira-build.cc index 93e46033170..f931c6e304c 100644 --- a/gcc/ira-build.cc +++ b/gcc/ira-build.cc @@ -1919,7 +1919,8 @@ create_bb_allocnos (ira_loop_tree_node_t bb_node) create_insn_allocnos (PATTERN (insn), NULL, false); /* It might be a allocno living through from one subloop to another. */ - EXECUTE_IF_SET_IN_REG_SET (df_get_live_in (bb), FIRST_PSEUDO_REGISTER, i, bi) + EXECUTE_IF_SET_IN_REG_SET (DF_LIVE_SUBREG_IN (bb), FIRST_PSEUDO_REGISTER, + i, bi) if (ira_curr_regno_allocno_map[i] == NULL) ira_create_allocno (i, false, ira_curr_loop_tree_node); } @@ -1935,9 +1936,9 @@ create_loop_allocnos (edge e) bitmap_iterator bi; ira_loop_tree_node_t parent; - live_in_regs = df_get_live_in (e->dest); + live_in_regs = DF_LIVE_SUBREG_IN (e->dest); border_allocnos = ira_curr_loop_tree_node->border_allocnos; - EXECUTE_IF_SET_IN_REG_SET (df_get_live_out (e->src), + EXECUTE_IF_SET_IN_REG_SET (DF_LIVE_SUBREG_OUT (e->src), FIRST_PSEUDO_REGISTER, i, bi) if (bitmap_bit_p (live_in_regs, i)) { diff --git a/gcc/ira-color.cc b/gcc/ira-color.cc index f2e8ea34152..4aa3e316282 100644 --- a/gcc/ira-color.cc +++ b/gcc/ira-color.cc @@ -2783,8 +2783,8 @@ ira_loop_edge_freq (ira_loop_tree_node_t loop_node, int regno, bool exit_p) FOR_EACH_EDGE (e, ei, loop_node->loop->header->preds) if (e->src != loop_node->loop->latch && (regno < 0 - || (bitmap_bit_p (df_get_live_out (e->src), regno) - && bitmap_bit_p (df_get_live_in (e->dest), regno)))) + || (bitmap_bit_p (DF_LIVE_SUBREG_OUT (e->src), regno) + && bitmap_bit_p (DF_LIVE_SUBREG_IN (e->dest), regno)))) freq += EDGE_FREQUENCY (e); } else @@ -2792,8 +2792,8 @@ ira_loop_edge_freq (ira_loop_tree_node_t loop_node, int regno, bool exit_p) auto_vec edges = get_loop_exit_edges (loop_node->loop); FOR_EACH_VEC_ELT (edges, i, e) if (regno < 0 - || (bitmap_bit_p (df_get_live_out (e->src), regno) - && bitmap_bit_p (df_get_live_in (e->dest), regno))) + || (bitmap_bit_p (DF_LIVE_SUBREG_OUT (e->src), regno) + && bitmap_bit_p (DF_LIVE_SUBREG_IN (e->dest), regno))) freq += EDGE_FREQUENCY (e); } diff --git a/gcc/ira-emit.cc b/gcc/ira-emit.cc index bcc4f09f7c4..84ed482e568 100644 --- a/gcc/ira-emit.cc +++ b/gcc/ira-emit.cc @@ -510,8 +510,8 @@ generate_edge_moves (edge e) return; src_map = src_loop_node->regno_allocno_map; dest_map = dest_loop_node->regno_allocno_map; - regs_live_in_dest = df_get_live_in (e->dest); - regs_live_out_src = df_get_live_out (e->src); + regs_live_in_dest = DF_LIVE_SUBREG_IN (e->dest); + regs_live_out_src = DF_LIVE_SUBREG_OUT (e->src); EXECUTE_IF_SET_IN_REG_SET (regs_live_in_dest, FIRST_PSEUDO_REGISTER, regno, bi) if (bitmap_bit_p (regs_live_out_src, regno)) @@ -1229,16 +1229,16 @@ add_ranges_and_copies (void) destination block) to use for searching allocnos by their regnos because of subsequent IR flattening. */ node = IRA_BB_NODE (bb)->parent; - bitmap_copy (live_through, df_get_live_in (bb)); + bitmap_copy (live_through, DF_LIVE_SUBREG_IN (bb)); add_range_and_copies_from_move_list (at_bb_start[bb->index], node, live_through, REG_FREQ_FROM_BB (bb)); - bitmap_copy (live_through, df_get_live_out (bb)); + bitmap_copy (live_through, DF_LIVE_SUBREG_OUT (bb)); add_range_and_copies_from_move_list (at_bb_end[bb->index], node, live_through, REG_FREQ_FROM_BB (bb)); FOR_EACH_EDGE (e, ei, bb->succs) { - bitmap_and (live_through, - df_get_live_in (e->dest), df_get_live_out (bb)); + bitmap_and (live_through, DF_LIVE_SUBREG_IN (e->dest), + DF_LIVE_SUBREG_OUT (bb)); add_range_and_copies_from_move_list ((move_t) e->aux, node, live_through, REG_FREQ_FROM_EDGE_FREQ (EDGE_FREQUENCY (e))); diff --git a/gcc/ira-lives.cc b/gcc/ira-lives.cc index 81af5c06460..05e2be12a26 100644 --- a/gcc/ira-lives.cc +++ b/gcc/ira-lives.cc @@ -1194,7 +1194,8 @@ process_out_of_region_eh_regs (basic_block bb) if (! eh_p) return; - EXECUTE_IF_SET_IN_BITMAP (df_get_live_out (bb), FIRST_PSEUDO_REGISTER, i, bi) + EXECUTE_IF_SET_IN_BITMAP (DF_LIVE_SUBREG_OUT (bb), FIRST_PSEUDO_REGISTER, i, + bi) { ira_allocno_t a = ira_curr_regno_allocno_map[i]; for (int n = ALLOCNO_NUM_OBJECTS (a) - 1; n >= 0; n--) @@ -1228,7 +1229,7 @@ add_conflict_from_region_landing_pads (eh_region region, ira_object_t obj, if ((landing_label = lp->landing_pad) != NULL && (landing_bb = BLOCK_FOR_INSN (landing_label)) != NULL && (region->type != ERT_CLEANUP - || bitmap_bit_p (df_get_live_in (landing_bb), + || bitmap_bit_p (DF_LIVE_SUBREG_IN (landing_bb), ALLOCNO_REGNO (a)))) { HARD_REG_SET new_conflict_regs @@ -1265,7 +1266,7 @@ process_bb_node_lives (ira_loop_tree_node_t loop_tree_node) high_pressure_start_point[ira_pressure_classes[i]] = -1; } curr_bb_node = loop_tree_node; - reg_live_out = df_get_live_out (bb); + reg_live_out = DF_LIVE_SUBREG_OUT (bb); sparseset_clear (objects_live); REG_SET_TO_HARD_REG_SET (hard_regs_live, reg_live_out); hard_regs_live &= ~(eliminable_regset | ira_no_alloc_regs); diff --git a/gcc/ira.cc b/gcc/ira.cc index d7530f01380..c7f27b17002 100644 --- a/gcc/ira.cc +++ b/gcc/ira.cc @@ -4735,8 +4735,8 @@ find_moveable_pseudos (void) bitmap_initialize (local, 0); bitmap_initialize (transp, 0); bitmap_initialize (moveable, 0); - bitmap_copy (live, df_get_live_out (bb)); - bitmap_and_into (live, df_get_live_in (bb)); + bitmap_copy (live, DF_LIVE_SUBREG_OUT (bb)); + bitmap_and_into (live, DF_LIVE_SUBREG_IN (bb)); bitmap_copy (transp, live); bitmap_clear (moveable); bitmap_clear (live); @@ -5036,7 +5036,8 @@ interesting_dest_for_shprep_1 (rtx set, basic_block call_dom) rtx dest = SET_DEST (set); if (!REG_P (src) || !HARD_REGISTER_P (src) || !REG_P (dest) || HARD_REGISTER_P (dest) - || (call_dom && !bitmap_bit_p (df_get_live_in (call_dom), REGNO (dest)))) + || (call_dom + && !bitmap_bit_p (DF_LIVE_SUBREG_IN (call_dom), REGNO (dest)))) return NULL; return dest; } @@ -5514,10 +5515,10 @@ allocate_initial_values (void) /* Update global register liveness information. */ FOR_EACH_BB_FN (bb, cfun) { - if (REGNO_REG_SET_P (df_get_live_in (bb), regno)) - SET_REGNO_REG_SET (df_get_live_in (bb), new_regno); - if (REGNO_REG_SET_P (df_get_live_out (bb), regno)) - SET_REGNO_REG_SET (df_get_live_out (bb), new_regno); + if (REGNO_REG_SET_P (DF_LIVE_SUBREG_IN (bb), regno)) + SET_REGNO_REG_SET (DF_LIVE_SUBREG_IN (bb), new_regno); + if (REGNO_REG_SET_P (DF_LIVE_SUBREG_OUT (bb), regno)) + SET_REGNO_REG_SET (DF_LIVE_SUBREG_OUT (bb), new_regno); } } } @@ -5679,6 +5680,7 @@ ira (FILE *f) if (optimize > 1) df_remove_problem (df_live); gcc_checking_assert (df_live == NULL); + df_live_subreg_add_problem (); if (flag_checking) df->changeable_flags |= DF_VERIFY_SCHEDULED;