diff mbox

RFA: partially hookize POINTER_SIZE

Message ID 20101129070117.ar5qwmbkg840ws4o-nzlynne@webmail.spamcop.net
State New
Headers show

Commit Message

Joern Rennecke Nov. 29, 2010, 12:01 p.m. UTC
This patch replaces uses of POINTER_SIZE in the frontends.
as discussed in PR46677, in frontend contexts where ptr_type_node - or
in the case of java, size_type - is known to be set, TYPE_PRECISION
of this type is used; otherwise, a function pointer_size in
targhooks.c is used, which in turn uses targetm.addr_space.pointer_mode,
and, if necessary, POINTER_SIZE.

bootstrapped & regression tested on i686-pc-linux-gnu
cross-tested for:
alpha-linux-gnu hppa-linux-gnu mips-elf sh-elf arc-elf ia64-elf  
mmix-knuth-mmixware sparc-elf arm-eabi iq2000-elf mn10300-elf spu-elf  
avr-elf lm32-elf moxie-elf v850-elf bfin-elf m32c-elf pdp11-aout  
vax-linux-gnu cris-elf m32r-elf picochip-elf xstormy16-elf crx-elf  
m68hc11-elf ppc-elf xtensa-elf fr30-elf m68k-elf rx-elf frv-elf  
mcore-elf s390-linux-gnu h8300-elf mep-elf score-elf microblaze-elf
bootstrapped & Ada regtested on x86_64-linux-gnu.
2010-11-29  Joern Rennecke  <amylaar@spamcop.net>

	PR other/46677
gcc:
	* targhooks.c (pointer_size): New function.
	* cppbuiltin.c (define_builtin_macros_for_lp64): Use pointer_size.
	(define_builtin_macros_for_type_sizes): Likewise.
	* target.h (pointer_size): Declare.

	* cppbuiltin.c (define_builtin_macros_for_type_sizes):
	Use TYPE_PRECISION (char_type_node).
gcc/c-family:
	c-common.c (c_common_nodes_and_builtins): Use pointer_size.
gcc/java:
	* decl.c (java_init_decl_processing): Use pointer_size.
	* java-tree.h (JAVA_POINTER_SIZE): Define.
	* class.c (make_class_data): Use JAVA_POINTER_SIZE.
	(emit_register_classes): Likewise.
	* jcf-parse.c (handle_long_constant): Likewise.
	* constants.c (build_constants_constructor): Likewise.
	* builtins.c (UNMARSHAL3, UNMARSHAL4, UNMARSHAL5): Likewise.
	(compareAndSwapObject_builtin): Likewise.
	* boehm.c (get_boehm_type_descriptor): Likewise.
	(mark_reference_fields): Add log2_size parameter.  Changed all callers.
gcc/cp:
	* cvt.c (cp_convert_to_pointer): Use TYPE_PRECISION (ptr_type_node).
gcc/fortran:
	* trans-types.c (gfc_init_kinds): Use pointer_size.
gcc/lto:
	* lto-object.c (lto_obj_begin_section): Use pointer_size.
ada:
	* gcc-interface/decl.c (gnat_to_gnu_entity): Replace pointer_size
	with pointer_size_t.  Replace POINTER_SIZE with pointer_size ().
	(rest_of_type_decl_compilation_no_defer): Use pointer_size.
	(gnat_to_gnu_param, annotate_rep, make_type_from_size): Likewise.
	* gcc-interface/utils2.c: Include target.h .
	(maybe_wrap_malloc, maybe_wrap_free): Use pointer_size.
	* gcc-interface/targtyps.c: Include target.h .
	(get_target_pointer_size): Use pointer_size.
diff mbox

Patch

Index: targhooks.c
===================================================================
--- targhooks.c	(revision 167235)
+++ targhooks.c	(working copy)
@@ -1362,4 +1362,23 @@ 
     { OPT_LEVELS_NONE, 0, NULL, 0 }
   };
 
