This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[RFC] Preliminary target abstraction patch


This is an initial version of a patch to get the target framework in
place.  It puts 4 functions into a "gcc_target" structure, with an
external instance of that structure called "target".  arm is the most
interesting target - 3 of the 4 are overridden.

It will probably need some Makefile.in adjustments, so that a proper
dependency on target.h and target-def.h exists in the relevant files.
It has not been properly tested - I'm working on that.

So, I'm just looking for confirmation that this is what we all had it
mind, and any improvements / suggestions (though I would ask that
minor things wait until we've got the patch in - making small
refinements on something where so much is out of CVS is painful).

The patch has the nice property of reducing the size of config/*/*.h
files, and reducing the number of global functions.

Thanks,

Neil.

============================================================
Index: gcc/c-decl.c
--- gcc/c-decl.c	2001/06/12 12:15:43	1.232
+++ gcc/c-decl.c	2001/06/21 06:13:13
@@ -41,6 +41,7 @@ Boston, MA 02111-1307, USA.  */
 #include "ggc.h"
 #include "tm_p.h"
 #include "cpplib.h"
+#include "target.h"
 
 /* In grokdeclarator, distinguish syntactic contexts of declarators.  */
 enum decl_context
@@ -1403,7 +1404,7 @@ duplicate_decls (newdecl, olddecl, diffe
 
   if (DECL_P (olddecl))
     DECL_MACHINE_ATTRIBUTES (newdecl)
-      = merge_machine_decl_attributes (olddecl, newdecl);
+      = (*target.merge_decl_attributes) (olddecl, newdecl);
 
   if (TREE_CODE (newtype) == ERROR_MARK
       || TREE_CODE (oldtype) == ERROR_MARK)
============================================================
Index: gcc/c-typeck.c
--- gcc/c-typeck.c	2001/06/12 12:15:43	1.125
+++ gcc/c-typeck.c	2001/06/21 06:13:29
@@ -41,6 +41,7 @@ Boston, MA 02111-1307, USA.  */
 #include "toplev.h"
 #include "intl.h"
 #include "ggc.h"
+#include "target.h"
 
 /* Nonzero if we've already printed a "missing braces around initializer"
    message within this initializer.  */
@@ -205,7 +206,7 @@ common_type (t1, t2)
     return t1;
 
   /* Merge the attributes.  */
-  attributes = merge_machine_type_attributes (t1, t2);
+  attributes = (*target.merge_type_attributes) (t1, t2);
 
   /* Treat an enum type as the unsigned integer type of the same width.  */
 
============================================================
Index: gcc/tree.c
--- gcc/tree.c	2001/06/04 13:21:38	1.196
+++ gcc/tree.c	2001/06/21 06:13:39
@@ -2706,124 +2706,119 @@ build_type_attribute_variant (ttype, att
   return ttype;
 }
 
-/* Return a 1 if ATTR_NAME and ATTR_ARGS is valid for either declaration DECL
-   or type TYPE and 0 otherwise.  Validity is determined the configuration
-   macros VALID_MACHINE_DECL_ATTRIBUTE and VALID_MACHINE_TYPE_ATTRIBUTE.  */
+/* Return 1 if ATTR_NAME and ATTR_ARGS is valid for either declaration
+   DECL or type TYPE and 0 otherwise.  Validity is determined the
+   target functions valid_decl_attribute and valid_machine_attribute.  */
 
 int
 valid_machine_attribute (attr_name, attr_args, decl, type)
-  tree attr_name;
-  tree attr_args ATTRIBUTE_UNUSED;
-  tree decl ATTRIBUTE_UNUSED;
-  tree type ATTRIBUTE_UNUSED;
+     tree attr_name;
+     tree attr_args;
+     tree decl;
+     tree type;
 {
-  int validated = 0;
-#ifdef VALID_MACHINE_DECL_ATTRIBUTE
-  tree decl_attr_list = decl != 0 ? DECL_MACHINE_ATTRIBUTES (decl) : 0;
-#endif
-#ifdef VALID_MACHINE_TYPE_ATTRIBUTE
-  tree type_attr_list = TYPE_ATTRIBUTES (type);
-#endif
-
   if (TREE_CODE (attr_name) != IDENTIFIER_NODE)
     abort ();
 
-#ifdef VALID_MACHINE_DECL_ATTRIBUTE
-  if (decl != 0
-      && VALID_MACHINE_DECL_ATTRIBUTE (decl, decl_attr_list, attr_name,
-				       attr_args))
+  if (decl && target.valid_decl_attribute != NULL)
     {
-      tree attr = lookup_attribute (IDENTIFIER_POINTER (attr_name),
-				    decl_attr_list);
+      tree decl_attrs = DECL_MACHINE_ATTRIBUTES (decl);
 
-      if (attr != NULL_TREE)
-	{
-	  /* Override existing arguments.  Declarations are unique so we can
-	     modify this in place.  */
-	  TREE_VALUE (attr) = attr_args;
-	}
-      else
+      if ((*target.valid_decl_attribute) (decl, decl_attrs, attr_name,
+					  attr_args))
 	{
-	  decl_attr_list = tree_cons (attr_name, attr_args, decl_attr_list);
-	  decl = build_decl_attribute_variant (decl, decl_attr_list);
-	}
+	  tree attr = lookup_attribute (IDENTIFIER_POINTER (attr_name),
+					decl_attrs);
+
+	  if (attr != NULL_TREE)
+	    {
+	      /* Override existing arguments.  Declarations are unique
+		 so we can modify this in place.  */
+	      TREE_VALUE (attr) = attr_args;
+	    }
+	  else
+	    {
+	      decl_attrs = tree_cons (attr_name, attr_args, decl_attrs);
+	      decl = build_decl_attribute_variant (decl, decl_attrs);
+	    }
 
-      validated = 1;
+	  /* Don't apply the attribute to both the decl and the type.  */
+	  return 1;
+	}
     }
-#endif
 
-#ifdef VALID_MACHINE_TYPE_ATTRIBUTE
-  if (validated)
-    /* Don't apply the attribute to both the decl and the type.  */
-    ;
-  else if (VALID_MACHINE_TYPE_ATTRIBUTE (type, type_attr_list, attr_name,
-					 attr_args))
+  if (target.valid_type_attribute != NULL)
     {
-      tree attr = lookup_attribute (IDENTIFIER_POINTER (attr_name),
-				    type_attr_list);
+      tree type_attrs = TYPE_ATTRIBUTES (type);
 
-      if (attr != NULL_TREE)
-	{
-	  /* Override existing arguments.
-	     ??? This currently works since attribute arguments are not
-	     included in `attribute_hash_list'.  Something more complicated
-	     may be needed in the future.  */
-	  TREE_VALUE (attr) = attr_args;
-	}
-      else
+      if ((*target.valid_type_attribute) (type, type_attrs, attr_name,
+					  attr_args))
 	{
-	  /* If this is part of a declaration, create a type variant,
-	     otherwise, this is part of a type definition, so add it
-	     to the base type.  */
-	  type_attr_list = tree_cons (attr_name, attr_args, type_attr_list);
-	  if (decl != 0)
-	    type = build_type_attribute_variant (type, type_attr_list);
-	  else
-	    TYPE_ATTRIBUTES (type) = type_attr_list;
-	}
+	  tree attr = lookup_attribute (IDENTIFIER_POINTER (attr_name),
+					type_attrs);
 
-      if (decl != 0)
-	TREE_TYPE (decl) = type;
-
-      validated = 1;
-    }
+	  if (attr != NULL_TREE)
+	    {
+	      /* Override existing arguments.  ??? This currently
+		 works since attribute arguments are not included in
+		 `attribute_hash_list'.  Something more complicated
+		 may be needed in the future.  */
+	      TREE_VALUE (attr) = attr_args;
+	    }
+	  else
+	    {
+	      /* If this is part of a declaration, create a type variant,
+		 otherwise, this is part of a type definition, so add it
+		 to the base type.  */
+	      type_attrs = tree_cons (attr_name, attr_args, type_attrs);
+	      if (decl != 0)
+		type = build_type_attribute_variant (type, type_attrs);
+	      else
+		TYPE_ATTRIBUTES (type) = type_attrs;
+	    }
 
-  /* Handle putting a type attribute on pointer-to-function-type by putting
-     the attribute on the function type.  */
-  else if (POINTER_TYPE_P (type)
-	   && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE
-	   && VALID_MACHINE_TYPE_ATTRIBUTE (TREE_TYPE (type), type_attr_list,
-					    attr_name, attr_args))
-    {
-      tree inner_type = TREE_TYPE (type);
-      tree inner_attr_list = TYPE_ATTRIBUTES (inner_type);
-      tree attr = lookup_attribute (IDENTIFIER_POINTER (attr_name),
-				    type_attr_list);
+	  if (decl)
+	    TREE_TYPE (decl) = type;
 
-      if (attr != NULL_TREE)
-	TREE_VALUE (attr) = attr_args;
-      else
-	{
-	  inner_attr_list = tree_cons (attr_name, attr_args, inner_attr_list);
-	  inner_type = build_type_attribute_variant (inner_type,
-						     inner_attr_list);
+	  return 1;
 	}
 
-      if (decl != 0)
-	TREE_TYPE (decl) = build_pointer_type (inner_type);
-      else
+      /* Handle putting a type attribute on pointer-to-function-type
+	 by putting the attribute on the function type.  */
+      else if (POINTER_TYPE_P (type)
+	       && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE
+	       && (*target.valid_type_attribute) (TREE_TYPE (type), type_attrs,
+						  attr_name, attr_args))
 	{
-	  /* Clear TYPE_POINTER_TO for the old inner type, since
-	     `type' won't be pointing to it anymore.  */
-	  TYPE_POINTER_TO (TREE_TYPE (type)) = NULL_TREE;
-	  TREE_TYPE (type) = inner_type;
-	}
+	  tree inner_type = TREE_TYPE (type);
+	  tree inner_attrs = TYPE_ATTRIBUTES (inner_type);
+	  tree attr = lookup_attribute (IDENTIFIER_POINTER (attr_name),
+					type_attrs);
+
+	  if (attr != NULL_TREE)
+	    TREE_VALUE (attr) = attr_args;
+	  else
+	    {
+	      inner_attrs = tree_cons (attr_name, attr_args, inner_attrs);
+	      inner_type = build_type_attribute_variant (inner_type,
+							 inner_attrs);
+	    }
+
+	  if (decl)
+	    TREE_TYPE (decl) = build_pointer_type (inner_type);
+	  else
+	    {
+	      /* Clear TYPE_POINTER_TO for the old inner type, since
+		 `type' won't be pointing to it anymore.  */
+	      TYPE_POINTER_TO (TREE_TYPE (type)) = NULL_TREE;
+	      TREE_TYPE (type) = inner_type;
+	    }
 
-      validated = 1;
+	  return 1;
+	}
     }
-#endif
 
-  return validated;
+  return 0;
 }
 
 /* Return non-zero if IDENT is a valid name for attribute ATTR,
@@ -2938,34 +2933,83 @@ merge_attributes (a1, a2)
 }
 
 /* Given types T1 and T2, merge their attributes and return
-   the result.  */
+  the result.  */
 
 tree
-merge_machine_type_attributes (t1, t2)
+merge_type_attributes (t1, t2)
      tree t1, t2;
 {
-#ifdef MERGE_MACHINE_TYPE_ATTRIBUTES
-  return MERGE_MACHINE_TYPE_ATTRIBUTES (t1, t2);
-#else
   return merge_attributes (TYPE_ATTRIBUTES (t1),
 			   TYPE_ATTRIBUTES (t2));
-#endif
 }
 
 /* Given decls OLDDECL and NEWDECL, merge their attributes and return
    the result.  */
 
 tree
-merge_machine_decl_attributes (olddecl, newdecl)
+merge_decl_attributes (olddecl, newdecl)
      tree olddecl, newdecl;
 {
-#ifdef MERGE_MACHINE_DECL_ATTRIBUTES
-  return MERGE_MACHINE_DECL_ATTRIBUTES (olddecl, newdecl);
-#else
   return merge_attributes (DECL_MACHINE_ATTRIBUTES (olddecl),
 			   DECL_MACHINE_ATTRIBUTES (newdecl));
-#endif
 }
+
+#ifdef TARGET_DLLIMPORT_DECL_ATTRIBUTES
+
+/* Specialization of merge_decl_attributes for various Windows targets.
+
+   This handles the following situation:
+
+     __declspec (dllimport) int foo;
+     int foo;
+
+   The second instance of `foo' nullifies the dllimport.  */
+
+tree
+merge_dllimport_decl_attributes (old, new)
+     tree old;
+     tree new;
+{
+  tree a;
+  int delete_dllimport_p;
+
+  old = DECL_MACHINE_ATTRIBUTES (old);
+  new = DECL_MACHINE_ATTRIBUTES (new);
+
+  /* What we need to do here is remove from `old' dllimport if it doesn't
+     appear in `new'.  dllimport behaves like extern: if a declaration is
+     marked dllimport and a definition appears later, then the object
+     is not dllimport'd.  */
+  if (lookup_attribute ("dllimport", old) != NULL_TREE
+      && lookup_attribute ("dllimport", new) == NULL_TREE)
+    delete_dllimport_p = 1;
+  else
+    delete_dllimport_p = 0;
+
+  a = merge_attributes (old, new);
+
+  if (delete_dllimport_p)
+    {
+      tree prev,t;
+
+      /* Scan the list for dllimport and delete it.  */
+      for (prev = NULL_TREE, t = a; t; prev = t, t = TREE_CHAIN (t))
+	{
+	  if (is_attribute_p ("dllimport", TREE_PURPOSE (t)))
+	    {
+	      if (prev == NULL_TREE)
+		a = TREE_CHAIN (a);
+	      else
+		TREE_CHAIN (prev) = TREE_CHAIN (t);
+	      break;
+	    }
+	}
+    }
+
+  return a;
+}
+
+#endif /* TARGET_DLLIMPORT_DECL_ATTRIBUTES  */
 
 /* Set the type qualifiers for TYPE to TYPE_QUALS, which is a bitmask
    of the various TYPE_QUAL values.  */
