[PATCH 6/9] tree-chkp.c: switch to targetm.pointer_size ()

tbsaunde+gcc@tbsaunde.org tbsaunde+gcc@tbsaunde.org
Mon Jul 27 03:42:00 GMT 2015


From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2015-07-26  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* tree-chkp.c (chkp_build_array_ref): Call targetm.pointer_size ().
	(chkp_find_bounds_for_elem): Likewise.
	(chkp_find_bound_slots_1): Likewise.
	(chkp_add_bounds_to_call_stmt): Likewise.
	(chkp_instrument_function): Likewise.
---
 gcc/tree-chkp.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/gcc/tree-chkp.c b/gcc/tree-chkp.c
index 8c1b48c..456e79b 100644
--- a/gcc/tree-chkp.c
+++ b/gcc/tree-chkp.c
@@ -1583,7 +1583,7 @@ chkp_build_array_ref (tree arr, tree etype, tree esize,
 
    ALL_BOUNDS[i] is filled with elem bounds if there
    is a field in TYPE which has pointer type and offset
-   equal to i * POINTER_SIZE in bits.  */
+   equal to i * targetm.pointer_size () in bits.  */
 static void
 chkp_find_bounds_for_elem (tree elem, tree *all_bounds,
 			   HOST_WIDE_INT offs,
@@ -1593,7 +1593,7 @@ chkp_find_bounds_for_elem (tree elem, tree *all_bounds,
 
   if (BOUNDED_TYPE_P (type))
     {
-      if (!all_bounds[offs / POINTER_SIZE])
+      if (!all_bounds[offs / targetm.pointer_size ()])
 	{
 	  tree temp = make_temp_ssa_name (type, NULL, "");
 	  gimple assign = gimple_build_assign (temp, elem);
@@ -1602,7 +1602,8 @@ chkp_find_bounds_for_elem (tree elem, tree *all_bounds,
 	  gsi_insert_before (iter, assign, GSI_SAME_STMT);
 	  gsi = gsi_for_stmt (assign);
 
-	  all_bounds[offs / POINTER_SIZE] = chkp_find_bounds (temp, &gsi);
+	  all_bounds[offs / targetm.pointer_size ()]
+	    = chkp_find_bounds (temp, &gsi);
 	}
     }
   else if (RECORD_OR_UNION_TYPE_P (type))
@@ -1659,7 +1660,7 @@ chkp_find_bound_slots_1 (const_tree type, bitmap have_bound,
 			 HOST_WIDE_INT offs)
 {
   if (BOUNDED_TYPE_P (type))
-    bitmap_set_bit (have_bound, offs / POINTER_SIZE);
+    bitmap_set_bit (have_bound, offs / targetm.pointer_size ());
   else if (RECORD_OR_UNION_TYPE_P (type))
     {
       tree field;
@@ -1906,7 +1907,7 @@ chkp_add_bounds_to_call_stmt (gimple_stmt_iterator *gsi)
       else if (chkp_type_has_pointer (type))
 	{
 	  HOST_WIDE_INT max_bounds
-	    = TREE_INT_CST_LOW (TYPE_SIZE (type)) / POINTER_SIZE;
+	    = TREE_INT_CST_LOW (TYPE_SIZE (type)) / targetm.pointer_size ();
 	  tree *all_bounds = (tree *)xmalloc (sizeof (tree) * max_bounds);
 	  HOST_WIDE_INT bnd_no;
 
@@ -4267,7 +4268,8 @@ chkp_instrument_function (void)
 	      EXECUTE_IF_SET_IN_BITMAP (slots, 0, bnd_no, bi)
 		{
 		  tree bounds = chkp_get_next_bounds_parm (arg);
-		  HOST_WIDE_INT offs = bnd_no * POINTER_SIZE / BITS_PER_UNIT;
+		  HOST_WIDE_INT offs
+		    = bnd_no * targetm.pointer_size () / BITS_PER_UNIT;
 		  tree addr = chkp_build_addr_expr (orig_arg);
 		  tree ptr = build2 (MEM_REF, ptr_type_node, addr,
 				     build_int_cst (ptr_type_node, offs));
-- 
2.4.0



More information about the Gcc-patches mailing list