+/* Return the size of a pointer.  This function might be used when
+   ptr_type_node is not / is not known to be set up, like in the
+   preprocessor.  */
+unsigned
+pointer_size (void)
+{
+  enum machine_mode
+    mode = targetm.addr_space.pointer_mode (ADDR_SPACE_GENERIC);
+
+  /* If the hook definition uses ptr_mode, and we are called before
+     init_emit_once, e.g. from the preprocessor, we might see VOIDmode.  */
+  if (mode == VOIDmode)
+    {
+      gcc_assert (mode == ptr_mode);
+      return POINTER_SIZE;
+    }
+  return GET_MODE_BITSIZE (mode);
+}
+
 #include "gt-targhooks.h"
Index: cppbuiltin.c
===================================================================
--- cppbuiltin.c	(revision 167235)
+++ cppbuiltin.c	(working copy)
@@ -106,7 +106,7 @@ 
 define_builtin_macros_for_lp64 (cpp_reader *pfile)
 {
   if (TYPE_PRECISION (long_integer_type_node) == 64
-      && POINTER_SIZE == 64
+      && pointer_size () == 64
       && TYPE_PRECISION (integer_type_node) == 32)
     {
       cpp_define (pfile, "_LP64");
@@ -164,9 +164,13 @@ 
                          : "__ORDER_LITTLE_ENDIAN__"));
 
   /* ptr_type_node can't be used here since ptr_mode is only set when
-     toplev calls backend_init which is not done with -E switch.  */
+     toplev calls backend_init which is not done with -E switch.
+     In principle we could use
+     targetm.addr_space.pointer_mode (ADDR_SPACE_GENERIC), but we don't really
+     want the prepocessor to have to know about machine modes, and most
+     definitions of the hook also use ptr_mode.  */
   cpp_define_formatted (pfile, "__SIZEOF_POINTER__=%d",
-			POINTER_SIZE / BITS_PER_UNIT);
+			pointer_size () / TYPE_PRECISION (char_type_node));
 }
 
 
Index: c-family/c-common.c
===================================================================
--- c-family/c-common.c	(revision 167235)
+++ c-family/c-common.c	(working copy)
@@ -4944,7 +4944,7 @@ 
   /* Create the built-in __null node.  It is important that this is
      not shared.  */
   null_node = make_node (INTEGER_CST);
-  TREE_TYPE (null_node) = c_common_type_for_size (POINTER_SIZE, 0);
+  TREE_TYPE (null_node) = c_common_type_for_size (pointer_size (), 0);
 
   /* Since builtin_types isn't gc'ed, don't export these nodes.  */
   memset (builtin_types, 0, sizeof (builtin_types));
Index: java/class.c
===================================================================
--- java/class.c	(revision 167235)
+++ java/class.c	(working copy)
@@ -1793,7 +1793,7 @@ 
   tree id_class = get_identifier("java.lang.Class");
   /** Offset from start of virtual function table declaration
       to where objects actually point at, following new g++ ABI. */
-  tree dtable_start_offset = size_int (2 * POINTER_SIZE / BITS_PER_UNIT);
+  tree dtable_start_offset = size_int (2 * JAVA_POINTER_SIZE / BITS_PER_UNIT);
   VEC(int, heap) *field_indexes;
   tree first_real_field;
   VEC(constructor_elt,gc) *v1 = NULL, *v2 = NULL;
@@ -2234,7 +2234,7 @@ 
   DECL_INITIAL (decl) = cons;
   
   /* Hash synchronization requires at least 64-bit alignment. */
-  if (flag_hash_synchronization && POINTER_SIZE < 64)
+  if (flag_hash_synchronization && JAVA_POINTER_SIZE < 64)
     DECL_ALIGN (decl) = 64; 
   
   if (flag_indirect_classes)
