summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2001-05-12 10:41:21 +0000
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2001-05-12 10:41:21 +0000
commit3aba38cc0710497d00193289e97efac937bb545a (patch)
tree85d31d3c38b3d8227bcdae0fdb074c5fbcdf205a /gcc
parentd75b8a6881a6a4cf009cf42d15035e95625272ff (diff)
downloadgcc-3aba38cc0710497d00193289e97efac937bb545a.tar.gz
* defaults.h (TARGET_PTRMEMFUNC_VBIT_LOCATION): Define.
* tm.texi (TARGET_PRTMEMFUNC_VBIT_LOCATION): Document. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@41989 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/defaults.h11
-rw-r--r--gcc/tm.texi39
3 files changed, 55 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cd72d9006e6..748847f68bc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2001-05-12 Alexandre Oliva <aoliva@redhat.com>
+
+ * defaults.h (TARGET_PTRMEMFUNC_VBIT_LOCATION): Define.
+ * tm.texi (TARGET_PRTMEMFUNC_VBIT_LOCATION): Document.
+
2001-05-11 Richard Henderson <rth@redhat.com>
* defaults.h (ASM_PREFERRED_EH_DATA_FORMAT): New.
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 9ec2af1a5ab..45fb088785f 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -325,5 +325,16 @@ do { \
#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) DW_EH_PE_absptr
#endif
+/* By default, the C++ compiler will use the lowest bit of the pointer
+ to function to indicate a pointer-to-member-function points to a
+ virtual member function. However, if FUNCTION_BOUNDARY indicates
+ function addresses aren't always even, the lowest bit of the delta
+ field will be used. */
+#ifndef TARGET_PTRMEMFUNC_VBIT_LOCATION
+#define TARGET_PTRMEMFUNC_VBIT_LOCATION \
+ (FUNCTION_BOUNDARY >= 2 * BITS_PER_UNIT \
+ ? ptrmemfunc_vbit_in_pfn : ptrmemfunc_vbit_in_delta)
+#endif
+
#endif /* GCC_DEFAULTS_H */
diff --git a/gcc/tm.texi b/gcc/tm.texi
index 1a1ad21238b..8f1c314d790 100644
--- a/gcc/tm.texi
+++ b/gcc/tm.texi
@@ -1451,6 +1451,45 @@ label.
On certain machines, it is important to have a separate label for each
selector because this enables the linker to eliminate duplicate selectors.
+@findex TARGET_PTRMEMFUNC_VBIT_LOCATION
+@item TARGET_PTRMEMFUNC_VBIT_LOCATION
+The C++ compiler represents a pointer-to-member-function with a struct
+that looks like:
+
+@example
+ struct @{
+ union @{
+ void (*fn)();
+ ptrdiff_t vtable_index;
+ @};
+ ptrdiff_t delta;
+ @};
+@end example
+
+@noindent
+The C++ compiler must use one bit to indicate whether the function that
+will be called through a pointer-to-member-function is virtual.
+Normally, we assume that the low-order bit of a function pointer must
+always be zero. Then, by ensuring that the vtable_index is odd, we can
+distinguish which variant of the union is in use. But, on some
+platforms function pointers can be odd, and so this doesn't work. In
+that case, we use the low-order bit of the @code{delta} field, and shift
+the remainder of the @code{delta} field to the left.
+
+GCC will automatically make the right selection about where to store
+this bit using the @code{FUNCTION_BOUNDARY} setting for your platform.
+However, some platforms such as ARM/Thumb have @code{FUNCTION_BOUNDARY}
+set such that functions always start at even addresses, but the lowest
+bit of pointers to functions indicate whether the function at that
+address is in ARM or Thumb mode. If this is the case of your
+architecture, you should define this macro to
+@code{ptrmemfunc_vbit_in_delta}.
+
+In general, you should not have to define this macro. On architectures
+in which function addresses are always even, according to
+@code{FUNCTION_BOUNDARY}, GCC will automatically define this macro to
+@code{ptrmemfunc_vbit_in_pfn}.
+
@findex TARGET_BELL
@item TARGET_BELL
A C constant expression for the integer value for escape sequence