diff mbox

make gcse.c:modify_mem_list hold VECs instead of INSN_LISTs

Message ID 20110405132025.GB30054@nightcrawler
State New
Headers show

Commit Message

Nathan Froyd April 5, 2011, 1:20 p.m. UTC
As promised, this patch turns modify_mem_list into an array of VECs,
similar to the changes done to canon_modify_mem_list.  Since I'm in the
area, I took the liberty of tweaking the VEC declarations related to
canon_modify_mem_list to have spaces before parens, as folks seem to
think that's the right way to write them.

Tested on x86_64-unknown-linux-gnu.  OK to commit?

-Nathan

	* gcse.c (modify_mem_list): Convert to an array of VECs.
	(canon_modify_mem_list, compute_transp): Tweak formatting.
	(alloc_gcse_mem): Likewise.  Adjust for modify_mem_list change.
	(load_killed_in_block_p): Likewise.
	(record_last_mem_set_info): Likewise.
	(clear_modify_mem_tables): Likewise.

Comments

Jeff Law April 5, 2011, 4:26 p.m. UTC | #1
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 04/05/11 07:20, Nathan Froyd wrote:
> As promised, this patch turns modify_mem_list into an array of VECs,
> similar to the changes done to canon_modify_mem_list.  Since I'm in the
> area, I took the liberty of tweaking the VEC declarations related to
> canon_modify_mem_list to have spaces before parens, as folks seem to
> think that's the right way to write them.
> 
> Tested on x86_64-unknown-linux-gnu.  OK to commit?
> 
> -Nathan
> 
> 	* gcse.c (modify_mem_list): Convert to an array of VECs.
> 	(canon_modify_mem_list, compute_transp): Tweak formatting.
> 	(alloc_gcse_mem): Likewise.  Adjust for modify_mem_list change.
> 	(load_killed_in_block_p): Likewise.
> 	(record_last_mem_set_info): Likewise.
> 	(clear_modify_mem_tables): Likewise.
OK.
jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNm0K4AAoJEBRtltQi2kC74eMH/1MKEULO+359JWwgaUem37o/
0LLmKqpxzE+FIYcUjvR0zWdI6kFI+sXBPCPv5RZqEKDq5Pdyh0StcIAoxGmPfahI
dwsypKr8zrtE28ItcsqDdMNT2j9/Ec3iJ3mB12m5b68S6y2u7l+LDCcD2Zb+L4g6
t0Btxks4PuypOTJppLSrbJ3ke6IcaXekS0VgVsEatqHIHVx/Goo6dYcAMs/3azBm
8Z0VVlSpneQ/mpTy8ltJ4e0PGUEE2qJ7HTPIkqdccWhj97KxpDARFKR3VSPw4jio
9FYJSr83+1ti1wzFBbr/x4lbT4gYc+HKF77uIM1dGXbNse+gVKjehR9VEX66WNI=
=7T4j
-----END PGP SIGNATURE-----
diff mbox

Patch

diff --git a/gcc/gcse.c b/gcc/gcse.c
index d6a4db4..41fff7a 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -382,7 +382,7 @@  static regset reg_set_bitmap;
 
 /* Array, indexed by basic block number for a list of insns which modify
    memory within that block.  */
-static rtx * modify_mem_list;
+static VEC (rtx,heap) **modify_mem_list;
 static bitmap modify_mem_list_set;
 
 typedef struct modify_pair_s
@@ -396,7 +396,7 @@  DEF_VEC_ALLOC_O(modify_pair,heap);
 
 /* This array parallels modify_mem_list, except that it stores MEMs
    being set and their canonicalized memory addresses.  */
-static VEC(modify_pair,heap) **canon_modify_mem_list;
+static VEC (modify_pair,heap) **canon_modify_mem_list;
 
 /* Bitmap indexed by block numbers to record which blocks contain
    function calls.  */
@@ -595,8 +595,8 @@  alloc_gcse_mem (void)
 
   /* Allocate array to keep a list of insns which modify memory in each
      basic block.  */
-  modify_mem_list = GCNEWVEC (rtx, last_basic_block);
-  canon_modify_mem_list = GCNEWVEC (VEC(modify_pair,heap) *,
+  modify_mem_list = GCNEWVEC (VEC (rtx,heap) *, last_basic_block);
+  canon_modify_mem_list = GCNEWVEC (VEC (modify_pair,heap) *,
 				    last_basic_block);
   modify_mem_list_set = BITMAP_ALLOC (NULL);
   blocks_with_calls = BITMAP_ALLOC (NULL);
@@ -991,26 +991,22 @@  mems_conflict_for_gcse_p (rtx dest, const_rtx setter ATTRIBUTE_UNUSED,
 static int
 load_killed_in_block_p (const_basic_block bb, int uid_limit, const_rtx x, int avail_p)
 {
-  rtx list_entry = modify_mem_list[bb->index];
+  VEC (rtx,heap) *list = modify_mem_list[bb->index];
+  rtx setter;
+  unsigned ix;
 
   /* If this is a readonly then we aren't going to be changing it.  */
   if (MEM_READONLY_P (x))
     return 0;
 
-  while (list_entry)
+  FOR_EACH_VEC_ELT_REVERSE (rtx, list, ix, setter)
     {
-      rtx setter;
       /* Ignore entries in the list that do not apply.  */
       if ((avail_p
-	   && DF_INSN_LUID (XEXP (list_entry, 0)) < uid_limit)
+	   && DF_INSN_LUID (setter) < uid_limit)
 	  || (! avail_p
-	      && DF_INSN_LUID (XEXP (list_entry, 0)) > uid_limit))
-	{
-	  list_entry = XEXP (list_entry, 1);
-	  continue;
-	}
-
-      setter = XEXP (list_entry, 0);
+	      && DF_INSN_LUID (setter) > uid_limit))
+	continue;
 
       /* If SETTER is a call everything is clobbered.  Note that calls
 	 to pure functions are never put on the list, so we need not
@@ -1028,7 +1024,6 @@  load_killed_in_block_p (const_basic_block bb, int uid_limit, const_rtx x, int av
       note_stores (PATTERN (setter), mems_conflict_for_gcse_p, NULL);
       if (gcse_mems_conflict_p)
 	return 1;
-      list_entry = XEXP (list_entry, 1);
     }
   return 0;
 }
@@ -1480,7 +1475,7 @@  record_last_mem_set_info (rtx insn)
 
   /* load_killed_in_block_p will handle the case of calls clobbering
      everything.  */
-  modify_mem_list[bb] = alloc_INSN_LIST (insn, modify_mem_list[bb]);
+  VEC_safe_push (rtx, heap, modify_mem_list[bb], insn);
   bitmap_set_bit (modify_mem_list_set, bb);
 
   if (CALL_P (insn))
@@ -1621,7 +1616,7 @@  clear_modify_mem_tables (void)
 
   EXECUTE_IF_SET_IN_BITMAP (modify_mem_list_set, 0, i, bi)
     {
-      free_INSN_LIST_list (modify_mem_list + i);
+      VEC_free (rtx, heap, modify_mem_list[i]);
       VEC_free (modify_pair, heap, canon_modify_mem_list[i]);
     }
   bitmap_clear (modify_mem_list_set);
@@ -1693,7 +1688,7 @@  compute_transp (const_rtx x, int indx, sbitmap *bmap)
 					    blocks_with_calls,
 					    0, bb_index, bi)
 	      {
-		VEC(modify_pair,heap) *list
+		VEC (modify_pair,heap) *list
 		  = canon_modify_mem_list[bb_index];
 		modify_pair *pair;
 		unsigned ix;