From: Trevor Saunders Date: Wed, 6 Jul 2016 23:53:04 +0000 (+0000) Subject: make antic_stores a vec X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6dbe4c9e2480349578199074b959502b859f7fcc;p=gcc.git make antic_stores a vec gcc/ChangeLog: 2016-07-06 Trevor Saunders * store-motion.c (struct st_expr): Make antic_stores a vector. (st_expr_entry): Adjust. (free_st_expr_entry): Likewise. (print_store_motion_mems): Likewise. (find_moveable_store): Likewise. (compute_store_table): Likewise. (remove_reachable_equiv_notes): Likewise. (replace_store_insn): Likewise. (build_store_vectors): Likewise. From-SVN: r238063 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 94dd9370801..d0ff7faeb84 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2016-07-06 Trevor Saunders + + * store-motion.c (struct st_expr): Make antic_stores a vector. + (st_expr_entry): Adjust. + (free_st_expr_entry): Likewise. + (print_store_motion_mems): Likewise. + (find_moveable_store): Likewise. + (compute_store_table): Likewise. + (remove_reachable_equiv_notes): Likewise. + (replace_store_insn): Likewise. + (build_store_vectors): Likewise. + 2016-07-06 Kyrylo Tkachov * config/arm/driver-arm.c (arm_cpu_table): Add entries for cortex-a32, diff --git a/gcc/store-motion.c b/gcc/store-motion.c index 301b69be86d..6d7d37f6944 100644 --- a/gcc/store-motion.c +++ b/gcc/store-motion.c @@ -46,7 +46,6 @@ along with GCC; see the file COPYING3. If not see a compile time hog that needs a rewrite (maybe cache st_exprs to invalidate REG_EQUAL/REG_EQUIV notes for?). - pattern_regs in st_expr should be a regset (on its own obstack). - - antic_stores and avail_stores should be VECs instead of lists. - store_motion_mems should be a vec instead of a list. - there should be an alloc pool for struct st_expr objects. - investigate whether it is helpful to make the address of an st_expr @@ -66,7 +65,7 @@ struct st_expr /* List of registers mentioned by the mem. */ rtx pattern_regs; /* INSN list of stores that are locally anticipatable. */ - rtx_insn_list *antic_stores; + vec antic_stores; /* INSN list of stores that are locally available. */ vec avail_stores; /* Next in the list. */ @@ -148,7 +147,7 @@ st_expr_entry (rtx x) ptr->next = store_motion_mems; ptr->pattern = x; ptr->pattern_regs = NULL_RTX; - ptr->antic_stores = NULL; + ptr->antic_stores.create (0); ptr->avail_stores.create (0); ptr->reaching_reg = NULL_RTX; ptr->index = 0; @@ -164,8 +163,8 @@ st_expr_entry (rtx x) static void free_st_expr_entry (struct st_expr * ptr) { - free_INSN_LIST_list (& ptr->antic_stores); - ptr->avail_stores.release (); + ptr->antic_stores.release (); + ptr->avail_stores.release (); free (ptr); } @@ -233,11 +232,7 @@ print_store_motion_mems (FILE * file) print_rtl (file, ptr->pattern); fprintf (file, "\n ANTIC stores : "); - - if (ptr->antic_stores) - print_rtl (file, ptr->antic_stores); - else - fprintf (file, "(nil)"); + print_rtx_insn_vec (file, ptr->antic_stores); fprintf (file, "\n AVAIL stores : "); @@ -566,11 +561,11 @@ find_moveable_store (rtx_insn *insn, int *regs_set_before, int *regs_set_after) /* Do not check for anticipatability if we either found one anticipatable store already, or tested for one and found out that it was killed. */ check_anticipatable = 0; - if (!ptr->antic_stores) + if (ptr->antic_stores.is_empty ()) check_anticipatable = 1; else { - rtx_insn *tmp = ptr->antic_stores->insn (); + rtx_insn *tmp = ptr->antic_stores.last (); if (tmp != NULL_RTX && BLOCK_FOR_INSN (tmp) != bb) check_anticipatable = 1; @@ -582,7 +577,7 @@ find_moveable_store (rtx_insn *insn, int *regs_set_before, int *regs_set_after) tmp = NULL; else tmp = insn; - ptr->antic_stores = alloc_INSN_LIST (tmp, ptr->antic_stores); + ptr->antic_stores.safe_push (tmp); } /* It is not necessary to check whether store is available if we did @@ -683,9 +678,9 @@ compute_store_table (void) for (ptr = first_st_expr (); ptr != NULL; ptr = next_st_expr (ptr)) { LAST_AVAIL_CHECK_FAILURE (ptr) = NULL_RTX; - if (ptr->antic_stores - && (tmp = ptr->antic_stores->insn ()) == NULL_RTX) - ptr->antic_stores = ptr->antic_stores->next (); + if (!ptr->antic_stores.is_empty () + && (tmp = ptr->antic_stores.last ()) == NULL) + ptr->antic_stores.pop (); } } @@ -831,7 +826,7 @@ remove_reachable_equiv_notes (basic_block bb, struct st_expr *smexpr) int sp; edge act; sbitmap visited = sbitmap_alloc (last_basic_block_for_fn (cfun)); - rtx last, note; + rtx note; rtx_insn *insn; rtx mem = smexpr->pattern; @@ -866,13 +861,13 @@ remove_reachable_equiv_notes (basic_block bb, struct st_expr *smexpr) } bitmap_set_bit (visited, bb->index); + rtx_insn *last; if (bitmap_bit_p (st_antloc[bb->index], smexpr->index)) { - for (last = smexpr->antic_stores; - BLOCK_FOR_INSN (XEXP (last, 0)) != bb; - last = XEXP (last, 1)) - continue; - last = XEXP (last, 0); + unsigned int i; + FOR_EACH_VEC_ELT_REVERSE (smexpr->antic_stores, i, last) + if (BLOCK_FOR_INSN (last) == bb) + break; } else last = NEXT_INSN (BB_END (bb)); @@ -911,15 +906,17 @@ replace_store_insn (rtx reg, rtx_insn *del, basic_block bb, struct st_expr *smexpr) { rtx_insn *insn; - rtx mem, note, set, ptr; + rtx mem, note, set; mem = smexpr->pattern; insn = gen_move_insn (reg, SET_SRC (single_set (del))); - for (ptr = smexpr->antic_stores; ptr; ptr = XEXP (ptr, 1)) - if (XEXP (ptr, 0) == del) + unsigned int i; + rtx_insn *temp; + FOR_EACH_VEC_ELT_REVERSE (smexpr->antic_stores, i, temp) + if (temp == del) { - XEXP (ptr, 0) = insn; + smexpr->antic_stores[i] = insn; break; } @@ -1001,7 +998,6 @@ build_store_vectors (void) basic_block bb; int *regs_set_in_block; rtx_insn *insn; - rtx_insn_list *st; struct st_expr * ptr; unsigned int max_gcse_regno = max_reg_num (); @@ -1038,9 +1034,9 @@ build_store_vectors (void) bitmap_set_bit (st_avloc[bb->index], ptr->index); } - for (st = ptr->antic_stores; st != NULL; st = st->next ()) + unsigned int i; + FOR_EACH_VEC_ELT_REVERSE (ptr->antic_stores, i, insn) { - insn = st->insn (); bb = BLOCK_FOR_INSN (insn); bitmap_set_bit (st_antloc[bb->index], ptr->index); }