From 2d5b3f6e54c8439baf3123ab9cb24946e59e7032 Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Sun, 13 Sep 2015 16:54:15 +0000 Subject: [PATCH] bt-load.c: remove typedefs that hide pointerness gcc/ChangeLog: 2015-09-13 Trevor Saunders * bt-load.c (struct btr_def_group): Rename from btr_def_group_s. (struct btr_user): Rename from btr_user_s. (struct btr_def): Rename from btr_def_s. (find_btr_def_group): Adjust. (add_btr_def): Likewise. (new_btr_user): Likewise. (note_other_use_this_block): Likewise. (compute_defs_uses_and_gen): Likewise. (link_btr_uses): Likewise. (build_btr_def_use_webs): Likewise. (block_at_edge_of_live_range_p): Likewise. (btr_def_live_range): Likewise. (combine_btr_defs): Likewise. (move_btr_def): Likewise. (migrate_btr_def): Likewise. (migrate_btr_defs): Likewise. From-SVN: r227722 --- gcc/ChangeLog | 19 +++++++ gcc/bt-load.c | 140 +++++++++++++++++++++++++------------------------- 2 files changed, 90 insertions(+), 69 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 031717dd9a0..dec1c70abf4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,22 @@ +2015-09-13 Trevor Saunders + + * bt-load.c (struct btr_def_group): Rename from btr_def_group_s. + (struct btr_user): Rename from btr_user_s. + (struct btr_def): Rename from btr_def_s. + (find_btr_def_group): Adjust. + (add_btr_def): Likewise. + (new_btr_user): Likewise. + (note_other_use_this_block): Likewise. + (compute_defs_uses_and_gen): Likewise. + (link_btr_uses): Likewise. + (build_btr_def_use_webs): Likewise. + (block_at_edge_of_live_range_p): Likewise. + (btr_def_live_range): Likewise. + (combine_btr_defs): Likewise. + (move_btr_def): Likewise. + (migrate_btr_def): Likewise. + (migrate_btr_defs): Likewise. + 2015-09-13 Trevor Saunders * var-tracking.c (shared_hash_def): Rename to shared_hash. diff --git a/gcc/bt-load.c b/gcc/bt-load.c index 5d8b752bd2c..9b1d366bf00 100644 --- a/gcc/bt-load.c +++ b/gcc/bt-load.c @@ -51,18 +51,20 @@ along with GCC; see the file COPYING3. If not see #include "rtl-iter.h" #include "fibonacci_heap.h" +struct btr_def; + /* Target register optimizations - these are performed after reload. */ -typedef struct btr_def_group_s +struct btr_def_group { - struct btr_def_group_s *next; + btr_def_group *next; rtx src; - struct btr_def_s *members; -} *btr_def_group; + btr_def *members; +}; -typedef struct btr_user_s +struct btr_user { - struct btr_user_s *next; + btr_user *next; basic_block bb; int luid; rtx_insn *insn; @@ -74,7 +76,7 @@ typedef struct btr_user_s int n_reaching_defs; int first_reaching_def; char other_use_this_block; -} *btr_user; +}; /* btr_def structs appear on three lists: 1. A list of all btr_def structures (head is @@ -85,10 +87,10 @@ typedef struct btr_user_s group (head is in a BTR_DEF_GROUP struct, linked by NEXT_THIS_GROUP field). */ -typedef struct btr_def_s +struct btr_def { - struct btr_def_s *next_this_bb; - struct btr_def_s *next_this_group; + btr_def *next_this_bb; + btr_def *next_this_group; basic_block bb; int luid; rtx_insn *insn; @@ -98,8 +100,8 @@ typedef struct btr_def_s source (i.e. a label), group links together all the insns with the same source. For other branch register setting insns, group is NULL. */ - btr_def_group group; - btr_user uses; + btr_def_group *group; + btr_user *uses; /* If this def has a reaching use which is not a simple use in a branch instruction, then has_ambiguous_use will be true, and we will not attempt to migrate this definition. */ @@ -119,38 +121,38 @@ typedef struct btr_def_s to clear out trs_live_at_end again. */ char own_end; bitmap live_range; -} *btr_def; +}; -typedef fibonacci_heap btr_heap_t; -typedef fibonacci_node btr_heap_node_t; +typedef fibonacci_heap btr_heap_t; +typedef fibonacci_node btr_heap_node_t; static int issue_rate; static int basic_block_freq (const_basic_block); static int insn_sets_btr_p (const rtx_insn *, int, int *); -static void find_btr_def_group (btr_def_group *, btr_def); -static btr_def add_btr_def (btr_heap_t *, basic_block, int, rtx_insn *, - unsigned int, int, btr_def_group *); -static btr_user new_btr_user (basic_block, int, rtx_insn *); +static void find_btr_def_group (btr_def_group **, btr_def *); +static btr_def *add_btr_def (btr_heap_t *, basic_block, int, rtx_insn *, + unsigned int, int, btr_def_group **); +static btr_user *new_btr_user (basic_block, int, rtx_insn *); static void dump_hard_reg_set (HARD_REG_SET); static void dump_btrs_live (int); -static void note_other_use_this_block (unsigned int, btr_user); -static void compute_defs_uses_and_gen (btr_heap_t *, btr_def *,btr_user *, +static void note_other_use_this_block (unsigned int, btr_user *); +static void compute_defs_uses_and_gen (btr_heap_t *, btr_def **, btr_user **, sbitmap *, sbitmap *, HARD_REG_SET *); static void compute_kill (sbitmap *, sbitmap *, HARD_REG_SET *); static void compute_out (sbitmap *bb_out, sbitmap *, sbitmap *, int); -static void link_btr_uses (btr_def *, btr_user *, sbitmap *, sbitmap *, int); +static void link_btr_uses (btr_def **, btr_user **, sbitmap *, sbitmap *, int); static void build_btr_def_use_webs (btr_heap_t *); -static int block_at_edge_of_live_range_p (int, btr_def); -static void clear_btr_from_live_range (btr_def def); -static void add_btr_to_live_range (btr_def, int); +static int block_at_edge_of_live_range_p (int, btr_def *); +static void clear_btr_from_live_range (btr_def *def); +static void add_btr_to_live_range (btr_def *, int); static void augment_live_range (bitmap, HARD_REG_SET *, basic_block, basic_block, int); static int choose_btr (HARD_REG_SET); -static void combine_btr_defs (btr_def, HARD_REG_SET *); -static void btr_def_live_range (btr_def, HARD_REG_SET *); -static void move_btr_def (basic_block, int, btr_def, bitmap, HARD_REG_SET *); -static int migrate_btr_def (btr_def, int); +static void combine_btr_defs (btr_def *, HARD_REG_SET *); +static void btr_def_live_range (btr_def *, HARD_REG_SET *); +static void move_btr_def (basic_block, int, btr_def *, bitmap, HARD_REG_SET *); +static int migrate_btr_def (btr_def *, int); static void migrate_btr_defs (enum reg_class, int); static int can_move_up (const_basic_block, const rtx_insn *, int); static void note_btr_set (rtx, const_rtx, void *); @@ -257,11 +259,11 @@ insn_sets_btr_p (const rtx_insn *insn, int check_const, int *regno) to in the list starting with *ALL_BTR_DEF_GROUPS. If no such group exists, create one. Add def to the group. */ static void -find_btr_def_group (btr_def_group *all_btr_def_groups, btr_def def) +find_btr_def_group (btr_def_group **all_btr_def_groups, btr_def *def) { if (insn_sets_btr_p (def->insn, 1, NULL)) { - btr_def_group this_group; + btr_def_group *this_group; rtx def_src = SET_SRC (single_set (def->insn)); /* ?? This linear search is an efficiency concern, particularly @@ -274,7 +276,7 @@ find_btr_def_group (btr_def_group *all_btr_def_groups, btr_def def) if (!this_group) { - this_group = XOBNEW (&migrate_btrl_obstack, struct btr_def_group_s); + this_group = XOBNEW (&migrate_btrl_obstack, btr_def_group); this_group->src = def_src; this_group->members = NULL; this_group->next = *all_btr_def_groups; @@ -291,13 +293,13 @@ find_btr_def_group (btr_def_group *all_btr_def_groups, btr_def def) /* Create a new target register definition structure, for a definition in block BB, instruction INSN, and insert it into ALL_BTR_DEFS. Return the new definition. */ -static btr_def +static btr_def * add_btr_def (btr_heap_t *all_btr_defs, basic_block bb, int insn_luid, rtx_insn *insn, unsigned int dest_reg, int other_btr_uses_before_def, - btr_def_group *all_btr_def_groups) + btr_def_group **all_btr_def_groups) { - btr_def this_def = XOBNEW (&migrate_btrl_obstack, struct btr_def_s); + btr_def *this_def = XOBNEW (&migrate_btrl_obstack, btr_def); this_def->bb = bb; this_def->luid = insn_luid; this_def->insn = insn; @@ -325,7 +327,7 @@ add_btr_def (btr_heap_t *all_btr_defs, basic_block bb, int insn_luid, /* Create a new target register user structure, for a use in block BB, instruction INSN. Return the new user. */ -static btr_user +static btr_user * new_btr_user (basic_block bb, int insn_luid, rtx_insn *insn) { /* This instruction reads target registers. We need @@ -334,7 +336,7 @@ new_btr_user (basic_block bb, int insn_luid, rtx_insn *insn) */ rtx *usep = find_btr_use (PATTERN (insn)); rtx use; - btr_user user = NULL; + btr_user *user = NULL; if (usep) { @@ -348,7 +350,7 @@ new_btr_user (basic_block bb, int insn_luid, rtx_insn *insn) usep = NULL; } use = usep ? *usep : NULL_RTX; - user = XOBNEW (&migrate_btrl_obstack, struct btr_user_s); + user = XOBNEW (&migrate_btrl_obstack, btr_user); user->bb = bb; user->luid = insn_luid; user->insn = insn; @@ -395,9 +397,9 @@ dump_btrs_live (int bb) If any of them use the same register, set their other_use_this_block flag. */ static void -note_other_use_this_block (unsigned int regno, btr_user users_this_bb) +note_other_use_this_block (unsigned int regno, btr_user *users_this_bb) { - btr_user user; + btr_user *user; for (user = users_this_bb; user != NULL; user = user->next) if (user->use && REGNO (user->use) == regno) @@ -405,7 +407,7 @@ note_other_use_this_block (unsigned int regno, btr_user users_this_bb) } struct defs_uses_info { - btr_user users_this_bb; + btr_user *users_this_bb; HARD_REG_SET btrs_written_in_block; HARD_REG_SET btrs_live_in_block; sbitmap bb_gen; @@ -438,8 +440,8 @@ note_btr_set (rtx dest, const_rtx set ATTRIBUTE_UNUSED, void *data) } static void -compute_defs_uses_and_gen (btr_heap_t *all_btr_defs, btr_def *def_array, - btr_user *use_array, sbitmap *btr_defset, +compute_defs_uses_and_gen (btr_heap_t *all_btr_defs, btr_def **def_array, + btr_user **use_array, sbitmap *btr_defset, sbitmap *bb_gen, HARD_REG_SET *btrs_written) { /* Scan the code building up the set of all defs and all uses. @@ -450,7 +452,7 @@ compute_defs_uses_and_gen (btr_heap_t *all_btr_defs, btr_def *def_array, */ int i; int insn_luid = 0; - btr_def_group all_btr_def_groups = NULL; + btr_def_group *all_btr_def_groups = NULL; defs_uses_info info; bitmap_vector_clear (bb_gen, last_basic_block_for_fn (cfun)); @@ -458,7 +460,7 @@ compute_defs_uses_and_gen (btr_heap_t *all_btr_defs, btr_def *def_array, { basic_block bb = BASIC_BLOCK_FOR_FN (cfun, i); int reg; - btr_def defs_this_bb = NULL; + btr_def *defs_this_bb = NULL; rtx_insn *insn; rtx_insn *last; int can_throw = 0; @@ -485,7 +487,7 @@ compute_defs_uses_and_gen (btr_heap_t *all_btr_defs, btr_def *def_array, if (insn_sets_btr_p (insn, 0, ®no)) { - btr_def def = add_btr_def ( + btr_def *def = add_btr_def ( all_btr_defs, bb, insn_luid, insn, regno, TEST_HARD_REG_BIT (info.btrs_live_in_block, regno), &all_btr_def_groups); @@ -505,7 +507,7 @@ compute_defs_uses_and_gen (btr_heap_t *all_btr_defs, btr_def *def_array, else if (cfun->has_nonlocal_label && GET_CODE (PATTERN (insn)) == UNSPEC_VOLATILE) { - btr_user user; + btr_user *user; /* Do the equivalent of calling note_other_use_this_block for every target register. */ @@ -521,7 +523,7 @@ compute_defs_uses_and_gen (btr_heap_t *all_btr_defs, btr_def *def_array, { if (find_btr_use (PATTERN (insn))) { - btr_user user = new_btr_user (bb, insn_luid, insn); + btr_user *user = new_btr_user (bb, insn_luid, insn); use_array[insn_uid] = user; if (user->use) @@ -655,7 +657,7 @@ compute_out (sbitmap *bb_out, sbitmap *bb_gen, sbitmap *bb_kill, int max_uid) } static void -link_btr_uses (btr_def *def_array, btr_user *use_array, sbitmap *bb_out, +link_btr_uses (btr_def **def_array, btr_user **use_array, sbitmap *bb_out, sbitmap *btr_defset, int max_uid) { int i; @@ -678,8 +680,8 @@ link_btr_uses (btr_def *def_array, btr_user *use_array, sbitmap *bb_out, { int insn_uid = INSN_UID (insn); - btr_def def = def_array[insn_uid]; - btr_user user = use_array[insn_uid]; + btr_def *def = def_array[insn_uid]; + btr_user *user = use_array[insn_uid]; if (def != NULL) { /* Remove all reaching defs of regno except @@ -716,7 +718,7 @@ link_btr_uses (btr_def *def_array, btr_user *use_array, sbitmap *bb_out, } EXECUTE_IF_SET_IN_BITMAP (reaching_defs_of_reg, 0, uid, sbi) { - btr_def def = def_array[uid]; + btr_def *def = def_array[uid]; /* We now know that def reaches user. */ @@ -770,8 +772,8 @@ static void build_btr_def_use_webs (btr_heap_t *all_btr_defs) { const int max_uid = get_max_uid (); - btr_def *def_array = XCNEWVEC (btr_def, max_uid); - btr_user *use_array = XCNEWVEC (btr_user, max_uid); + btr_def **def_array = XCNEWVEC (btr_def *, max_uid); + btr_user **use_array = XCNEWVEC (btr_user *, max_uid); sbitmap *btr_defset = sbitmap_vector_alloc ( (last_btr - first_btr) + 1, max_uid); sbitmap *bb_gen = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), @@ -808,14 +810,14 @@ build_btr_def_use_webs (btr_heap_t *all_btr_defs) live range of the definition DEF, AND there are other live ranges of the same target register that include BB. */ static int -block_at_edge_of_live_range_p (int bb, btr_def def) +block_at_edge_of_live_range_p (int bb, btr_def *def) { if (def->other_btr_uses_before_def && BASIC_BLOCK_FOR_FN (cfun, bb) == def->bb) return 1; else if (def->other_btr_uses_after_use) { - btr_user user; + btr_user *user; for (user = def->uses; user != NULL; user = user->next) if (BASIC_BLOCK_FOR_FN (cfun, bb) == user->bb) return 1; @@ -832,7 +834,7 @@ block_at_edge_of_live_range_p (int bb, btr_def def) to remove the target register from the live set of these blocks only if they do not contain other live ranges for the same register. */ static void -clear_btr_from_live_range (btr_def def) +clear_btr_from_live_range (btr_def *def) { unsigned bb; bitmap_iterator bi; @@ -860,7 +862,7 @@ clear_btr_from_live_range (btr_def def) If OWN_END is set, also show that the register is live from our definitions at the end of the basic block where it is defined. */ static void -add_btr_to_live_range (btr_def def, int own_end) +add_btr_to_live_range (btr_def *def, int own_end) { unsigned bb; bitmap_iterator bi; @@ -1003,11 +1005,11 @@ choose_btr (HARD_REG_SET used_btrs) in this live range, but ignore the live range represented by DEF when calculating this set. */ static void -btr_def_live_range (btr_def def, HARD_REG_SET *btrs_live_in_range) +btr_def_live_range (btr_def *def, HARD_REG_SET *btrs_live_in_range) { if (!def->live_range) { - btr_user user; + btr_user *user; def->live_range = BITMAP_ALLOC (NULL); @@ -1050,9 +1052,9 @@ btr_def_live_range (btr_def def, HARD_REG_SET *btrs_live_in_range) group that are dominated by DEF, provided that there is a target register available to allocate to the merged web. */ static void -combine_btr_defs (btr_def def, HARD_REG_SET *btrs_live_in_range) +combine_btr_defs (btr_def *def, HARD_REG_SET *btrs_live_in_range) { - btr_def other_def; + btr_def *other_def; for (other_def = def->group->members; other_def != NULL; @@ -1070,7 +1072,7 @@ combine_btr_defs (btr_def def, HARD_REG_SET *btrs_live_in_range) int btr; HARD_REG_SET combined_btrs_live; bitmap combined_live_range = BITMAP_ALLOC (NULL); - btr_user user; + btr_user *user; if (other_def->live_range == NULL) { @@ -1100,7 +1102,7 @@ combine_btr_defs (btr_def def, HARD_REG_SET *btrs_live_in_range) user = other_def->uses; while (user != NULL) { - btr_user next = user->next; + btr_user *next = user->next; user->next = def->uses; def->uses = user; @@ -1139,7 +1141,7 @@ combine_btr_defs (btr_def def, HARD_REG_SET *btrs_live_in_range) If this new position means that other defs in the same group can be combined with DEF then combine them. */ static void -move_btr_def (basic_block new_def_bb, int btr, btr_def def, bitmap live_range, +move_btr_def (basic_block new_def_bb, int btr, btr_def *def, bitmap live_range, HARD_REG_SET *btrs_live_in_range) { /* We can move the instruction. @@ -1154,7 +1156,7 @@ move_btr_def (basic_block new_def_bb, int btr, btr_def def, bitmap live_range, rtx btr_rtx; rtx_insn *new_insn; machine_mode btr_mode; - btr_user user; + btr_user *user; rtx set; if (dump_file) @@ -1264,7 +1266,7 @@ can_move_up (const_basic_block bb, const rtx_insn *insn, int n_insns) MIN_COST, but we may be able to reduce it further). Return zero if no further migration is possible. */ static int -migrate_btr_def (btr_def def, int min_cost) +migrate_btr_def (btr_def *def, int min_cost) { bitmap live_range; HARD_REG_SET btrs_live_in_range; @@ -1273,7 +1275,7 @@ migrate_btr_def (btr_def def, int min_cost) basic_block attempt; int give_up = 0; int def_moved = 0; - btr_user user; + btr_user *user; int def_latency; if (dump_file) @@ -1432,7 +1434,7 @@ migrate_btr_defs (enum reg_class btr_class, int allow_callee_save) while (!all_btr_defs.empty ()) { int min_cost = -all_btr_defs.min_key (); - btr_def def = all_btr_defs.extract_min (); + btr_def *def = all_btr_defs.extract_min (); if (migrate_btr_def (def, min_cost)) { all_btr_defs.insert (-def->cost, def); -- 2.30.2