From patchwork Thu Sep 3 05:26:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tbsaunde+gcc@tbsaunde.org X-Patchwork-Id: 513831 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 4330A140273 for ; Thu, 3 Sep 2015 15:27:25 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=fQQX/Ypi; dkim-atps=neutral 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:date:message-id:in-reply-to:references; q=dns; s= default; b=wQ4VnZVp0CytHAZkmpObXh/6qSa22LVAOtXR+lLlA3fZZkLz2/CF2 gwBKT4ETRdQjSGNFh6BwAOoadMOoe+63pDPMQv7TOTC02UXRmcdhm1MS54rQbPtF YNuU0aD0JRi1tI9Y0yAcBYKp6u5h9HsDJEl4y5gB8RSqvI6I2sEIjY= 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:date:message-id:in-reply-to:references; s=default; bh=w/szpJcpYSCojv902OzV5ikmocU=; b=fQQX/Ypi2Pe7z/6eU1QVlq8CEyYC 2fB/J+Q0RLbbxUpHbwqcbdq6/+4fjjCm61sTugn6n31xBCPelpIk7MnAga+pdpSL IWwo2XAZgZJ/XBWfU+wa9ehLHPB/NgAHeLXhwk8yPFFSumqQw/ca7I8Q7wicofIc PaUaEoqp/0FNGSY= Received: (qmail 90246 invoked by alias); 3 Sep 2015 05:26:55 -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 90090 invoked by uid 89); 3 Sep 2015 05:26:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.7 required=5.0 tests=AWL, BAYES_50, KAM_LAZY_DOMAIN_SECURITY, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: paperclip.tbsaunde.org Received: from tbsaunde.org (HELO paperclip.tbsaunde.org) (66.228.47.254) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 03 Sep 2015 05:26:52 +0000 Received: from iceball.corp.tor1.mozilla.com (unknown [66.207.208.102]) by paperclip.tbsaunde.org (Postfix) with ESMTPSA id 14551C0B6 for ; Thu, 3 Sep 2015 05:26:51 +0000 (UTC) From: tbsaunde+gcc@tbsaunde.org To: gcc-patches@gcc.gnu.org Subject: [PATCH 02/10] dse.c: remove some typedefs that hide pointerness Date: Thu, 3 Sep 2015 01:26:38 -0400 Message-Id: <1441258006-10575-3-git-send-email-tbsaunde+gcc@tbsaunde.org> In-Reply-To: <1441258006-10575-1-git-send-email-tbsaunde+gcc@tbsaunde.org> References: <1441258006-10575-1-git-send-email-tbsaunde+gcc@tbsaunde.org> X-IsSubscribed: yes From: Trevor Saunders gcc/ChangeLog: 2015-09-02 Trevor Saunders * dse.c (store_info_t): Remove typedef. (group_info_t): Likewise. (const_group_info_t): Likewise. (deferred_change_t): Likewise. (get_group_info): Adjust. (free_store_info): Likewise. (canon_address): Likewise. (clear_rhs_from_active_local_stores): Likewise. (record_store): Likewise. (replace_read): Likewise. (check_mem_read_rtx): Likewise. (scan_insn): Likewise. (remove_useless_values): Likewise. (dse_step1): Likewise. (dse_step2_init): Likewise. (dse_step2_nospill): Likewise. (scan_stores_nospill): Likewise. (scan_reads_nospill): Likewise. (dse_step3_exit_block_scan): Likewise. (dse_step3): Likewise. (dse_step5_nospill): Likewise. (dse_step6): Likewise. --- gcc/dse.c | 115 ++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 55 insertions(+), 60 deletions(-) diff --git a/gcc/dse.c b/gcc/dse.c index 780379a..0634d9d 100644 --- a/gcc/dse.c +++ b/gcc/dse.c @@ -307,7 +307,6 @@ lowpart_bitmask (int n) return mask >> (HOST_BITS_PER_WIDE_INT - n); } -typedef struct store_info *store_info_t; static object_allocator cse_store_info_pool ("cse_store_info_pool", 100); @@ -400,7 +399,7 @@ struct insn_info_type But it could also contain clobbers. Insns that contain more than one mem set are not deletable, but each of those mems are here in order to provide info to delete other insns. */ - store_info_t store_rec; + store_info *store_rec; /* The linked list of mem uses in this insn. Only the reads from rtx bases are listed here. The reads to cselib bases are @@ -564,8 +563,6 @@ struct group_info int *offset_map_n, *offset_map_p; int offset_map_size_n, offset_map_size_p; }; -typedef struct group_info *group_info_t; -typedef const struct group_info *const_group_info_t; static object_allocator group_info_pool ("rtx_group_info_pool", 100); @@ -574,7 +571,7 @@ static object_allocator group_info_pool static int rtx_group_next_id; -static vec rtx_group_vec; +static vec rtx_group_vec; /* This structure holds the set of changes that are being deferred @@ -591,15 +588,13 @@ struct deferred_change struct deferred_change *next; }; -typedef struct deferred_change *deferred_change_t; - static object_allocator deferred_change_pool ("deferred_change_pool", 10); -static deferred_change_t deferred_change_list = NULL; +static deferred_change *deferred_change_list = NULL; /* The group that holds all of the clear_alias_sets. */ -static group_info_t clear_alias_group; +static group_info *clear_alias_group; /* The modes of the clear_alias_sets. */ static htab_t clear_alias_mode_table; @@ -680,11 +675,11 @@ static hash_table *rtx_group_table; /* Get the GROUP for BASE. Add a new group if it is not there. */ -static group_info_t +static group_info * get_group_info (rtx base) { struct group_info tmp_gi; - group_info_t gi; + group_info *gi; group_info **slot; if (base) @@ -693,7 +688,7 @@ get_group_info (rtx base) if necessary. */ tmp_gi.rtx_base = base; slot = rtx_group_table->find_slot (&tmp_gi, INSERT); - gi = (group_info_t) *slot; + gi = *slot; } else { @@ -790,17 +785,17 @@ dse_step0 (void) static void free_store_info (insn_info_t insn_info) { - store_info_t store_info = insn_info->store_rec; - while (store_info) + store_info *cur = insn_info->store_rec; + while (cur) { - store_info_t next = store_info->next; - if (store_info->is_large) - BITMAP_FREE (store_info->positions_needed.large.bmap); - if (store_info->cse_base) - cse_store_info_pool.remove (store_info); + store_info *next = cur->next; + if (cur->is_large) + BITMAP_FREE (cur->positions_needed.large.bmap); + if (cur->cse_base) + cse_store_info_pool.remove (cur); else - rtx_store_info_pool.remove (store_info); - store_info = next; + rtx_store_info_pool.remove (cur); + cur = next; } insn_info->cannot_delete = true; @@ -1015,7 +1010,7 @@ can_escape (tree expr) OFFSET and WIDTH. */ static void -set_usage_bits (group_info_t group, HOST_WIDE_INT offset, HOST_WIDE_INT width, +set_usage_bits (group_info *group, HOST_WIDE_INT offset, HOST_WIDE_INT width, tree expr) { HOST_WIDE_INT i; @@ -1240,7 +1235,7 @@ canon_address (rtx mem, if (ADDR_SPACE_GENERIC_P (MEM_ADDR_SPACE (mem)) && const_or_frame_p (address)) { - group_info_t group = get_group_info (address); + group_info *group = get_group_info (address); if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, " gid=%d offset=%d \n", @@ -1276,7 +1271,7 @@ clear_rhs_from_active_local_stores (void) while (ptr) { - store_info_t store_info = ptr->store_rec; + store_info *store_info = ptr->store_rec; /* Skip the clobbers. */ while (!store_info->is_set) store_info = store_info->next; @@ -1292,7 +1287,7 @@ clear_rhs_from_active_local_stores (void) /* Mark byte POS bytes from the beginning of store S_INFO as unneeded. */ static inline void -set_position_unneeded (store_info_t s_info, int pos) +set_position_unneeded (store_info *s_info, int pos) { if (__builtin_expect (s_info->is_large, false)) { @@ -1307,7 +1302,7 @@ set_position_unneeded (store_info_t s_info, int pos) /* Mark the whole store S_INFO as unneeded. */ static inline void -set_all_positions_unneeded (store_info_t s_info) +set_all_positions_unneeded (store_info *s_info) { if (__builtin_expect (s_info->is_large, false)) { @@ -1323,7 +1318,7 @@ set_all_positions_unneeded (store_info_t s_info) /* Return TRUE if any bytes from S_INFO store are needed. */ static inline bool -any_positions_needed_p (store_info_t s_info) +any_positions_needed_p (store_info *s_info) { if (__builtin_expect (s_info->is_large, false)) return (s_info->positions_needed.large.count @@ -1337,7 +1332,7 @@ any_positions_needed_p (store_info_t s_info) store are needed. */ static inline bool -all_positions_needed_p (store_info_t s_info, int start, int width) +all_positions_needed_p (store_info *s_info, int start, int width) { if (__builtin_expect (s_info->is_large, false)) { @@ -1355,7 +1350,7 @@ all_positions_needed_p (store_info_t s_info, int start, int width) } -static rtx get_stored_val (store_info_t, machine_mode, HOST_WIDE_INT, +static rtx get_stored_val (store_info *, machine_mode, HOST_WIDE_INT, HOST_WIDE_INT, basic_block, bool); @@ -1371,7 +1366,7 @@ record_store (rtx body, bb_info_t bb_info) HOST_WIDE_INT width = 0; alias_set_type spill_alias_set; insn_info_t insn_info = bb_info->last_insn; - store_info_t store_info = NULL; + store_info *store_info = NULL; int group_id; cselib_val *base = NULL; insn_info_t ptr, last, redundant_reason; @@ -1467,7 +1462,7 @@ record_store (rtx body, bb_info_t bb_info) /* In the restrictive case where the base is a constant or the frame pointer we can do global analysis. */ - group_info_t group + group_info *group = rtx_group_vec[group_id]; tree expr = MEM_EXPR (mem); @@ -1537,7 +1532,7 @@ record_store (rtx body, bb_info_t bb_info) mem_addr = base->val_rtx; else { - group_info_t group + group_info *group = rtx_group_vec[group_id]; mem_addr = group->canon_base_addr; } @@ -1552,7 +1547,7 @@ record_store (rtx body, bb_info_t bb_info) while (ptr) { insn_info_t next = ptr->next_local_store; - store_info_t s_info = ptr->store_rec; + struct store_info *s_info = ptr->store_rec; bool del = true; /* Skip the clobbers. We delete the active insn if this insn @@ -1722,7 +1717,7 @@ dump_insn_info (const char * start, insn_info_t insn_info) static rtx find_shift_sequence (int access_size, - store_info_t store_info, + store_info *store_info, machine_mode read_mode, int shift, bool speed, bool require_cst) { @@ -1854,7 +1849,7 @@ look_for_hardregs (rtx x, const_rtx pat ATTRIBUTE_UNUSED, void *data) if not successful. If REQUIRE_CST is true, return always constant. */ static rtx -get_stored_val (store_info_t store_info, machine_mode read_mode, +get_stored_val (store_info *store_info, machine_mode read_mode, HOST_WIDE_INT read_begin, HOST_WIDE_INT read_end, basic_block bb, bool require_cst) { @@ -1954,7 +1949,7 @@ get_stored_val (store_info_t store_info, machine_mode read_mode, went ok. */ static bool -replace_read (store_info_t store_info, insn_info_t store_insn, +replace_read (store_info *store_info, insn_info_t store_insn, read_info_t read_info, insn_info_t read_insn, rtx *loc, bitmap regs_live) { @@ -2029,7 +2024,7 @@ replace_read (store_info_t store_info, insn_info_t store_insn, if (validate_change (read_insn->insn, loc, read_reg, 0)) { - deferred_change_t change = deferred_change_pool.allocate (); + deferred_change *change = deferred_change_pool.allocate (); /* Insert this right before the store insn where it will be safe from later insns that might change it before the read. */ @@ -2150,7 +2145,7 @@ check_mem_read_rtx (rtx *loc, bb_info_t bb_info) mem_addr = base->val_rtx; else { - group_info_t group + group_info *group = rtx_group_vec[group_id]; mem_addr = group->canon_base_addr; } @@ -2176,7 +2171,7 @@ check_mem_read_rtx (rtx *loc, bb_info_t bb_info) while (i_ptr) { - store_info_t store_info = i_ptr->store_rec; + store_info *store_info = i_ptr->store_rec; /* Skip the clobbers. */ while (!store_info->is_set) @@ -2218,7 +2213,7 @@ check_mem_read_rtx (rtx *loc, bb_info_t bb_info) while (i_ptr) { bool remove = false; - store_info_t store_info = i_ptr->store_rec; + store_info *store_info = i_ptr->store_rec; /* Skip the clobbers. */ while (!store_info->is_set) @@ -2302,7 +2297,7 @@ check_mem_read_rtx (rtx *loc, bb_info_t bb_info) while (i_ptr) { bool remove = false; - store_info_t store_info = i_ptr->store_rec; + store_info *store_info = i_ptr->store_rec; if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, " processing cselib load against insn %d\n", @@ -2532,7 +2527,7 @@ scan_insn (bb_info_t bb_info, rtx_insn *insn) /* If the frame is read, the frame related stores are killed. */ else if (insn_info->frame_read) { - store_info_t store_info = i_ptr->store_rec; + store_info *store_info = i_ptr->store_rec; /* Skip the clobbers. */ while (!store_info->is_set) @@ -2659,7 +2654,7 @@ remove_useless_values (cselib_val *base) while (insn_info) { - store_info_t store_info = insn_info->store_rec; + store_info *store_info = insn_info->store_rec; bool del = false; /* If ANY of the store_infos match the cselib group that is @@ -2756,7 +2751,7 @@ dse_step1 (void) insn_info_t i_ptr = active_local_stores; while (i_ptr) { - store_info_t store_info = i_ptr->store_rec; + store_info *store_info = i_ptr->store_rec; /* Skip the clobbers. */ while (!store_info->is_set) @@ -2766,7 +2761,7 @@ dse_step1 (void) else if (store_info->group_id >= 0) { - group_info_t group + group_info *group = rtx_group_vec[store_info->group_id]; if (group->frame_related && !i_ptr->cannot_delete) delete_dead_store_insn (i_ptr); @@ -2780,7 +2775,7 @@ dse_step1 (void) replace_read. Cselib is finished with this block. */ while (deferred_change_list) { - deferred_change_t next = deferred_change_list->next; + deferred_change *next = deferred_change_list->next; /* There is no reason to validate this change. That was done earlier. */ @@ -2797,7 +2792,7 @@ dse_step1 (void) { if (ptr->contains_cselib_groups) { - store_info_t s_info = ptr->store_rec; + store_info *s_info = ptr->store_rec; while (s_info && !s_info->is_set) s_info = s_info->next; if (s_info @@ -2818,7 +2813,7 @@ dse_step1 (void) } else { - store_info_t s_info; + store_info *s_info; /* Free at least positions_needed bitmaps. */ for (s_info = ptr->store_rec; s_info; s_info = s_info->next) @@ -2854,7 +2849,7 @@ static void dse_step2_init (void) { unsigned int i; - group_info_t group; + group_info *group; FOR_EACH_VEC_ELT (rtx_group_vec, i, group) { @@ -2905,7 +2900,7 @@ static bool dse_step2_nospill (void) { unsigned int i; - group_info_t group; + group_info *group; /* Position 0 is unused because 0 is used in the maps to mean unused. */ current_position = 1; @@ -2954,7 +2949,7 @@ dse_step2_nospill (void) there, return 0. */ static int -get_bitmap_index (group_info_t group_info, HOST_WIDE_INT offset) +get_bitmap_index (group_info *group_info, HOST_WIDE_INT offset) { if (offset < 0) { @@ -2976,12 +2971,12 @@ get_bitmap_index (group_info_t group_info, HOST_WIDE_INT offset) may be NULL. */ static void -scan_stores_nospill (store_info_t store_info, bitmap gen, bitmap kill) +scan_stores_nospill (store_info *store_info, bitmap gen, bitmap kill) { while (store_info) { HOST_WIDE_INT i; - group_info_t group_info + group_info *group_info = rtx_group_vec[store_info->group_id]; if (group_info->process_globally) for (i = store_info->begin; i < store_info->end; i++) @@ -3003,7 +2998,7 @@ scan_stores_nospill (store_info_t store_info, bitmap gen, bitmap kill) may be NULL. */ static void -scan_stores_spill (store_info_t store_info, bitmap gen, bitmap kill) +scan_stores_spill (store_info *store_info, bitmap gen, bitmap kill) { while (store_info) { @@ -3031,7 +3026,7 @@ scan_reads_nospill (insn_info_t insn_info, bitmap gen, bitmap kill) { read_info_t read_info = insn_info->read_rec; int i; - group_info_t group; + group_info *group; /* If this insn reads the frame, kill all the frame related stores. */ if (insn_info->frame_read) @@ -3239,7 +3234,7 @@ dse_step3_exit_block_scan (bb_info_t bb_info) if (stores_off_frame_dead_at_return) { unsigned int i; - group_info_t group; + group_info *group; FOR_EACH_VEC_ELT (rtx_group_vec, i, group) { @@ -3320,7 +3315,7 @@ dse_step3 (bool for_spills) if (!all_ones) { unsigned int j; - group_info_t group; + group_info *group; all_ones = BITMAP_ALLOC (&dse_bitmap_obstack); FOR_EACH_VEC_ELT (rtx_group_vec, j, group) @@ -3524,7 +3519,7 @@ dse_step5_nospill (void) && (!insn_info->cannot_delete) && (!bitmap_empty_p (v))) { - store_info_t store_info = insn_info->store_rec; + store_info *store_info = insn_info->store_rec; /* Try to delete the current insn. */ deleted = true; @@ -3538,7 +3533,7 @@ dse_step5_nospill (void) else { HOST_WIDE_INT i; - group_info_t group_info + group_info *group_info = rtx_group_vec[store_info->group_id]; for (i = store_info->begin; i < store_info->end; i++) @@ -3624,7 +3619,7 @@ dse_step6 (void) && INSN_P (insn_info->insn) && !insn_info->cannot_delete) { - store_info_t s_info = insn_info->store_rec; + store_info *s_info = insn_info->store_rec; while (s_info && !s_info->is_set) s_info = s_info->next;