* target.h (struct gcc_target): Add new field to struct cxx: import_export_class.
authornickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 1 Jul 2004 08:47:16 +0000 (08:47 +0000)
committernickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 1 Jul 2004 08:47:16 +0000 (08:47 +0000)
* target-def.h (TARGET_CXX): Initialise the new field.
  (TARGET_CXX_IMPORT_EXPORT_CLASS): Provide a default value for the new field.
* doc/tm.texi: Document the new target hook.
* decl2.c (import_export_class): Invoke the import_export_class field in the
  gcc_target structure if it is not empty.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@83964 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/doc/tm.texi
gcc/target-def.h
gcc/target.h

index 91d96cc..02e8412 100644 (file)
@@ -1,3 +1,12 @@
+2004-07-01  Nick Clifton  <nickc@redhat.com>
+
+       * target.h (struct gcc_target): Add new field to struct cxx:
+       import_export_class.
+        * target-def.h (TARGET_CXX): Initialise the new field.
+        (TARGET_CXX_IMPORT_EXPORT_CLASS): Provide a default value for
+       the new field.  
+        * doc/tm.texi: Document the new target hook.
+
 2004-07-01  Paolo Bonzini  <bonzini@gnu.org>
 
        * builtins.c (fold_builtin_classify): Fix typo.
index 2e89bcc..c8f9358 100644 (file)
@@ -1,3 +1,9 @@
+2004-07-01  Nick Clifton  <nickc@redhat.com>
+
+       * decl2.c (import_export_class): Invoke the
+       import_export_class field in the gcc_target structure if it is not
+       empty.
+
 2004-06-30  Richard Henderson  (rth@redhat.com>
 
        * decl.c (start_preparsed_function): Don't set immediate_size_expand.
index f3ecc3e..191888e 100644 (file)
@@ -1510,6 +1510,10 @@ import_export_class (tree ctype)
     import_export = 0;
 #endif
 
+  /* Allow backends the chance to overrule the decision.  */
+  if (targetm.cxx.import_export_class)
+    import_export = targetm.cxx.import_export_class (ctype, import_export);
+
   if (import_export)
     {
       SET_CLASSTYPE_INTERFACE_KNOWN (ctype);
index 5f32581..a5455b0 100644 (file)
@@ -8495,6 +8495,15 @@ This hook should return @code{true} if the element size should be stored in
 array cookies.  The default is to return @code{false}.
 @end deftypefn
 
+@deftypefn {Target Hook} int TARGET_CXX_IMPORT_EXPORT_CLASS (tree  @var{type}, int @var{import_export})
+If defined by a backend this hook allows the decision made to export
+class @var{type} to be overruled.  Upon entry @var{import_export}
+will contain 1 if the class is going to be exported, -1 if it is going
+to be imported and 0 otherwise.  This function should return the
+modified value and perform any other actions necessary to support the
+backend's targeted operating system.
+@end deftypefn
+
 @node Misc
 @section Miscellaneous Parameters
 @cindex parameters, miscellaneous
index fbc84b6..9058794 100644 (file)
@@ -410,12 +410,17 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #define TARGET_CXX_COOKIE_HAS_SIZE hook_bool_void_false
 #endif
 
+#ifndef TARGET_CXX_IMPORT_EXPORT_CLASS
+#define TARGET_CXX_IMPORT_EXPORT_CLASS NULL
+#endif
+
 #define TARGET_CXX             \
   {                            \
     TARGET_CXX_GUARD_TYPE,     \
     TARGET_CXX_GUARD_MASK_BIT, \
     TARGET_CXX_GET_COOKIE_SIZE,        \
-    TARGET_CXX_COOKIE_HAS_SIZE \
+    TARGET_CXX_COOKIE_HAS_SIZE,        \
+    TARGET_CXX_IMPORT_EXPORT_CLASS     \
   }
 
 /* The whole shebang.  */
index 300ef57..fd58fec 100644 (file)
@@ -487,6 +487,9 @@ struct gcc_target
     /* Returns true if the element size should be stored in the
        array cookie.  */
     bool (*cookie_has_size) (void);
+    /* Allows backends to perform additional processing when
+       deciding if a class should be exported or imported.  */
+    int (*import_export_class) (tree, int);
   } cxx;
 
   /* Leave the boolean fields at the end.  */