+2001-06-29 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * target.h (struct gcc_target): Add comp_type_attributes and
+ set_default_type_attributes.
+ * target-def.h (TARGET_COMP_TYPE_ATTRIBUTES,
+ TARGET_SET_DEFAULT_TYPE_ATTRIBUTES): Define.
+ (TARGET_INITIALIZER): Update.
+ * doc/tm.texi (COMP_TYPE_ATTRIBUTES, TARGET_COMP_TYPE_ATTRIBUTES,
+ SET_DEFAULT_TYPE_ATTRIBUTES, TARGET_SET_DEFAULT_TYPE_ATTRIBUTES):
+ Update documentation of old target macros to describe new target
+ hooks.
+ * tree.c (make_node): Use target.set_default_type_attributes.
+ (default_comp_type_attributes,
+ default_set_default_type_attributes): New functions.
+ * tree.h (default_comp_type_attributes,
+ default_set_default_type_attributes): Declare.
+ * c-typeck.c (COMP_TYPE_ATTRIBUTES): Don't define.
+ (comptypes): Use target.comp_type_attributes.
+ * config/arc/arc-protos.h, config/arc/arc.c, config/arc/arc.h
+ (arc_comp_type_attributes, arc_set_default_type_attributes,
+ COMP_TYPE_ATTRIBUTES, SET_DEFAULT_TYPE_ATTRIBUTES): Remove
+ functions and macros with default behaviour.
+ * config/m32r/m32r-protos.h, config/m32r/m32r.c,
+ config/m32r/m32r.h (m32r_comp_type_attributes,
+ m32r_set_default_type_attributes, COMP_TYPE_ATTRIBUTES,
+ SET_DEFAULT_TYPE_ATTRIBUTES): Likewise.
+ * config/m68hc11/m68hc11-protos.h, config/m68hc11/m68hc11.c,
+ config/m68hc11/m68hc11.h (m68hc11_comp_type_attributes,
+ m68hc11_set_default_type_attributes, COMP_TYPE_ATTRIBUTES,
+ SET_DEFAULT_TYPE_ATTRIBUTES): Likewise.
+ * config/ns32k/ns32k-protos.h, config/ns32k/ns32k.c,
+ config/ns32k/ns32k.h (ns32k_comp_type_attributes,
+ COMP_TYPE_ATTRIBUTES): Likewise.
+ * config/rs6000/rs6000-protos.h, config/rs6000/rs6000.c,
+ config/rs6000/rs6000.h (rs6000_comp_type_attributes,
+ rs6000_set_default_type_attributes, COMP_TYPE_ATTRIBUTES,
+ SET_DEFAULT_TYPE_ATTRIBUTES): Likewise.
+ * config/d30v/d30v.h (COMP_TYPE_ATTRIBUTES,
+ SET_DEFAULT_TYPE_ATTRIBUTES): Remove commented out macro
+ definitions.
+ * config/i386/i386.h (SET_DEFAULT_TYPE_ATTRIBUTES): Likewise.
+ * config/ns32k/ns32k.h (SET_DEFAULT_TYPE_ATTRIBUTES): Likewise.
+ * config/arm/arm.c (arm_comp_type_attributes,
+ arm_set_default_type_attributes): Make static.
+ (TARGET_COMP_TYPE_ATTRIBUTES, TARGET_SET_DEFAULT_TYPE_ATTRIBUTES):
+ Define.
+ * config/arm/arm.h (COMP_TYPE_ATTRIBUTES,
+ SET_DEFAULT_TYPE_ATTRIBUTES): Don't define.
+ * config/arm/arm-protos.h (arm_comp_type_attributes,
+ arm_set_default_type_attributes): Don't declare.
+ * config/i386/i386.c (ix86_comp_type_attributes): Make static.
+ (TARGET_COMP_TYPE_ATTRIBUTES): Define.
+ * config/i386/i386.h (COMP_TYPE_ATTRIBUTES): Don't define.
+ * config/i386/i386-protos.h (ix86_comp_type_attributes): Don't
+ declare.
+
2001-06-28 Jan van Male <jan.vanmale@fenk.wau.nl>
* predict.c (dump_prediction): Eliminate fprintf warning.
if (TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2))
return 1;
-#ifndef COMP_TYPE_ATTRIBUTES
-#define COMP_TYPE_ATTRIBUTES(t1,t2) 1
-#endif
-
/* 1 if no need for warning yet, 2 if warning cause has been seen. */
- if (! (attrval = COMP_TYPE_ATTRIBUTES (t1, t2)))
+ if (! (attrval = (*target.comp_type_attributes) (t1, t2)))
return 0;
/* 1 if no need for warning yet, 2 if warning cause has been seen. */
#ifdef TREE_CODE
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 void arc_setup_incoming_varargs PARAMS ((CUMULATIVE_ARGS *,
enum machine_mode, tree,
int *, int));
return 0;
}
-/* Return zero if TYPE1 and TYPE are incompatible, one if they are compatible,
- and two if they are nearly compatible (which causes a warning to be
- generated). */
-
-int
-arc_comp_type_attributes (type1, type2)
- tree type1 ATTRIBUTE_UNUSED, type2 ATTRIBUTE_UNUSED;
-{
- return 1;
-}
-
-/* Set the default attributes for TYPE. */
-
-void
-arc_set_default_type_attributes (type)
- tree type ATTRIBUTE_UNUSED;
-{
-}
\f
/* Acceptable arguments to the call insn. */
/* A function address in a call instruction. */
#define FUNCTION_MODE SImode
-/* 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). */
-#define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \
-arc_comp_type_attributes (TYPE1, TYPE2)
-
-/* Give newly defined TYPE some default attributes. */
-#define SET_DEFAULT_TYPE_ATTRIBUTES(TYPE) \
-arc_set_default_type_attributes (TYPE)
-
/* alloca should avoid clobbering the old register save area. */
/* ??? Not defined in tm.texi. */
#define SETJMP_VIA_SAVE_AREA
#ifdef TREE_CODE
extern int arm_return_in_memory PARAMS ((tree));
-extern int arm_comp_type_attributes PARAMS ((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));
#endif
tree, tree));
static int arm_valid_decl_attribute_p PARAMS ((tree, tree,
tree, tree));
+static int arm_comp_type_attributes PARAMS ((tree, tree));
+static void arm_set_default_type_attributes PARAMS ((tree));
#undef Hint
#undef Mmode
#undef Ulong
# define TARGET_VALID_DECL_ATTRIBUTE arm_valid_decl_attribute_p
#endif
+#undef TARGET_COMP_TYPE_ATTRIBUTES
+#define TARGET_COMP_TYPE_ATTRIBUTES arm_comp_type_attributes
+
+#undef TARGET_SET_DEFAULT_TYPE_ATTRIBUTES
+#define TARGET_SET_DEFAULT_TYPE_ATTRIBUTES arm_set_default_type_attributes
+
struct gcc_target target = TARGET_INITIALIZER;
\f
/* Obstack for minipool constant handling. */
/* Return 0 if the attributes for two types are incompatible, 1 if they
are compatible, and 2 if they are nearly compatible (which causes a
warning to be generated). */
-int
+static int
arm_comp_type_attributes (type1, type2)
tree type1;
tree type2;
/* Assigns default attributes to newly defined type. This is used to
set short_call/long_call attributes for function types of
functions defined inside corresponding #pragma scopes. */
-void
+static void
arm_set_default_type_attributes (type)
tree type;
{
offset. */
extern int making_const_table;
\f
-/* 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). */
-#define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \
- (arm_comp_type_attributes (TYPE1, TYPE2))
-
-/* If defined, a C statement that assigns default attributes to newly
- defined TYPE. */
-#define SET_DEFAULT_TYPE_ATTRIBUTES(TYPE) \
- arm_set_default_type_attributes (TYPE)
-
/* Handle pragmas for compatibility with Intel's compilers. */
#define REGISTER_TARGET_PRAGMAS(PFILE) do { \
cpp_register_pragma (PFILE, 0, "long_calls", arm_pr_long_calls); \
must also be defined). */
/* #define HANDLE_WEAK_PRAGMA */
-/* 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). */
-/* #define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) */
-
-/* If defined, a C statement that assigns default attributes to newly defined
- TYPE. */
-/* #define SET_DEFAULT_TYPE_ATTRIBUTES(TYPE) */
-
/* Define this macro to control use of the character `$' in identifier names.
The value should be 0, 1, or 2. 0 means `$' is not allowed by default; 1
means it is allowed by default if `-traditional' is used; 2 means it is
#endif
#ifdef TREE_CODE
-extern int ix86_comp_type_attributes PARAMS ((tree, tree));
extern int ix86_return_pops_args PARAMS ((tree, tree, int));
extern int ix86_data_alignment PARAMS ((tree, int));
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_comp_type_attributes PARAMS ((tree, tree));
\f
/* Initialize the GCC target structure. */
#ifdef TARGET_DLLIMPORT_DECL_ATTRIBUTES
#undef TARGET_VALID_TYPE_ATTRIBUTE
#define TARGET_VALID_TYPE_ATTRIBUTE ix86_valid_type_attribute_p
+#undef TARGET_COMP_TYPE_ATTRIBUTES
+#define TARGET_COMP_TYPE_ATTRIBUTES ix86_comp_type_attributes
+
struct gcc_target target = TARGET_INITIALIZER;
\f
/* Sometimes certain combinations of command options do not make
are compatible, and 2 if they are nearly compatible (which causes a
warning to be generated). */
-int
+static int
ix86_comp_type_attributes (type1, type2)
tree type1;
tree type2;
while (0)
\f
-/* 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). */
-
-#define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \
- (ix86_comp_type_attributes (TYPE1, TYPE2))
-
-/* If defined, a C statement that assigns default attributes to newly
- defined TYPE. */
-
-/* #define SET_DEFAULT_TYPE_ATTRIBUTES (TYPE) */
-
/* Max number of args passed in registers. If this is more than 3, we will
have problems with ebx (register #4), since it is a caller save register and
is also used as the pic register in ELF. So for now, don't allow more than
extern void m32r_sched_init PARAMS ((FILE *, int));
extern int direct_return PARAMS ((void));
#ifdef TREE_CODE
-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));
extern enum m32r_function_type m32r_compute_function_type PARAMS ((tree));
extern void m32r_select_section PARAMS ((tree, int));
-extern void m32r_set_default_type_attributes PARAMS ((tree));
#ifdef HAVE_MACHINE_MODES
extern void m32r_setup_incoming_varargs PARAMS ((CUMULATIVE_ARGS *, Mmode, tree, int *, int));
return 0;
}
-
-/* Return zero if TYPE1 and TYPE are incompatible, one if they are compatible,
- and two if they are nearly compatible (which causes a warning to be
- generated). */
-
-int
-m32r_comp_type_attributes (type1, type2)
- tree type1 ATTRIBUTE_UNUSED;
- tree type2 ATTRIBUTE_UNUSED;
-{
- return 1;
-}
-
-/* Set the default attributes for TYPE. */
-
-void
-m32r_set_default_type_attributes (type)
- tree type ATTRIBUTE_UNUSED;
-{
-}
\f
/* A C statement or statements to switch to the appropriate
section for output of DECL. DECL is either a `VAR_DECL' node
/* A function address in a call instruction. */
#define FUNCTION_MODE SImode
-
-/* 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). */
-#define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \
- m32r_comp_type_attributes (TYPE1, TYPE2)
-
-/* Give newly defined TYPE some default attributes. */
-#define SET_DEFAULT_TYPE_ATTRIBUTES(TYPE) \
- m32r_set_default_type_attributes (TYPE)
\f
/* Define the information needed to generate branch and scc insns. This is
stored from the compare operation. Note that we can't use "rtx" here
enum machine_mode,
tree,
int));
-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));
#endif
return 0;
}
-/* 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). */
-
-int
-m68hc11_comp_type_attributes (type1, type2)
- tree type1 ATTRIBUTE_UNUSED;
- tree type2 ATTRIBUTE_UNUSED;
-{
- return 1;
-}
-
-/* If defined, a C statement that assigns default attributes to newly
- defined TYPE. */
-
-void
-m68hc11_set_default_type_attributes (type)
- tree type ATTRIBUTE_UNUSED;
-{
-}
-
/* Define this macro if references to a symbol must be treated
differently depending on something about the variable or function
named by the symbol (such as what section it is in).
m68hc11_initialize_trampoline ((TRAMP), (FNADDR), (CXT))
\f
-/* 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). */
-
-#define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \
- (m68hc11_comp_type_attributes (TYPE1, TYPE2))
-
-/* If defined, a C statement that assigns default attributes to newly
- defined TYPE. */
-
-#define SET_DEFAULT_TYPE_ATTRIBUTES(TYPE) \
- (m68hc11_set_default_type_attributes (TYPE))
-
/* Define this macro if references to a symbol must be treated
differently depending on something about the variable or function
named by the symbol (such as what section it is in).
#endif /* RTX_CODE */
#ifdef TREE_CODE
-extern int ns32k_comp_type_attributes PARAMS ((tree, tree));
extern int ns32k_return_pops_args PARAMS ((tree, tree, int));
#endif /* TREE_CODE */
return 0;
}
-/* Return 0 if the attributes for two types are incompatible, 1 if they
- are compatible, and 2 if they are nearly compatible (which causes a
- warning to be generated). */
-
-int
-ns32k_comp_type_attributes (type1, type2)
- tree type1 ATTRIBUTE_UNUSED;
- tree type2 ATTRIBUTE_UNUSED;
-{
- return 1;
-}
-
\f
/* Value is the number of bytes of arguments automatically
popped when returning from a subroutine call.
{ if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) \
goto LABEL;}
\f
-/* 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). */
-
-#define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \
- (ns32k_comp_type_attributes (TYPE1, TYPE2))
-
-/* If defined, a C statement that assigns default attributes to newly
- defined TYPE. */
-
-/* #define SET_DEFAULT_TYPE_ATTRIBUTES (TYPE) */
-\f
/* Specify the machine mode that this machine uses
for the index in the tablejump instruction.
HI mode is more efficient but the range is not wide enough for
int *, int));
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 void rs6000_set_default_type_attributes PARAMS ((tree));
extern void rs6000_encode_section_info PARAMS ((tree));
extern void rs6000_select_section PARAMS ((tree, int));
extern void rs6000_unique_section PARAMS ((tree, int));
return 0;
}
-/* 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). */
-
-int
-rs6000_comp_type_attributes (type1, type2)
- tree type1 ATTRIBUTE_UNUSED;
- tree type2 ATTRIBUTE_UNUSED;
-{
- return 1;
-}
-
-/* If defined, a C statement that assigns default attributes to newly
- defined TYPE. */
-
-void
-rs6000_set_default_type_attributes (type)
- tree type ATTRIBUTE_UNUSED;
-{
- return;
-}
-
/* Return a reference suitable for calling a function with the
longcall attribute. */
struct rtx_def *
#define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, CXT) \
rs6000_initialize_trampoline (ADDR, FNADDR, CXT)
\f
-/* 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). */
-
-#define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \
- (rs6000_comp_type_attributes (TYPE1, TYPE2))
-
-/* If defined, a C statement that assigns default attributes to newly
- defined TYPE. */
-
-#define SET_DEFAULT_TYPE_ATTRIBUTES(TYPE) \
- (rs6000_set_default_type_attributes (TYPE))
-
-\f
/* Definitions for __builtin_return_address and __builtin_frame_address.
__builtin_return_address (0) should give link register (65), enable
this. */
+2001-06-29 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * typeck.c (COMP_TYPE_ATTRIBUTES): Don't define.
+ (comptypes): Use target.comp_type_attributes.
+
2001-06-29 Nathan Sidwell <nathan@codesourcery.com>
* cp-tree.h (flag_dump_class_layout): Remove unneeded declaration.
if (TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2))
return 1;
- /* ??? COMP_TYPE_ATTRIBUTES is currently useless for variables as each
- attribute is its own main variant (`val' will remain 0). */
-#ifndef COMP_TYPE_ATTRIBUTES
-#define COMP_TYPE_ATTRIBUTES(t1,t2) 1
-#endif
-
if (strict & COMPARE_NO_ATTRIBUTES)
attrval = 1;
/* 1 if no need for warning yet, 2 if warning cause has been seen. */
- else if (! (attrval = COMP_TYPE_ATTRIBUTES (t1, t2)))
+ else if (! (attrval = (*target.comp_type_attributes) (t1, t2)))
return 0;
/* 1 if no need for warning yet, 2 if warning cause has been seen. */
The attributes in @var{attributes} have previously been assigned to @var{type}.
@end deftypefn
-@table @code
-@findex COMP_TYPE_ATTRIBUTES
-@item COMP_TYPE_ATTRIBUTES (@var{type1}, @var{type2})
-If defined, a C expression whose value is zero if the attributes on
+@deftypefn {Target Hook} int TARGET_COMP_TYPE_ATTRIBUTES (tree @var{type1}, tree @var{type2})
+If defined, this target hook is a function which returns zero if the attributes on
@var{type1} and @var{type2} are incompatible, one if they are compatible,
and two if they are nearly compatible (which causes a warning to be
-generated).
+generated). If this is not defined, machine-specific attributes are
+supposed always to be compatible.
+@end deftypefn
-@findex SET_DEFAULT_TYPE_ATTRIBUTES
-@item SET_DEFAULT_TYPE_ATTRIBUTES (@var{type})
-If defined, a C statement that assigns default attributes to
+@deftypefn {Target Hook} void TARGET_SET_DEFAULT_TYPE_ATTRIBUTES (tree @var{type})
+If defined, this target hook is a function which assigns default attributes to
newly defined @var{type}.
-@end table
+@end deftypefn
@deftypefn {Target Hook} tree TARGET_MERGE_TYPE_ATTRIBUTES (tree @var{type1}, tree @var{type2})
Define this target hook if the merging of type attributes needs special
#define TARGET_MERGE_TYPE_ATTRIBUTES merge_type_attributes
#define TARGET_VALID_DECL_ATTRIBUTE default_valid_attribute_p
#define TARGET_VALID_TYPE_ATTRIBUTE default_valid_attribute_p
+#define TARGET_COMP_TYPE_ATTRIBUTES default_comp_type_attributes
+#define TARGET_SET_DEFAULT_TYPE_ATTRIBUTES default_set_default_type_attributes
/* The whole shebang. */
#define TARGET_INITIALIZER \
TARGET_MERGE_DECL_ATTRIBUTES, \
TARGET_MERGE_TYPE_ATTRIBUTES, \
TARGET_VALID_DECL_ATTRIBUTE, \
- TARGET_VALID_TYPE_ATTRIBUTE \
+ TARGET_VALID_TYPE_ATTRIBUTE, \
+ TARGET_COMP_TYPE_ATTRIBUTES, \
+ TARGET_SET_DEFAULT_TYPE_ATTRIBUTES \
}
previously been assigned to TYPE. */
int (* valid_type_attribute) PARAMS ((tree type, tree attributes,
tree identifier, tree args));
+
+ /* Return 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). */
+ int (* comp_type_attributes) PARAMS ((tree type1, tree type2));
+
+ /* Assign default attributes to the newly defined TYPE. */
+ void (* set_default_type_attributes) PARAMS ((tree type));
};
extern struct gcc_target target;
TYPE_USER_ALIGN (t) = 0;
TYPE_MAIN_VARIANT (t) = t;
TYPE_ATTRIBUTES (t) = NULL_TREE;
-#ifdef SET_DEFAULT_TYPE_ATTRIBUTES
- SET_DEFAULT_TYPE_ATTRIBUTES (t);
-#endif
+ (* target.set_default_type_attributes) (t);
/* Note that we have not yet computed the alias set for this
type. */
TYPE_ALIAS_SET (t) = -1;
return 0;
}
+/* Default value of target.comp_type_attributes that always returns 1. */
+
+int
+default_comp_type_attributes (type1, type2)
+ tree type1 ATTRIBUTE_UNUSED;
+ tree type2 ATTRIBUTE_UNUSED;
+{
+ return 1;
+}
+
+/* Default version of target.set_default_type_attributes that always does
+ nothing. */
+
+void
+default_set_default_type_attributes (type)
+ tree type ATTRIBUTE_UNUSED;
+{
+}
+
/* 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. */
extern tree merge_decl_attributes PARAMS ((tree, tree));
extern tree merge_type_attributes PARAMS ((tree, tree));
extern int default_valid_attribute_p PARAMS ((tree, tree, tree, tree));
+extern int default_comp_type_attributes PARAMS ((tree, tree));
+extern void default_set_default_type_attributes PARAMS ((tree));
/* Split a list of declspecs and attributes into two. */