@@ -2831,12 +2831,13 @@ 
 	 but doesn't have a JCR_SECTION_NAME.  */
       gcc_unreachable ();
 #endif
-      assemble_align (POINTER_SIZE);
+      assemble_align (JAVA_POINTER_SIZE);
 
       FOR_EACH_VEC_ELT (tree, registered_class, i, klass)
 	{
 	  t = build_fold_addr_expr (klass);
-	  output_constant (t, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE);
+	  output_constant (t, JAVA_POINTER_SIZE / BITS_PER_UNIT,
+			   JAVA_POINTER_SIZE);
 	}
     }
   else
Index: java/decl.c
===================================================================
--- java/decl.c	(revision 167235)
+++ java/decl.c	(working copy)
@@ -606,8 +606,10 @@ 
 
   /* This is not a java type, however tree-dfa requires a definition for
      size_type_node.  */
-  size_type_node = make_unsigned_type (POINTER_SIZE);
+  size_type_node = make_unsigned_type (pointer_size ());
   set_sizetype (size_type_node);
+  /* Henceforth, we can use TYPE_PRECISION (size_type_node) when we mean
+     pointer_size () for the current target, to avoid unnecessary overhead.  */
 
   /* Define these next since types below may used them.  */
   integer_type_node = java_type_for_size (INT_TYPE_SIZE, 0);
