From 0777c850bf46d987cba16c3b88582f1f34e29481 Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Wed, 6 Jul 2016 23:53:15 +0000 Subject: [PATCH] make stores rtx_insn_list a vec gcc/ChangeLog: 2016-07-06 Trevor Saunders * gcse.c (struct ls_expr): Make stores field a vector. (ldst_entry): Adjust. (free_ldst_entry): Likewise. (print_ldst_list): Likewise. (compute_ld_motion_mems): Likewise. (update_ld_motion_stores): Likewise. From-SVN: r238065 --- gcc/ChangeLog | 9 +++++++++ gcc/gcse.c | 22 +++++++++------------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0fabfc61e75..4a35420b85c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2016-07-06 Trevor Saunders + + * gcse.c (struct ls_expr): Make stores field a vector. + (ldst_entry): Adjust. + (free_ldst_entry): Likewise. + (print_ldst_list): Likewise. + (compute_ld_motion_mems): Likewise. + (update_ld_motion_stores): Likewise. + 2016-07-06 Trevor Saunders * gcse.c (struct ls_expr): Remove loads field. diff --git a/gcc/gcse.c b/gcc/gcse.c index 127a65a871d..49534f255f6 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -143,6 +143,7 @@ along with GCC; see the file COPYING3. If not see #include "df.h" #include "tm_p.h" #include "insn-config.h" +#include "print-rtl.h" #include "regs.h" #include "ira.h" #include "recog.h" @@ -342,7 +343,7 @@ struct ls_expr struct gcse_expr * expr; /* Gcse expression reference for LM. */ rtx pattern; /* Pattern of this mem. */ rtx pattern_regs; /* List of registers mentioned by the mem. */ - rtx_insn_list *stores; /* INSN list of stores seen. */ + vec stores; /* INSN list of stores seen. */ struct ls_expr * next; /* Next in the list. */ int invalid; /* Invalid for some reason. */ int index; /* If it maps to a bitmap index. */ @@ -3604,7 +3605,7 @@ ldst_entry (rtx x) ptr->expr = NULL; ptr->pattern = x; ptr->pattern_regs = NULL_RTX; - ptr->stores = NULL; + ptr->stores.create (0); ptr->reaching_reg = NULL_RTX; ptr->invalid = 0; ptr->index = 0; @@ -3620,7 +3621,7 @@ ldst_entry (rtx x) static void free_ldst_entry (struct ls_expr * ptr) { - free_INSN_LIST_list (& ptr->stores); + ptr->stores.release (); free (ptr); } @@ -3661,11 +3662,7 @@ print_ldst_list (FILE * file) print_rtl (file, ptr->pattern); fprintf (file, "\n Stores : "); - - if (ptr->stores) - print_rtl (file, ptr->stores); - else - fprintf (file, "(nil)"); + print_rtx_insn_vec (file, ptr->stores); fprintf (file, "\n\n"); } @@ -3822,7 +3819,7 @@ compute_ld_motion_mems (void) returns 0 for all REGs. */ && can_assign_to_reg_without_clobbers_p (src, src_mode)) - ptr->stores = alloc_INSN_LIST (insn, ptr->stores); + ptr->stores.safe_push (insn); else ptr->invalid = 1; } @@ -3915,11 +3912,10 @@ update_ld_motion_stores (struct gcse_expr * expr) where reg is the reaching reg used in the load. We checked in compute_ld_motion_mems that we can replace (set mem expr) with (set reg expr) in that insn. */ - rtx list = mem_ptr->stores; - - for ( ; list != NULL_RTX; list = XEXP (list, 1)) + rtx_insn *insn; + unsigned int i; + FOR_EACH_VEC_ELT_REVERSE (mem_ptr->stores, i, insn) { - rtx_insn *insn = as_a (XEXP (list, 0)); rtx pat = PATTERN (insn); rtx src = SET_SRC (pat); rtx reg = expr->reaching_reg; -- 2.30.2