============================================================
Index: gcc/tree.h
--- gcc/tree.h	2001/06/08 18:12:54	1.247
+++ gcc/tree.h	2001/06/21 06:13:48
@@ -2039,8 +2039,8 @@ extern tree make_tree			PARAMS ((tree, s
 extern tree build_type_attribute_variant PARAMS ((tree, tree));
 extern tree build_decl_attribute_variant PARAMS ((tree, tree));
 
-extern tree merge_machine_decl_attributes PARAMS ((tree, tree));
-extern tree merge_machine_type_attributes PARAMS ((tree, tree));
+extern tree merge_decl_attributes PARAMS ((tree, tree));
+extern tree merge_type_attributes PARAMS ((tree, tree));
 
 /* Split a list of declspecs and attributes into two.  */
 
@@ -2067,6 +2067,12 @@ extern tree lookup_attribute		PARAMS ((c
 /* Given two attributes lists, return a list of their union.  */
 
 extern tree merge_attributes		PARAMS ((tree, tree));
+
+#ifdef TARGET_DLLIMPORT_DECL_ATTRIBUTES
+/* Given two Windows decl attributes lists, possibly including
+   dllimport, return a list of their union .  */
+extern tree merge_dllimport_decl_attributes PARAMS ((tree, tree));
+#endif
 
 /* Return a version of the TYPE, qualified as indicated by the
    TYPE_QUALS, if one exists.  If no qualified version exists yet,
============================================================
Index: gcc/config/1750a/1750a.c
--- gcc/config/1750a/1750a.c	2000/05/01 17:17:55	1.8
+++ gcc/config/1750a/1750a.c	2001/06/21 06:13:51
@@ -33,6 +33,8 @@ Boston, MA 02111-1307, USA.  */
 #include "regs.h"
 #include "output.h"
 #include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
 
 struct datalabel_array datalbl[DATALBL_ARRSIZ];
 int datalbl_ndx = -1;
@@ -44,7 +46,11 @@ const char *const sectname[4] =
 {"Init", "Normal", "Konst", "Static"};
 
 static int which_bit PARAMS ((int));
+
+/* Initialize the GCC target structure.  */
 
+struct gcc_target target = TARGET_INITIALIZER;
+
 void
 notice_update_cc (exp)
      rtx exp;
============================================================
Index: gcc/config/a29k/a29k.c
--- gcc/config/a29k/a29k.c	2001/04/03 15:05:37	1.15
+++ gcc/config/a29k/a29k.c	2001/06/21 06:13:53
@@ -39,6 +39,8 @@ Boston, MA 02111-1307, USA.  */
 #include "tree.h"
 #include "reload.h"
 #include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
 
 static int shift_constant_operand PARAMS ((rtx, enum machine_mode, int));
 static void a29k_set_memflags_1 PARAMS ((rtx, int, int, int, int));
@@ -89,6 +91,10 @@ int a29k_debug_reg_map[FIRST_PSEUDO_REGI
 
 rtx a29k_compare_op0, a29k_compare_op1;
 int a29k_compare_fp_p;
+
+/* Initialize the GCC target structure.  */
+
+struct gcc_target target = TARGET_INITIALIZER;
 
 /* Returns 1 if OP is a 8-bit constant. */
 
============================================================
Index: gcc/config/alpha/alpha.c
--- gcc/config/alpha/alpha.c	2001/06/11 16:27:25	1.163
+++ gcc/config/alpha/alpha.c	2001/06/21 06:14:07
@@ -42,6 +42,8 @@ Boston, MA 02111-1307, USA.  */
 #include "toplev.h"
 #include "ggc.h"
 #include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
 
 /* External data.  */
 extern int rtx_equal_function_value_matters;
@@ -142,6 +144,10 @@ static rtx alpha_emit_xfloating_compare
 
 #define REG_PV 27
 #define REG_RA 26
+
+/* Initialize the GCC target structure.  */
+
+struct gcc_target target = TARGET_INITIALIZER;
 
 /* Parse target option strings. */
 
============================================================
Index: gcc/config/arc/arc-protos.h
--- gcc/config/arc/arc-protos.h	2000/01/14 16:21:46	1.1
+++ gcc/config/arc/arc-protos.h	2001/06/21 06:14:07
@@ -62,7 +62,6 @@ extern int shift_operator PARAMS ((rtx, 
 extern enum arc_function_type arc_compute_function_type PARAMS ((tree));
 extern int arc_comp_type_attributes PARAMS ((tree, tree));
 extern void arc_set_default_type_attributes PARAMS ((tree));
-extern int arc_valid_machine_decl_attribute PARAMS ((tree, tree, tree, tree));
 extern void arc_setup_incoming_varargs PARAMS ((CUMULATIVE_ARGS *,
 						enum machine_mode, tree,
 						int *, int));
============================================================
Index: gcc/config/arc/arc.c
--- gcc/config/arc/arc.c	2001/03/22 18:48:33	1.15
+++ gcc/config/arc/arc.c	2001/06/21 06:14:12
@@ -38,6 +38,8 @@ Boston, MA 02111-1307, USA.  */
 #include "recog.h"
 #include "toplev.h"
 #include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
 
 /* Which cpu we're compiling for (NULL(=base), ???).  */
 const char *arc_cpu_string;
@@ -85,7 +87,14 @@ static int current_insn_set_cc_p;
 static void record_cc_ref PARAMS ((rtx));
 static void arc_init_reg_tables PARAMS ((void));
 static int get_arc_condition_code PARAMS ((rtx));
+static int arc_valid_decl_attribute PARAMS ((tree, tree, tree, tree));
+
+/* Initialize the GCC target structure.  */
+#undef TARGET_VALID_DECL_ATTRIBUTE
+#define TARGET_VALID_DECL_ATTRIBUTE arc_valid_decl_attribute
 
+struct gcc_target target = TARGET_INITIALIZER;
+
 /* Called by OVERRIDE_OPTIONS to initialize various things.  */
 
 void
@@ -313,8 +322,8 @@ arc_init_reg_tables ()
 
 /* Return nonzero if IDENTIFIER is a valid decl attribute.  */
 
-int
-arc_valid_machine_decl_attribute (type, attributes, identifier, args)
+static int
+arc_valid_decl_attribute (type, attributes, identifier, args)
      tree type ATTRIBUTE_UNUSED;
      tree attributes ATTRIBUTE_UNUSED;
      tree identifier;
============================================================
Index: gcc/config/arc/arc.h
--- gcc/config/arc/arc.h	2001/04/16 18:30:35	1.26
+++ gcc/config/arc/arc.h	2001/06/21 06:14:18
@@ -1584,12 +1584,6 @@ do { if ((LOG) != 0) fprintf (FILE, "\t.
 /* A function address in a call instruction.  */
 #define FUNCTION_MODE SImode
 
-/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
-   is a valid machine specific attribute for DECL.
-   The attributes in ATTRIBUTES have previously been assigned to TYPE.  */
-#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \
-arc_valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS)
-
 /* A C expression that returns zero if the attributes on TYPE1 and TYPE2 are
    incompatible, one if they are compatible, and two if they are
    nearly compatible (which causes a warning to be generated).  */
============================================================
Index: gcc/config/arm/arm-protos.h
--- gcc/config/arm/arm-protos.h	2001/05/26 14:11:12	1.20
+++ gcc/config/arm/arm-protos.h	2001/06/21 06:14:20
@@ -38,9 +38,7 @@ extern unsigned long arm_current_func_ty
 
 #ifdef TREE_CODE
 extern int    arm_return_in_memory	PARAMS ((tree));
-extern int    arm_valid_machine_decl_attribute	PARAMS ((tree, tree, tree));
 extern int    arm_comp_type_attributes	PARAMS ((tree, tree));
-extern int    arm_valid_type_attribute_p PARAMS ((tree, tree, tree, tree));
 extern void   arm_set_default_type_attributes	PARAMS ((tree));
 extern void   arm_encode_call_attribute	PARAMS ((tree, int));
 extern int    arm_function_ok_for_sibcall PARAMS ((tree));
@@ -187,10 +185,6 @@ extern int  arm_dllexport_name_p 	PARAMS
 extern int  arm_dllimport_name_p 	PARAMS ((const char *));
 
 #ifdef TREE_CODE
-extern int  arm_pe_valid_machine_decl_attribute
-					PARAMS ((tree, tree, tree, tree));
-extern tree arm_pe_merge_machine_decl_attributes
-					PARAMS ((tree, tree));
 extern void arm_pe_unique_section 	PARAMS ((tree, int));
 extern void arm_pe_encode_section_info 	PARAMS ((tree));
 extern int  arm_dllexport_p 		PARAMS ((tree));
============================================================
Index: gcc/config/arm/arm.c
--- gcc/config/arm/arm.c	2001/05/24 21:09:05	1.146
+++ gcc/config/arm/arm.c	2001/06/21 06:14:41
@@ -44,6 +44,8 @@ Boston, MA 02111-1307, USA.  */
 #include "except.h"
 #include "c-pragma.h"
 #include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
 
 /* Forward definitions of types.  */
 typedef struct minipool_node    Mnode;
@@ -99,12 +101,34 @@ static int       current_file_function_o
 static Ulong     arm_compute_save_reg_mask	PARAMS ((void));
 static Ulong     arm_isr_value 			PARAMS ((tree));
 static Ulong     arm_compute_func_type		PARAMS ((void));
-
+static int	 arm_valid_type_attribute_p	PARAMS ((tree, tree,
+							 tree, tree));
+static int	 arm_valid_decl_attribute_p	PARAMS ((tree, tree,
+							 tree, tree));
 #undef Hint
 #undef Mmode
 #undef Ulong
 #undef Ccstar
+
+/* Initialize the GCC target structure.  */
+#ifdef TARGET_DLLIMPORT_DECL_ATTRIBUTES
+#undef TARGET_MERGE_DECL_ATTRIBUTES
+#define TARGET_MERGE_DECL_ATTRIBUTES merge_dllimport_decl_attributes
+#endif
+
+#undef TARGET_VALID_TYPE_ATTRIBUTE
+#define TARGET_VALID_TYPE_ATTRIBUTE arm_valid_type_attribute_p
+
+#undef TARGET_VALID_DECL_ATTRIBUTE
+#ifdef ARM_PE
+   static int arm_pe_valid_decl_attribute_p PARAMS ((tree, tree, tree, tree));
+#  define TARGET_VALID_DECL_ATTRIBUTE arm_pe_valid_decl_attribute_p
+#else
+#  define TARGET_VALID_DECL_ATTRIBUTE arm_valid_decl_attribute_p
+#endif
 
+struct gcc_target target = TARGET_INITIALIZER;
+
 /* Obstack for minipool constant handling.  */
 static struct obstack minipool_obstack;
 static char *minipool_startobj;
@@ -1850,10 +1874,10 @@ arm_pr_long_calls_off (pfile)
 }
 
 
-/* Return nonzero if IDENTIFIER with arguments ARGS is a valid machine specific
-   attribute for TYPE.  The attributes in ATTRIBUTES have previously been
-   assigned to TYPE.  */
-int
+/* Return nonzero if IDENTIFIER with arguments ARGS is a valid machine
+   specific attribute for TYPE.  The attributes in ATTRIBUTES have
+   previously been assigned to TYPE.  */
+static int
 arm_valid_type_attribute_p (type, attributes, identifier, args)
      tree type;
      tree attributes ATTRIBUTE_UNUSED;
@@ -4092,9 +4116,10 @@ multi_register_push (op, mode)
      Always assume that this function will be entered in ARM mode,
      not Thumb mode, and that the caller wishes to be returned to in
      ARM mode.  */
-int
-arm_valid_machine_decl_attribute (decl, attr, args)
+static int
+arm_valid_decl_attribute_p (decl, attributes, attr, args)
      tree decl;
+     tree attributes ATTRIBUTE_UNUSED;
      tree attr;
      tree args;
 {
@@ -4117,6 +4142,39 @@ arm_valid_machine_decl_attribute (decl, 
   
   return 0;
 }
+
+#ifdef ARM_PE
+
+/* ARM/PE has three new attributes:
+   naked - for interrupt functions
+   dllexport - for exporting a function/variable that will live in a dll
+   dllimport - for importing a function/variable from a dll
+
+   Microsoft allows multiple declspecs in one __declspec, separating
+   them with spaces.  We do NOT support this.  Instead, use __declspec
+   multiple times.
+*/
+
+static int
+arm_pe_valid_decl_attribute_p (decl, attributes, attr, args)
+     tree decl;
+     tree attributes;
+     tree attr;
+     tree args;
+{
+  if (args != NULL_TREE)
+    return 0;
+
+  if (is_attribute_p ("dllexport", attr))
+    return 1;
+  
+  if (is_attribute_p ("dllimport", attr))
+    return 1;
+
+  return arm_valid_decl_attribute_p (decl, attributes, attr, args);
+}
+
+#endif /* ARM_PE  */
 
 /* Routines for use in generating RTL.  */
 rtx
============================================================
Index: gcc/config/arm/arm.h
--- gcc/config/arm/arm.h	2001/05/26 01:31:37	1.104
+++ gcc/config/arm/arm.h	2001/06/21 06:14:51
@@ -2544,12 +2544,6 @@ extern const char * arm_pic_register_str
    offset.  */
 extern int making_const_table;
 
-/* If defined, a C expression whose value is nonzero if IDENTIFIER
-   with arguments ARGS is a valid machine specific attribute for TYPE.
-   The attributes in ATTRIBUTES have previously been assigned to TYPE.  */
-#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, NAME, ARGS) \
-  (arm_valid_type_attribute_p (TYPE, ATTRIBUTES, NAME, ARGS))
-
 /* If defined, a C expression whose value is zero if the attributes on
    TYPE1 and TYPE2 are incompatible, one if they are compatible, and
    two if they are nearly compatible (which causes a warning to be
============================================================
Index: gcc/config/arm/coff.h
--- gcc/config/arm/coff.h	2001/04/16 18:30:36	1.20
+++ gcc/config/arm/coff.h	2001/06/21 06:14:52
@@ -41,12 +41,6 @@ Boston, MA 02111-1307, USA.  */
   { "marm", "mlittle-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork" }
 #endif
 
-/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
-   is a valid machine specific attribute for DECL.
-   The attributes in ATTRIBUTES have previously been assigned to DECL.  */
-#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \
-  arm_valid_machine_decl_attribute (DECL, IDENTIFIER, ARGS)
-
 /* This is COFF, but prefer stabs.  */
 #define SDB_DEBUGGING_INFO
 
============================================================
Index: gcc/config/arm/elf.h
--- gcc/config/arm/elf.h	2001/05/04 16:16:43	1.26
+++ gcc/config/arm/elf.h	2001/06/21 06:14:52
@@ -190,12 +190,6 @@ Boston, MA 02111-1307, USA.  */
 #define MULTILIB_DEFAULTS \
   { "marm", "mlittle-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork", "fno-leading-underscore" }
 #endif
-
-/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
-   is a valid machine specific attribute for DECL.
-   The attributes in ATTRIBUTES have previously been assigned to DECL.  */
-#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \
-  arm_valid_machine_decl_attribute (DECL, IDENTIFIER, ARGS)
 
 
 /* This outputs a lot of .req's to define alias for various registers.
============================================================
Index: gcc/config/arm/pe.c
--- gcc/config/arm/pe.c	2000/04/08 14:29:52	1.8
+++ gcc/config/arm/pe.c	2001/06/21 06:14:54
@@ -31,93 +31,6 @@ Boston, MA 02111-1307, USA.  */
 
 extern int current_function_anonymous_args;
 
-/* ARM/PE specific attribute support.
-
-   ARM/PE has three new attributes:
-   naked - for interrupt functions
-   dllexport - for exporting a function/variable that will live in a dll
-   dllimport - for importing a function/variable from a dll
-
-   Microsoft allows multiple declspecs in one __declspec, separating
-   them with spaces.  We do NOT support this.  Instead, use __declspec
-   multiple times.
-*/
-
-/* Return nonzero if ATTR is a valid attribute for DECL.
-   ATTRIBUTES are any existing attributes and ARGS are the arguments
-   supplied with ATTR.  */
-
-int
-arm_pe_valid_machine_decl_attribute (decl, attributes, attr, args)
-     tree decl;
-     tree attributes ATTRIBUTE_UNUSED;
-     tree attr;
-     tree args;
-{
-  if (args != NULL_TREE)
-    return 0;
-
-  if (is_attribute_p ("dllexport", attr))
-    return 1;
-  
-  if (is_attribute_p ("dllimport", attr))
-    return 1;
-
-  return arm_valid_machine_decl_attribute (decl, attr, args);
-}
-
-/* Merge attributes in decls OLD and NEW.
-
-   This handles the following situation:
-
-   __declspec (dllimport) int foo;
-   int foo;
-
-   The second instance of `foo' nullifies the dllimport.  */
-
-tree
-arm_pe_merge_machine_decl_attributes (old, new)
-     tree old, new;
-{
-  tree a;
-  int delete_dllimport_p;
-
-  old = DECL_MACHINE_ATTRIBUTES (old);
-  new = DECL_MACHINE_ATTRIBUTES (new);
-
-  /* What we need to do here is remove from `old' dllimport if it doesn't
-     appear in `new'.  dllimport behaves like extern: if a declaration is
-     marked dllimport and a definition appears later, then the object
-     is not dllimport'd.  */
-
-  if (lookup_attribute ("dllimport", old) != NULL_TREE
-      && lookup_attribute ("dllimport", new) == NULL_TREE)
-    delete_dllimport_p = 1;
-  else
-    delete_dllimport_p = 0;
-
-  a = merge_attributes (old, new);
-
-  if (delete_dllimport_p)
-    {
-      tree prev,t;
-
-      /* Scan the list for dllimport and delete it.  */
-      for (prev = NULL_TREE, t = a; t; prev = t, t = TREE_CHAIN (t))
-	{
-	  if (is_attribute_p ("dllimport", TREE_PURPOSE (t)))
-	    {
-	      if (prev == NULL_TREE)
-		a = TREE_CHAIN (a);
-	      else
-		TREE_CHAIN (prev) = TREE_CHAIN (t);
-	      break;
-	    }
-	}
-    }
-
-  return a;
-}
 
 /* Return non-zero if DECL is a dllexport'd object.  */
 
============================================================
Index: gcc/config/arm/pe.h
--- gcc/config/arm/pe.h	2000/06/27 02:26:16	1.8
+++ gcc/config/arm/pe.h	2001/06/21 06:14:54
@@ -38,6 +38,10 @@ Boston, MA 02111-1307, USA.  */
 #undef  TARGET_VERSION
 #define TARGET_VERSION fputs (" (ARM/pe)", stderr)
 
+/* Get tree.c to declare a target-specific specialization of
+   merge_decl_attributes.  */
+#define TARGET_DLLIMPORT_DECL_ATTRIBUTES
+
 /* Support the __declspec keyword by turning them into attributes.
    We currently only support: naked, dllimport, and dllexport.
    Note that the current way we do this may result in a collision with
@@ -91,16 +95,6 @@ Boston, MA 02111-1307, USA.  */
   1,1,1			\
 }
 
-/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
-   is a valid machine specific attribute for DECL.
-   The attributes in ATTRIBUTES have previously been assigned to DECL.  */
-#undef  VALID_MACHINE_DECL_ATTRIBUTE
-#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \
-  arm_pe_valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS)
-
-#define MERGE_MACHINE_DECL_ATTRIBUTES(OLD, NEW) \
-  arm_pe_merge_machine_decl_attributes ((OLD), (NEW))
-
 /* In addition to the stuff done in arm.h, we must mark dll symbols specially.
    Definitions of dllexport'd objects install some info in the .drectve
    section.  References to dllimport'd objects are fetched indirectly via
============================================================
Index: gcc/config/avr/avr-protos.h
--- gcc/config/avr/avr-protos.h	2001/01/21 07:08:46	1.12
+++ gcc/config/avr/avr-protos.h	2001/06/21 06:14:55
@@ -50,12 +50,6 @@ extern void   encode_section_info       
 extern void   asm_output_section_name      PARAMS ((FILE *file, tree decl,
 						   const char *name,
 						   int reloc));
-extern int    valid_machine_type_attribute PARAMS ((tree type, tree attributes,
-						   tree identifier,
-						   tree args));
-extern int    valid_machine_decl_attribute PARAMS ((tree decl, tree attributes,
-						   tree attr, tree args));
-
 extern int    avr_progmem_p                PARAMS ((tree decl));
 
 
============================================================
Index: gcc/config/avr/avr.c
--- gcc/config/avr/avr.c	2001/03/22 18:48:33	1.39
+++ gcc/config/avr/avr.c	2001/06/21 06:15:03
@@ -38,6 +38,8 @@
 #include "function.h"
 #include "recog.h"
 #include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
 
 /* Maximal allowed offset for an address in the LD command */
 #define MAX_LD_OFFSET(MODE) (64 - (signed)GET_MODE_SIZE (MODE))
@@ -56,6 +58,8 @@ static int    compare_sign_p       PARAM
 static int    reg_was_0            PARAMS ((rtx insn, rtx op));
 static int    io_address_p         PARAMS ((rtx x, int size));
 void          debug_hard_reg_set   PARAMS ((HARD_REG_SET set));
+static int    avr_valid_type_attribute PARAMS ((tree, tree, tree, tree));
+static int    avr_valid_decl_attribute PARAMS ((tree, tree, tree, tree));
 
 /* Allocate registers from r25 to r8 for parameters for function calls */
 #define FIRST_CUM_REG 26
@@ -165,7 +169,16 @@ static const struct mcu_type_s avr_mcu_t
 };
 
 int avr_case_values_threshold = 30000;
+
+/* Initialize the GCC target structure.  */
+#undef TARGET_VALID_DECL_ATTRIBUTE
+#define TARGET_VALID_DECL_ATTRIBUTE avr_valid_decl_attribute
 
+#undef TARGET_VALID_TYPE_ATTRIBUTE
+#define TARGET_VALID_TYPE_ATTRIBUTE avr_valid_type_attribute
+
+struct gcc_target target = TARGET_INITIALIZER;
+
 void
 avr_override_options ()
 {
@@ -4664,8 +4677,8 @@ class_likely_spilled_p (c)
 
 /* Only `progmem' attribute valid for type.  */
 
-int
-valid_machine_type_attribute(type, attributes, identifier, args)
+static int
+avr_valid_type_attribute (type, attributes, identifier, args)
      tree type ATTRIBUTE_UNUSED;
      tree attributes ATTRIBUTE_UNUSED;
      tree identifier;
@@ -4684,8 +4697,8 @@ valid_machine_type_attribute(type, attri
    prologue interrupts are enabled;
    naked     - don't generate function prologue/epilogue and `ret' command.  */
 
-int
-valid_machine_decl_attribute (decl, attributes, attr, args)
+static int
+avr_valid_decl_attribute (decl, attributes, attr, args)
      tree decl;
      tree attributes ATTRIBUTE_UNUSED;
      tree attr;
============================================================
Index: gcc/config/avr/avr.h
--- gcc/config/avr/avr.h	2001/05/04 15:06:34	1.21
+++ gcc/config/avr/avr.h	2001/06/21 06:15:18
@@ -2837,20 +2837,6 @@ extern int avr_case_values_threshold;
    of arguments that the function accepts.  Some people think a larger
    threshold should be used on RISC machines.  */
 
-#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \
-valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS)
-/* `VALID_MACHINE_DECL_ATTRIBUTE (DECL, ATTRIBUTES, IDENTIFIER, ARGS)'
-   If defined, a C expression whose value is nonzero if IDENTIFIER
-   with arguments ARGS is a valid machine specific attribute for DECL.
-   The attributes in ATTRIBUTES have previously been assigned to DECL.  */
-
-#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, IDENTIFIER, ARGS) \
-     valid_machine_type_attribute(TYPE, ATTRIBUTES, IDENTIFIER, ARGS)
-/* `VALID_MACHINE_TYPE_ATTRIBUTE (TYPE, ATTRIBUTES, IDENTIFIER, ARGS)'
-   If defined, a C expression whose value is nonzero if IDENTIFIER
-   with arguments ARGS is a valid machine specific attribute for TYPE.
-   The attributes in ATTRIBUTES have previously been assigned to TYPE.  */
-
 #define DOLLARS_IN_IDENTIFIERS 0
 /* Define this macro to control use of the character `$' in identifier
    names.  0 means `$' is not allowed by default; 1 means it is
============================================================
Index: gcc/config/c4x/c4x-protos.h
--- gcc/config/c4x/c4x-protos.h	2001/05/26 15:07:50	1.17
+++ gcc/config/c4x/c4x-protos.h	2001/06/21 06:15:18
@@ -61,8 +61,6 @@ extern struct rtx_def *c4x_function_arg 
 
 extern void c4x_encode_section_info PARAMS ((tree));
 
-extern int c4x_valid_type_attribute_p PARAMS ((tree, tree, tree, tree));
-
 #endif /* TREE_CODE */
 
 
============================================================
Index: gcc/config/c4x/c4x.c
--- gcc/config/c4x/c4x.c	2001/05/04 15:06:34	1.82
+++ gcc/config/c4x/c4x.c	2001/06/21 06:15:24
@@ -47,6 +47,8 @@ Boston, MA 02111-1307, USA.  */
 #include "c-lex.h"
 #include "c-pragma.h"
 #include "c4x-protos.h"
+#include "target.h"
+#include "target-def.h"
 
 rtx smulhi3_libfunc;
 rtx umulhi3_libfunc;
@@ -187,7 +189,14 @@ static int c4x_parse_pragma PARAMS ((con
 static int c4x_r11_set_p PARAMS ((rtx));
 static int c4x_rptb_valid_p PARAMS ((rtx, rtx));
 static int c4x_label_ref_used_p PARAMS ((rtx, rtx));
+static int c4x_valid_type_attribute_p PARAMS ((tree, tree, tree, tree));
+
+/* Initialize the GCC target structure.  */
+#undef TARGET_VALID_TYPE_ATTRIBUTE
+#define TARGET_VALID_TYPE_ATTRIBUTE c4x_valid_type_attribute_p
 
+struct gcc_target target = TARGET_INITIALIZER;
+
 /* Called to register all of our global variables with the garbage
    collector.  */
 
@@ -4741,7 +4750,7 @@ c4x_set_default_attributes(decl, attribu
    specific attribute for TYPE.  The attributes in ATTRIBUTES have
    previously been assigned to TYPE.  */
 
-int
+static int
 c4x_valid_type_attribute_p (type, attributes, identifier, args)
      tree type;
      tree attributes ATTRIBUTE_UNUSED;
============================================================
Index: gcc/config/c4x/c4x.h
--- gcc/config/c4x/c4x.h	2001/05/04 15:06:34	1.75
+++ gcc/config/c4x/c4x.h	2001/06/21 06:15:33
@@ -2446,9 +2446,6 @@ do {						\
 #define SET_DEFAULT_DECL_ATTRIBUTES(DECL, ATTRIBUTES) \
   c4x_set_default_attributes (DECL, &ATTRIBUTES)
 
-#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, NAME, ARGS) \
-  (c4x_valid_type_attribute_p (TYPE, ATTRIBUTES, NAME, ARGS))
-
 /* Assembler Commands for Alignment.  */
 
 #define ASM_OUTPUT_SKIP(FILE, SIZE) \
============================================================
Index: gcc/config/clipper/clipper.c
--- gcc/config/clipper/clipper.c	2001/03/22 18:48:33	1.12
+++ gcc/config/clipper/clipper.c	2001/06/21 06:15:35
@@ -37,13 +37,19 @@ Boston, MA 02111-1307, USA.  */
 #include "flags.h"
 #include "recog.h"
 #include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
 
 extern char regs_ever_live[];
 
 extern int frame_pointer_needed;
 
 static int frame_size;
+
+/* Initialize the GCC target structure.  */
 
+struct gcc_target target = TARGET_INITIALIZER;
+
 /* Compute size of a clipper stack frame where 'lsize' is the required
    space for local variables.  */
 
============================================================
Index: gcc/config/convex/convex.c
--- gcc/config/convex/convex.c	2001/03/22 18:48:34	1.9
+++ gcc/config/convex/convex.c	2001/06/21 06:15:36
@@ -33,6 +33,8 @@ Boston, MA 02111-1307, USA.  */
 #include "function.h"
 #include "expr.h"
 #include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
 
 /* Tables used in convex.h */
 
@@ -62,7 +64,11 @@ static int frame_argblock_size;
 static rtx convert_arg_pushes ();
 #endif
 static void expand_movstr_call PARAMS ((rtx *));
+
+/* Initialize the GCC target structure.  */
 
+struct gcc_target target = TARGET_INITIALIZER;
+
 /* Here from OVERRIDE_OPTIONS at startup.  Initialize constant tables. */
 
 void
============================================================
Index: gcc/config/d30v/d30v.c
--- gcc/config/d30v/d30v.c	2001/04/03 15:05:42	1.7
+++ gcc/config/d30v/d30v.c	2001/06/21 06:15:44
@@ -39,6 +39,8 @@
 #include "function.h"
 #include "toplev.h"
 #include "ggc.h"
+#include "target.h"
+#include "target-def.h"
 
 static void d30v_print_operand_memory_reference PARAMS ((FILE *, rtx));
 static void d30v_build_long_insn PARAMS ((HOST_WIDE_INT, HOST_WIDE_INT,
@@ -76,7 +78,10 @@ enum reg_class regno_reg_class[FIRST_PSE
 
 /* Map class letter into register class */
 enum reg_class reg_class_from_letter[256];
+
+/* Initialize the GCC target structure.  */
 
+struct gcc_target target = TARGET_INITIALIZER;
 
 /* Sometimes certain combinations of command options do not make
    sense on a particular target machine.  You can define a macro
============================================================
Index: gcc/config/d30v/d30v.h
--- gcc/config/d30v/d30v.h	2001/05/17 03:15:52	1.19
+++ gcc/config/d30v/d30v.h	2001/06/21 06:16:08
@@ -5907,16 +5907,6 @@ fprintf (STREAM, "\t.word .L%d\n", VALUE
    must also be defined).  */
 /* #define HANDLE_WEAK_PRAGMA */
 
-/* If defined, a C expression whose value is nonzero if IDENTIFIER with
-   arguments ARGS is a valid machine specific attribute for DECL.  The
-   attributes in ATTRIBUTES have previously been assigned to DECL.  */
-/* #define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) */
-
-/* If defined, a C expression whose value is nonzero if IDENTIFIER with
-   arguments ARGS is a valid machine specific attribute for TYPE.  The
-   attributes in ATTRIBUTES have previously been assigned to TYPE.  */
-/* #define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, IDENTIFIER, ARGS) */
-
 /* If defined, a C expression whose value is zero if the attributes on TYPE1
    and TYPE2 are incompatible, one if they are compatible, and two if they are
    nearly compatible (which causes a warning to be generated).  */
============================================================
Index: gcc/config/dsp16xx/dsp16xx.c
--- gcc/config/dsp16xx/dsp16xx.c	2001/03/22 18:48:34	1.13
+++ gcc/config/dsp16xx/dsp16xx.c	2001/06/21 06:16:12
@@ -38,6 +38,8 @@ Boston, MA 02111-1307, USA.  */
 #include "toplev.h"
 #include "recog.h"
 #include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
 
 const char *text_seg_name;
 const char *rsect_text;
@@ -145,7 +147,11 @@ static const char *const lshift_right_as
 };
 
 static int reg_save_size PARAMS ((void));
+
+/* Initialize the GCC target structure.  */
 
+struct gcc_target target = TARGET_INITIALIZER;
+
 int 
 hard_regno_mode_ok (regno, mode)
      int regno;
============================================================
Index: gcc/config/elxsi/elxsi.c
--- gcc/config/elxsi/elxsi.c	2000/05/01 17:21:40	1.7
+++ gcc/config/elxsi/elxsi.c	2001/06/21 06:16:12
@@ -27,6 +27,8 @@ Boston, MA 02111-1307, USA.  */
 #include "function.h"
 #include "output.h"
 #include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
 
 extern const char *reg_names[];
 rtx cmp_op0=0, cmp_op1=0;
@@ -35,7 +37,11 @@ rtx cmp_op0=0, cmp_op1=0;
 static const char *const cmp_tab[] = {
     "gt", "gt", "eq", "eq", "ge", "ge", "lt", "lt", "ne", "ne",
     "le", "le" };
+
+/* Initialize the GCC target structure.  */
 
+struct gcc_target target = TARGET_INITIALIZER;
+
 /* type is the index into the above table */
 /* s is "" for signed, or "u" for unsigned */
 const char *
============================================================
Index: gcc/config/fr30/fr30.c
--- gcc/config/fr30/fr30.c	2001/03/22 18:48:34	1.9
+++ gcc/config/fr30/fr30.c	2001/06/21 06:16:15
@@ -42,6 +42,8 @@ Boston, MA 02111-1307, USA.  */
 #include "except.h"
 #include "function.h"
 #include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
 
 /*}}}*/
 /*{{{  Function Prologues & Epilogues */ 
@@ -136,7 +138,11 @@ static struct fr30_frame_info 	zero_fram
 #if UNITS_PER_WORD == 4
 #define WORD_ALIGN(SIZE) (((SIZE) + 3) & ~3)
 #endif
-     
+
+/* Initialize the GCC target structure.  */
+
+struct gcc_target target = TARGET_INITIALIZER;
+
 /* Returns the number of bytes offset between FROM_REG and TO_REG
    for the current function.  As a side effect it fills in the 
    current_frame_info structure, if the data is available.  */
============================================================
Index: gcc/config/h8300/h8300-protos.h
--- gcc/config/h8300/h8300-protos.h	2001/05/26 15:07:50	1.7
+++ gcc/config/h8300/h8300-protos.h	2001/06/21 06:16:16
@@ -61,8 +61,6 @@ extern int nshift_operator PARAMS ((rtx,
 #ifdef TREE_CODE
 extern struct rtx_def *function_arg PARAMS ((CUMULATIVE_ARGS *,
 					     enum machine_mode, tree, int));
-extern int h8300_valid_machine_decl_attribute PARAMS ((tree, tree, tree,
-						       tree));
 extern int h8300_funcvec_function_p PARAMS ((tree));
 extern int h8300_eightbit_data_p PARAMS ((tree));
 extern int h8300_tiny_data_p PARAMS ((tree));
============================================================
Index: gcc/config/h8300/h8300.c
--- gcc/config/h8300/h8300.c	2001/04/21 16:00:13	1.55
+++ gcc/config/h8300/h8300.c	2001/06/21 06:16:22
@@ -40,6 +40,8 @@ Boston, MA 02111-1307, USA.  */
 #include "c-pragma.h"
 #include "tm_p.h"
 #include "ggc.h"
+#include "target.h"
+#include "target-def.h"
 
 /* Forward declarations.  */
 static int h8300_interrupt_function_p PARAMS ((tree));
@@ -51,6 +53,7 @@ static unsigned int compute_saved_regs P
 static void push PARAMS ((FILE *, int));
 static void pop PARAMS ((FILE *, int));
 static const char *cond_string PARAMS ((enum rtx_code));
+static int h8300_valid_decl_attribute PARAMS ((tree, tree, tree, tree));
 
 /* CPU_TYPE, says what cpu we're compiling for.  */
 int cpu_type;
@@ -90,7 +93,13 @@ static const char *const h8_pop_ops[2] =
 static const char *const h8_mov_ops[2] = { "mov.w", "mov.l" };
 
 const char *h8_push_op, *h8_pop_op, *h8_mov_op;
+
+/* Initialize the GCC target structure.  */
+#undef TARGET_VALID_DECL_ATTRIBUTE
+#define TARGET_VALID_DECL_ATTRIBUTE h8300_valid_decl_attribute
 
+struct gcc_target target = TARGET_INITIALIZER;
+
 /* Initialize various cpu specific globals at start up.  */
 
 void
@@ -3023,8 +3032,8 @@ h8300_tiny_data_p (decl)
    tiny_data: This variable lives in the tiny data area and can be
    referenced with 16-bit absolute memory references.  */
 
-int
-h8300_valid_machine_decl_attribute (decl, attributes, attr, args)
+static int
+h8300_valid_decl_attribute (decl, attributes, attr, args)
      tree decl;
      tree attributes ATTRIBUTE_UNUSED;
      tree attr;
============================================================
Index: gcc/config/h8300/h8300.h
--- gcc/config/h8300/h8300.h	2001/06/13 17:41:19	1.42
+++ gcc/config/h8300/h8300.h	2001/06/21 06:16:27
@@ -998,12 +998,6 @@ struct cum_arg
    so give the MEM rtx a byte's mode.  */
 #define FUNCTION_MODE QImode
 
-/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
-   is a valid machine specific attribute for DECL.
-   The attributes in ATTRIBUTES have previously been assigned to DECL.  */
-#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \
-h8300_valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS)
-
 #define ADJUST_INSN_LENGTH(INSN, LENGTH) \
   LENGTH += h8300_adjust_insn_length (INSN, LENGTH);
 
============================================================
Index: gcc/config/i370/i370.c
--- gcc/config/i370/i370.c	2001/03/22 18:48:34	1.16
+++ gcc/config/i370/i370.c	2001/06/21 06:16:31
@@ -41,6 +41,8 @@ Boston, MA 02111-1307, USA.  */
 #include "c-pragma.h"
 #include "c-lex.h"
 #include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
 
 extern FILE *asm_out_file;
 
@@ -283,7 +285,11 @@ static const unsigned char ebcasc[256] =
  /*F8   8     9                                     */
      0x38, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF
 };
+
+/* Initialize the GCC target structure.  */
 
+struct gcc_target target = TARGET_INITIALIZER;
+
 /* Map characters from one character set to another.
    C is the character to be translated.  */
 
============================================================
Index: gcc/config/i386/cygwin.h
--- gcc/config/i386/cygwin.h	2001/05/20 19:54:04	1.45
+++ gcc/config/i386/cygwin.h	2001/06/21 06:16:34
@@ -86,6 +86,10 @@ Boston, MA 02111-1307, USA. */
 		       "-idirafter /usr/include/mingw"
 #endif
 
+/* Get tree.c to declare a target-specific specialization of
+   merge_decl_attributes.  */
+#define TARGET_DLLIMPORT_DECL_ATTRIBUTES
+
 /* Support the __declspec keyword by turning them into attributes.
    We currently only support: dllimport and dllexport.
    Note that the current way we do this may result in a collision with
@@ -198,11 +202,6 @@ extern int i386_pe_valid_decl_attribute_
 #define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, IDENTIFIER, ARGS) \
   i386_pe_valid_type_attribute_p (TYPE, ATTRIBUTES, IDENTIFIER, ARGS)
 extern int i386_pe_valid_type_attribute_p PARAMS ((TREE, TREE, TREE, TREE));
-
-extern union tree_node *i386_pe_merge_decl_attributes PARAMS ((TREE, TREE));
-#define MERGE_MACHINE_DECL_ATTRIBUTES(OLD, NEW) \
-  i386_pe_merge_decl_attributes ((OLD), (NEW))
-extern TREE i386_pe_merge_decl_attributes PARAMS ((TREE, TREE));
 
 /* Used to implement dllexport overriding dllimport semantics.  It's also used
    to handle vtables - the first pass won't do anything because
============================================================
Index: gcc/config/i386/i386-protos.h
--- gcc/config/i386/i386-protos.h	2001/04/09 11:18:38	1.49
+++ gcc/config/i386/i386-protos.h	2001/06/21 06:16:34
@@ -168,8 +168,6 @@ extern rtx ix86_expand_builtin PARAMS ((
 #endif
 
 #ifdef TREE_CODE
-extern int ix86_valid_decl_attribute_p PARAMS ((tree, tree, tree, tree));
-extern int ix86_valid_type_attribute_p PARAMS ((tree, tree, tree, tree));
 extern int ix86_comp_type_attributes PARAMS ((tree, tree));
 extern int ix86_return_pops_args PARAMS ((tree, tree, int));
 
============================================================
Index: gcc/config/i386/i386.c
--- gcc/config/i386/i386.c	2001/06/14 13:41:22	1.268
+++ gcc/config/i386/i386.c	2001/06/21 06:16:56
@@ -40,6 +40,8 @@ Boston, MA 02111-1307, USA.  */
 #include "toplev.h"
 #include "basic-block.h"
 #include "ggc.h"
+#include "target.h"
+#include "target-def.h"
 
 #ifndef CHECK_STACK_LIMIT
 #define CHECK_STACK_LIMIT -1
@@ -605,7 +607,19 @@ static int ix86_fp_comparison_sahf_cost 
 static int ix86_fp_comparison_cost PARAMS ((enum rtx_code code));
 static int ix86_save_reg PARAMS ((int, int));
 static void ix86_compute_frame_layout PARAMS ((struct ix86_frame *));
+static int ix86_valid_type_attribute_p PARAMS ((tree, tree, tree, tree));
 
+/* Initialize the GCC target structure.  */
+#ifdef TARGET_DLLIMPORT_DECL_ATTRIBUTES
+#undef TARGET_MERGE_DECL_ATTRIBUTES
+#define TARGET_MERGE_DECL_ATTRIBUTES merge_dllimport_decl_attributes
+#endif
+
+#undef TARGET_VALID_TYPE_ATTRIBUTE
+#define TARGET_VALID_TYPE_ATTRIBUTE ix86_valid_type_attribute_p
+
+struct gcc_target target = TARGET_INITIALIZER;
+
 /* Sometimes certain combinations of command options do not make
    sense on a particular target machine.  You can define a macro
    `OVERRIDE_OPTIONS' to take account of this.  This macro, if
@@ -860,24 +874,10 @@ optimization_options (level, size)
 }
 
 /* Return nonzero if IDENTIFIER with arguments ARGS is a valid machine specific
-   attribute for DECL.  The attributes in ATTRIBUTES have previously been
-   assigned to DECL.  */
-
-int
-ix86_valid_decl_attribute_p (decl, attributes, identifier, args)
-     tree decl ATTRIBUTE_UNUSED;
-     tree attributes ATTRIBUTE_UNUSED;
-     tree identifier ATTRIBUTE_UNUSED;
-     tree args ATTRIBUTE_UNUSED;
-{
-  return 0;
-}
-
-/* Return nonzero if IDENTIFIER with arguments ARGS is a valid machine specific
    attribute for TYPE.  The attributes in ATTRIBUTES have previously been
    assigned to TYPE.  */
 
-int
+static int
 ix86_valid_type_attribute_p (type, attributes, identifier, args)
      tree type;
      tree attributes ATTRIBUTE_UNUSED;
============================================================
Index: gcc/config/i386/i386.h
--- gcc/config/i386/i386.h	2001/06/14 10:45:38	1.188
+++ gcc/config/i386/i386.h	2001/06/21 06:17:06
@@ -2240,20 +2240,6 @@ do									\
 while (0)
 
 
-/* If defined, a C expression whose value is nonzero if IDENTIFIER
-   with arguments ARGS is a valid machine specific attribute for DECL.
-   The attributes in ATTRIBUTES have previously been assigned to DECL.  */
-
-#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, NAME, ARGS) \
-  (ix86_valid_decl_attribute_p (DECL, ATTRIBUTES, NAME, ARGS))
-
-/* If defined, a C expression whose value is nonzero if IDENTIFIER
-   with arguments ARGS is a valid machine specific attribute for TYPE.
-   The attributes in ATTRIBUTES have previously been assigned to TYPE.  */
-
-#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, NAME, ARGS) \
-  (ix86_valid_type_attribute_p (TYPE, ATTRIBUTES, NAME, ARGS))
-
 /* If defined, a C expression whose value is zero if the attributes on
    TYPE1 and TYPE2 are incompatible, one if they are compatible, and
    two if they are nearly compatible (which causes a warning to be
============================================================
Index: gcc/config/i386/winnt.c
--- gcc/config/i386/winnt.c	2001/03/20 17:42:56	1.20
+++ gcc/config/i386/winnt.c	2001/06/21 06:17:08
@@ -95,58 +95,6 @@ i386_pe_valid_type_attribute_p (type, at
   return ix86_valid_type_attribute_p (type, attributes, attr, args);
 }
 
-/* Merge attributes in decls OLD and NEW.
-
-   This handles the following situation:
-
-   __declspec (dllimport) int foo;
-   int foo;
-
-   The second instance of `foo' nullifies the dllimport.  */
-
-tree
-i386_pe_merge_decl_attributes (old, new)
-     tree old, new;
-{
-  tree a;
-  int delete_dllimport_p;
-
-  old = DECL_MACHINE_ATTRIBUTES (old);
-  new = DECL_MACHINE_ATTRIBUTES (new);
-
-  /* What we need to do here is remove from `old' dllimport if it doesn't
-     appear in `new'.  dllimport behaves like extern: if a declaration is
-     marked dllimport and a definition appears later, then the object
-     is not dllimport'd.  */
-
-  if (lookup_attribute ("dllimport", old) != NULL_TREE
-      && lookup_attribute ("dllimport", new) == NULL_TREE)
-    delete_dllimport_p = 1;
-  else
-    delete_dllimport_p = 0;
-
-  a = merge_attributes (old, new);
-
-  if (delete_dllimport_p)
-    {
-      tree prev,t;
-
-      /* Scan the list for dllimport and delete it.  */
-      for (prev = NULL_TREE, t = a; t; prev = t, t = TREE_CHAIN (t))
-	{
-	  if (is_attribute_p ("dllimport", TREE_PURPOSE (t)))
-	    {
-	      if (prev == NULL_TREE)
-		a = TREE_CHAIN (a);
-	      else
-		TREE_CHAIN (prev) = TREE_CHAIN (t);
-	      break;
-	    }
-	}
-    }
-
-  return a;
-}
 
 /* Return the type that we should use to determine if DECL is
    imported or exported.  */
============================================================
Index: gcc/config/i860/i860.c
--- gcc/config/i860/i860.c	2001/05/04 15:06:35	1.19
+++ gcc/config/i860/i860.c	2001/06/21 06:17:14
@@ -42,6 +42,8 @@ Boston, MA 02111-1307, USA.  */
 #include "function.h"
 #include "expr.h"
 #include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
 
 static rtx find_addr_reg PARAMS ((rtx));
 static int reg_clobbered_p PARAMS ((rtx, rtx));
@@ -59,6 +61,10 @@ const char *i860_reg_prefix = I860_REG_P
 /* Save information from a "cmpxx" operation until the branch is emitted.  */
 
 rtx i860_compare_op0, i860_compare_op1;
+
+/* Initialize the GCC target structure.  */
+
+struct gcc_target target = TARGET_INITIALIZER;
 
 /* Return non-zero if this pattern, can be evaluated safely, even if it
    was not asked for.  */
============================================================
Index: gcc/config/i960/i960.c
--- gcc/config/i960/i960.c	2001/04/21 16:14:44	1.23
+++ gcc/config/i960/i960.c	2001/06/21 06:17:19
@@ -44,6 +44,8 @@ Boston, MA 02111-1307, USA.  */
 #include "c-pragma.h"
 #include "c-lex.h"
 #include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
 
 /* Save the operands last given to a compare for use when we
    generate a scc or bcc insn.  */
@@ -86,7 +88,11 @@ static int ret_label = 0;
 ((TYPE_ARG_TYPES (TREE_TYPE (FNDECL)) != 0						      \
   && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (TREE_TYPE (FNDECL)))) != void_type_node))    \
  || current_function_varargs)
+
+/* Initialize the GCC target structure.  */
 
+struct gcc_target target = TARGET_INITIALIZER;
+
 /* Initialize variables before compiling any files.  */
 
 void
============================================================
Index: gcc/config/ia64/ia64-protos.h
--- gcc/config/ia64/ia64-protos.h	2001/04/20 12:19:46	1.28
+++ gcc/config/ia64/ia64-protos.h	2001/06/21 06:17:20
@@ -124,7 +124,6 @@ extern void ia64_function_arg_advance PA
 extern int ia64_return_in_memory PARAMS((tree));
 extern void ia64_asm_output_external PARAMS((FILE *, tree, const char *));
 
-extern int ia64_valid_type_attribute PARAMS((tree, tree, tree, tree));
 extern void ia64_encode_section_info PARAMS((tree));
 #endif /* TREE_CODE */
 
============================================================
Index: gcc/config/ia64/ia64.c
--- gcc/config/ia64/ia64.c	2001/06/08 17:42:25	1.95
+++ gcc/config/ia64/ia64.c	2001/06/21 06:17:36
@@ -42,6 +42,8 @@ Boston, MA 02111-1307, USA.  */
 #include "basic-block.h"
 #include "toplev.h"
 #include "sched-int.h"
+#include "target.h"
+#include "target-def.h"
 
 /* This is used for communication between ASM_OUTPUT_LABEL and
    ASM_OUTPUT_LABELREF.  */
@@ -134,7 +136,14 @@ static rtx ia64_expand_compare_and_swap 
 static rtx ia64_expand_lock_test_and_set PARAMS ((enum machine_mode,
 						  tree, rtx));
 static rtx ia64_expand_lock_release PARAMS ((enum machine_mode, tree, rtx));
+static int ia64_valid_type_attribute PARAMS((tree, tree, tree, tree));
 
+/* Initialize the GCC target structure.  */
+#undef TARGET_VALID_TYPE_ATTRIBUTE
+#define TARGET_VALID_TYPE_ATTRIBUTE ia64_valid_type_attribute
+
+struct gcc_target target = TARGET_INITIALIZER;
+
 /* Return 1 if OP is a valid operand for the MEM of a CALL insn.  */
 
 int
@@ -6521,7 +6530,7 @@ ia64_epilogue_uses (regno)
 
 /* Return true if IDENTIFIER is a valid attribute for TYPE.  */
 
-int
+static int
 ia64_valid_type_attribute (type, attributes, identifier, args)
      tree type;
      tree attributes ATTRIBUTE_UNUSED;
============================================================
Index: gcc/config/ia64/ia64.h
--- gcc/config/ia64/ia64.h	2001/05/21 03:14:31	1.67
+++ gcc/config/ia64/ia64.h	2001/06/21 06:17:49
@@ -2767,13 +2767,6 @@ do {									\
 
 #define HANDLE_SYSV_PRAGMA
 
-/* If defined, a C expression whose value is nonzero if IDENTIFIER with
-   arguments ARGS is a valid machine specific attribute for TYPE.  The
-   attributes in ATTRIBUTES have previously been assigned to TYPE.  */
-
-#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, IDENTIFIER, ARGS) \
-  ia64_valid_type_attribute (TYPE, ATTRIBUTES, IDENTIFIER, ARGS)
-
 /* In rare cases, correct code generation requires extra machine dependent
    processing between the second jump optimization pass and delayed branch
    scheduling.  On those machines, define this macro as a C statement to act on
============================================================
Index: gcc/config/m32r/m32r-protos.h
--- gcc/config/m32r/m32r-protos.h	2001/06/11 16:58:56	1.3
+++ gcc/config/m32r/m32r-protos.h	2001/06/21 06:17:49
@@ -36,7 +36,6 @@ extern void   m32r_asm_file_start		PARAM
 extern void   m32r_sched_init 			PARAMS ((FILE *, int));
 extern int    direct_return 			PARAMS ((void));
 #ifdef TREE_CODE
-extern int    m32r_valid_machine_decl_attribute	PARAMS ((tree, tree, tree, tree));
 extern int    m32r_comp_type_attributes		PARAMS ((tree, tree));
 extern void   m32r_select_section		PARAMS ((tree, int));
 extern void   m32r_encode_section_info		PARAMS ((tree));
============================================================
Index: gcc/config/m32r/m32r.c
--- gcc/config/m32r/m32r.c	2001/06/11 16:58:56	1.26
+++ gcc/config/m32r/m32r.c	2001/06/21 06:17:52
@@ -36,6 +36,8 @@ Boston, MA 02111-1307, USA.  */
 #include "toplev.h"
 #include "ggc.h"
 #include "m32r-protos.h"
+#include "target.h"
+#include "target-def.h"
 
 /* Save the operands last given to a compare for use when we
    generate a scc or bcc insn.  */
@@ -59,7 +61,15 @@ int m32r_sched_odd_word_p;
 static void  init_reg_tables			PARAMS ((void));
 static void  block_move_call			PARAMS ((rtx, rtx, rtx));
 static int   m32r_is_insn			PARAMS ((rtx));
+static int   m32r_valid_decl_attribute		PARAMS ((tree, tree,
+							 tree, tree));
+
+/* Initialize the GCC target structure.  */
+#undef TARGET_VALID_DECL_ATTRIBUTE
+#define TARGET_VALID_DECL_ATTRIBUTE m32r_valid_decl_attribute
 
+struct gcc_target target = TARGET_INITIALIZER;
+
 /* Called by OVERRIDE_OPTIONS to initialize various things.  */
 
 void
@@ -242,8 +252,8 @@ init_idents PARAMS ((void))
 
 /* Return nonzero if IDENTIFIER is a valid decl attribute.  */
 
-int
-m32r_valid_machine_decl_attribute (type, attributes, identifier, args)
+static int
+m32r_valid_decl_attribute (type, attributes, identifier, args)
      tree type ATTRIBUTE_UNUSED;
      tree attributes ATTRIBUTE_UNUSED;
      tree identifier;
============================================================
Index: gcc/config/m32r/m32r.h
--- gcc/config/m32r/m32r.h	2001/06/11 16:58:56	1.38
+++ gcc/config/m32r/m32r.h	2001/06/21 06:18:00
@@ -2121,12 +2121,6 @@ extern char m32r_punct_chars[];
 /* A function address in a call instruction.  */
 #define FUNCTION_MODE SImode
 
-/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
-   is a valid machine specific attribute for DECL.
-   The attributes in ATTRIBUTES have previously been assigned to TYPE.  */
-#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \
-m32r_valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS)
-
 /* A C expression that returns zero if the attributes on TYPE1 and TYPE2 are
    incompatible, one if they are compatible, and two if they are
    nearly compatible (which causes a warning to be generated).  */
============================================================
Index: gcc/config/m68hc11/m68hc11-protos.h
--- gcc/config/m68hc11/m68hc11-protos.h	2001/06/10 10:18:40	1.5
+++ gcc/config/m68hc11/m68hc11-protos.h	2001/06/21 06:18:00
@@ -43,10 +43,6 @@ extern void m68hc11_function_arg_advance
                                                  enum machine_mode,
                                                  tree,
                                                  int));
-extern int m68hc11_valid_decl_attribute_p PARAMS((tree, tree,
-					          tree, tree));
-extern int m68hc11_valid_type_attribute_p PARAMS((tree, tree,
-						  tree, tree));
 extern int m68hc11_comp_type_attributes PARAMS((tree, tree));
 extern void m68hc11_set_default_type_attributes PARAMS((tree));
 extern void m68hc11_encode_section_info PARAMS((tree));
============================================================
Index: gcc/config/m68hc11/m68hc11.c
--- gcc/config/m68hc11/m68hc11.c	2001/05/20 11:37:11	1.11
+++ gcc/config/m68hc11/m68hc11.c	2001/06/21 06:18:09
@@ -52,6 +52,8 @@ Note:
 #include "basic-block.h"
 #include "function.h"
 #include "ggc.h"
+#include "target.h"
+#include "target-def.h"
 
 static void print_options PARAMS ((FILE *));
 static void emit_move_after_reload PARAMS ((rtx, rtx, rtx));
@@ -64,6 +66,8 @@ static rtx m68hc11_expand_compare PARAMS
 static int must_parenthesize PARAMS ((rtx));
 static int m68hc11_shift_cost PARAMS ((enum machine_mode, rtx, int));
 static int m68hc11_auto_inc_p PARAMS ((rtx));
+static int m68hc11_valid_type_attribute_p PARAMS((tree, tree,
+						  tree, tree));
 
 void create_regs_rtx PARAMS ((void));
 
@@ -201,7 +205,13 @@ const char *m68hc11_soft_reg_count;
 static void m68hc11_add_gc_roots PARAMS ((void));
 
 static int nb_soft_regs;
+
+/* Initialize the GCC target structure.  */
+#undef TARGET_VALID_TYPE_ATTRIBUTE
+#define TARGET_VALID_TYPE_ATTRIBUTE m68hc11_valid_type_attribute_p
 
+struct gcc_target target = TARGET_INITIALIZER;
+
 int
 m68hc11_override_options ()
 {
@@ -1116,24 +1126,10 @@ m68hc11_initialize_trampoline (tramp, fn
 /* Declaration of types.  */
 
 /* If defined, a C expression whose value is nonzero if IDENTIFIER
-   with arguments ARGS is a valid machine specific attribute for DECL.
-   The attributes in ATTRIBUTES have previously been assigned to DECL.  */
-
-int
-m68hc11_valid_decl_attribute_p (decl, attributes, identifier, args)
-     tree decl ATTRIBUTE_UNUSED;
-     tree attributes ATTRIBUTE_UNUSED;
-     tree identifier ATTRIBUTE_UNUSED;
-     tree args ATTRIBUTE_UNUSED;
-{
-  return 0;
-}
-
-/* If defined, a C expression whose value is nonzero if IDENTIFIER
    with arguments ARGS is a valid machine specific attribute for TYPE.
    The attributes in ATTRIBUTES have previously been assigned to TYPE.  */
 
-int
+static int
 m68hc11_valid_type_attribute_p (type, attributes, identifier, args)
      tree type;
      tree attributes ATTRIBUTE_UNUSED;
============================================================
Index: gcc/config/m68hc11/m68hc11.h
--- gcc/config/m68hc11/m68hc11.h	2001/06/10 10:16:27	1.11
+++ gcc/config/m68hc11/m68hc11.h	2001/06/21 06:18:16
@@ -1203,21 +1203,6 @@ typedef struct m68hc11_args
   m68hc11_initialize_trampoline ((TRAMP), (FNADDR), (CXT))
 
 
-
-/* If defined, a C expression whose value is nonzero if IDENTIFIER
-   with arguments ARGS is a valid machine specific attribute for DECL.
-   The attributes in ATTRIBUTES have previously been assigned to DECL.  */
-
-#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, NAME, ARGS) \
-  (m68hc11_valid_decl_attribute_p (DECL, ATTRIBUTES, NAME, ARGS))
-
-/* If defined, a C expression whose value is nonzero if IDENTIFIER
-   with arguments ARGS is a valid machine specific attribute for TYPE.
-   The attributes in ATTRIBUTES have previously been assigned to TYPE.  */
-
-#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, NAME, ARGS) \
-  (m68hc11_valid_type_attribute_p (TYPE, ATTRIBUTES, NAME, ARGS))
-
 /* If defined, a C expression whose value is zero if the attributes on
    TYPE1 and TYPE2 are incompatible, one if they are compatible, and
    two if they are nearly compatible (which causes a warning to be
============================================================
Index: gcc/config/m68k/m68k.c
--- gcc/config/m68k/m68k.c	2001/03/22 18:48:49	1.42
+++ gcc/config/m68k/m68k.c	2001/06/21 06:18:22
@@ -34,6 +34,8 @@ Boston, MA 02111-1307, USA.  */
 #include "recog.h"
 #include "toplev.h"
 #include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
 
 /* Needed for use_return_insn.  */
 #include "flags.h"
@@ -75,7 +77,11 @@ int m68k_align_funcs;
    sCC expanders peek at this to determine what to do for the
    68060, which has no fsCC instructions.  */
 int m68k_last_compare_had_fp_operands;
+
+/* Initialize the GCC target structure.  */
 
+struct gcc_target target = TARGET_INITIALIZER;
+
 /* Sometimes certain combinations of command options do not make
    sense on a particular target machine.  You can define a macro
    `OVERRIDE_OPTIONS' to take account of this.  This macro, if
============================================================
Index: gcc/config/m88k/m88k.c
--- gcc/config/m88k/m88k.c	2001/04/16 18:30:43	1.30
+++ gcc/config/m88k/m88k.c	2001/06/21 06:18:30
@@ -39,6 +39,8 @@ Boston, MA 02111-1307, USA.  */
 #include "recog.h"
 #include "toplev.h"
 #include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
 
 extern int flag_traditional;
 extern FILE *asm_out_file;
@@ -60,6 +62,10 @@ rtx m88k_compare_op0;		/* cmpsi operand 
 rtx m88k_compare_op1;		/* cmpsi operand 1 */
 
 enum processor_type m88k_cpu;	/* target cpu */
+
+/* Initialize the GCC target structure.  */
+
+struct gcc_target target = TARGET_INITIALIZER;
 
 /* Determine what instructions are needed to manufacture the integer VALUE
    in the given MODE.  */
============================================================
Index: gcc/config/mcore/mcore-protos.h
--- gcc/config/mcore/mcore-protos.h	2000/09/21 17:33:51	1.3
+++ gcc/config/mcore/mcore-protos.h	2001/06/21 06:18:31
@@ -37,8 +37,6 @@ extern int          mcore_naked_function
 #ifdef TREE_CODE
 extern void         mcore_unique_section         	PARAMS ((tree, int));
 extern void         mcore_encode_section_info    	PARAMS ((tree));
-extern int          mcore_valid_machine_decl_attribute	PARAMS ((tree, tree, tree, tree));
-extern tree         mcore_merge_machine_decl_attributes PARAMS ((tree, tree));
 
 #ifdef HAVE_MACHINE_MODES
 extern int          mcore_function_arg_partial_nregs	PARAMS ((CUMULATIVE_ARGS, enum machine_mode, tree, int));
============================================================
Index: gcc/config/mcore/mcore.c
--- gcc/config/mcore/mcore.c	2001/04/04 00:46:26	1.12
+++ gcc/config/mcore/mcore.c	2001/06/21 06:18:39
@@ -39,6 +39,8 @@ the Free Software Foundation, 675 Mass A
 #include "function.h"
 #include "ggc.h"
 #include "toplev.h"
+#include "target.h"
+#include "target-def.h"
 
 /* Maximum size we are allowed to grow the stack in a single operation.
    If we want more, we must do it in increments of at most this size.
@@ -128,7 +130,20 @@ static void       mcore_mark_dllexport  
 static void       mcore_mark_dllimport         PARAMS ((tree));
 static int        mcore_dllexport_p            PARAMS ((tree));
 static int        mcore_dllimport_p            PARAMS ((tree));
+static int        mcore_valid_decl_attribute   PARAMS ((tree, tree,
+							tree, tree));
 
+/* Initialize the GCC target structure.  */
+#ifdef TARGET_DLLIMPORT_DECL_ATTRIBUTES
+#undef TARGET_MERGE_DECL_ATTRIBUTES
+#define TARGET_MERGE_DECL_ATTRIBUTES merge_dllimport_decl_attributes
+#endif
+
+#undef TARGET_VALID_DECL_ATTRIBUTE
+#define TARGET_VALID_DECL_ATTRIBUTE mcore_valid_decl_attribute
+
+struct gcc_target target = TARGET_INITIALIZER;
+
 /* Adjust the stack and return the number of bytes taken to do it.  */
 static void
 output_stack_adjust (direction, size)
@@ -3496,8 +3511,8 @@ mcore_encode_section_info (decl)
    dllexport - for exporting a function/variable that will live in a dll
    dllimport - for importing a function/variable from a dll
    naked     - do not create a function prologue/epilogue.  */
-int
-mcore_valid_machine_decl_attribute (decl, attributes, attr, args)
+static int
+mcore_valid_decl_attribute (decl, attributes, attr, args)
      tree decl;
      tree attributes ATTRIBUTE_UNUSED;
      tree attr;
@@ -3535,57 +3550,6 @@ mcore_valid_machine_decl_attribute (decl
     }
 
   return 0;
-}
-
-/* Merge attributes in decls OLD and NEW.
-   This handles the following situation:
-
-     __declspec (dllimport) int foo;
-     int foo;
-
-   The second instance of `foo' nullifies the dllimport.  */
-tree
-mcore_merge_machine_decl_attributes (old, new)
-     tree old;
-     tree new;
-{
-  tree a;
-  int delete_dllimport_p;
-
-  old = DECL_MACHINE_ATTRIBUTES (old);
-  new = DECL_MACHINE_ATTRIBUTES (new);
-
-  /* What we need to do here is remove from `old' dllimport if it doesn't
-     appear in `new'.  dllimport behaves like extern: if a declaration is
-     marked dllimport and a definition appears later, then the object
-     is not dllimport'd.  */
-  if (   lookup_attribute ("dllimport", old) != NULL_TREE
-      && lookup_attribute ("dllimport", new) == NULL_TREE)
-    delete_dllimport_p = 1;
-  else
-    delete_dllimport_p = 0;
-
-  a = merge_attributes (old, new);
-
-  if (delete_dllimport_p)
-    {
-      tree prev,t;
-
-      /* Scan the list for dllimport and delete it.  */
-      for (prev = NULL_TREE, t = a; t; prev = t, t = TREE_CHAIN (t))
-	{
-	  if (is_attribute_p ("dllimport", TREE_PURPOSE (t)))
-	    {
-	      if (prev == NULL_TREE)
-		a = TREE_CHAIN (a);
-	      else
-		TREE_CHAIN (prev) = TREE_CHAIN (t);
-	      break;
-	    }
-	}
-    }
-
-  return a;
 }
 
 /* Cover function for UNIQUE_SECTION.  */
============================================================
Index: gcc/config/mcore/mcore.h
--- gcc/config/mcore/mcore.h	2001/05/26 01:31:43	1.6
+++ gcc/config/mcore/mcore.h	2001/06/21 06:18:44
@@ -35,15 +35,9 @@ the Free Software Foundation, 675 Mass A
 /* Run-time Target Specification.  */
 #define TARGET_MCORE
 
-/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
-   is a valid machine specific attribute for DECL.
-   The attributes in ATTRIBUTES have previously been assigned to DECL.  */
-#undef  VALID_MACHINE_DECL_ATTRIBUTE
-#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \
-  mcore_valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS)
-
-#define MERGE_MACHINE_DECL_ATTRIBUTES(OLD, NEW) \
-  mcore_merge_machine_decl_attributes (OLD, NEW)
+/* Get tree.c to declare a target-specific specialization of
+   merge_decl_attributes.  */
+#define TARGET_DLLIMPORT_DECL_ATTRIBUTES
 
 /* Support the __declspec keyword by turning them into attributes.
    We currently only support: dllexport and dllimport.
============================================================
Index: gcc/config/mips/mips.c
--- gcc/config/mips/mips.c	2001/05/31 19:39:30	1.117
+++ gcc/config/mips/mips.c	2001/06/21 06:19:05
@@ -49,8 +49,9 @@ Boston, MA 02111-1307, USA.  */
 #include "output.h"
 #include "tm_p.h"
 #include "ggc.h"
-
 #include "gstab.h"
+#include "target.h"
+#include "target-def.h"
 
 #ifdef __GNU_STAB__
 #define STAB_CODE_TYPE enum __stab_debug_code
@@ -427,7 +428,10 @@ enum reg_class mips_char_to_class[256] =
   NO_REGS,	NO_REGS,	NO_REGS,	NO_REGS,
   NO_REGS,	NO_REGS,	NO_REGS,	NO_REGS,
 };
+
+/* Initialize the GCC target structure.  */
 
+struct gcc_target target = TARGET_INITIALIZER;
 
 /* Return truth value of whether OP can be used as an operands
    where a register or 16 bit unsigned integer is needed.  */
============================================================
Index: gcc/config/mn10200/mn10200.c
--- gcc/config/mn10200/mn10200.c	2001/04/03 15:06:02	1.17
+++ gcc/config/mn10200/mn10200.c	2001/06/21 06:19:09
@@ -38,6 +38,8 @@ Boston, MA 02111-1307, USA.  */
 #include "ggc.h"
 #include "toplev.h"
 #include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
 
 /* Global registers known to hold the value zero.
 
@@ -63,7 +65,11 @@ static void count_tst_insns PARAMS ((int
 
 /* Note whether or not we need an out of line epilogue.  */
 static int out_of_line_epilogue;
+
+/* Initialize the GCC target structure.  */
 
+struct gcc_target target = TARGET_INITIALIZER;
+
 /* Indicate this file was compiled by gcc and what optimization
    level was used.  */
 void
============================================================
Index: gcc/config/mn10300/mn10300.c
--- gcc/config/mn10300/mn10300.c	2001/04/14 07:45:10	1.35
+++ gcc/config/mn10300/mn10300.c	2001/06/21 06:19:12
@@ -38,6 +38,8 @@ Boston, MA 02111-1307, USA.  */
 #include "obstack.h"
 #include "toplev.h"
 #include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
 
 /* The size of the callee register save area.  Right now we save everything
    on entry since it costs us nothing in code size.  It does cost us from a
@@ -48,7 +50,11 @@ Boston, MA 02111-1307, USA.  */
 			+ 4 * regs_ever_live[7] \
 			+ 16 * (regs_ever_live[14] || regs_ever_live[15] \
 				|| regs_ever_live[16] || regs_ever_live[17]))
+
+/* Initialize the GCC target structure.  */
 
+struct gcc_target target = TARGET_INITIALIZER;
+
 void
 asm_file_start (file)
      FILE *file;
============================================================
Index: gcc/config/ns32k/ns32k-protos.h
--- gcc/config/ns32k/ns32k-protos.h	2000/01/18 23:06:06	1.1
+++ gcc/config/ns32k/ns32k-protos.h	2001/06/21 06:19:12
@@ -40,8 +40,6 @@ extern int symbolic_reference_mentioned_
 #ifdef TREE_CODE
 extern int ns32k_comp_type_attributes PARAMS ((tree, tree));
 extern int ns32k_return_pops_args PARAMS ((tree, tree, int));
-extern int ns32k_valid_decl_attribute_p PARAMS ((tree, tree, tree, tree));
-extern int ns32k_valid_type_attribute_p PARAMS ((tree, tree, tree, tree));
 #endif /* TREE_CODE */
 
 extern int hard_regno_mode_ok PARAMS ((int, enum machine_mode));
============================================================
Index: gcc/config/ns32k/ns32k.c
--- gcc/config/ns32k/ns32k.c	2001/03/22 18:48:50	1.12
+++ gcc/config/ns32k/ns32k.c	2001/06/21 06:19:14
@@ -35,6 +35,8 @@ Boston, MA 02111-1307, USA.  */
 #include "flags.h"
 #include "recog.h"
 #include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
 
 #ifdef OSF_OS
 int ns32k_num_files = 0;
@@ -62,7 +64,14 @@ const char *const ns32k_out_reg_names[] 
 static rtx gen_indexed_expr PARAMS ((rtx, rtx, rtx));
 static const char *singlemove_string PARAMS ((rtx *));
 static void move_tail PARAMS ((rtx[], int, int));
+static int ns32k_valid_type_attribute_p PARAMS ((tree, tree, tree, tree));
+
+/* Initialize the GCC target structure.  */
+#undef TARGET_VALID_TYPE_ATTRIBUTE
+#define TARGET_VALID_TYPE_ATTRIBUTE ns32k_valid_type_attribute_p
 
+struct gcc_target target = TARGET_INITIALIZER;
+
 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */ 
 int
 hard_regno_mode_ok (regno, mode)
@@ -634,24 +643,10 @@ symbolic_reference_mentioned_p (op)
 }
 
 /* Return nonzero if IDENTIFIER with arguments ARGS is a valid machine specific
-   attribute for DECL.  The attributes in ATTRIBUTES have previously been
-   assigned to DECL.  */
-
-int
-ns32k_valid_decl_attribute_p (decl, attributes, identifier, args)
-     tree decl ATTRIBUTE_UNUSED;
-     tree attributes ATTRIBUTE_UNUSED;
-     tree identifier ATTRIBUTE_UNUSED;
-     tree args ATTRIBUTE_UNUSED;
-{
-  return 0;
-}
-
-/* Return nonzero if IDENTIFIER with arguments ARGS is a valid machine specific
    attribute for TYPE.  The attributes in ATTRIBUTES have previously been
    assigned to TYPE.  */
 
-int
+static int
 ns32k_valid_type_attribute_p (type, attributes, identifier, args)
      tree type;
      tree attributes ATTRIBUTE_UNUSED;
============================================================
Index: gcc/config/ns32k/ns32k.h
--- gcc/config/ns32k/ns32k.h	2001/02/18 18:40:02	1.19
+++ gcc/config/ns32k/ns32k.h	2001/06/21 06:19:19
@@ -1294,20 +1294,6 @@ while (0)
  { if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC)	\
      goto LABEL;}
 
-/* If defined, a C expression whose value is nonzero if IDENTIFIER
-   with arguments ARGS is a valid machine specific attribute for DECL.
-   The attributes in ATTRIBUTES have previously been assigned to DECL.  */
-
-#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, NAME, ARGS) \
-  (ns32k_valid_decl_attribute_p (DECL, ATTRIBUTES, NAME, ARGS))
-
-/* If defined, a C expression whose value is nonzero if IDENTIFIER
-   with arguments ARGS is a valid machine specific attribute for TYPE.
-   The attributes in ATTRIBUTES have previously been assigned to TYPE.  */
-
-#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, NAME, ARGS) \
-  (ns32k_valid_type_attribute_p (TYPE, ATTRIBUTES, NAME, ARGS))
-
 /* If defined, a C expression whose value is zero if the attributes on
    TYPE1 and TYPE2 are incompatible, one if they are compatible, and
    two if they are nearly compatible (which causes a warning to be
============================================================
Index: gcc/config/pa/pa.c
--- gcc/config/pa/pa.c	2001/05/07 01:50:52	1.112
+++ gcc/config/pa/pa.c	2001/06/21 06:19:38
@@ -41,6 +41,8 @@ Boston, MA 02111-1307, USA.  */
 #include "ggc.h"
 #include "recog.h"
 #include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
 
 #ifndef DO_FRAME_NOTES
 #ifdef INCOMING_RETURN_ADDR_RTX
@@ -105,7 +107,11 @@ struct deferred_plabel
   char *name;
 } *deferred_plabels = 0;
 int n_deferred_plabels = 0;
+
+/* Initialize the GCC target structure.  */
 
+struct gcc_target target = TARGET_INITIALIZER;
+
 void
 override_options ()
 {
============================================================
Index: gcc/config/pdp11/pdp11.c
--- gcc/config/pdp11/pdp11.c	2001/03/22 18:48:50	1.16
+++ gcc/config/pdp11/pdp11.c	2001/06/21 06:19:38
@@ -35,6 +35,8 @@ Boston, MA 02111-1307, USA.  */
 #include "recog.h"
 #include "tree.h"
 #include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
 
 /*
 #define FPU_REG_P(X)	((X)>=8 && (X)<14)
@@ -50,7 +52,11 @@ int current_first_parm_offset;
 
 static rtx find_addr_reg PARAMS ((rtx)); 
 static const char *singlemove_string PARAMS ((rtx *)); 
+
+/* Initialize the GCC target structure.  */
 
+struct gcc_target target = TARGET_INITIALIZER;
+
 /* Nonzero if OP is a valid second operand for an arithmetic insn.  */
 
 int
============================================================
Index: gcc/config/pj/pj.c
--- gcc/config/pj/pj.c	2001/03/22 18:48:50	1.4
+++ gcc/config/pj/pj.c	2001/06/21 06:19:41
@@ -99,6 +99,8 @@ Boston, MA 02111-1307, USA.  */
 #include "toplev.h"
 #include "basic-block.h"
 #include "ggc.h"
+#include "target.h"
+#include "target-def.h"
 
 /* Compare insns in pj.md store the information needed to generate
    branch instructions here.  */
@@ -122,7 +124,11 @@ static int nfakes;
 /* Whether anything has been printed to the current assembly output
    line. */
 int pj_stuff_on_line;
+
+/* Initialize the GCC target structure.  */
 
+struct gcc_target target = TARGET_INITIALIZER;
+
 /* printf to the asm_out_file, with special format control characters
    for decoding operands.  
 
============================================================
Index: gcc/config/romp/romp.c
--- gcc/config/romp/romp.c	2001/04/03 15:06:10	1.13
+++ gcc/config/romp/romp.c	2001/06/21 06:19:44
@@ -38,6 +38,8 @@ Boston, MA 02111-1307, USA.  */
 #include "tree.h"
 #include "function.h"
 #include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
 
 #define min(A,B)	((A) < (B) ? (A) : (B))
 #define max(A,B)	((A) > (B) ? (A) : (B))
@@ -48,6 +50,10 @@ static void output_fpops PARAMS ((FILE *
 static void init_fpops PARAMS ((void));
 static int memory_offset_in_range_p PARAMS ((rtx, enum machine_mode, int, int));
 static unsigned int hash_rtx PARAMS ((rtx));
+
+/* Initialize the GCC target structure.  */
+
+struct gcc_target target = TARGET_INITIALIZER;
 
 /* Return 1 if the insn using CC0 set by INSN does not contain
    any unsigned tests applied to the condition codes.
============================================================
Index: gcc/config/rs6000/rs6000-protos.h
--- gcc/config/rs6000/rs6000-protos.h	2001/05/21 18:38:22	1.19
+++ gcc/config/rs6000/rs6000-protos.h	2001/06/21 06:19:46
@@ -138,8 +138,6 @@ extern void setup_incoming_varargs PARAM
 extern struct rtx_def *rs6000_va_arg PARAMS ((tree, tree));
 extern void output_mi_thunk PARAMS ((FILE *, tree, int, tree));
 extern int rs6000_comp_type_attributes PARAMS ((tree, tree));
-extern int rs6000_valid_decl_attribute_p PARAMS ((tree, tree, tree, tree));
-extern int rs6000_valid_type_attribute_p PARAMS ((tree, tree, tree, tree));
 extern void rs6000_set_default_type_attributes PARAMS ((tree));
 extern void rs6000_encode_section_info PARAMS ((tree));
 extern void rs6000_select_section PARAMS ((tree, int));
============================================================
Index: gcc/config/rs6000/rs6000.c
--- gcc/config/rs6000/rs6000.c	2001/06/08 02:28:04	1.183
+++ gcc/config/rs6000/rs6000.c	2001/06/21 06:20:04
@@ -42,6 +42,8 @@ Boston, MA 02111-1307, USA.  */
 #include "ggc.h"
 #include "hashtab.h"
 #include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
 
 #ifndef TARGET_NO_PROTOTYPE
 #define TARGET_NO_PROTOTYPE 0
@@ -124,6 +126,7 @@ static void rs6000_free_machine_status P
 static void rs6000_init_machine_status PARAMS ((struct function *));
 static void rs6000_mark_machine_status PARAMS ((struct function *));
 static int rs6000_ra_ever_killed PARAMS ((void));
+static int rs6000_valid_type_attribute_p PARAMS ((tree, tree, tree, tree));
 
 /* Default register names.  */
 char rs6000_reg_names[][8] =
@@ -161,7 +164,13 @@ static char alt_reg_names[][8] =
 #ifndef MASK_STRICT_ALIGN
 #define MASK_STRICT_ALIGN 0
 #endif
+
+/* Initialize the GCC target structure.  */
+#undef TARGET_VALID_TYPE_ATTRIBUTE
+#define TARGET_VALID_TYPE_ATTRIBUTE rs6000_valid_type_attribute_p
 
+struct gcc_target target = TARGET_INITIALIZER;
+
 /* Override command line options.  Mostly we process the processor
    type and sometimes adjust other TARGET_ options.  */
 
@@ -7847,20 +7856,6 @@ rs6000_initialize_trampoline (addr, fnad
 }
 
 
-/* If defined, a C expression whose value is nonzero if IDENTIFIER
-   with arguments ARGS is a valid machine specific attribute for DECL.
-   The attributes in ATTRIBUTES have previously been assigned to DECL.  */
-
-int
-rs6000_valid_decl_attribute_p (decl, attributes, identifier, args)
-     tree decl ATTRIBUTE_UNUSED;
-     tree attributes ATTRIBUTE_UNUSED;
-     tree identifier ATTRIBUTE_UNUSED;
-     tree args ATTRIBUTE_UNUSED;
-{
-  return 0;
-}
-
 /* If defined, a C expression whose value is nonzero if IDENTIFIER
    with arguments ARGS is a valid machine specific attribute for TYPE.
    The attributes in ATTRIBUTES have previously been assigned to TYPE.  */
============================================================
Index: gcc/config/rs6000/rs6000.h
--- gcc/config/rs6000/rs6000.h	2001/05/21 18:38:25	1.113
+++ gcc/config/rs6000/rs6000.h	2001/06/21 06:20:17
@@ -1613,20 +1613,6 @@ typedef struct rs6000_args
 #define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, CXT)		\
   rs6000_initialize_trampoline (ADDR, FNADDR, CXT)
 
-/* If defined, a C expression whose value is nonzero if IDENTIFIER
-   with arguments ARGS is a valid machine specific attribute for DECL.
-   The attributes in ATTRIBUTES have previously been assigned to DECL.  */
-
-#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, NAME, ARGS) \
-  (rs6000_valid_decl_attribute_p (DECL, ATTRIBUTES, NAME, ARGS))
-
-/* If defined, a C expression whose value is nonzero if IDENTIFIER
-   with arguments ARGS is a valid machine specific attribute for TYPE.
-   The attributes in ATTRIBUTES have previously been assigned to TYPE.  */
-
-#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, NAME, ARGS) \
-  (rs6000_valid_type_attribute_p (TYPE, ATTRIBUTES, NAME, ARGS))
-
 /* If defined, a C expression whose value is zero if the attributes on
    TYPE1 and TYPE2 are incompatible, one if they are compatible, and
    two if they are nearly compatible (which causes a warning to be
============================================================
Index: gcc/config/sh/sh-protos.h
--- gcc/config/sh/sh-protos.h	2001/05/26 15:07:50	1.14
+++ gcc/config/sh/sh-protos.h	2001/06/21 06:20:17
@@ -106,7 +106,6 @@ extern rtx sh_va_arg PARAMS ((tree, tree
 
 #ifdef TREE_CODE
 extern void sh_pragma_insert_attributes PARAMS ((tree, tree *, tree *));
-extern int sh_valid_machine_decl_attribute PARAMS ((tree, tree, tree, tree));
 extern tree sh_build_va_list PARAMS ((void));
 #endif /* TREE_CODE */
 
============================================================
Index: gcc/config/sh/sh.c
--- gcc/config/sh/sh.c	2001/06/20 16:04:31	1.99
+++ gcc/config/sh/sh.c	2001/06/21 06:20:27
@@ -37,6 +37,8 @@ Boston, MA 02111-1307, USA.  */
 #include "recog.h"
 #include "c-pragma.h"
 #include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
 
 int code_for_indirect_jump_scratch = CODE_FOR_indirect_jump_scratch;
 
@@ -148,7 +150,14 @@ static int calc_live_regs PARAMS ((int *
 static void mark_use PARAMS ((rtx, rtx *));
 static HOST_WIDE_INT rounded_frame_size PARAMS ((int));
 static rtx mark_constant_pool_use PARAMS ((rtx));
+static int sh_valid_decl_attribute PARAMS ((tree, tree, tree, tree));
 
+/* Initialize the GCC target structure.  */
+#undef TARGET_VALID_DECL_ATTRIBUTE
+#define TARGET_VALID_DECL_ATTRIBUTE sh_valid_decl_attribute
+
+struct gcc_target target = TARGET_INITIALIZER;
+
 /* Print the operand address in x to the stream.  */
 
 void
@@ -4619,8 +4628,8 @@ sh_pragma_insert_attributes (node, attri
    trap_exit -- use a trapa to exit an interrupt function instead of
    an rte instruction.  */
 
-int
-sh_valid_machine_decl_attribute (decl, attributes, attr, args)
+static int
+sh_valid_decl_attribute (decl, attributes, attr, args)
      tree decl;
      tree attributes ATTRIBUTE_UNUSED;
      tree attr;
============================================================
Index: gcc/config/sh/sh.h
--- gcc/config/sh/sh.h	2001/05/29 10:44:01	1.103
+++ gcc/config/sh/sh.h	2001/06/21 06:20:35
@@ -2303,12 +2303,6 @@ extern int pragma_interrupt;
    for interrupt functions.  */
 extern struct rtx_def *sp_switch;
 
-/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
-   is a valid machine specific attribute for DECL.
-   The attributes in ATTRIBUTES have previously been assigned to DECL.  */
-#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \
-sh_valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS)
-
 #define PRAGMA_INSERT_ATTRIBUTES(node, pattr, prefix_attr) \
   sh_pragma_insert_attributes (node, pattr, prefix_attr)
 
============================================================
Index: gcc/config/sparc/sparc.c
--- gcc/config/sparc/sparc.c	2001/04/21 16:14:45	1.141
+++ gcc/config/sparc/sparc.c	2001/06/21 06:20:54
@@ -40,6 +40,8 @@ Boston, MA 02111-1307, USA.  */
 #include "toplev.h"
 #include "ggc.h"
 #include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
 
 /* 1 if the caller has placed an "unimp" insn immediately after the call.
    This is used in v8 code when calling a function that returns a structure.
@@ -175,7 +177,11 @@ struct sparc_cpu_select sparc_select[] =
 
 /* CPU type.  This is set from TARGET_CPU_DEFAULT and -m{cpu,tune}=xxx.  */
 enum processor_type sparc_cpu;
+
+/* Initialize the GCC target structure.  */
 
+struct gcc_target target = TARGET_INITIALIZER;
+
 /* Validate and override various options, and do some machine dependent
    initialization.  */
 
============================================================
Index: gcc/config/v850/v850-protos.h
--- gcc/config/v850/v850-protos.h	2001/05/26 15:07:50	1.8
+++ gcc/config/v850/v850-protos.h	2001/06/21 06:20:54
@@ -72,7 +72,6 @@ extern rtx    v850_va_arg               
 #endif /* TREE_CODE */
 
 #ifdef TREE_CODE
-extern int    v850_valid_machine_decl_attribute  PARAMS ((tree, tree, tree));
 extern void   v850_encode_data_area         PARAMS ((tree));
 extern void   v850_set_default_decl_attr    PARAMS ((tree));
 extern int    v850_interrupt_function_p     PARAMS ((tree));
============================================================
Index: gcc/config/v850/v850.c
--- gcc/config/v850/v850.c	2001/05/04 15:06:41	1.40
+++ gcc/config/v850/v850.c	2001/06/21 06:20:59
@@ -40,6 +40,8 @@ Boston, MA 02111-1307, USA.  */
 #include "c-lex.h"
 #include "ggc.h"
 #include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
 
 #ifndef streq
 #define streq(a,b) (strcmp (a, b) == 0)
@@ -54,6 +56,7 @@ static void v850_set_data_area       PAR
 static void v850_init_machine_status PARAMS ((struct function *));
 static void v850_mark_machine_status PARAMS ((struct function *));
 static void v850_free_machine_status PARAMS ((struct function *));
+static int v850_valid_decl_attribute PARAMS ((tree, tree, tree, tree));
 
 /* True if the current function has anonymous arguments.  */
 int current_function_anonymous_args;
@@ -81,7 +84,12 @@ static int v850_interrupt_cache_p = FALS
 
 /* Whether current function is an interrupt handler.  */
 static int v850_interrupt_p = FALSE;
+
+/* Initialize the GCC target structure.  */
+#undef TARGET_VALID_DECL_ATTRIBUTE
+#define TARGET_VALID_DECL_ATTRIBUTE v850_valid_decl_attribute
 
+struct gcc_target target = TARGET_INITIALIZER;
 
 /* Sometimes certain combinations of command options do not make
    sense on a particular target machine.  You can define a macro
@@ -2006,9 +2014,10 @@ v850_set_data_area (decl, data_area)
 /* Return nonzero if ATTR is a valid attribute for DECL.
    ARGS are the arguments supplied with ATTR.  */
 
-int
-v850_valid_machine_decl_attribute (decl, attr, args)
+static int
+v850_valid_decl_attribute (decl, unused, attr, args)
      tree decl;
+     tree unused ATTRIBUTE_UNUSED;
      tree attr;
      tree args;
 {
============================================================
Index: gcc/config/v850/v850.h
--- gcc/config/v850/v850.h	2001/05/26 01:31:43	1.35
+++ gcc/config/v850/v850.h	2001/06/21 06:21:05
@@ -1499,12 +1499,6 @@ do { char dstr[30];					\
    so give the MEM rtx a byte's mode.  */
 #define FUNCTION_MODE QImode
 
-/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
-   is a valid machine specific attribute for DECL.
-   The attributes in ATTRIBUTES have previously been assigned to DECL.  */
-#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \
-  v850_valid_machine_decl_attribute (DECL, IDENTIFIER, ARGS)
-
 /* A C statement that assigns default attributes to a newly created DECL.  */
 #define SET_DEFAULT_DECL_ATTRIBUTES(decl, attr) \
      v850_set_default_decl_attr (decl)
============================================================
Index: gcc/config/vax/vax.c
--- gcc/config/vax/vax.c	2001/03/22 18:48:52	1.10
+++ gcc/config/vax/vax.c	2001/06/21 06:21:07
@@ -34,7 +34,13 @@ Boston, MA 02111-1307, USA.  */
 #include "tree.h"
 #endif
 #include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
+
+/* Initialize the GCC target structure.  */
 
+struct gcc_target target = TARGET_INITIALIZER;
+
 /* This is like nonimmediate_operand with a restriction on the type of MEM.  */
 
 void
============================================================
Index: gcc/config/we32k/we32k.c
--- gcc/config/we32k/we32k.c	2000/12/07 01:58:24	1.9
+++ gcc/config/we32k/we32k.c	2001/06/21 06:21:07
@@ -30,7 +30,13 @@ Boston, MA 02111-1307, USA.  */
 #include "recog.h"
 #include "output.h"
 #include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
+
+/* Initialize the GCC target structure.  */
 
+struct gcc_target target = TARGET_INITIALIZER;
+
 void
 output_move_double (operands)
      rtx *operands;
============================================================
Index: gcc/cp/decl.c
--- gcc/cp/decl.c	2001/06/18 16:15:09	1.794
+++ gcc/cp/decl.c	2001/06/21 06:21:43
@@ -43,6 +43,7 @@ Boston, MA 02111-1307, USA.  */
 #include "../hash.h"
 #include "ggc.h"
 #include "tm_p.h"
+#include "target.h"
 
 extern int (*valid_lang_attribute) PARAMS ((tree, tree, tree, tree));
 
@@ -3483,7 +3484,7 @@ duplicate_decls (newdecl, olddecl)
   /* Copy all the DECL_... slots specified in the new decl
      except for any that we copy here from the old type.  */
   DECL_MACHINE_ATTRIBUTES (newdecl)
-    = merge_machine_decl_attributes (olddecl, newdecl);
+    = (*target.merge_decl_attributes) (olddecl, newdecl);
 
   if (TREE_CODE (newdecl) == TEMPLATE_DECL)
     {
============================================================
Index: gcc/cp/decl2.c
--- gcc/cp/decl2.c	2001/06/06 21:52:52	1.470
+++ gcc/cp/decl2.c	2001/06/21 06:21:56
@@ -2455,13 +2455,15 @@ import_export_class (ctype)
   if (CLASSTYPE_INTERFACE_ONLY (ctype))
     return;
 
-#ifdef VALID_MACHINE_TYPE_ATTRIBUTE
-  /* FIXME this should really use some sort of target-independent macro.  */
-  if (lookup_attribute ("dllimport", TYPE_ATTRIBUTES (ctype)))
-    import_export = -1;
-  else if (lookup_attribute ("dllexport", TYPE_ATTRIBUTES (ctype)))
-    import_export = 1;
-#endif
+  if (target.valid_type_attribute != NULL)
+    {
+      /* FIXME this should really use some sort of target-independent
+         macro.  */
+      if (lookup_attribute ("dllimport", TYPE_ATTRIBUTES (ctype)))
+	import_export = -1;
+      else if (lookup_attribute ("dllexport", TYPE_ATTRIBUTES (ctype)))
+	import_export = 1;
+    }
 
   /* If we got -fno-implicit-templates, we import template classes that
      weren't explicitly instantiated.  */
============================================================
Index: gcc/cp/typeck.c
--- gcc/cp/typeck.c	2001/06/18 16:15:12	1.352
+++ gcc/cp/typeck.c	2001/06/21 06:22:12
@@ -41,6 +41,7 @@ Boston, MA 02111-1307, USA.  */
 #include "output.h"
 #include "toplev.h"
 #include "diagnostic.h"
+#include "target.h"
 
 static tree convert_for_assignment PARAMS ((tree, tree, const char *, tree,
 					  int));
@@ -210,8 +211,8 @@ qualify_type_recursive (t1, t2)
       tree tt2 = TREE_TYPE (t2);
       tree b1;
       int type_quals;
-      tree target;
-      tree attributes = merge_machine_type_attributes (t1, t2);
+      tree tgt;
+      tree attributes = (*target.merge_type_attributes) (t1, t2);
 
       if (TREE_CODE (tt1) == OFFSET_TYPE)
 	{
@@ -223,11 +224,11 @@ qualify_type_recursive (t1, t2)
 	b1 = NULL_TREE;
 
       type_quals = (CP_TYPE_QUALS (tt1) | CP_TYPE_QUALS (tt2));
-      target = qualify_type_recursive (tt1, tt2);
-      target = cp_build_qualified_type (target, type_quals);
+      tgt = qualify_type_recursive (tt1, tt2);
+      tgt = cp_build_qualified_type (tgt, type_quals);
       if (b1)
-	target = build_offset_type (b1, target);
-      t1 = build_pointer_type (target);
+	tgt = build_offset_type (b1, tgt);
+      t1 = build_pointer_type (tgt);
       t1 = build_type_attribute_variant (t1, attributes);
     }
   return t1;
@@ -342,7 +343,7 @@ type_after_usual_arithmetic_conversions 
 
   /* In what follows, we slightly generalize the rules given in [expr]
      so as to deal with `long long'.  First, merge the attributes.  */
-  attributes = merge_machine_type_attributes (t1, t2);
+  attributes = (*target.merge_type_attributes) (t1, t2);
 
   /* If only one is real, use it as the result.  */
   if (code1 == REAL_TYPE && code2 != REAL_TYPE)
@@ -548,7 +549,7 @@ common_type (t1, t2)
     return type_after_usual_arithmetic_conversions (t1, t2);
 
   /* Merge the attributes.  */
-  attributes = merge_machine_type_attributes (t1, t2);
+  attributes = (*target.merge_type_attributes) (t1, t2);
 
   /* Treat an enum type as the unsigned integer type of the same width.  */
 
============================================================
Index: gcc/target.h
--- gcc/target.h	created
+++ gcc/target.h	Tue Jun 19 22:56:08 2001	1.1
@@ -0,0 +1,68 @@
+/* Data structure definitions for a generic GCC target.
+   Copyright (C) 2001 Free Software Foundation, Inc.
+
+This program is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ In other words, you are welcome to use, share and improve this program.
+ You are forbidden to forbid anyone else to use, share and improve
+ what you give them.   Help stamp out software-hoarding!  */
+
+/* This file contains a data structure that describes a GCC target.
+   At present, it is incomplete, but in future it should grow to
+   contain most or all target machine and target O/S specific
+   information.
+
+   This structure has its initializer declared in target-def.h in the
+   form of large macro TARGET_INITIALIZER that expands to many smaller
+   macros.
+
+   The smaller macros each initialize one component of the structure,
+   and each has a default.  Each target should have a file that
+   includes target.h and target-def.h, and overrides any inappropriate
+   defaults by undefining the relevant macro and defining a suitable
+   replacement.  That file should then contain the definition of
+   "target" like so:
+
+   struct gcc_target target = TARGET_INITIALIZER;
+
+   Doing things this way allows us to bring together everything that
+   defines a target to GCC.  By supplying a default that is
+   appropriate to most targets, we can easily add new items without
+   needing to edit dozens of target configuration files.  It should
+   also allow us to gradually reduce the amount of conditional
+   compilation that is scattered throughout GCC.  */
+
+struct gcc_target
+{
+  /* Given two decls, merge their attributes and return the result.  */
+  tree (* merge_decl_attributes) PARAMS ((tree, tree));
+
+  /* Given two types, merge their attributes and return the result.  */
+  tree (* merge_type_attributes) PARAMS ((tree, tree));
+
+  /* Nonzero if IDENTIFIER with arguments ARGS is a valid machine
+     specific attribute for DECL.  The attributes in ATTRIBUTES have
+     previously been assigned to DECL.  */
+  int (* valid_decl_attribute) PARAMS ((tree decl, tree attributes,
+					tree identifier, tree args));
+
+  /* Nonzero if IDENTIFIER with arguments ARGS is a valid machine
+     specific attribute for TYPE.  The attributes in ATTRIBUTES have
+     previously been assigned to TYPE.  */
+  int (* valid_type_attribute) PARAMS ((tree type, tree attributes,
+					tree identifier, tree args));
+};
+
+extern struct gcc_target target;
============================================================
Index: gcc/target-def.h
--- gcc/target-def.h	created
+++ gcc/target-def.h	Tue Jun 19 23:05:55 2001	1.1
@@ -0,0 +1,38 @@
+/* Default initializers for a generic GCC target.
+   Copyright (C) 2001 Free Software Foundation, Inc.
+
+This program is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ In other words, you are welcome to use, share and improve this program.
+ You are forbidden to forbid anyone else to use, share and improve
+ what you give them.   Help stamp out software-hoarding!  */
+
+/* See target.h for a desciption of what this file contains and how to
+   use it.  */
+
+/* Both in tree.c.  */
+#define TARGET_MERGE_DECL_ATTRIBUTES merge_decl_attributes
+#define TARGET_MERGE_TYPE_ATTRIBUTES merge_type_attributes
+#define TARGET_VALID_DECL_ATTRIBUTE 0
+#define TARGET_VALID_TYPE_ATTRIBUTE 0
+
+/* The whole shebang.  */
+#define TARGET_INITIALIZER			\
+{						\
+  TARGET_MERGE_DECL_ATTRIBUTES,			\
+  TARGET_MERGE_TYPE_ATTRIBUTES,			\
+  TARGET_VALID_DECL_ATTRIBUTE,			\
+  TARGET_VALID_TYPE_ATTRIBUTE			\
+}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]