* Makefile.in (TARGET_H, TARGET_DEF_H): New.
(c-decl.o, tree.o, c-typeck.o, $(out_object_file)): Update.
* c-decl.c (duplicate_decls): Use function pointer.
* c-typeck.c (common_type): Similarly.
* tree.c (valid_machine_attribute): Similarly.
(merge_machine_type_attributes): Rename merge_type_attributes.
(merge_machine_decl_attributes): Rename merge_decl_attributes.
(merge_dllimport_decl_attributes): New function.
* tree.h (merge_machine_type_attributes): Rename merge_type_attributes.
(merge_machine_decl_attributes): Rename merge_decl_attributes.
(merge_dllimport_decl_attributes): New prototype.
* target.h: New.
* target-def.h: New.
doc: (Joseph Myers)
* doc/gcc.texi, doc/tm.texi: Update documentation.
cp: Make-lang.in: Update dependencies.
* spew.c: Include target.h.
(duplicate_decls): Call target function.
* decl2.c: include target.h
(import_export_class): Use existence of target function pointer.
* typeck.c: Include target.h.
(qualify_type_recursive): Rename variable. Call target function.
(type_after_usual_arithmetic_conversions): Similarly.
(common_type): Similarly.
config: * 1750a/1750a.c, a29k/29k.c, alpha/alpha.c, arc/arc.c, arm/arm.c,
avr/avr.c, c4x/c4x.c, clipper/clipper.c, convex/convex.c,
d30v/d30v.c, dsp16xx/dsp16xx.c, elxsi/elxsi.c, fr30/fr30.c,
i370/i370.c, i386/i386.c, i860/i860.c, i960/i960.c, ia64/ia64.c,
m32r/m32r.c, m68hc11/m68hc11.c, m68k/m68k.c, m88k/m88k.c,
mips/mips.c, mn10200/mn10200.c, mn10300/mn10300.c, ns32k/ns32k.c,
pa/pa.c, pdp11/pdp11.c, pj/pj.c, romp/romp.c, rs6000/rs6000.c,
sh/sh.c, sparc/sparc.c, v850/v850.c, vax/vax.c, we32k/we32k.c)
: Include target.h and target-def.h. Define target.
* arc/arc-protos.h (arc_valid_machine_decl_attribute): Remove.
* arc/arc.c (arc_valid_machine_decl_attribute): Rename
arc_valid_decl_attribute, make static.
* arc/arc.h (VALID_MACHINE_TYPE_ATTRIBUTE): Remove.
* arm/arm-protos.h (arm_valid_machine_decl_attribute,
arm_valid_type_attribute_p, arm_pe_valid_machine_decl_attribute,
arm_pe_merge_machine_decl_attributes): Remove.
* arm/arm.c (arm_valid_machine_decl_attribute_p): Rename
arm_valid_decl_attribute_p, make static.
(arm_pe_valid_decl_attribute_p): Move from pe.c.
* arm/pe.c (arm_pe_valid_machine_decl_attribute_p): Move to arm.c.
(arm_pe_merge_machine_decl_attributes): Move to tree.c.
* arm/arm.h (VALID_MACHINE_TYPE_ATTRIBUTE): Remove.
* arm/coff.h (VALID_MACHINE_DECL_ATTRIBUTE): Remove.
* arm/elf.h (VALID_MACHINE_DECL_ATTRIBUTE): Remove.
* arm/pe.h (TARGET_DLLIMPORT_DECL_ATTRIBUTES): New.
(VALID_MACHINE_TYPE_ATTRIBUTE, VALID_MACHINE_DECL_ATTRIBUTE): Remove.
* avr/avr-protos.h (valid_machine_type_attribute,
valid_machine_decl_attribute): Remove.
* avr/avr.c (valid_machine_type_attribute,
valid_machine_decl_attribute): Rename and make static.
* avr/avr.h (VALID_MACHINE_TYPE_ATTRIBUTE,
VALID_MACHINE_DECL_ATTRIBUTE): Remove.
* c4x/c4x-protos.h (c4x_valid_type_attribute_p): Remove.
* c4x/c4x.c (c4x_valid_type_attribute_p): Make static.
* c4x/c4x.h (VALID_MACHINE_TYPE_ATTRIBUTE): Remove.
* d30v/d30v.h: Remove obsolete comments.
* h8300/h8300-protos.h (h8300_valid_machine_decl_attribute): Remove.
* h8300/h8300.c (h8300_valid_machine_decl_attribute): Rename, make
static.
* h8300/h8300.h (VALID_MACHINE_DECL_ATTRIBUTE): Remove.
* i386/cygwin.h (TARGET_DLLIMPORT_DECL_ATTRIBUTES): Define.
(i386_pe_merge_decl_attributes, MERGE_MACHINE_DECL_ATTRIBUTES,
i386_pe_valid_type_attributes_p): Remove.
* i386/i386-protos.h (ix86_valid_decl_attribute_p,
ix86_valid_type_attribute_p): Remove.
* i386/i386.c (ix86_valid_decl_attribute_p): Remove.
(ix86_valid_type_attribute_p): Make static.
* i386/i386.h (VALID_MACHINE_DECL_ATTRIBUTE,
VALID_MACHINE_TYPE_ATTRIBUTE): Remove.
* i386/winnt.c (i386_pe_merge_decl_attributes): Move to tree.c.
* ia64/ia64-protos.h (ia64_valid_type_attribute): Remove.
* ia64/ia64.c (ia64_valid_type_attribute): Make static.
* ia64/ia64.h (VALID_MACHINE_TYPE_ATTRIBUTE): Remove.
* m32r/m32r-protos.h (m32r_valid_machine_decl_attribute): Remove.
* m32r/m32r.c (m32r_valid_decl_attribute): Make static.
* m32r/m32r.h (VALID_MACHINE_DECL_ATTRIBUTE): Remove.
* m68hc11/m68hc11-protos.h (m68hc11_valid_decl_attribute_p,
m68hc11_valid_type_attribute_p): Remove.
* m68hc11/m68hc11.c (m68hc11_valid_decl_attribute_p): Remove.
(m68hc11_valid_type_attribute_p): Make static.
* m68hc11/m68hc11.h (VALID_MACHINE_DECL_ATTRIBUTE,
VALID_MACHINE_TYPE_ATTRIBUTE): Remove.
* mcore/mcore-protos.h (mcore_valid_machine_decl_attribute,
mcore_merge_machine_decl_attribute): Remove.
* mcore/mcore.c (mcore_valid_machine_decl_attribute): Rename,
make static.
(mcore_merge_machine_decl_attributes): Move to tree.c.
* mcore/mcore.h (VALID_MACHINE_DECL_ATTRIBUTE,
VALID_MACHINE_TYPE_ATTRIBUTE): Remove.
(TARGET_DLLIMPORT_DECL_ATTRIBUTES): Define.
* ns32k/ns32k-protos.h (ns32k_valid_decl_attribute_p,
ns32k_valid_type_attribute_p): Remove.
* ns32k/ns32k.c (ns32k_valid_decl_attribute_p): Remove.
(ns32k_valid_type_attribute_p): Make static.
* ns32k/ns32k.h (VALID_MACHINE_DECL_ATTRIBUTE,
VALID_MACHINE_TYPE_ATTRIBUTE): Remove.
* rs6000/rs6000-protos.h (rs6000_valid_decl_attribute_p,
rs6000_valid_type_attribute_p): Remove.
* rs6000/rs6000.c (rs6000_valid_decl_attribute_p): Remove.
(rs6000_valid_type_attribute_p): Make static.
* rs6000/rs6000.h (VALID_MACHINE_DECL_ATTRIBUTE,
VALID_MACHINE_TYPE_ATTRIBUTE): Remove.
* sh/sh-protos.h (sh_valid_machine_decl_attribute): Remove.
* sh/sh.c (sh_valid_machine_decl_attribute): Rename, make static.
* sh/sh.h (VALID_MACHINE_DECL_ATTRIBUTE): Remove.
* v850/v850-protos.h (v850_valid_machine_decl_attribute): Remove.
* v850/v850.c (v850_valid_machine_decl_attribute): Rename, make static.
* v850/v850.h (VALID_MACHINE_DECL_ATTRIBUTE): Remove.
From-SVN: r43585
+2001-06-26 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * Makefile.in (TARGET_H, TARGET_DEF_H): New.
+ (c-decl.o, tree.o, c-typeck.o, $(out_object_file)): Update.
+ * c-decl.c (duplicate_decls): Use function pointer.
+ * c-typeck.c (common_type): Similarly.
+ * tree.c (valid_machine_attribute): Similarly.
+ (merge_machine_type_attributes): Rename merge_type_attributes.
+ (merge_machine_decl_attributes): Rename merge_decl_attributes.
+ (merge_dllimport_decl_attributes): New function.
+ * tree.h (merge_machine_type_attributes): Rename merge_type_attributes.
+ (merge_machine_decl_attributes): Rename merge_decl_attributes.
+ (merge_dllimport_decl_attributes): New prototype.
+ * target.h: New.
+ * target-def.h: New.
+
+doc: (Joseph Myers)
+ * doc/gcc.texi, doc/tm.texi: Update documentation.
+
+cp: Make-lang.in: Update dependencies.
+ * spew.c: Include target.h.
+ (duplicate_decls): Call target function.
+ * decl2.c: include target.h
+ (import_export_class): Use existence of target function pointer.
+ * typeck.c: Include target.h.
+ (qualify_type_recursive): Rename variable. Call target function.
+ (type_after_usual_arithmetic_conversions): Similarly.
+ (common_type): Similarly.
+
+config: * 1750a/1750a.c, a29k/29k.c, alpha/alpha.c, arc/arc.c, arm/arm.c,
+ avr/avr.c, c4x/c4x.c, clipper/clipper.c, convex/convex.c,
+ d30v/d30v.c, dsp16xx/dsp16xx.c, elxsi/elxsi.c, fr30/fr30.c,
+ i370/i370.c, i386/i386.c, i860/i860.c, i960/i960.c, ia64/ia64.c,
+ m32r/m32r.c, m68hc11/m68hc11.c, m68k/m68k.c, m88k/m88k.c,
+ mips/mips.c, mn10200/mn10200.c, mn10300/mn10300.c, ns32k/ns32k.c,
+ pa/pa.c, pdp11/pdp11.c, pj/pj.c, romp/romp.c, rs6000/rs6000.c,
+ sh/sh.c, sparc/sparc.c, v850/v850.c, vax/vax.c, we32k/we32k.c)
+ : Include target.h and target-def.h. Define target.
+
+ * arc/arc-protos.h (arc_valid_machine_decl_attribute): Remove.
+ * arc/arc.c (arc_valid_machine_decl_attribute): Rename
+ arc_valid_decl_attribute, make static.
+ * arc/arc.h (VALID_MACHINE_TYPE_ATTRIBUTE): Remove.
+ * arm/arm-protos.h (arm_valid_machine_decl_attribute,
+ arm_valid_type_attribute_p, arm_pe_valid_machine_decl_attribute,
+ arm_pe_merge_machine_decl_attributes): Remove.
+ * arm/arm.c (arm_valid_machine_decl_attribute_p): Rename
+ arm_valid_decl_attribute_p, make static.
+ (arm_pe_valid_decl_attribute_p): Move from pe.c.
+ * arm/pe.c (arm_pe_valid_machine_decl_attribute_p): Move to arm.c.
+ (arm_pe_merge_machine_decl_attributes): Move to tree.c.
+ * arm/arm.h (VALID_MACHINE_TYPE_ATTRIBUTE): Remove.
+ * arm/coff.h (VALID_MACHINE_DECL_ATTRIBUTE): Remove.
+ * arm/elf.h (VALID_MACHINE_DECL_ATTRIBUTE): Remove.
+ * arm/pe.h (TARGET_DLLIMPORT_DECL_ATTRIBUTES): New.
+ (VALID_MACHINE_TYPE_ATTRIBUTE, VALID_MACHINE_DECL_ATTRIBUTE): Remove.
+ * avr/avr-protos.h (valid_machine_type_attribute,
+ valid_machine_decl_attribute): Remove.
+ * avr/avr.c (valid_machine_type_attribute,
+ valid_machine_decl_attribute): Rename and make static.
+ * avr/avr.h (VALID_MACHINE_TYPE_ATTRIBUTE,
+ VALID_MACHINE_DECL_ATTRIBUTE): Remove.
+ * c4x/c4x-protos.h (c4x_valid_type_attribute_p): Remove.
+ * c4x/c4x.c (c4x_valid_type_attribute_p): Make static.
+ * c4x/c4x.h (VALID_MACHINE_TYPE_ATTRIBUTE): Remove.
+ * d30v/d30v.h: Remove obsolete comments.
+ * h8300/h8300-protos.h (h8300_valid_machine_decl_attribute): Remove.
+ * h8300/h8300.c (h8300_valid_machine_decl_attribute): Rename, make
+ static.
+ * h8300/h8300.h (VALID_MACHINE_DECL_ATTRIBUTE): Remove.
+ * i386/cygwin.h (TARGET_DLLIMPORT_DECL_ATTRIBUTES): Define.
+ (i386_pe_merge_decl_attributes, MERGE_MACHINE_DECL_ATTRIBUTES,
+ i386_pe_valid_type_attributes_p): Remove.
+ * i386/i386-protos.h (ix86_valid_decl_attribute_p,
+ ix86_valid_type_attribute_p): Remove.
+ * i386/i386.c (ix86_valid_decl_attribute_p): Remove.
+ (ix86_valid_type_attribute_p): Make static.
+ * i386/i386.h (VALID_MACHINE_DECL_ATTRIBUTE,
+ VALID_MACHINE_TYPE_ATTRIBUTE): Remove.
+ * i386/winnt.c (i386_pe_merge_decl_attributes): Move to tree.c.
+ * ia64/ia64-protos.h (ia64_valid_type_attribute): Remove.
+ * ia64/ia64.c (ia64_valid_type_attribute): Make static.
+ * ia64/ia64.h (VALID_MACHINE_TYPE_ATTRIBUTE): Remove.
+ * m32r/m32r-protos.h (m32r_valid_machine_decl_attribute): Remove.
+ * m32r/m32r.c (m32r_valid_decl_attribute): Make static.
+ * m32r/m32r.h (VALID_MACHINE_DECL_ATTRIBUTE): Remove.
+ * m68hc11/m68hc11-protos.h (m68hc11_valid_decl_attribute_p,
+ m68hc11_valid_type_attribute_p): Remove.
+ * m68hc11/m68hc11.c (m68hc11_valid_decl_attribute_p): Remove.
+ (m68hc11_valid_type_attribute_p): Make static.
+ * m68hc11/m68hc11.h (VALID_MACHINE_DECL_ATTRIBUTE,
+ VALID_MACHINE_TYPE_ATTRIBUTE): Remove.
+ * mcore/mcore-protos.h (mcore_valid_machine_decl_attribute,
+ mcore_merge_machine_decl_attribute): Remove.
+ * mcore/mcore.c (mcore_valid_machine_decl_attribute): Rename,
+ make static.
+ (mcore_merge_machine_decl_attributes): Move to tree.c.
+ * mcore/mcore.h (VALID_MACHINE_DECL_ATTRIBUTE,
+ VALID_MACHINE_TYPE_ATTRIBUTE): Remove.
+ (TARGET_DLLIMPORT_DECL_ATTRIBUTES): Define.
+ * ns32k/ns32k-protos.h (ns32k_valid_decl_attribute_p,
+ ns32k_valid_type_attribute_p): Remove.
+ * ns32k/ns32k.c (ns32k_valid_decl_attribute_p): Remove.
+ (ns32k_valid_type_attribute_p): Make static.
+ * ns32k/ns32k.h (VALID_MACHINE_DECL_ATTRIBUTE,
+ VALID_MACHINE_TYPE_ATTRIBUTE): Remove.
+ * rs6000/rs6000-protos.h (rs6000_valid_decl_attribute_p,
+ rs6000_valid_type_attribute_p): Remove.
+ * rs6000/rs6000.c (rs6000_valid_decl_attribute_p): Remove.
+ (rs6000_valid_type_attribute_p): Make static.
+ * rs6000/rs6000.h (VALID_MACHINE_DECL_ATTRIBUTE,
+ VALID_MACHINE_TYPE_ATTRIBUTE): Remove.
+ * sh/sh-protos.h (sh_valid_machine_decl_attribute): Remove.
+ * sh/sh.c (sh_valid_machine_decl_attribute): Rename, make static.
+ * sh/sh.h (VALID_MACHINE_DECL_ATTRIBUTE): Remove.
+ * v850/v850-protos.h (v850_valid_machine_decl_attribute): Remove.
+ * v850/v850.c (v850_valid_machine_decl_attribute): Rename, make static.
+ * v850/v850.h (VALID_MACHINE_DECL_ATTRIBUTE): Remove.
+
2001-06-26 Vladimir Makarov <vmakarov@toke.toronto.redhat.com>
* glimits.h (USHRT_MAX): Use unsigned suffix if int can not hold
HCONFIG_H = hconfig.h $(build_xm_file_list)
CONFIG_H = $(GCONFIG_H) insn-codes.h insn-flags.h
TCONFIG_H = tconfig.h $(xm_file_list) insn-codes.h
+TARGET_H = target.h
+TARGET_DEF_H = target-def.h
TM_P_H = tm_p.h $(tm_p_file_list) insn-codes.h
MACHMODE_H = machmode.h machmode.def
$(SHELL) $(srcdir)/move-if-change tmp-c-parse.y $(srcdir)/c-parse.y
c-decl.o : c-decl.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) $(C_TREE_H) \
- $(GGC_H) c-lex.h flags.h function.h output.h $(EXPR_H) \
+ $(GGC_H) $(TARGET_H) c-lex.h flags.h function.h output.h $(EXPR_H) \
toplev.h intl.h $(TM_P_H)
c-typeck.o : c-typeck.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(C_TREE_H) \
- flags.h intl.h output.h $(EXPR_H) $(RTL_H) toplev.h $(TM_P_H)
+ $(TARGET_H) flags.h intl.h output.h $(EXPR_H) $(RTL_H) toplev.h $(TM_P_H)
c-lang.o : c-lang.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(C_TREE_H) \
$(GGC_H) c-lex.h toplev.h diagnostic.h output.h function.h \
$(RTL_H) $(EXPR_H)
convert.o: convert.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) flags.h convert.h toplev.h
tree.o : tree.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) flags.h function.h toplev.h \
- $(GGC_H) $(HASHTAB_H) output.h $(TM_P_H)
+ $(GGC_H) $(HASHTAB_H) $(TARGET_H) output.h $(TM_P_H)
print-tree.o : print-tree.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(GGC_H)
stor-layout.o : stor-layout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) flags.h \
function.h $(EXPR_H) $(RTL_H) toplev.h $(GGC_H) $(TM_P_H)
$(out_object_file): $(out_file) $(CONFIG_H) $(TREE_H) $(GGC_H) \
$(RTL_H) $(REGS_H) hard-reg-set.h real.h insn-config.h conditions.h \
- output.h $(INSN_ATTR_H) $(SYSTEM_H) toplev.h \
- function.h sched-int.h $(TM_P_H)
+ output.h $(INSN_ATTR_H) $(SYSTEM_H) toplev.h $(TARGET_H) \
+ $(TARGET_DEF_H) function.h sched-int.h $(TM_P_H)
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
$(out_file) $(OUTPUT_OPTION)
#include "ggc.h"
#include "tm_p.h"
#include "cpplib.h"
+#include "target.h"
/* In grokdeclarator, distinguish syntactic contexts of declarators. */
enum decl_context
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)
#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. */
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. */
#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;
{"Init", "Normal", "Konst", "Static"};
static int which_bit PARAMS ((int));
+\f
+/* Initialize the GCC target structure. */
+struct gcc_target target = TARGET_INITIALIZER;
+\f
void
notice_update_cc (exp)
rtx exp;
#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));
rtx a29k_compare_op0, a29k_compare_op1;
int a29k_compare_fp_p;
\f
+/* Initialize the GCC target structure. */
+
+struct gcc_target target = TARGET_INITIALIZER;
+\f
/* Returns 1 if OP is a 8-bit constant. */
int
#include "ggc.h"
#include "tm_p.h"
#include "integrate.h"
+#include "target.h"
+#include "target-def.h"
/* External data. */
extern int rtx_equal_function_value_matters;
#define REG_PV 27
#define REG_RA 26
\f
+/* Initialize the GCC target structure. */
+
+struct gcc_target target = TARGET_INITIALIZER;
+\f
/* Parse target option strings. */
void
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));
#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;
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));
+\f
+/* 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;
+\f
/* Called by OVERRIDE_OPTIONS to initialize various things. */
void
/* 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;
/* 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). */
#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));
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));
#include "c-pragma.h"
#include "integrate.h"
#include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
/* Forward definitions of types. */
typedef struct minipool_node Mnode;
static Ulong arm_compute_save_reg_mask PARAMS ((void));
static Ulong arm_isr_value PARAMS ((tree));
static Ulong arm_compute_func_type PARAMS ((void));
-\f
+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
+\f
+/* 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;
+\f
/* Obstack for minipool constant handling. */
static struct obstack minipool_obstack;
static char *minipool_startobj;
}
\f
-/* 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;
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;
{
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 */
\f
/* Routines for use in generating RTL. */
rtx
offset. */
extern int making_const_table;
\f
-/* 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
{ "marm", "mlittle-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork" }
#endif
\f
-/* 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)
-\f
/* This is COFF, but prefer stabs. */
#define SDB_DEBUGGING_INFO
#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)
\f
/* This outputs a lot of .req's to define alias for various registers.
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;
-}
\f
/* Return non-zero if DECL is a dllexport'd object. */
#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
1,1,1 \
}
\f
-/* 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
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));
#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))
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
};
int avr_case_values_threshold = 30000;
+\f
+/* 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;
+\f
void
avr_override_options ()
{
/* 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;
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;
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
extern void c4x_encode_section_info PARAMS ((tree));
-extern int c4x_valid_type_attribute_p PARAMS ((tree, tree, tree, tree));
-
#endif /* TREE_CODE */
#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;
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));
+\f
+/* 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;
+\f
/* Called to register all of our global variables with the garbage
collector. */
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;
#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) \
#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;
+\f
+/* Initialize the GCC target structure. */
+struct gcc_target target = TARGET_INITIALIZER;
+\f
/* Compute size of a clipper stack frame where 'lsize' is the required
space for local variables. */
#include "function.h"
#include "expr.h"
#include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
/* Tables used in convex.h */
static rtx convert_arg_pushes ();
#endif
static void expand_movstr_call PARAMS ((rtx *));
+\f
+/* Initialize the GCC target structure. */
+struct gcc_target target = TARGET_INITIALIZER;
+\f
/* Here from OVERRIDE_OPTIONS at startup. Initialize constant tables. */
void
#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,
/* Map class letter into register class */
enum reg_class reg_class_from_letter[256];
+\f
+/* Initialize the GCC target structure. */
+struct gcc_target target = TARGET_INITIALIZER;
\f
/* Sometimes certain combinations of command options do not make
sense on a particular target machine. You can define a macro
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). */
#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;
};
static int reg_save_size PARAMS ((void));
+\f
+/* Initialize the GCC target structure. */
+struct gcc_target target = TARGET_INITIALIZER;
+\f
int
hard_regno_mode_ok (regno, mode)
int regno;
#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;
static const char *const cmp_tab[] = {
"gt", "gt", "eq", "eq", "ge", "ge", "lt", "lt", "ne", "ne",
"le", "le" };
+\f
+/* Initialize the GCC target structure. */
+struct gcc_target target = TARGET_INITIALIZER;
+\f
/* type is the index into the above table */
/* s is "" for signed, or "u" for unsigned */
const char *
#include "except.h"
#include "function.h"
#include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
/*}}}*/
/*{{{ Function Prologues & Epilogues */
#if UNITS_PER_WORD == 4
#define WORD_ALIGN(SIZE) (((SIZE) + 3) & ~3)
#endif
-
+\f
+/* Initialize the GCC target structure. */
+
+struct gcc_target target = TARGET_INITIALIZER;
+\f
/* 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. */
#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));
#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));
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;
static const char *const h8_mov_ops[2] = { "mov.w", "mov.l" };
const char *h8_push_op, *h8_pop_op, *h8_mov_op;
+\f
+/* 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;
+\f
/* Initialize various cpu specific globals at start up. */
void
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;
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);
#include "c-pragma.h"
#include "c-lex.h"
#include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
extern FILE *asm_out_file;
/*F8 8 9 */
0x38, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF
};
+\f
+/* Initialize the GCC target structure. */
+struct gcc_target target = TARGET_INITIALIZER;
+\f
/* Map characters from one character set to another.
C is the character to be translated. */
"-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
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
DECL_CONTEXT (DECL) will be 0 so i386_pe_dll{ex,im}port_p will return 0.
#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));
#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
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));
+\f
+/* 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;
\f
/* Sometimes certain combinations of command options do not make
sense on a particular target machine. You can define a macro
#endif
}
\f
-/* 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;
while (0)
\f
-/* 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
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;
-}
\f
/* Return the type that we should use to determine if DECL is
imported or exported. */
#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));
rtx i860_compare_op0, i860_compare_op1;
\f
+/* Initialize the GCC target structure. */
+
+struct gcc_target target = TARGET_INITIALIZER;
+\f
/* Return non-zero if this pattern, can be evaluated safely, even if it
was not asked for. */
int
#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. */
((TYPE_ARG_TYPES (TREE_TYPE (FNDECL)) != 0 \
&& (TREE_VALUE (tree_last (TYPE_ARG_TYPES (TREE_TYPE (FNDECL)))) != void_type_node)) \
|| current_function_varargs)
+\f
+/* Initialize the GCC target structure. */
+struct gcc_target target = TARGET_INITIALIZER;
+\f
/* Initialize variables before compiling any files. */
void
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 */
#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. */
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));
+\f
+/* 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;
\f
/* Return 1 if OP is a valid operand for the MEM of a CALL insn. */
/* 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;
#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
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));
#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. */
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));
+\f
+/* 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;
+\f
/* Called by OVERRIDE_OPTIONS to initialize various things. */
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;
/* 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). */
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));
#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));
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));
static void m68hc11_add_gc_roots PARAMS ((void));
static int nb_soft_regs;
+\f
+/* 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;
+\f
int
m68hc11_override_options ()
{
\f
/* 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;
m68hc11_initialize_trampoline ((TRAMP), (FNADDR), (CXT))
\f
-
-/* 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
#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"
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;
+\f
+/* Initialize the GCC target structure. */
+struct gcc_target target = TARGET_INITIALIZER;
+\f
/* 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
#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;
enum processor_type m88k_cpu; /* target cpu */
\f
+/* Initialize the GCC target structure. */
+
+struct gcc_target target = TARGET_INITIALIZER;
+\f
/* Determine what instructions are needed to manufacture the integer VALUE
in the given MODE. */
#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));
#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.
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));
+\f
+/* 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;
\f
/* Adjust the stack and return the number of bytes taken to do it. */
static void
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;
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. */
void
/* 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.
#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
NO_REGS, NO_REGS, NO_REGS, NO_REGS,
NO_REGS, NO_REGS, NO_REGS, NO_REGS,
};
+\f
+/* Initialize the GCC target structure. */
+struct gcc_target target = TARGET_INITIALIZER;
\f
/* Return truth value of whether OP can be used as an operands
where a register or 16 bit unsigned integer is needed. */
#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.
/* Note whether or not we need an out of line epilogue. */
static int out_of_line_epilogue;
+\f
+/* Initialize the GCC target structure. */
+struct gcc_target target = TARGET_INITIALIZER;
+\f
/* Indicate this file was compiled by gcc and what optimization
level was used. */
void
#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
+ 4 * regs_ever_live[7] \
+ 16 * (regs_ever_live[14] || regs_ever_live[15] \
|| regs_ever_live[16] || regs_ever_live[17]))
+\f
+/* Initialize the GCC target structure. */
+struct gcc_target target = TARGET_INITIALIZER;
+\f
void
asm_file_start (file)
FILE *file;
#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));
#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;
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));
+\f
+/* 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;
+\f
/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
int
hard_regno_mode_ok (regno, mode)
return 0;
}
\f
-/* 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;
{ if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) \
goto LABEL;}
\f
-/* 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
#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
char *name;
} *deferred_plabels = 0;
int n_deferred_plabels = 0;
+\f
+/* Initialize the GCC target structure. */
+struct gcc_target target = TARGET_INITIALIZER;
+\f
void
override_options ()
{
#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)
static rtx find_addr_reg PARAMS ((rtx));
static const char *singlemove_string PARAMS ((rtx *));
+\f
+/* Initialize the GCC target structure. */
+struct gcc_target target = TARGET_INITIALIZER;
+\f
/* Nonzero if OP is a valid second operand for an arithmetic insn. */
int
#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. */
/* Whether anything has been printed to the current assembly output
line. */
int pj_stuff_on_line;
+\f
+/* Initialize the GCC target structure. */
+struct gcc_target target = TARGET_INITIALIZER;
+\f
/* printf to the asm_out_file, with special format control characters
for decoding operands.
#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))
static int memory_offset_in_range_p PARAMS ((rtx, enum machine_mode, int, int));
static unsigned int hash_rtx PARAMS ((rtx));
\f
+/* Initialize the GCC target structure. */
+
+struct gcc_target target = TARGET_INITIALIZER;
+\f
/* Return 1 if the insn using CC0 set by INSN does not contain
any unsigned tests applied to the condition codes.
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));
#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
static void rs6000_free_machine_status PARAMS ((struct function *));
static void rs6000_init_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));
\f
/* Default register names. */
char rs6000_reg_names[][8] =
#ifndef MASK_STRICT_ALIGN
#define MASK_STRICT_ALIGN 0
#endif
+\f
+/* 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;
+\f
/* Override command line options. Mostly we process the processor
type and sometimes adjust other TARGET_ options. */
}
\f
-/* 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. */
-int
+static int
rs6000_valid_type_attribute_p (type, attributes, identifier, args)
tree type;
tree attributes ATTRIBUTE_UNUSED;
#define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, CXT) \
rs6000_initialize_trampoline (ADDR, FNADDR, CXT)
\f
-/* 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
#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 */
#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;
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));
+\f
+/* 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;
\f
/* Print the operand address in x to the stream. */
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;
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)
#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.
/* CPU type. This is set from TARGET_CPU_DEFAULT and -m{cpu,tune}=xxx. */
enum processor_type sparc_cpu;
+\f
+/* Initialize the GCC target structure. */
+struct gcc_target target = TARGET_INITIALIZER;
+\f
/* Validate and override various options, and do some machine dependent
initialization. */
#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));
#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)
static void substitute_ep_register PARAMS ((rtx, rtx, int, int, rtx *, rtx *));
static int ep_memory_offset PARAMS ((enum machine_mode, int));
static void v850_set_data_area PARAMS ((tree, v850_data_area));
+static int v850_valid_decl_attribute PARAMS ((tree, tree, tree, tree));
/* True if the current function has anonymous arguments. */
int current_function_anonymous_args;
/* Whether current function is an interrupt handler. */
static int v850_interrupt_p = FALSE;
+\f
+/* 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;
\f
/* Sometimes certain combinations of command options do not make
sense on a particular target machine. You can define a macro
/* 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;
{
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)
#include "tree.h"
#endif
#include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
+\f
+/* Initialize the GCC target structure. */
+struct gcc_target target = TARGET_INITIALIZER;
+\f
/* This is like nonimmediate_operand with a restriction on the type of MEM. */
void
#include "recog.h"
#include "output.h"
#include "tm_p.h"
+#include "target.h"
+#include "target-def.h"
+\f
+/* Initialize the GCC target structure. */
+struct gcc_target target = TARGET_INITIALIZER;
+\f
void
output_move_double (operands)
rtx *operands;
#\f
# .o: .h dependencies.
CXX_TREE_H = $(TREE_H) cp/cp-tree.h c-common.h cp/cp-tree.def c-common.def \
- function.h varray.h $(SYSTEM_H) $(CONFIG_H) \
+ function.h varray.h $(SYSTEM_H) $(CONFIG_H) $(TARGET_H) \
$(srcdir)/../include/hashtab.h $(srcdir)/../include/splay-tree.h
cp/spew.o: cp/spew.c $(CXX_TREE_H) cp/parse.h flags.h cp/lex.h toplev.h
#include "../hash.h"
#include "ggc.h"
#include "tm_p.h"
+#include "target.h"
extern int (*valid_lang_attribute) PARAMS ((tree, tree, tree, tree));
/* 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)
{
#include "ggc.h"
#include "timevar.h"
#include "cpplib.h"
+#include "target.h"
extern cpp_reader *parse_in;
/* This structure contains information about the initializations
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. */
#include "output.h"
#include "toplev.h"
#include "diagnostic.h"
+#include "target.h"
static tree convert_for_assignment PARAMS ((tree, tree, const char *, tree,
int));
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)
{
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;
/* 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)
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. */
* Trees:: The source representation used by the C and C++ front ends.
* RTL:: The intermediate representation that most passes work on.
* Machine Desc:: How to write machine description instruction patterns.
-* Target Macros:: How to write the machine description C macros.
+* Target Macros:: How to write the machine description C macros and functions.
* Config:: Writing the @file{xm-@var{machine}.h} file.
* Fragments:: Writing the @file{t-@var{target}} and @file{x-@var{host}} files.
@end ifset
@c For copying conditions, see the file gcc.texi.
@node Target Macros
-@chapter Target Description Macros
+@chapter Target Description Macros and Functions
@cindex machine description macros
@cindex target description macros
@cindex macros, target description
In addition to the file @file{@var{machine}.md}, a machine description
includes a C header file conventionally given the name
-@file{@var{machine}.h}. This header file defines numerous macros
-that convey the information about the target machine that does not fit
-into the scheme of the @file{.md} file. The file @file{tm.h} should be
-a link to @file{@var{machine}.h}. The header file @file{config.h}
-includes @file{tm.h} and most compiler source files include
-@file{config.h}.
+@file{@var{machine}.h} and a C source file named @file{@var{machine}.c}.
+The header file defines numerous macros that convey the information
+about the target machine that does not fit into the scheme of the
+@file{.md} file. The file @file{tm.h} should be a link to
+@file{@var{machine}.h}. The header file @file{config.h} includes
+@file{tm.h} and most compiler source files include @file{config.h}. The
+source file defines a variable @code{target}, which is a structure
+containing pointers to functions and data relating to the target
+machine. @file{@var{machine}.c} should also contain their definitions,
+if they are not defined elsewhere in GCC, and other functions called
+through the macros defined in the @file{.h} file.
@menu
+* Target Structure:: The @code{target} variable.
* Driver:: Controlling how the driver runs the compilation passes.
* Run-time Target:: Defining @samp{-m} options like @option{-m68000} and @option{-m68020}.
* Per-Function Data:: Defining data structures for per-function information.
* Misc:: Everything else.
@end menu
+@node Target Structure
+@section The Global @code{target} Variable
+@cindex target hooks
+@cindex target functions
+
+@deftypevar {struct gcc_target} target
+The target @file{.c} file must define the global @code{target} variable
+which contains pointers to functions and data relating to the target
+machine. The variable is declared in @file{target.h};
+@file{target-def.h} defines the macro @code{TARGET_INITIALIZER} which is
+used to initialize the variable, and macros for the default initializers
+for elements of the structure. The @file{.c} file should override those
+macros for which the default definition is inappropriate. For example:
+@smallexample
+#include "target.h"
+#include "target-def.h"
+
+/* @r{Initialize the GCC target structure.} */
+
+#undef TARGET_VALID_TYPE_ATTRIBUTE
+#define TARGET_VALID_TYPE_ATTRIBUTE @var{machine}_valid_type_attribute_p
+
+struct gcc_target target = TARGET_INITIALIZER;
+@end smallexample
+@end deftypevar
+
+Where a macro should be defined in the @file{.c} file in this manner to
+form part of the @code{target} structure, it is documented below as a
+``Target Hook'' with a prototype. Many macros will change in future
+from being defined in the @file{.h} file to being part of the
+@code{target} structure.
+
@node Driver
@section Controlling the Compilation Driver, @file{gcc}
@cindex driver
invocations of this pragma cause the previous values to be stacked, so
that invocations of @samp{#pragma pack(pop)} will return to the previous
value.
+@end table
-@findex VALID_MACHINE_DECL_ATTRIBUTE
-@item VALID_MACHINE_DECL_ATTRIBUTE (@var{decl}, @var{attributes}, @var{identifier}, @var{args})
-If defined, a C expression whose value is nonzero if @var{identifier} with
+@deftypefn {Target Hook} int TARGET_VALID_DECL_ATTRIBUTE (tree @var{decl}, tree @var{attributes}, tree @var{identifier}, tree @var{args})
+If defined, this target hook is a function which returns nonzero if @var{identifier} with
arguments @var{args} is a valid machine specific attribute for @var{decl}.
The attributes in @var{attributes} have previously been assigned to @var{decl}.
+@end deftypefn
-@findex VALID_MACHINE_TYPE_ATTRIBUTE
-@item VALID_MACHINE_TYPE_ATTRIBUTE (@var{type}, @var{attributes}, @var{identifier}, @var{args})
-If defined, a C expression whose value is nonzero if @var{identifier} with
+@deftypefn {Target Hook} int TARGET_VALID_TYPE_ATTRIBUTE (tree @var{type}, tree @var{attributes}, tree @var{identifier}, tree @var{args})
+If defined, this target hook is a function which returns nonzero if @var{identifier} with
arguments @var{args} is a valid machine specific attribute for @var{type}.
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
@item SET_DEFAULT_TYPE_ATTRIBUTES (@var{type})
If defined, a C statement that assigns default attributes to
newly defined @var{type}.
+@end table
-@findex MERGE_MACHINE_TYPE_ATTRIBUTES
-@item MERGE_MACHINE_TYPE_ATTRIBUTES (@var{type1}, @var{type2})
-Define this macro if the merging of type attributes needs special handling.
-If defined, the result is a list of the combined TYPE_ATTRIBUTES of
-@var{type1} and @var{type2}. It is assumed that comptypes has already been
-called and returned 1.
-
-@findex MERGE_MACHINE_DECL_ATTRIBUTES
-@item MERGE_MACHINE_DECL_ATTRIBUTES (@var{olddecl}, @var{newdecl})
-Define this macro if the merging of decl attributes needs special handling.
-If defined, the result is a list of the combined DECL_MACHINE_ATTRIBUTES of
-@var{olddecl} and @var{newdecl}. @var{newdecl} is a duplicate declaration
-of @var{olddecl}. Examples of when this is needed are when one attribute
-overrides another, or when an attribute is nullified by a subsequent
-definition.
+@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
+handling. If defined, the result is a list of the combined
+@code{TYPE_ATTRIBUTES} of @var{type1} and @var{type2}. It is assumed
+that @code{comptypes} has already been called and returned 1. This
+function may call @code{merge_attributes} to handle machine-independent
+merging.
+@end deftypefn
+
+@deftypefn {Target Hook} tree TARGET_MERGE_DECL_ATTRIBUTES (tree @var{olddecl}, tree @var{newdecl})
+Define this target hook if the merging of decl attributes needs special
+handling. If defined, the result is a list of the combined
+@code{DECL_MACHINE_ATTRIBUTES} of @var{olddecl} and @var{newdecl}.
+@var{newdecl} is a duplicate declaration of @var{olddecl}. Examples of
+when this is needed are when one attribute overrides another, or when an
+attribute is nullified by a subsequent definition. This function may
+call @code{merge_attributes} to handle machine-independent merging.
+
+@findex TARGET_DLLIMPORT_DECL_ATTRIBUTES
+If the only target-specific handling you require is @samp{dllimport} for
+Windows targets, you should define the macro
+@code{TARGET_DLLIMPORT_DECL_ATTRIBUTES}. This links in a function
+called @code{merge_dllimport_decl_attributes} which can then be defined
+as the expansion of @code{TARGET_MERGE_DECL_ATTRIBUTES}. This is done
+in @file{i386/cygwin.h} and @file{i386/i386.c}, for example.
+@end deftypefn
+@table @code
@findex INSERT_ATTRIBUTES
@item INSERT_ATTRIBUTES (@var{node}, @var{attr_ptr}, @var{prefix_ptr})
Define this macro if you want to be able to add attributes to a decl
--- /dev/null
+/* 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 \
+}
--- /dev/null
+/* 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;
#include "ggc.h"
#include "hashtab.h"
#include "output.h"
+#include "target.h"
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
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;
-{
- 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
-
+ tree attr_name;
+ tree attr_args;
+ tree decl;
+ tree type;
+{
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);
- validated = 1;
+ 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);
+ }
+
+ /* 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)
+ if ((*target.valid_type_attribute) (type, type_attrs, attr_name,
+ attr_args))
{
- /* 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_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;
- }
-
- if (decl != 0)
- TREE_TYPE (decl) = type;
+ tree attr = lookup_attribute (IDENTIFIER_POINTER (attr_name),
+ type_attrs);
- 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);
- validated = 1;
+ 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;
+ }
+
+ return 1;
+ }
}
-#endif
- return validated;
+ return 0;
}
/* Return non-zero if IDENT is a valid name for attribute ATTR,
}
/* 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 */
\f
/* Set the type qualifiers for TYPE to TYPE_QUALS, which is a bitmask
of the various TYPE_QUAL values. */
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. */
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,
return NULL_TREE. */