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

gcc/ChangeLog:

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

        * doc/tm.texi: Regenerate.
        * doc/tm.texi.in: Adjust.
        * target.def (pointer_size): New hook.
        * targhooks.c (default_pointer_size): New function.
        * targhooks.h (default_pointer_size): New function.
---
 gcc/doc/tm.texi    | 7 +++++++
 gcc/doc/tm.texi.in | 2 ++
 gcc/target.def     | 8 ++++++++
 gcc/targhooks.c    | 8 ++++++++
 gcc/targhooks.h    | 1 +
 5 files changed, 26 insertions(+)

diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index f95646c..34cc8f6 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -907,6 +907,13 @@ you must define @code{POINTERS_EXTEND_UNSIGNED}.  If you 
do not specify
 a value the default is @code{BITS_PER_WORD}.
 @end defmac
 
+@deftypefn {Target Hook} {unsigned int} TARGET_POINTER_SIZE ()
+Width of a pointer, in bits.  You must specify a value no wider than the
+ width of @code{Pmode}.  If it is not equal to the width of @code{Pmode},
+ you must define @code{POINTERS_EXTEND_UNSIGNED}.  If you do not specify
+ a value the default is @code{BITS_PER_WORD}.
+@end deftypefn
+
 @defmac POINTERS_EXTEND_UNSIGNED
 A C expression that determines how pointers should be extended from
 @code{ptr_mode} to either @code{Pmode} or @code{word_mode}.  It is
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 2383fb9..ca08f11 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -881,6 +881,8 @@ you must define @code{POINTERS_EXTEND_UNSIGNED}.  If you do 
not specify
 a value the default is @code{BITS_PER_WORD}.
 @end defmac
 
+@hook TARGET_POINTER_SIZE
+
 @defmac POINTERS_EXTEND_UNSIGNED
 A C expression that determines how pointers should be extended from
 @code{ptr_mode} to either @code{Pmode} or @code{word_mode}.  It is
diff --git a/gcc/target.def b/gcc/target.def
index 4edc209..2e247e0 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -5716,6 +5716,14 @@ DEFHOOK
  void, (tree *hold, tree *clear, tree *update),
  default_atomic_assign_expand_fenv)
 
+DEFHOOK
+(pointer_size,
+"Width of a pointer, in bits.  You must specify a value no wider than the\n\
+ width of @code{Pmode}.  If it is not equal to the width of @code{Pmode},\n\
+ you must define @code{POINTERS_EXTEND_UNSIGNED}.  If you do not specify\n\
+ a value the default is @code{BITS_PER_WORD}.",
+unsigned int, (), default_pointer_size)
+
 /* Leave the boolean fields at the end.  */
 
 /* True if we can create zeroed data by switching to a BSS section
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index 3eca47e..19272c4 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -1926,4 +1926,12 @@ can_use_doloop_if_innermost (const widest_int &, const 
widest_int &,
   return loop_depth == 1;
 }
 
+/* Default implementation of TARGET_POINTER_SIZE.  */
+
+unsigned int
+default_pointer_size ()
+{
+  return POINTER_SIZE;
+}
+
 #include "gt-targhooks.h"
diff --git a/gcc/targhooks.h b/gcc/targhooks.h
index 5ae991d..6782d37 100644
--- a/gcc/targhooks.h
+++ b/gcc/targhooks.h
@@ -240,4 +240,5 @@ extern void default_setup_incoming_vararg_bounds 
(cumulative_args_t ca ATTRIBUTE
                                                  tree type ATTRIBUTE_UNUSED,
                                                  int *pretend_arg_size 
ATTRIBUTE_UNUSED,
                                                  int second_time 
ATTRIBUTE_UNUSED);
+extern unsigned int default_pointer_size ();
 #endif /* GCC_TARGHOOKS_H */
-- 
2.4.0

Reply via email to