From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9829 invoked by alias); 6 Aug 2014 18:05:51 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 9724 invoked by uid 89); 6 Aug 2014 18:05:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (208.118.235.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 06 Aug 2014 18:05:45 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XF4tN-00013U-SL for gcc-patches@gcc.gnu.org; Wed, 06 Aug 2014 13:20:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37569) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XF4tN-00013K-Hl for gcc-patches@gcc.gnu.org; Wed, 06 Aug 2014 13:20:49 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s76HJnqb028784 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 6 Aug 2014 13:19:49 -0400 Received: from c64.redhat.com (vpn-239-139.phx2.redhat.com [10.3.239.139]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s76HJ2ot030913; Wed, 6 Aug 2014 13:19:48 -0400 From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [PATCH 079/236] gcse.c: Use rtx_insn Date: Wed, 06 Aug 2014 18:05:00 -0000 Message-Id: <1407345815-14551-80-git-send-email-dmalcolm@redhat.com> In-Reply-To: <1407345815-14551-1-git-send-email-dmalcolm@redhat.com> References: <1407345815-14551-1-git-send-email-dmalcolm@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 X-IsSubscribed: yes X-SW-Source: 2014-08/txt/msg00726.txt.bz2 gcc/ * gcse.c (struct occr): Strengthen field "insn" from rtx to rtx_insn *. (test_insn): Likewise for this global. (oprs_unchanged_p): Strengthen param "insn" from const_rtx to const rtx_insn *. (oprs_anticipatable_p): Likewise. (oprs_available_p): Likewise. (insert_expr_in_table): Strengthen param "insn" from rtx to rtx_insn *. (hash_scan_set): Likewise. (hash_scan_clobber): Likewise. (hash_scan_call): Likewise. (hash_scan_insn): Likewise. (compute_hash_table_work): Likewise for local "insn". (process_insert_insn): Likewise for return type and local "pat". (insert_insn_end_basic_block): Likewise for locals "new_insn", "pat", "pat_end", "maybe_cc0_setter". (pre_edge_insert): Likewise for local "insn". (pre_insert_copy_insn): Likewise for param "insn". (pre_insert_copies): Likewise for local "insn". (struct set_data): Likewise for field "insn". (single_set_gcse): Likewise for param "insn". (gcse_emit_move_after): Likewise. (pre_delete): Likewise for local "insn". (update_bb_reg_pressure): Likewise for param "from" and local "insn". (should_hoist_expr_to_dom): Likewise for param "from". (hoist_code): Likewise for local "insn". (get_pressure_class_and_nregs): Likewise for param "insn". (calculate_bb_reg_pressure): Likewise for local "insn". (compute_ld_motion_mems): Likewise. --- gcc/gcse.c | 92 ++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 47 insertions(+), 45 deletions(-) diff --git a/gcc/gcse.c b/gcc/gcse.c index 163a529..0889e45 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -296,7 +296,7 @@ struct occr /* Next occurrence of this expression. */ struct occr *next; /* The insn that computes the expression. */ - rtx insn; + rtx_insn *insn; /* Nonzero if this [anticipatable] occurrence has been deleted. */ char deleted_p; /* Nonzero if this [available] occurrence has been copied to @@ -462,16 +462,16 @@ static void *gcalloc (size_t, size_t) ATTRIBUTE_MALLOC; static void *gcse_alloc (unsigned long); static void alloc_gcse_mem (void); static void free_gcse_mem (void); -static void hash_scan_insn (rtx, struct hash_table_d *); -static void hash_scan_set (rtx, rtx, struct hash_table_d *); -static void hash_scan_clobber (rtx, rtx, struct hash_table_d *); -static void hash_scan_call (rtx, rtx, struct hash_table_d *); +static void hash_scan_insn (rtx_insn *, struct hash_table_d *); +static void hash_scan_set (rtx, rtx_insn *, struct hash_table_d *); +static void hash_scan_clobber (rtx, rtx_insn *, struct hash_table_d *); +static void hash_scan_call (rtx, rtx_insn *, struct hash_table_d *); static int want_to_gcse_p (rtx, int *); -static int oprs_unchanged_p (const_rtx, const_rtx, int); -static int oprs_anticipatable_p (const_rtx, const_rtx); -static int oprs_available_p (const_rtx, const_rtx); -static void insert_expr_in_table (rtx, enum machine_mode, rtx, int, int, int, - struct hash_table_d *); +static int oprs_unchanged_p (const_rtx, const rtx_insn *, int); +static int oprs_anticipatable_p (const_rtx, const rtx_insn *); +static int oprs_available_p (const_rtx, const rtx_insn *); +static void insert_expr_in_table (rtx, enum machine_mode, rtx_insn *, int, int, + int, struct hash_table_d *); static unsigned int hash_expr (const_rtx, enum machine_mode, int *, int); static void record_last_reg_set_info (rtx, int); static void record_last_mem_set_info (rtx); @@ -493,7 +493,7 @@ static struct edge_list *compute_pre_data (void); static int pre_expr_reaches_here_p (basic_block, struct expr *, basic_block); static void insert_insn_end_basic_block (struct expr *, basic_block); -static void pre_insert_copy_insn (struct expr *, rtx); +static void pre_insert_copy_insn (struct expr *, rtx_insn *); static void pre_insert_copies (void); static int pre_delete (void); static int pre_gcse (struct edge_list *); @@ -505,12 +505,12 @@ static void compute_code_hoist_vbeinout (void); static void compute_code_hoist_data (void); static int should_hoist_expr_to_dom (basic_block, struct expr *, basic_block, sbitmap, int, int *, enum reg_class, - int *, bitmap, rtx); + int *, bitmap, rtx_insn *); static int hoist_code (void); static enum reg_class get_regno_pressure_class (int regno, int *nregs); -static enum reg_class get_pressure_class_and_nregs (rtx insn, int *nregs); +static enum reg_class get_pressure_class_and_nregs (rtx_insn *insn, int *nregs); static int one_code_hoisting_pass (void); -static rtx process_insert_insn (struct expr *); +static rtx_insn *process_insert_insn (struct expr *); static int pre_edge_insert (struct edge_list *, struct expr **); static int pre_expr_reaches_here_p_work (basic_block, struct expr *, basic_block, char *); @@ -526,7 +526,7 @@ static void trim_ld_motion_mems (void); static void update_ld_motion_stores (struct expr *); static void clear_modify_mem_tables (void); static void free_modify_mem_tables (void); -static rtx gcse_emit_move_after (rtx, rtx, rtx); +static rtx gcse_emit_move_after (rtx, rtx, rtx_insn *); static bool is_too_expensive (const char *); #define GNEW(T) ((T *) gmalloc (sizeof (T))) @@ -830,7 +830,7 @@ want_to_gcse_p (rtx x, int *max_distance_ptr) /* Used internally by can_assign_to_reg_without_clobbers_p. */ -static GTY(()) rtx test_insn; +static GTY(()) rtx_insn *test_insn; /* Return true if we can assign X to a pseudo register such that the resulting insn does not result in clobbering a hard register as a @@ -891,7 +891,7 @@ can_assign_to_reg_without_clobbers_p (rtx x) or from INSN to the end of INSN's basic block (if AVAIL_P != 0). */ static int -oprs_unchanged_p (const_rtx x, const_rtx insn, int avail_p) +oprs_unchanged_p (const_rtx x, const rtx_insn *insn, int avail_p) { int i, j; enum rtx_code code; @@ -1066,7 +1066,7 @@ load_killed_in_block_p (const_basic_block bb, int uid_limit, const_rtx x, the start of INSN's basic block up to but not including INSN. */ static int -oprs_anticipatable_p (const_rtx x, const_rtx insn) +oprs_anticipatable_p (const_rtx x, const rtx_insn *insn) { return oprs_unchanged_p (x, insn, 0); } @@ -1075,7 +1075,7 @@ oprs_anticipatable_p (const_rtx x, const_rtx insn) INSN to the end of INSN's basic block. */ static int -oprs_available_p (const_rtx x, const_rtx insn) +oprs_available_p (const_rtx x, const rtx_insn *insn) { return oprs_unchanged_p (x, insn, 1); } @@ -1121,7 +1121,8 @@ expr_equiv_p (const_rtx x, const_rtx y) be moved. */ static void -insert_expr_in_table (rtx x, enum machine_mode mode, rtx insn, int antic_p, +insert_expr_in_table (rtx x, enum machine_mode mode, rtx_insn *insn, + int antic_p, int avail_p, int max_distance, struct hash_table_d *table) { int found, do_not_record_p; @@ -1226,7 +1227,7 @@ insert_expr_in_table (rtx x, enum machine_mode mode, rtx insn, int antic_p, /* Scan SET present in INSN and add an entry to the hash TABLE. */ static void -hash_scan_set (rtx set, rtx insn, struct hash_table_d *table) +hash_scan_set (rtx set, rtx_insn *insn, struct hash_table_d *table) { rtx src = SET_SRC (set); rtx dest = SET_DEST (set); @@ -1345,14 +1346,14 @@ hash_scan_set (rtx set, rtx insn, struct hash_table_d *table) } static void -hash_scan_clobber (rtx x ATTRIBUTE_UNUSED, rtx insn ATTRIBUTE_UNUSED, +hash_scan_clobber (rtx x ATTRIBUTE_UNUSED, rtx_insn *insn ATTRIBUTE_UNUSED, struct hash_table_d *table ATTRIBUTE_UNUSED) { /* Currently nothing to do. */ } static void -hash_scan_call (rtx x ATTRIBUTE_UNUSED, rtx insn ATTRIBUTE_UNUSED, +hash_scan_call (rtx x ATTRIBUTE_UNUSED, rtx_insn *insn ATTRIBUTE_UNUSED, struct hash_table_d *table ATTRIBUTE_UNUSED) { /* Currently nothing to do. */ @@ -1361,7 +1362,7 @@ hash_scan_call (rtx x ATTRIBUTE_UNUSED, rtx insn ATTRIBUTE_UNUSED, /* Process INSN and add hash table entries as appropriate. */ static void -hash_scan_insn (rtx insn, struct hash_table_d *table) +hash_scan_insn (rtx_insn *insn, struct hash_table_d *table) { rtx pat = PATTERN (insn); int i; @@ -1561,7 +1562,7 @@ compute_hash_table_work (struct hash_table_d *table) FOR_EACH_BB_FN (current_bb, cfun) { - rtx insn; + rtx_insn *insn; unsigned int regno; /* First pass over the instructions records information used to @@ -2117,13 +2118,13 @@ pre_expr_reaches_here_p (basic_block occr_bb, struct expr *expr, basic_block bb) /* Generate RTL to copy an EXPR to its `reaching_reg' and return it. */ -static rtx +static rtx_insn * process_insert_insn (struct expr *expr) { rtx reg = expr->reaching_reg; /* Copy the expression to make sure we don't have any sharing issues. */ rtx exp = copy_rtx (expr->expr); - rtx pat; + rtx_insn *pat; start_sequence (); @@ -2156,10 +2157,10 @@ static void insert_insn_end_basic_block (struct expr *expr, basic_block bb) { rtx insn = BB_END (bb); - rtx new_insn; + rtx_insn *new_insn; rtx reg = expr->reaching_reg; int regno = REGNO (reg); - rtx pat, pat_end; + rtx_insn *pat, *pat_end; pat = process_insert_insn (expr); gcc_assert (pat && INSN_P (pat)); @@ -2185,7 +2186,7 @@ insert_insn_end_basic_block (struct expr *expr, basic_block bb) insn = XEXP (note, 0); else { - rtx maybe_cc0_setter = prev_nonnote_insn (insn); + rtx_insn *maybe_cc0_setter = prev_nonnote_insn (insn); if (maybe_cc0_setter && INSN_P (maybe_cc0_setter) && sets_cc0_p (PATTERN (maybe_cc0_setter))) @@ -2293,7 +2294,7 @@ pre_edge_insert (struct edge_list *edge_list, struct expr **index_map) reach the deleted occurrence in BB. */ if (!bitmap_bit_p (inserted[e], j)) { - rtx insn; + rtx_insn *insn; edge eg = INDEX_EDGE (edge_list, e); /* We can't insert anything on an abnormal and @@ -2350,7 +2351,7 @@ pre_edge_insert (struct edge_list *edge_list, struct expr **index_map) MEM <- reaching_reg. */ static void -pre_insert_copy_insn (struct expr *expr, rtx insn) +pre_insert_copy_insn (struct expr *expr, rtx_insn *insn) { rtx reg = expr->reaching_reg; int regno = REGNO (reg); @@ -2473,7 +2474,7 @@ pre_insert_copies (void) for (avail = expr->avail_occr; avail != NULL; avail = avail->next) { - rtx insn = avail->insn; + rtx_insn *insn = avail->insn; /* No need to handle this one if handled already. */ if (avail->copied_p) @@ -2504,7 +2505,7 @@ pre_insert_copies (void) struct set_data { - rtx insn; + rtx_insn *insn; const_rtx set; int nsets; }; @@ -2540,7 +2541,7 @@ record_set_data (rtx dest, const_rtx set, void *data) } static const_rtx -single_set_gcse (rtx insn) +single_set_gcse (rtx_insn *insn) { struct set_data s; rtx pattern; @@ -2565,7 +2566,7 @@ single_set_gcse (rtx insn) in INSN. */ static rtx -gcse_emit_move_after (rtx dest, rtx src, rtx insn) +gcse_emit_move_after (rtx dest, rtx src, rtx_insn *insn) { rtx new_rtx; const_rtx set = single_set_gcse (insn); @@ -2620,7 +2621,7 @@ pre_delete (void) /* We only need to search antic_occr since we require ANTLOC != 0. */ for (occr = expr->antic_occr; occr != NULL; occr = occr->next) { - rtx insn = occr->insn; + rtx_insn *insn = occr->insn; rtx set; basic_block bb = BLOCK_FOR_INSN (insn); @@ -2952,9 +2953,10 @@ compute_code_hoist_data (void) NOTE: Register pressure won't be increased in this function. */ static int -update_bb_reg_pressure (basic_block bb, rtx from) +update_bb_reg_pressure (basic_block bb, rtx_insn *from) { - rtx dreg, insn; + rtx dreg; + rtx_insn *insn; basic_block succ_bb; df_ref *op, op_ref; edge succ; @@ -3038,7 +3040,7 @@ static int should_hoist_expr_to_dom (basic_block expr_bb, struct expr *expr, basic_block bb, sbitmap visited, int distance, int *bb_size, enum reg_class pressure_class, - int *nregs, bitmap hoisted_bbs, rtx from) + int *nregs, bitmap hoisted_bbs, rtx_insn *from) { unsigned int i; edge pred; @@ -3234,7 +3236,7 @@ hoist_code (void) FOR_EACH_BB_FN (bb, cfun) { - rtx insn; + rtx_insn *insn; int to_head; to_head = 0; @@ -3428,7 +3430,7 @@ hoist_code (void) to hoist to BB and make the transformations. */ FOR_EACH_VEC_ELT (occrs_to_hoist, j, occr) { - rtx insn; + rtx_insn *insn; const_rtx set; gcc_assert (!occr->deleted_p); @@ -3511,7 +3513,7 @@ get_regno_pressure_class (int regno, int *nregs) /* Return pressure class and number of hard registers (through *NREGS) for destination of INSN. */ static enum reg_class -get_pressure_class_and_nregs (rtx insn, int *nregs) +get_pressure_class_and_nregs (rtx_insn *insn, int *nregs) { rtx reg; enum reg_class pressure_class; @@ -3564,7 +3566,7 @@ calculate_bb_reg_pressure (void) { int i; unsigned int j; - rtx insn; + rtx_insn *insn; basic_block bb; bitmap curr_regs_live; bitmap_iterator bi; @@ -3943,7 +3945,7 @@ compute_ld_motion_mems (void) { struct ls_expr * ptr; basic_block bb; - rtx insn; + rtx_insn *insn; pre_ldst_mems = NULL; pre_ldst_table.create (13); -- 1.8.5.3