diff mbox

[1/9] remove POINTER_SIZE_UNITS macro

Message ID 1437966615-21093-2-git-send-email-tbsaunde+gcc@tbsaunde.org
State New
Headers show

Commit Message

tbsaunde+gcc@tbsaunde.org July 27, 2015, 3:10 a.m. UTC
From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/lto/ChangeLog:

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

	* lto-object.c (lto_obj_begin_section): Call pointer_size_units ().

gcc/c-family/ChangeLog:

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

	* c-cppbuiltin.c (cpp_atomic_builtins): Call pointer_size_units ().

gcc/ChangeLog:

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

	* defaults.h (POINTER_SIZE_UNITS): Remove.
	* dwarf2asm.c (size_of_encoded_value): Adjust.
	(dw2_output_indirect_constant_1): Likewise.
	* stor-layout.c (layout_type): Likewise.
	* target.h (pointer_size_units): New function.
	* varasm.c (assemble_addr_to_section): Adjust.
	(default_assemble_integer): Likewise.
	(dump_tm_clone_pairs): Likewise.
---
 gcc/c-family/c-cppbuiltin.c | 2 +-
 gcc/defaults.h              | 3 ---
 gcc/dwarf2asm.c             | 4 ++--
 gcc/lto/lto-object.c        | 3 ++-
 gcc/stor-layout.c           | 2 +-
 gcc/target.h                | 8 ++++++++
 gcc/varasm.c                | 8 ++++----
 7 files changed, 18 insertions(+), 12 deletions(-)
diff mbox

Patch

diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c
index 1beb2db..73ec8eb 100644
--- a/gcc/c-family/c-cppbuiltin.c
+++ b/gcc/c-family/c-cppbuiltin.c
@@ -674,7 +674,7 @@  cpp_atomic_builtins (cpp_reader *pfile)
 
   /* 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  or pch.  */
-  psize = POINTER_SIZE_UNITS;
+  psize = pointer_size_units ();
   if (psize >= SWAP_LIMIT)
     psize = 0;
   builtin_define_with_int_value ("__GCC_ATOMIC_POINTER_LOCK_FREE", 
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 9d38ba1..1dd965b 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -771,9 +771,6 @@  see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #ifndef POINTER_SIZE
 #define POINTER_SIZE BITS_PER_WORD
 #endif
-#ifndef POINTER_SIZE_UNITS
-#define POINTER_SIZE_UNITS ((POINTER_SIZE + BITS_PER_UNIT - 1) / BITS_PER_UNIT)
-#endif
 
 
 #ifndef PIC_OFFSET_TABLE_REGNUM
diff --git a/gcc/dwarf2asm.c b/gcc/dwarf2asm.c
index 9f3c4b1..b63f82e 100644
--- a/gcc/dwarf2asm.c
+++ b/gcc/dwarf2asm.c
@@ -385,7 +385,7 @@  size_of_encoded_value (int encoding)
   switch (encoding & 0x07)
     {
     case DW_EH_PE_absptr:
-      return POINTER_SIZE_UNITS;
+      return pointer_size_units ();
     case DW_EH_PE_udata2:
       return 2;
     case DW_EH_PE_udata4:
@@ -902,7 +902,7 @@  dw2_output_indirect_constant_1 (const char *sym, tree id)
 
   sym_ref = gen_rtx_SYMBOL_REF (Pmode, sym);
   assemble_variable (decl, 1, 1, 1);
-  assemble_integer (sym_ref, POINTER_SIZE_UNITS, POINTER_SIZE, 1);
+  assemble_integer (sym_ref, pointer_size_units (), POINTER_SIZE, 1);
 
   return 0;
 }
diff --git a/gcc/lto/lto-object.c b/gcc/lto/lto-object.c
index 087c6b1..198a585 100644
--- a/gcc/lto/lto-object.c
+++ b/gcc/lto/lto-object.c
@@ -37,6 +37,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "cgraph.h"
 #include "lto-section-names.h"
 #include "simple-object.h"
+#include "target.h"
 
 /* An LTO file wrapped around an simple_object.  */
 
@@ -340,7 +341,7 @@  lto_obj_begin_section (const char *name)
 	      && lo->sobj_w != NULL
 	      && lo->section == NULL);
 
-  align = ceil_log2 (POINTER_SIZE_UNITS);
+  align = ceil_log2 (pointer_size_units ());
   lo->section = simple_object_write_create_section (lo->sobj_w, name, align,
 						    &errmsg, &err);
   if (lo->section == NULL)
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 0d4f4a4..160ffe2 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -2229,7 +2229,7 @@  layout_type (tree type)
 
     case OFFSET_TYPE:
       TYPE_SIZE (type) = bitsize_int (POINTER_SIZE);
-      TYPE_SIZE_UNIT (type) = size_int (POINTER_SIZE_UNITS);
+      TYPE_SIZE_UNIT (type) = size_int (pointer_size_units ());
       /* A pointer might be MODE_PARTIAL_INT, but ptrdiff_t must be
 	 integral, which may be an __intN.  */
       SET_TYPE_MODE (type, mode_for_size (POINTER_SIZE, MODE_INT, 0));
diff --git a/gcc/target.h b/gcc/target.h
index a79f424..6715b07 100644
--- a/gcc/target.h
+++ b/gcc/target.h
@@ -219,4 +219,12 @@  pack_cumulative_args (CUMULATIVE_ARGS *arg)
 }
 #endif /* GCC_TM_H */
 
+/* Return the width of a pointer in units.  */
+
+inline unsigned int
+pointer_size_units ()
+{
+  return (POINTER_SIZE + BITS_PER_UNIT - 1) /  BITS_PER_UNIT;
+}
+
 #endif /* GCC_TARGET_H */
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 6a4ba0b..8cb2ec9 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -1544,7 +1544,7 @@  assemble_addr_to_section (rtx symbol, section *sec)
 {
   switch_to_section (sec);
   assemble_align (POINTER_SIZE);
-  assemble_integer (symbol, POINTER_SIZE_UNITS, POINTER_SIZE, 1);
+  assemble_integer (symbol, pointer_size_units (), POINTER_SIZE, 1);
 }
 
 /* Return the numbered .ctors.N (if CONSTRUCTOR_P) or .dtors.N (if
@@ -2732,7 +2732,7 @@  default_assemble_integer (rtx x ATTRIBUTE_UNUSED,
   const char *op = integer_asm_op (size, aligned_p);
   /* Avoid GAS bugs for large values.  Specifically negative values whose
      absolute value fits in a bfd_vma, but not in a bfd_signed_vma.  */
-  if (size > UNITS_PER_WORD && size > POINTER_SIZE_UNITS)
+  if (size > UNITS_PER_WORD && size > pointer_size_units ())
     return false;
   return op && (assemble_integer_with_op (op, x), true);
 }
@@ -5875,9 +5875,9 @@  dump_tm_clone_pairs (vec<tm_alias_pair> tm_alias_pairs)
 	}
 
       assemble_integer (XEXP (DECL_RTL (src), 0),
-			POINTER_SIZE_UNITS, POINTER_SIZE, 1);
+			pointer_size_units (), POINTER_SIZE, 1);
       assemble_integer (XEXP (DECL_RTL (dst), 0),
-			POINTER_SIZE_UNITS, POINTER_SIZE, 1);
+			pointer_size_units (), POINTER_SIZE, 1);
     }
 }