Index: java/jcf-parse.c
===================================================================
--- java/jcf-parse.c	(revision 167235)
+++ java/jcf-parse.c	(working copy)
@@ -475,7 +475,7 @@ 
 {
   /* If we're on a 64-bit platform we can fit a long or double
      into the same space as a jword.  */
-  if (POINTER_SIZE >= 64)
+  if (JAVA_POINTER_SIZE >= 64)
     index = find_constant1 (cpool, kind, JPOOL_LONG (jcf, index));
 
   /* In a compiled program the constant pool is in native word
Index: java/constants.c
===================================================================
--- java/constants.c	(revision 167235)
+++ java/constants.c	(working copy)
@@ -541,7 +541,7 @@ 
 	     not a scalar but a union, and that's how we should
 	     represent it in the compiler.  We should fix this.  */
 	  if (BYTES_BIG_ENDIAN)
-	    temp <<= ((POINTER_SIZE > 32) ? POINTER_SIZE - 32 : 0);
+	    temp <<= ((JAVA_POINTER_SIZE > 32) ? JAVA_POINTER_SIZE - 32 : 0);
 
           CONSTRUCTOR_PREPEND_VALUE (t, get_tag_node (outgoing_cpool->tags[i]));
           CONSTRUCTOR_PREPEND_VALUE (d,
Index: java/builtins.c
===================================================================
--- java/builtins.c	(revision 167235)
+++ java/builtins.c	(working copy)
@@ -244,7 +244,7 @@ 
   tree orig_method_call = METHOD_CALL;					\
   this_arg = CALL_EXPR_ARG (orig_method_call, 0);			\
   obj_arg = CALL_EXPR_ARG (orig_method_call, 1);			\
-  offset_arg = fold_convert (java_type_for_size (POINTER_SIZE, 0),	\
+  offset_arg = fold_convert (java_type_for_size (JAVA_POINTER_SIZE, 0),	\
 			     CALL_EXPR_ARG (orig_method_call, 2));	\
 }									\
 while (0)
@@ -256,7 +256,7 @@ 
   tree orig_method_call = METHOD_CALL;					\
   this_arg = CALL_EXPR_ARG (orig_method_call, 0);			\
   obj_arg = CALL_EXPR_ARG (orig_method_call, 1);			\
-  offset_arg = fold_convert (java_type_for_size (POINTER_SIZE, 0),	\
+  offset_arg = fold_convert (java_type_for_size (JAVA_POINTER_SIZE, 0),	\
 			     CALL_EXPR_ARG (orig_method_call, 2));	\
   value_arg = CALL_EXPR_ARG (orig_method_call, 3);			\
   value_type = TREE_TYPE (value_arg);					\
@@ -270,7 +270,7 @@ 
   tree orig_method_call = METHOD_CALL;					\
   this_arg = CALL_EXPR_ARG (orig_method_call, 0);			\
   obj_arg = CALL_EXPR_ARG (orig_method_call, 1);			\
-  offset_arg = fold_convert (java_type_for_size (POINTER_SIZE, 0),	\
+  offset_arg = fold_convert (java_type_for_size (JAVA_POINTER_SIZE, 0),	\
 			     CALL_EXPR_ARG (orig_method_call, 2));	\
   expected_arg = CALL_EXPR_ARG (orig_method_call, 3);			\
   value_arg = CALL_EXPR_ARG (orig_method_call, 4);			\
@@ -378,7 +378,7 @@ 
     int builtin;
 
     UNMARSHAL5 (orig_call);
-    builtin = (POINTER_SIZE == 32 
+    builtin = (JAVA_POINTER_SIZE == 32 
 	       ? BUILT_IN_BOOL_COMPARE_AND_SWAP_4 
 	       : BUILT_IN_BOOL_COMPARE_AND_SWAP_8);
 
Index: java/java-tree.h
===================================================================
--- java/java-tree.h	(revision 167235)
+++ java/java-tree.h	(working copy)
@@ -1516,4 +1516,12 @@ 
 
 extern FILE *finput;
 
+/* Frontends shouldn't use POINTER_SIZE, since that is a target macro.
+   We can't use TYPE_PRECISION (ptr_type_node), since that node isn't
+   available for java.
+   Luckily, sizetype is set with the precision of pointer_size (),
+   so we don't have to call pointer_size all the time once sizetype
+   has been set up.  */
+#define JAVA_POINTER_SIZE (TYPE_PRECISION (sizetype))
+
 #endif /* ! GCC_JAVA_TREE_H */
Index: java/boehm.c
===================================================================
--- java/boehm.c	(revision 167235)
+++ java/boehm.c	(working copy)
@@ -36,7 +36,8 @@ 
 #include "toplev.h"
 
 static void mark_reference_fields (tree, double_int *, unsigned int,
-				   int *, int *, int *, HOST_WIDE_INT *);
+				   int *, int *, int *, HOST_WIDE_INT *,
+				   unsigned int);
 
 /* A procedure-based object descriptor.  We know that our
    `kind' is 0, and `env' is likewise 0, so we have a simple
@@ -54,7 +55,8 @@ 
 		       int *pointer_after_end,
 		       int *all_bits_set,
 		       int *last_set_index,
-		       HOST_WIDE_INT *last_view_index)
+		       HOST_WIDE_INT *last_view_index,
+		       unsigned int log2_size)
 {
   /* See if we have fields from our superclass.  */
   if (DECL_NAME (field) == NULL_TREE)
@@ -62,7 +64,7 @@ 
       mark_reference_fields (TYPE_FIELDS (TREE_TYPE (field)),
 			     mask, ubit,
 			     pointer_after_end, all_bits_set,
-			     last_set_index, last_view_index);
+			     last_set_index, last_view_index, log2_size);
       field = DECL_CHAIN (field);
     }
 
@@ -90,15 +92,15 @@ 
 	     we already covered, then we are doomed.  */
 	  gcc_assert (offset > *last_view_index);
 
-	  if (offset % (HOST_WIDE_INT) (POINTER_SIZE / BITS_PER_UNIT))
+	  if (offset & ((1 << log2_size) - 1))
 	    {
 	      *all_bits_set = -1;
 	      *pointer_after_end = 1;
 	      break;
 	    }
 
-	  count = offset * BITS_PER_UNIT / POINTER_SIZE;
-	  size_words = size_bytes * BITS_PER_UNIT / POINTER_SIZE;
+	  count = offset >> log2_size;
+	  size_words = size_bytes >> log2_size;
 
 	  *last_set_index = count;
 	     
@@ -152,7 +154,7 @@ 
   if (int_size_in_bytes (type) == -1)
     goto procedure_object_descriptor;
 
-  bit = POINTER_SIZE / BITS_PER_UNIT;
+  bit = JAVA_POINTER_SIZE / BITS_PER_UNIT;
   /* The size of this node has to be known.  And, we only support 32
      and 64 bit targets, so we need to know that the log2 is one of
      our values.  */
@@ -175,7 +177,7 @@ 
   field = TYPE_FIELDS (type);
   mark_reference_fields (field, &mask, ubit,
 			 &pointer_after_end, &all_bits_set,
-			 &last_set_index, &last_view_index);
+			 &last_set_index, &last_view_index, log2_size);
 
   /* If the object is all pointers, or if the part with pointers fits
      in our bitmap, then we are ok.  Otherwise we have to allocate it
Index: target.h
===================================================================
--- target.h	(revision 167235)
+++ target.h	(working copy)
@@ -176,4 +176,8 @@ 
 /* Each target can provide their own.  */
 extern struct gcc_targetcm targetcm;
 
+/* Functions defined in targhooks.c that use target hooks and/or target
+   macros that make these values available to frontends / tree optimizers.  */
+extern unsigned pointer_size (void);
+
 #endif /* GCC_TARGET_H */
Index: cp/cvt.c
===================================================================
--- cp/cvt.c	(revision 167235)
+++ cp/cvt.c	(working copy)
@@ -221,9 +221,12 @@ 
 
   if (INTEGRAL_CODE_P (form))
     {
-      if (TYPE_PRECISION (intype) == POINTER_SIZE)
+      if (TYPE_PRECISION (intype) == TYPE_PRECISION (ptr_type_node))
 	return build1 (CONVERT_EXPR, type, expr);
-      expr = cp_convert (c_common_type_for_size (POINTER_SIZE, 0), expr);
+      expr
+	= cp_convert (c_common_type_for_size (TYPE_PRECISION (ptr_type_node),
+							      0),
+		      expr);
       /* Modes may be different but sizes should be the same.  There
 	 is supposed to be some integral type that is the same width
 	 as a pointer.  */
Index: ada/gcc-interface/decl.c
===================================================================
--- ada/gcc-interface/decl.c	(revision 167235)
+++ ada/gcc-interface/decl.c	(working copy)
@@ -396,7 +396,7 @@ 
 	  if (IN (kind, Float_Kind))
 	    max_esize = fp_prec_to_size (LONG_DOUBLE_TYPE_SIZE);
 	  else if (IN (kind, Access_Kind))
-	    max_esize = POINTER_SIZE * 2;
+	    max_esize = pointer_size () * 2;
 	  else
 	    max_esize = LONG_LONG_TYPE_SIZE;
 
@@ -3714,7 +3714,7 @@ 
 	      = TYPE_IS_FAT_POINTER_P (gnu_type)
 		? TYPE_UNCONSTRAINED_ARRAY (gnu_type) : TREE_TYPE (gnu_type);
 
-	    if (esize == POINTER_SIZE
+	    if (esize == pointer_size ()
 		&& (got_fat_p || TYPE_IS_FAT_POINTER_P (gnu_type)))
 	      gnu_type
 		= build_pointer_type
@@ -4853,7 +4853,7 @@ 
 	    {
 	      /* In this mode, the tag and the parent components are not
 		 generated by the front-end so the sizes must be adjusted.  */
-	      tree pointer_size = bitsize_int (POINTER_SIZE), offset;
+	      tree pointer_size_t = bitsize_int (pointer_size ()), offset;
 	      Uint uint_size;
 
 	      if (Is_Derived_Type (gnat_entity))
@@ -4864,13 +4864,13 @@ 
 				 Alignment (Etype (Base_Type (gnat_entity))));
 		}
 	      else
-		offset = pointer_size;
+		offset = pointer_size_t;
 
 	      gnu_size = size_binop (PLUS_EXPR, gnu_size, offset);
-	      gnu_size = size_binop (MULT_EXPR, pointer_size,
+	      gnu_size = size_binop (MULT_EXPR, pointer_size_t,
 						size_binop (CEIL_DIV_EXPR,
 							    gnu_size,
-							    pointer_size));
+							    pointer_size_t));
 	      uint_size = annotate_value (gnu_size);
 	      Set_Esize (gnat_entity, uint_size);
 	      Set_RM_Size (gnat_entity, uint_size);
@@ -5107,7 +5107,7 @@ 
 finish_fat_pointer_type (tree record_type, tree field_list)
 {
   /* Make sure we can put it into a register.  */
-  TYPE_ALIGN (record_type) = MIN (BIGGEST_ALIGNMENT, 2 * POINTER_SIZE);
+  TYPE_ALIGN (record_type) = MIN (BIGGEST_ALIGNMENT, 2 * pointer_size ());
 
   /* Show what it really is.  */
   TYPE_FAT_POINTER_P (record_type) = 1;
@@ -5393,7 +5393,7 @@ 
   /* Fat pointers are passed as thin pointers for foreign conventions.  */
   else if (foreign && TYPE_IS_FAT_POINTER_P (gnu_param_type))
     gnu_param_type
-      = make_type_from_size (gnu_param_type, size_int (POINTER_SIZE), 0);
+      = make_type_from_size (gnu_param_type, size_int (pointer_size ()), 0);
 
   /* If we must pass or were requested to pass by reference, do so.
      If we were requested to pass by copy, do so.
@@ -7520,7 +7520,7 @@ 
 		    = UI_To_gnu (Esize (Etype (Base_Type (gnat_entity))),
 				 bitsizetype);
 		else
-		  parent_offset = bitsize_int (POINTER_SIZE);
+		  parent_offset = bitsize_int (pointer_size ());
 	      }
 	    else
 	      parent_offset = bitsize_zero_node;
@@ -7959,7 +7959,7 @@ 
     case RECORD_TYPE:
       /* Do something if this is a fat pointer, in which case we
 	 may need to return the thin pointer.  */
-      if (TYPE_FAT_POINTER_P (type) && size < POINTER_SIZE * 2)
+      if (TYPE_FAT_POINTER_P (type) && size < pointer_size () * 2)
 	{
 	  enum machine_mode p_mode = mode_for_size (size, MODE_INT, 0);
 	  if (!targetm.valid_pointer_mode (p_mode))
@@ -7974,7 +7974,7 @@ 
     case POINTER_TYPE:
       /* Only do something if this is a thin pointer, in which case we
 	 may need to return the fat pointer.  */
-      if (TYPE_IS_THIN_POINTER_P (type) && size >= POINTER_SIZE * 2)
+      if (TYPE_IS_THIN_POINTER_P (type) && size >= pointer_size () * 2)
 	return
 	  build_pointer_type (TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (type)));
       break;
Index: ada/gcc-interface/targtyps.c
===================================================================
--- ada/gcc-interface/targtyps.c	(revision 167235)
+++ ada/gcc-interface/targtyps.c	(working copy)
@@ -31,6 +31,7 @@ 
 #include "tree.h"
 #include "tm.h"
 #include "tm_p.h"
+#include "target.h"
 
 #include "ada.h"
 #include "types.h"
@@ -131,7 +132,7 @@ 
 Pos
 get_target_pointer_size (void)
 {
-  return POINTER_SIZE;
+  return pointer_size ();
 }
 
 /* Alignment related values, mapped to attributes for functional and
Index: ada/gcc-interface/utils2.c
===================================================================
--- ada/gcc-interface/utils2.c	(revision 167235)
+++ ada/gcc-interface/utils2.c	(working copy)
@@ -32,6 +32,7 @@ 
 #include "ggc.h"
 #include "output.h"
 #include "tree-inline.h"
+#include "target.h"
 
 #include "ada.h"
 #include "types.h"
@@ -1941,7 +1942,7 @@ 
     = ((data_align > default_allocator_alignment)
        ? make_aligning_type (data_type, data_align, data_size,
 			     default_allocator_alignment,
-			     POINTER_SIZE / BITS_PER_UNIT)
+			     pointer_size () / BITS_PER_UNIT)
        : NULL_TREE);
 
   tree size_to_malloc
@@ -1952,7 +1953,7 @@ 
   /* On VMS, if pointers are 64-bit and the allocator size is 32-bit or
      Convention C, allocate 32-bit memory.  */
   if (TARGET_ABI_OPEN_VMS
-      && POINTER_SIZE == 64
+      && pointer_size () == 64
       && Nkind (gnat_node) == N_Allocator
       && (UI_To_Int (Esize (Etype (gnat_node))) == 32
           || Convention (Etype (gnat_node)) == Convention_C))
@@ -1984,7 +1985,7 @@ 
       tree storage_ptr_slot_addr
 	= build_binary_op (POINTER_PLUS_EXPR, ptr_void_type_node,
 			   convert (ptr_void_type_node, aligning_field_addr),
-			   size_int (-(HOST_WIDE_INT) POINTER_SIZE
+			   size_int (-(HOST_WIDE_INT) pointer_size ()
 				     / BITS_PER_UNIT));
 
       tree storage_ptr_slot
@@ -2026,7 +2027,7 @@ 
 	= build_binary_op
 	  (POINTER_PLUS_EXPR, ptr_void_type_node,
 	   convert (ptr_void_type_node, data_ptr),
-	   size_int (-(HOST_WIDE_INT) POINTER_SIZE / BITS_PER_UNIT));
+	   size_int (-(HOST_WIDE_INT) pointer_size () / BITS_PER_UNIT));
 
       /* FREE_PTR (void *) = *(void **)DATA_FRONT_PTR  */
       free_ptr
Index: fortran/trans-types.c
===================================================================
--- fortran/trans-types.c	(revision 167235)
+++ fortran/trans-types.c	(working copy)
@@ -566,7 +566,7 @@ 
   gfc_character_storage_size = gfc_default_character_kind * 8;
 
   /* Choose the integer kind the same size as "void*" for our index kind.  */
-  gfc_index_integer_kind = POINTER_SIZE / 8;
+  gfc_index_integer_kind = pointer_size () / 8;
   /* Pick a kind the same size as the C "int" type.  */
   gfc_c_int_kind = INT_TYPE_SIZE / 8;
 
Index: fortran/f95-lang.c
===================================================================
--- fortran/f95-lang.c	(revision 167235)
+++ fortran/f95-lang.c	(working copy)
@@ -583,7 +583,7 @@ 
      want double_type_node to actually have double precision.  */
   build_common_tree_nodes (false);
 
-  size_type_node = gfc_build_uint_type (POINTER_SIZE);
+  size_type_node = gfc_build_uint_type (pointer_size ());
   set_sizetype (size_type_node);
 
   build_common_tree_nodes_2 (0);
Index: lto/lto-object.c
===================================================================
--- lto/lto-object.c	(revision 167235)
+++ lto/lto-object.c	(working copy)
@@ -325,7 +325,7 @@ 
 	      && lo->sobj_w != NULL
 	      && lo->section == NULL);
 
-  align = exact_log2 (POINTER_SIZE / BITS_PER_UNIT);
+  align = exact_log2 (pointer_size () / BITS_PER_UNIT);
   lo->section = simple_object_write_create_section (lo->sobj_w, name, align,
 						    &errmsg, &err);
   if (lo->section == NULL)