From 52d6bee4af7c047290440bcef095b2b11b5280f4 Mon Sep 17 00:00:00 2001 From: nickc Date: Thu, 1 Jul 2004 08:47:16 +0000 Subject: [PATCH] * 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. * 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 | 9 +++++++++ gcc/cp/ChangeLog | 6 ++++++ gcc/cp/decl2.c | 4 ++++ gcc/doc/tm.texi | 9 +++++++++ gcc/target-def.h | 7 ++++++- gcc/target.h | 3 +++ 6 files changed, 37 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 91d96cc2455..02e841262c9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2004-07-01 Nick Clifton + + * 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 * builtins.c (fold_builtin_classify): Fix typo. diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2e89bcc0ff8..c8f935823cf 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2004-07-01 Nick Clifton + + * 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. diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index f3ecc3e5dcc..191888e1b87 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -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); diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 5f325815d14..a5455b00baf 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -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 diff --git a/gcc/target-def.h b/gcc/target-def.h index fbc84b6d421..905879441c5 100644 --- a/gcc/target-def.h +++ b/gcc/target-def.h @@ -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. */ diff --git a/gcc/target.h b/gcc/target.h index 300ef57063d..fd58fecba90 100644 --- a/gcc/target.h +++ b/gcc/target.h @@ -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. */ -- 2.11.4.GIT