diff options
author | Neil Booth <neil@daikokuya.demon.co.uk> | 2001-06-26 18:09:27 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2001-06-26 18:09:27 +0000 |
commit | 672a6f42e98d55a92af9b649f077c0d38517116e (patch) | |
tree | d665db59621711f135866f664fecbdc22274c141 /gcc | |
parent | 51da3560e0f89359b53d63f90ee422e95872be45 (diff) | |
download | gcc-672a6f42e98d55a92af9b649f077c0d38517116e.zip gcc-672a6f42e98d55a92af9b649f077c0d38517116e.tar.gz gcc-672a6f42e98d55a92af9b649f077c0d38517116e.tar.bz2 |
Makefile.in (TARGET_H, [...]): New.
* 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
Diffstat (limited to 'gcc')
87 files changed, 874 insertions, 634 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d1dac4c..7f59344 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,122 @@ +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 diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 563e7b7..811a944 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -552,6 +552,8 @@ GCONFIG_H = config.h $(host_xm_file_list) 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 @@ -1148,10 +1150,10 @@ $(srcdir)/c-parse.y: c-parse.in $(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) @@ -1321,7 +1323,7 @@ prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_H) Makefile prefix.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) @@ -1535,8 +1537,8 @@ params.o : params.c $(CONFIG_H) $(SYSTEM_H) params.h toplev.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) diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 2c16afb..348701e 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -41,6 +41,7 @@ Boston, MA 02111-1307, USA. */ #include "ggc.h" #include "tm_p.h" #include "cpplib.h" +#include "target.h" /* In grokdeclarator, distinguish syntactic contexts of declarators. */ enum decl_context @@ -1403,7 +1404,7 @@ duplicate_decls (newdecl, olddecl, different_binding_level) 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) diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index cf99533..1a9ed5f 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -41,6 +41,7 @@ Boston, MA 02111-1307, USA. */ #include "toplev.h" #include "intl.h" #include "ggc.h" +#include "target.h" /* Nonzero if we've already printed a "missing braces around initializer" message within this initializer. */ @@ -205,7 +206,7 @@ common_type (t1, t2) return t1; /* Merge the attributes. */ - attributes = merge_machine_type_attributes (t1, t2); + attributes = (*target.merge_type_attributes) (t1, t2); /* Treat an enum type as the unsigned integer type of the same width. */ diff --git a/gcc/config/1750a/1750a.c b/gcc/config/1750a/1750a.c index 83c303b..cdeecd2 100644 --- a/gcc/config/1750a/1750a.c +++ b/gcc/config/1750a/1750a.c @@ -33,6 +33,8 @@ Boston, MA 02111-1307, USA. */ #include "regs.h" #include "output.h" #include "tm_p.h" +#include "target.h" +#include "target-def.h" struct datalabel_array datalbl[DATALBL_ARRSIZ]; int datalbl_ndx = -1; @@ -44,7 +46,11 @@ const char *const sectname[4] = {"Init", "Normal", "Konst", "Static"}; static int which_bit PARAMS ((int)); + +/* Initialize the GCC target structure. */ +struct gcc_target target = TARGET_INITIALIZER; + void notice_update_cc (exp) rtx exp; diff --git a/gcc/config/a29k/a29k.c b/gcc/config/a29k/a29k.c index 65c6240..3d6e85d 100644 --- a/gcc/config/a29k/a29k.c +++ b/gcc/config/a29k/a29k.c @@ -39,6 +39,8 @@ Boston, MA 02111-1307, USA. */ #include "tree.h" #include "reload.h" #include "tm_p.h" +#include "target.h" +#include "target-def.h" static int shift_constant_operand PARAMS ((rtx, enum machine_mode, int)); static void a29k_set_memflags_1 PARAMS ((rtx, int, int, int, int)); @@ -90,6 +92,10 @@ int a29k_debug_reg_map[FIRST_PSEUDO_REGISTER]; rtx a29k_compare_op0, a29k_compare_op1; int a29k_compare_fp_p; +/* Initialize the GCC target structure. */ + +struct gcc_target target = TARGET_INITIALIZER; + /* Returns 1 if OP is a 8-bit constant. */ int diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 79700d4..37a8313 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -43,6 +43,8 @@ Boston, MA 02111-1307, USA. */ #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; @@ -144,6 +146,10 @@ static rtx alpha_emit_xfloating_compare #define REG_PV 27 #define REG_RA 26 +/* Initialize the GCC target structure. */ + +struct gcc_target target = TARGET_INITIALIZER; + /* Parse target option strings. */ void diff --git a/gcc/config/arc/arc-protos.h b/gcc/config/arc/arc-protos.h index 442a1bf..e550e68 100644 --- a/gcc/config/arc/arc-protos.h +++ b/gcc/config/arc/arc-protos.h @@ -62,7 +62,6 @@ extern int shift_operator PARAMS ((rtx, enum machine_mode)); 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)); diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index 5c9acc6..c5c91069 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -38,6 +38,8 @@ Boston, MA 02111-1307, USA. */ #include "recog.h" #include "toplev.h" #include "tm_p.h" +#include "target.h" +#include "target-def.h" /* Which cpu we're compiling for (NULL(=base), ???). */ const char *arc_cpu_string; @@ -85,7 +87,14 @@ static int current_insn_set_cc_p; static void record_cc_ref PARAMS ((rtx)); static void arc_init_reg_tables PARAMS ((void)); static int get_arc_condition_code PARAMS ((rtx)); +static int arc_valid_decl_attribute PARAMS ((tree, tree, tree, tree)); + +/* Initialize the GCC target structure. */ +#undef TARGET_VALID_DECL_ATTRIBUTE +#define TARGET_VALID_DECL_ATTRIBUTE arc_valid_decl_attribute +struct gcc_target target = TARGET_INITIALIZER; + /* Called by OVERRIDE_OPTIONS to initialize various things. */ void @@ -313,8 +322,8 @@ arc_init_reg_tables () /* Return nonzero if IDENTIFIER is a valid decl attribute. */ -int -arc_valid_machine_decl_attribute (type, attributes, identifier, args) +static int +arc_valid_decl_attribute (type, attributes, identifier, args) tree type ATTRIBUTE_UNUSED; tree attributes ATTRIBUTE_UNUSED; tree identifier; diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h index 9026cf8..4a78213 100644 --- a/gcc/config/arc/arc.h +++ b/gcc/config/arc/arc.h @@ -1575,12 +1575,6 @@ do { if ((LOG) != 0) fprintf (FILE, "\t.align %d\n", 1 << (LOG)); } while (0) /* 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). */ diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index 96af949..2d3ee1a 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -38,9 +38,7 @@ extern unsigned long arm_current_func_type PARAMS ((void)); #ifdef TREE_CODE extern int arm_return_in_memory PARAMS ((tree)); -extern int arm_valid_machine_decl_attribute PARAMS ((tree, tree, tree)); extern int arm_comp_type_attributes PARAMS ((tree, tree)); -extern int arm_valid_type_attribute_p PARAMS ((tree, tree, tree, tree)); extern void arm_set_default_type_attributes PARAMS ((tree)); extern void arm_encode_call_attribute PARAMS ((tree, int)); extern int arm_function_ok_for_sibcall PARAMS ((tree)); @@ -187,10 +185,6 @@ extern int arm_dllexport_name_p PARAMS ((const char *)); 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)); diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index c1f7887..b673534 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -45,6 +45,8 @@ Boston, MA 02111-1307, USA. */ #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; @@ -100,12 +102,34 @@ static int current_file_function_operand PARAMS ((rtx)); static Ulong arm_compute_save_reg_mask PARAMS ((void)); static Ulong arm_isr_value PARAMS ((tree)); static Ulong arm_compute_func_type PARAMS ((void)); - +static int arm_valid_type_attribute_p PARAMS ((tree, tree, + tree, tree)); +static int arm_valid_decl_attribute_p PARAMS ((tree, tree, + tree, tree)); #undef Hint #undef Mmode #undef Ulong #undef Ccstar + +/* Initialize the GCC target structure. */ +#ifdef TARGET_DLLIMPORT_DECL_ATTRIBUTES +#undef TARGET_MERGE_DECL_ATTRIBUTES +#define TARGET_MERGE_DECL_ATTRIBUTES merge_dllimport_decl_attributes +#endif +#undef TARGET_VALID_TYPE_ATTRIBUTE +#define TARGET_VALID_TYPE_ATTRIBUTE arm_valid_type_attribute_p + +#undef TARGET_VALID_DECL_ATTRIBUTE +#ifdef ARM_PE + static int arm_pe_valid_decl_attribute_p PARAMS ((tree, tree, tree, tree)); +# define TARGET_VALID_DECL_ATTRIBUTE arm_pe_valid_decl_attribute_p +#else +# define TARGET_VALID_DECL_ATTRIBUTE arm_valid_decl_attribute_p +#endif + +struct gcc_target target = TARGET_INITIALIZER; + /* Obstack for minipool constant handling. */ static struct obstack minipool_obstack; static char *minipool_startobj; @@ -1851,10 +1875,10 @@ arm_pr_long_calls_off (pfile) } -/* Return nonzero if IDENTIFIER with arguments ARGS is a valid machine specific - attribute for TYPE. The attributes in ATTRIBUTES have previously been - assigned to TYPE. */ -int +/* Return nonzero if IDENTIFIER with arguments ARGS is a valid machine + specific attribute for TYPE. The attributes in ATTRIBUTES have + previously been assigned to TYPE. */ +static int arm_valid_type_attribute_p (type, attributes, identifier, args) tree type; tree attributes ATTRIBUTE_UNUSED; @@ -4093,9 +4117,10 @@ multi_register_push (op, mode) Always assume that this function will be entered in ARM mode, not Thumb mode, and that the caller wishes to be returned to in ARM mode. */ -int -arm_valid_machine_decl_attribute (decl, attr, args) +static int +arm_valid_decl_attribute_p (decl, attributes, attr, args) tree decl; + tree attributes ATTRIBUTE_UNUSED; tree attr; tree args; { @@ -4118,6 +4143,39 @@ arm_valid_machine_decl_attribute (decl, attr, 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 */ /* Routines for use in generating RTL. */ rtx diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 2057ae6..88997d7 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -2542,12 +2542,6 @@ extern const char * arm_pic_register_string; offset. */ extern int making_const_table; -/* If defined, a C expression whose value is nonzero if IDENTIFIER - with arguments ARGS is a valid machine specific attribute for TYPE. - The attributes in ATTRIBUTES have previously been assigned to TYPE. */ -#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, NAME, ARGS) \ - (arm_valid_type_attribute_p (TYPE, ATTRIBUTES, NAME, ARGS)) - /* If defined, a C expression whose value is zero if the attributes on TYPE1 and TYPE2 are incompatible, one if they are compatible, and two if they are nearly compatible (which causes a warning to be diff --git a/gcc/config/arm/coff.h b/gcc/config/arm/coff.h index 6265691..eeea20b 100644 --- a/gcc/config/arm/coff.h +++ b/gcc/config/arm/coff.h @@ -41,12 +41,6 @@ Boston, MA 02111-1307, USA. */ { "marm", "mlittle-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork" } #endif -/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS - is a valid machine specific attribute for DECL. - The attributes in ATTRIBUTES have previously been assigned to DECL. */ -#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \ - arm_valid_machine_decl_attribute (DECL, IDENTIFIER, ARGS) - /* This is COFF, but prefer stabs. */ #define SDB_DEBUGGING_INFO diff --git a/gcc/config/arm/elf.h b/gcc/config/arm/elf.h index 71fe99b..2eb2388 100644 --- a/gcc/config/arm/elf.h +++ b/gcc/config/arm/elf.h @@ -190,12 +190,6 @@ Boston, MA 02111-1307, USA. */ #define MULTILIB_DEFAULTS \ { "marm", "mlittle-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork", "fno-leading-underscore" } #endif - -/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS - is a valid machine specific attribute for DECL. - The attributes in ATTRIBUTES have previously been assigned to DECL. */ -#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \ - arm_valid_machine_decl_attribute (DECL, IDENTIFIER, ARGS) /* This outputs a lot of .req's to define alias for various registers. diff --git a/gcc/config/arm/pe.c b/gcc/config/arm/pe.c index 55b4668..29c470e 100644 --- a/gcc/config/arm/pe.c +++ b/gcc/config/arm/pe.c @@ -31,93 +31,6 @@ Boston, MA 02111-1307, USA. */ extern int current_function_anonymous_args; -/* ARM/PE specific attribute support. - - ARM/PE has three new attributes: - naked - for interrupt functions - dllexport - for exporting a function/variable that will live in a dll - dllimport - for importing a function/variable from a dll - - Microsoft allows multiple declspecs in one __declspec, separating - them with spaces. We do NOT support this. Instead, use __declspec - multiple times. -*/ - -/* Return nonzero if ATTR is a valid attribute for DECL. - ATTRIBUTES are any existing attributes and ARGS are the arguments - supplied with ATTR. */ - -int -arm_pe_valid_machine_decl_attribute (decl, attributes, attr, args) - tree decl; - tree attributes ATTRIBUTE_UNUSED; - tree attr; - tree args; -{ - if (args != NULL_TREE) - return 0; - - if (is_attribute_p ("dllexport", attr)) - return 1; - - if (is_attribute_p ("dllimport", attr)) - return 1; - - return arm_valid_machine_decl_attribute (decl, attr, args); -} - -/* Merge attributes in decls OLD and NEW. - - This handles the following situation: - - __declspec (dllimport) int foo; - int foo; - - The second instance of `foo' nullifies the dllimport. */ - -tree -arm_pe_merge_machine_decl_attributes (old, new) - tree old, new; -{ - tree a; - int delete_dllimport_p; - - old = DECL_MACHINE_ATTRIBUTES (old); - new = DECL_MACHINE_ATTRIBUTES (new); - - /* What we need to do here is remove from `old' dllimport if it doesn't - appear in `new'. dllimport behaves like extern: if a declaration is - marked dllimport and a definition appears later, then the object - is not dllimport'd. */ - - if (lookup_attribute ("dllimport", old) != NULL_TREE - && lookup_attribute ("dllimport", new) == NULL_TREE) - delete_dllimport_p = 1; - else - delete_dllimport_p = 0; - - a = merge_attributes (old, new); - - if (delete_dllimport_p) - { - tree prev,t; - - /* Scan the list for dllimport and delete it. */ - for (prev = NULL_TREE, t = a; t; prev = t, t = TREE_CHAIN (t)) - { - if (is_attribute_p ("dllimport", TREE_PURPOSE (t))) - { - if (prev == NULL_TREE) - a = TREE_CHAIN (a); - else - TREE_CHAIN (prev) = TREE_CHAIN (t); - break; - } - } - } - - return a; -} /* Return non-zero if DECL is a dllexport'd object. */ diff --git a/gcc/config/arm/pe.h b/gcc/config/arm/pe.h index 8acd3e0..8281886 100644 --- a/gcc/config/arm/pe.h +++ b/gcc/config/arm/pe.h @@ -38,6 +38,10 @@ Boston, MA 02111-1307, USA. */ #undef TARGET_VERSION #define TARGET_VERSION fputs (" (ARM/pe)", stderr) +/* Get tree.c to declare a target-specific specialization of + merge_decl_attributes. */ +#define TARGET_DLLIMPORT_DECL_ATTRIBUTES + /* Support the __declspec keyword by turning them into attributes. We currently only support: naked, dllimport, and dllexport. Note that the current way we do this may result in a collision with @@ -91,16 +95,6 @@ Boston, MA 02111-1307, USA. */ 1,1,1 \ } -/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS - is a valid machine specific attribute for DECL. - The attributes in ATTRIBUTES have previously been assigned to DECL. */ -#undef VALID_MACHINE_DECL_ATTRIBUTE -#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \ - arm_pe_valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS) - -#define MERGE_MACHINE_DECL_ATTRIBUTES(OLD, NEW) \ - arm_pe_merge_machine_decl_attributes ((OLD), (NEW)) - /* In addition to the stuff done in arm.h, we must mark dll symbols specially. Definitions of dllexport'd objects install some info in the .drectve section. References to dllimport'd objects are fetched indirectly via diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h index c7f5539..3d99a31 100644 --- a/gcc/config/avr/avr-protos.h +++ b/gcc/config/avr/avr-protos.h @@ -50,12 +50,6 @@ extern void encode_section_info PARAMS ((tree decl)); 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)); diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index fe3df94..7ca4ab7 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -38,6 +38,8 @@ #include "function.h" #include "recog.h" #include "tm_p.h" +#include "target.h" +#include "target-def.h" /* Maximal allowed offset for an address in the LD command */ #define MAX_LD_OFFSET(MODE) (64 - (signed)GET_MODE_SIZE (MODE)) @@ -56,6 +58,8 @@ static int compare_sign_p PARAMS ((rtx insn)); static int reg_was_0 PARAMS ((rtx insn, rtx op)); static int io_address_p PARAMS ((rtx x, int size)); void debug_hard_reg_set PARAMS ((HARD_REG_SET set)); +static int avr_valid_type_attribute PARAMS ((tree, tree, tree, tree)); +static int avr_valid_decl_attribute PARAMS ((tree, tree, tree, tree)); /* Allocate registers from r25 to r8 for parameters for function calls */ #define FIRST_CUM_REG 26 @@ -165,7 +169,16 @@ static const struct mcu_type_s avr_mcu_types[] = { }; int avr_case_values_threshold = 30000; + +/* Initialize the GCC target structure. */ +#undef TARGET_VALID_DECL_ATTRIBUTE +#define TARGET_VALID_DECL_ATTRIBUTE avr_valid_decl_attribute +#undef TARGET_VALID_TYPE_ATTRIBUTE +#define TARGET_VALID_TYPE_ATTRIBUTE avr_valid_type_attribute + +struct gcc_target target = TARGET_INITIALIZER; + void avr_override_options () { @@ -4664,8 +4677,8 @@ class_likely_spilled_p (c) /* Only `progmem' attribute valid for type. */ -int -valid_machine_type_attribute(type, attributes, identifier, args) +static int +avr_valid_type_attribute (type, attributes, identifier, args) tree type ATTRIBUTE_UNUSED; tree attributes ATTRIBUTE_UNUSED; tree identifier; @@ -4684,8 +4697,8 @@ valid_machine_type_attribute(type, attributes, identifier, args) 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; diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h index 79c8689..25aeca3 100644 --- a/gcc/config/avr/avr.h +++ b/gcc/config/avr/avr.h @@ -2837,20 +2837,6 @@ extern int avr_case_values_threshold; of arguments that the function accepts. Some people think a larger threshold should be used on RISC machines. */ -#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \ -valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS) -/* `VALID_MACHINE_DECL_ATTRIBUTE (DECL, ATTRIBUTES, IDENTIFIER, ARGS)' - If defined, a C expression whose value is nonzero if IDENTIFIER - with arguments ARGS is a valid machine specific attribute for DECL. - The attributes in ATTRIBUTES have previously been assigned to DECL. */ - -#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, IDENTIFIER, ARGS) \ - valid_machine_type_attribute(TYPE, ATTRIBUTES, IDENTIFIER, ARGS) -/* `VALID_MACHINE_TYPE_ATTRIBUTE (TYPE, ATTRIBUTES, IDENTIFIER, ARGS)' - If defined, a C expression whose value is nonzero if IDENTIFIER - with arguments ARGS is a valid machine specific attribute for TYPE. - The attributes in ATTRIBUTES have previously been assigned to TYPE. */ - #define DOLLARS_IN_IDENTIFIERS 0 /* Define this macro to control use of the character `$' in identifier names. 0 means `$' is not allowed by default; 1 means it is diff --git a/gcc/config/c4x/c4x-protos.h b/gcc/config/c4x/c4x-protos.h index 1456045..27bbbdb 100644 --- a/gcc/config/c4x/c4x-protos.h +++ b/gcc/config/c4x/c4x-protos.h @@ -61,8 +61,6 @@ extern struct rtx_def *c4x_function_arg PARAMS ((CUMULATIVE_ARGS *, extern void c4x_encode_section_info PARAMS ((tree)); -extern int c4x_valid_type_attribute_p PARAMS ((tree, tree, tree, tree)); - #endif /* TREE_CODE */ diff --git a/gcc/config/c4x/c4x.c b/gcc/config/c4x/c4x.c index 9486fdc..bf30de3 100644 --- a/gcc/config/c4x/c4x.c +++ b/gcc/config/c4x/c4x.c @@ -47,6 +47,8 @@ Boston, MA 02111-1307, USA. */ #include "c-lex.h" #include "c-pragma.h" #include "c4x-protos.h" +#include "target.h" +#include "target-def.h" rtx smulhi3_libfunc; rtx umulhi3_libfunc; @@ -187,7 +189,14 @@ static int c4x_parse_pragma PARAMS ((const char *, tree *, tree *)); static int c4x_r11_set_p PARAMS ((rtx)); static int c4x_rptb_valid_p PARAMS ((rtx, rtx)); static int c4x_label_ref_used_p PARAMS ((rtx, rtx)); - +static int c4x_valid_type_attribute_p PARAMS ((tree, tree, tree, tree)); + +/* Initialize the GCC target structure. */ +#undef TARGET_VALID_TYPE_ATTRIBUTE +#define TARGET_VALID_TYPE_ATTRIBUTE c4x_valid_type_attribute_p + +struct gcc_target target = TARGET_INITIALIZER; + /* Called to register all of our global variables with the garbage collector. */ @@ -4741,7 +4750,7 @@ c4x_set_default_attributes(decl, attributes) 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; diff --git a/gcc/config/c4x/c4x.h b/gcc/config/c4x/c4x.h index 49b903e..9637526 100644 --- a/gcc/config/c4x/c4x.h +++ b/gcc/config/c4x/c4x.h @@ -2446,9 +2446,6 @@ do { \ #define SET_DEFAULT_DECL_ATTRIBUTES(DECL, ATTRIBUTES) \ c4x_set_default_attributes (DECL, &ATTRIBUTES) -#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, NAME, ARGS) \ - (c4x_valid_type_attribute_p (TYPE, ATTRIBUTES, NAME, ARGS)) - /* Assembler Commands for Alignment. */ #define ASM_OUTPUT_SKIP(FILE, SIZE) \ diff --git a/gcc/config/clipper/clipper.c b/gcc/config/clipper/clipper.c index 0c3f379..42a5ad7 100644 --- a/gcc/config/clipper/clipper.c +++ b/gcc/config/clipper/clipper.c @@ -37,13 +37,19 @@ Boston, MA 02111-1307, USA. */ #include "flags.h" #include "recog.h" #include "tm_p.h" +#include "target.h" +#include "target-def.h" extern char regs_ever_live[]; extern int frame_pointer_needed; static int frame_size; + +/* Initialize the GCC target structure. */ +struct gcc_target target = TARGET_INITIALIZER; + /* Compute size of a clipper stack frame where 'lsize' is the required space for local variables. */ diff --git a/gcc/config/convex/convex.c b/gcc/config/convex/convex.c index 947a715..8589fb4 100644 --- a/gcc/config/convex/convex.c +++ b/gcc/config/convex/convex.c @@ -33,6 +33,8 @@ Boston, MA 02111-1307, USA. */ #include "function.h" #include "expr.h" #include "tm_p.h" +#include "target.h" +#include "target-def.h" /* Tables used in convex.h */ @@ -62,7 +64,11 @@ static int frame_argblock_size; static rtx convert_arg_pushes (); #endif static void expand_movstr_call PARAMS ((rtx *)); + +/* Initialize the GCC target structure. */ +struct gcc_target target = TARGET_INITIALIZER; + /* Here from OVERRIDE_OPTIONS at startup. Initialize constant tables. */ void diff --git a/gcc/config/d30v/d30v.c b/gcc/config/d30v/d30v.c index 8f8f6d2..c63dd52 100644 --- a/gcc/config/d30v/d30v.c +++ b/gcc/config/d30v/d30v.c @@ -39,6 +39,8 @@ #include "function.h" #include "toplev.h" #include "ggc.h" +#include "target.h" +#include "target-def.h" static void d30v_print_operand_memory_reference PARAMS ((FILE *, rtx)); static void d30v_build_long_insn PARAMS ((HOST_WIDE_INT, HOST_WIDE_INT, @@ -76,7 +78,10 @@ enum reg_class regno_reg_class[FIRST_PSEUDO_REGISTER]; /* Map class letter into register class */ enum reg_class reg_class_from_letter[256]; + +/* Initialize the GCC target structure. */ +struct gcc_target target = TARGET_INITIALIZER; /* Sometimes certain combinations of command options do not make sense on a particular target machine. You can define a macro diff --git a/gcc/config/d30v/d30v.h b/gcc/config/d30v/d30v.h index 3efa6d7..f072cfb 100644 --- a/gcc/config/d30v/d30v.h +++ b/gcc/config/d30v/d30v.h @@ -5889,16 +5889,6 @@ fprintf (STREAM, "\t.word .L%d\n", VALUE) must also be defined). */ /* #define HANDLE_WEAK_PRAGMA */ -/* If defined, a C expression whose value is nonzero if IDENTIFIER with - arguments ARGS is a valid machine specific attribute for DECL. The - attributes in ATTRIBUTES have previously been assigned to DECL. */ -/* #define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) */ - -/* If defined, a C expression whose value is nonzero if IDENTIFIER with - arguments ARGS is a valid machine specific attribute for TYPE. The - attributes in ATTRIBUTES have previously been assigned to TYPE. */ -/* #define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, IDENTIFIER, ARGS) */ - /* If defined, a C expression whose value is zero if the attributes on TYPE1 and TYPE2 are incompatible, one if they are compatible, and two if they are nearly compatible (which causes a warning to be generated). */ diff --git a/gcc/config/dsp16xx/dsp16xx.c b/gcc/config/dsp16xx/dsp16xx.c index fbc28c0..2a333ea 100644 --- a/gcc/config/dsp16xx/dsp16xx.c +++ b/gcc/config/dsp16xx/dsp16xx.c @@ -38,6 +38,8 @@ Boston, MA 02111-1307, USA. */ #include "toplev.h" #include "recog.h" #include "tm_p.h" +#include "target.h" +#include "target-def.h" const char *text_seg_name; const char *rsect_text; @@ -145,7 +147,11 @@ static const char *const lshift_right_asm_first[] = }; static int reg_save_size PARAMS ((void)); + +/* Initialize the GCC target structure. */ +struct gcc_target target = TARGET_INITIALIZER; + int hard_regno_mode_ok (regno, mode) int regno; diff --git a/gcc/config/elxsi/elxsi.c b/gcc/config/elxsi/elxsi.c index ba1ea27..41b3363 100644 --- a/gcc/config/elxsi/elxsi.c +++ b/gcc/config/elxsi/elxsi.c @@ -27,6 +27,8 @@ Boston, MA 02111-1307, USA. */ #include "function.h" #include "output.h" #include "tm_p.h" +#include "target.h" +#include "target-def.h" extern const char *reg_names[]; rtx cmp_op0=0, cmp_op1=0; @@ -35,7 +37,11 @@ rtx cmp_op0=0, cmp_op1=0; static const char *const cmp_tab[] = { "gt", "gt", "eq", "eq", "ge", "ge", "lt", "lt", "ne", "ne", "le", "le" }; + +/* Initialize the GCC target structure. */ +struct gcc_target target = TARGET_INITIALIZER; + /* type is the index into the above table */ /* s is "" for signed, or "u" for unsigned */ const char * diff --git a/gcc/config/fr30/fr30.c b/gcc/config/fr30/fr30.c index f1f63e1..51a5c26 100644 --- a/gcc/config/fr30/fr30.c +++ b/gcc/config/fr30/fr30.c @@ -42,6 +42,8 @@ Boston, MA 02111-1307, USA. */ #include "except.h" #include "function.h" #include "tm_p.h" +#include "target.h" +#include "target-def.h" /*}}}*/ /*{{{ Function Prologues & Epilogues */ @@ -136,7 +138,11 @@ static struct fr30_frame_info zero_frame_info; #if UNITS_PER_WORD == 4 #define WORD_ALIGN(SIZE) (((SIZE) + 3) & ~3) #endif - + +/* Initialize the GCC target structure. */ + +struct gcc_target target = TARGET_INITIALIZER; + /* Returns the number of bytes offset between FROM_REG and TO_REG for the current function. As a side effect it fills in the current_frame_info structure, if the data is available. */ diff --git a/gcc/config/h8300/h8300-protos.h b/gcc/config/h8300/h8300-protos.h index 999dcf1..0c3aa29 100644 --- a/gcc/config/h8300/h8300-protos.h +++ b/gcc/config/h8300/h8300-protos.h @@ -61,8 +61,6 @@ extern int nshift_operator PARAMS ((rtx, enum machine_mode)); #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)); diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index f2bca7d..9fd2c32 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -40,6 +40,8 @@ Boston, MA 02111-1307, USA. */ #include "c-pragma.h" #include "tm_p.h" #include "ggc.h" +#include "target.h" +#include "target-def.h" /* Forward declarations. */ static int h8300_interrupt_function_p PARAMS ((tree)); @@ -51,6 +53,7 @@ static unsigned int compute_saved_regs PARAMS ((void)); static void push PARAMS ((FILE *, int)); static void pop PARAMS ((FILE *, int)); static const char *cond_string PARAMS ((enum rtx_code)); +static int h8300_valid_decl_attribute PARAMS ((tree, tree, tree, tree)); /* CPU_TYPE, says what cpu we're compiling for. */ int cpu_type; @@ -90,7 +93,13 @@ static const char *const h8_pop_ops[2] = { "pop", "pop.l" }; static const char *const h8_mov_ops[2] = { "mov.w", "mov.l" }; const char *h8_push_op, *h8_pop_op, *h8_mov_op; + +/* Initialize the GCC target structure. */ +#undef TARGET_VALID_DECL_ATTRIBUTE +#define TARGET_VALID_DECL_ATTRIBUTE h8300_valid_decl_attribute +struct gcc_target target = TARGET_INITIALIZER; + /* Initialize various cpu specific globals at start up. */ void @@ -3022,8 +3031,8 @@ h8300_tiny_data_p (decl) tiny_data: This variable lives in the tiny data area and can be referenced with 16-bit absolute memory references. */ -int -h8300_valid_machine_decl_attribute (decl, attributes, attr, args) +static int +h8300_valid_decl_attribute (decl, attributes, attr, args) tree decl; tree attributes ATTRIBUTE_UNUSED; tree attr; diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h index d4d3fc1..47450e5 100644 --- a/gcc/config/h8300/h8300.h +++ b/gcc/config/h8300/h8300.h @@ -998,12 +998,6 @@ struct cum_arg so give the MEM rtx a byte's mode. */ #define FUNCTION_MODE QImode -/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS - is a valid machine specific attribute for DECL. - The attributes in ATTRIBUTES have previously been assigned to DECL. */ -#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \ -h8300_valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS) - #define ADJUST_INSN_LENGTH(INSN, LENGTH) \ LENGTH += h8300_adjust_insn_length (INSN, LENGTH); diff --git a/gcc/config/i370/i370.c b/gcc/config/i370/i370.c index 778930e..ebd1d85 100644 --- a/gcc/config/i370/i370.c +++ b/gcc/config/i370/i370.c @@ -41,6 +41,8 @@ Boston, MA 02111-1307, USA. */ #include "c-pragma.h" #include "c-lex.h" #include "tm_p.h" +#include "target.h" +#include "target-def.h" extern FILE *asm_out_file; @@ -283,7 +285,11 @@ static const unsigned char ebcasc[256] = /*F8 8 9 */ 0x38, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF }; + +/* Initialize the GCC target structure. */ +struct gcc_target target = TARGET_INITIALIZER; + /* Map characters from one character set to another. C is the character to be translated. */ diff --git a/gcc/config/i386/cygwin.h b/gcc/config/i386/cygwin.h index a3d587fe..a1c7c33 100644 --- a/gcc/config/i386/cygwin.h +++ b/gcc/config/i386/cygwin.h @@ -86,6 +86,10 @@ Boston, MA 02111-1307, USA. */ "-idirafter /usr/include/mingw" #endif +/* Get tree.c to declare a target-specific specialization of + merge_decl_attributes. */ +#define TARGET_DLLIMPORT_DECL_ATTRIBUTES + /* Support the __declspec keyword by turning them into attributes. We currently only support: dllimport and dllexport. Note that the current way we do this may result in a collision with @@ -199,11 +203,6 @@ extern int i386_pe_valid_decl_attribute_p PARAMS ((TREE, TREE, TREE, TREE)); 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. diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h index 58d2313..88706c8 100644 --- a/gcc/config/i386/i386-protos.h +++ b/gcc/config/i386/i386-protos.h @@ -169,8 +169,6 @@ extern rtx ix86_expand_builtin PARAMS ((tree, rtx, rtx, enum machine_mode, int)) #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)); diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 42cc2f7..21ceedc 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -40,6 +40,8 @@ Boston, MA 02111-1307, USA. */ #include "toplev.h" #include "basic-block.h" #include "ggc.h" +#include "target.h" +#include "target-def.h" #ifndef CHECK_STACK_LIMIT #define CHECK_STACK_LIMIT -1 @@ -605,6 +607,18 @@ static int ix86_fp_comparison_sahf_cost PARAMS ((enum rtx_code code)); static int ix86_fp_comparison_cost PARAMS ((enum rtx_code code)); static int ix86_save_reg PARAMS ((int, int)); static void ix86_compute_frame_layout PARAMS ((struct ix86_frame *)); +static int ix86_valid_type_attribute_p PARAMS ((tree, tree, tree, tree)); + +/* Initialize the GCC target structure. */ +#ifdef TARGET_DLLIMPORT_DECL_ATTRIBUTES +#undef TARGET_MERGE_DECL_ATTRIBUTES +#define TARGET_MERGE_DECL_ATTRIBUTES merge_dllimport_decl_attributes +#endif + +#undef TARGET_VALID_TYPE_ATTRIBUTE +#define TARGET_VALID_TYPE_ATTRIBUTE ix86_valid_type_attribute_p + +struct gcc_target target = TARGET_INITIALIZER; /* Sometimes certain combinations of command options do not make sense on a particular target machine. You can define a macro @@ -860,24 +874,10 @@ optimization_options (level, size) } /* Return nonzero if IDENTIFIER with arguments ARGS is a valid machine specific - attribute for DECL. The attributes in ATTRIBUTES have previously been - assigned to DECL. */ - -int -ix86_valid_decl_attribute_p (decl, attributes, identifier, args) - tree decl ATTRIBUTE_UNUSED; - tree attributes ATTRIBUTE_UNUSED; - tree identifier ATTRIBUTE_UNUSED; - tree args ATTRIBUTE_UNUSED; -{ - return 0; -} - -/* Return nonzero if IDENTIFIER with arguments ARGS is a valid machine specific attribute for TYPE. The attributes in ATTRIBUTES have previously been assigned to TYPE. */ -int +static int ix86_valid_type_attribute_p (type, attributes, identifier, args) tree type; tree attributes ATTRIBUTE_UNUSED; diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 10556e6..177e132 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -2240,20 +2240,6 @@ do \ while (0) -/* If defined, a C expression whose value is nonzero if IDENTIFIER - with arguments ARGS is a valid machine specific attribute for DECL. - The attributes in ATTRIBUTES have previously been assigned to DECL. */ - -#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, NAME, ARGS) \ - (ix86_valid_decl_attribute_p (DECL, ATTRIBUTES, NAME, ARGS)) - -/* If defined, a C expression whose value is nonzero if IDENTIFIER - with arguments ARGS is a valid machine specific attribute for TYPE. - The attributes in ATTRIBUTES have previously been assigned to TYPE. */ - -#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, NAME, ARGS) \ - (ix86_valid_type_attribute_p (TYPE, ATTRIBUTES, NAME, ARGS)) - /* If defined, a C expression whose value is zero if the attributes on TYPE1 and TYPE2 are incompatible, one if they are compatible, and two if they are nearly compatible (which causes a warning to be diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c index 39074cc..676c4bd 100644 --- a/gcc/config/i386/winnt.c +++ b/gcc/config/i386/winnt.c @@ -95,58 +95,6 @@ i386_pe_valid_type_attribute_p (type, attributes, attr, args) return ix86_valid_type_attribute_p (type, attributes, attr, args); } -/* Merge attributes in decls OLD and NEW. - - This handles the following situation: - - __declspec (dllimport) int foo; - int foo; - - The second instance of `foo' nullifies the dllimport. */ - -tree -i386_pe_merge_decl_attributes (old, new) - tree old, new; -{ - tree a; - int delete_dllimport_p; - - old = DECL_MACHINE_ATTRIBUTES (old); - new = DECL_MACHINE_ATTRIBUTES (new); - - /* What we need to do here is remove from `old' dllimport if it doesn't - appear in `new'. dllimport behaves like extern: if a declaration is - marked dllimport and a definition appears later, then the object - is not dllimport'd. */ - - if (lookup_attribute ("dllimport", old) != NULL_TREE - && lookup_attribute ("dllimport", new) == NULL_TREE) - delete_dllimport_p = 1; - else - delete_dllimport_p = 0; - - a = merge_attributes (old, new); - - if (delete_dllimport_p) - { - tree prev,t; - - /* Scan the list for dllimport and delete it. */ - for (prev = NULL_TREE, t = a; t; prev = t, t = TREE_CHAIN (t)) - { - if (is_attribute_p ("dllimport", TREE_PURPOSE (t))) - { - if (prev == NULL_TREE) - a = TREE_CHAIN (a); - else - TREE_CHAIN (prev) = TREE_CHAIN (t); - break; - } - } - } - - return a; -} /* Return the type that we should use to determine if DECL is imported or exported. */ diff --git a/gcc/config/i860/i860.c b/gcc/config/i860/i860.c index 5261b69..08e099b 100644 --- a/gcc/config/i860/i860.c +++ b/gcc/config/i860/i860.c @@ -42,6 +42,8 @@ Boston, MA 02111-1307, USA. */ #include "function.h" #include "expr.h" #include "tm_p.h" +#include "target.h" +#include "target-def.h" static rtx find_addr_reg PARAMS ((rtx)); static int reg_clobbered_p PARAMS ((rtx, rtx)); @@ -60,6 +62,10 @@ const char *i860_reg_prefix = I860_REG_PREFIX; rtx i860_compare_op0, i860_compare_op1; +/* Initialize the GCC target structure. */ + +struct gcc_target target = TARGET_INITIALIZER; + /* Return non-zero if this pattern, can be evaluated safely, even if it was not asked for. */ int diff --git a/gcc/config/i960/i960.c b/gcc/config/i960/i960.c index 0773c57..fbdc939 100644 --- a/gcc/config/i960/i960.c +++ b/gcc/config/i960/i960.c @@ -44,6 +44,8 @@ Boston, MA 02111-1307, USA. */ #include "c-pragma.h" #include "c-lex.h" #include "tm_p.h" +#include "target.h" +#include "target-def.h" /* Save the operands last given to a compare for use when we generate a scc or bcc insn. */ @@ -86,7 +88,11 @@ static int ret_label = 0; ((TYPE_ARG_TYPES (TREE_TYPE (FNDECL)) != 0 \ && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (TREE_TYPE (FNDECL)))) != void_type_node)) \ || current_function_varargs) + +/* Initialize the GCC target structure. */ +struct gcc_target target = TARGET_INITIALIZER; + /* Initialize variables before compiling any files. */ void diff --git a/gcc/config/ia64/ia64-protos.h b/gcc/config/ia64/ia64-protos.h index a5c2848..f0bae81 100644 --- a/gcc/config/ia64/ia64-protos.h +++ b/gcc/config/ia64/ia64-protos.h @@ -124,7 +124,6 @@ extern void ia64_function_arg_advance PARAMS((CUMULATIVE_ARGS *, 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 */ diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index b85ce75..c503a67 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -42,6 +42,8 @@ Boston, MA 02111-1307, USA. */ #include "basic-block.h" #include "toplev.h" #include "sched-int.h" +#include "target.h" +#include "target-def.h" /* This is used for communication between ASM_OUTPUT_LABEL and ASM_OUTPUT_LABELREF. */ @@ -134,6 +136,13 @@ static rtx ia64_expand_compare_and_swap PARAMS ((enum machine_mode, int, static rtx ia64_expand_lock_test_and_set PARAMS ((enum machine_mode, tree, rtx)); static rtx ia64_expand_lock_release PARAMS ((enum machine_mode, tree, rtx)); +static int ia64_valid_type_attribute PARAMS((tree, tree, tree, tree)); + +/* Initialize the GCC target structure. */ +#undef TARGET_VALID_TYPE_ATTRIBUTE +#define TARGET_VALID_TYPE_ATTRIBUTE ia64_valid_type_attribute + +struct gcc_target target = TARGET_INITIALIZER; /* Return 1 if OP is a valid operand for the MEM of a CALL insn. */ @@ -6524,7 +6533,7 @@ ia64_epilogue_uses (regno) /* Return true if IDENTIFIER is a valid attribute for TYPE. */ -int +static int ia64_valid_type_attribute (type, attributes, identifier, args) tree type; tree attributes ATTRIBUTE_UNUSED; diff --git a/gcc/config/ia64/ia64.h b/gcc/config/ia64/ia64.h index 20c4084..cb2747e 100644 --- a/gcc/config/ia64/ia64.h +++ b/gcc/config/ia64/ia64.h @@ -2756,13 +2756,6 @@ do { \ #define HANDLE_SYSV_PRAGMA -/* If defined, a C expression whose value is nonzero if IDENTIFIER with - arguments ARGS is a valid machine specific attribute for TYPE. The - attributes in ATTRIBUTES have previously been assigned to TYPE. */ - -#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, IDENTIFIER, ARGS) \ - ia64_valid_type_attribute (TYPE, ATTRIBUTES, IDENTIFIER, ARGS) - /* In rare cases, correct code generation requires extra machine dependent processing between the second jump optimization pass and delayed branch scheduling. On those machines, define this macro as a C statement to act on diff --git a/gcc/config/m32r/m32r-protos.h b/gcc/config/m32r/m32r-protos.h index f3eda83..5ab4a4c 100644 --- a/gcc/config/m32r/m32r-protos.h +++ b/gcc/config/m32r/m32r-protos.h @@ -36,7 +36,6 @@ extern void m32r_asm_file_start PARAMS ((FILE *)); 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)); diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c index 5bb2d56..a7763a2 100644 --- a/gcc/config/m32r/m32r.c +++ b/gcc/config/m32r/m32r.c @@ -36,6 +36,8 @@ Boston, MA 02111-1307, USA. */ #include "toplev.h" #include "ggc.h" #include "m32r-protos.h" +#include "target.h" +#include "target-def.h" /* Save the operands last given to a compare for use when we generate a scc or bcc insn. */ @@ -59,7 +61,15 @@ int m32r_sched_odd_word_p; static void init_reg_tables PARAMS ((void)); static void block_move_call PARAMS ((rtx, rtx, rtx)); static int m32r_is_insn PARAMS ((rtx)); +static int m32r_valid_decl_attribute PARAMS ((tree, tree, + tree, tree)); + +/* Initialize the GCC target structure. */ +#undef TARGET_VALID_DECL_ATTRIBUTE +#define TARGET_VALID_DECL_ATTRIBUTE m32r_valid_decl_attribute +struct gcc_target target = TARGET_INITIALIZER; + /* Called by OVERRIDE_OPTIONS to initialize various things. */ void @@ -242,8 +252,8 @@ init_idents PARAMS ((void)) /* Return nonzero if IDENTIFIER is a valid decl attribute. */ -int -m32r_valid_machine_decl_attribute (type, attributes, identifier, args) +static int +m32r_valid_decl_attribute (type, attributes, identifier, args) tree type ATTRIBUTE_UNUSED; tree attributes ATTRIBUTE_UNUSED; tree identifier; diff --git a/gcc/config/m32r/m32r.h b/gcc/config/m32r/m32r.h index 2381605..8600e6e 100644 --- a/gcc/config/m32r/m32r.h +++ b/gcc/config/m32r/m32r.h @@ -2112,12 +2112,6 @@ extern char m32r_punct_chars[]; /* A function address in a call instruction. */ #define FUNCTION_MODE SImode -/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS - is a valid machine specific attribute for DECL. - The attributes in ATTRIBUTES have previously been assigned to TYPE. */ -#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \ -m32r_valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS) - /* A C expression that returns zero if the attributes on TYPE1 and TYPE2 are incompatible, one if they are compatible, and two if they are nearly compatible (which causes a warning to be generated). */ diff --git a/gcc/config/m68hc11/m68hc11-protos.h b/gcc/config/m68hc11/m68hc11-protos.h index 890bc20..8c659b0 100644 --- a/gcc/config/m68hc11/m68hc11-protos.h +++ b/gcc/config/m68hc11/m68hc11-protos.h @@ -43,10 +43,6 @@ extern void m68hc11_function_arg_advance PARAMS((CUMULATIVE_ARGS*, 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)); diff --git a/gcc/config/m68hc11/m68hc11.c b/gcc/config/m68hc11/m68hc11.c index fed8d16..906c368 100644 --- a/gcc/config/m68hc11/m68hc11.c +++ b/gcc/config/m68hc11/m68hc11.c @@ -52,6 +52,8 @@ Note: #include "basic-block.h" #include "function.h" #include "ggc.h" +#include "target.h" +#include "target-def.h" static void print_options PARAMS ((FILE *)); static void emit_move_after_reload PARAMS ((rtx, rtx, rtx)); @@ -64,6 +66,8 @@ static rtx m68hc11_expand_compare PARAMS((enum rtx_code, 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)); @@ -201,7 +205,13 @@ const char *m68hc11_soft_reg_count; static void m68hc11_add_gc_roots PARAMS ((void)); static int nb_soft_regs; + +/* Initialize the GCC target structure. */ +#undef TARGET_VALID_TYPE_ATTRIBUTE +#define TARGET_VALID_TYPE_ATTRIBUTE m68hc11_valid_type_attribute_p +struct gcc_target target = TARGET_INITIALIZER; + int m68hc11_override_options () { @@ -1116,24 +1126,10 @@ m68hc11_initialize_trampoline (tramp, fnaddr, cxt) /* 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; diff --git a/gcc/config/m68hc11/m68hc11.h b/gcc/config/m68hc11/m68hc11.h index 0e9a65b..e9c38de 100644 --- a/gcc/config/m68hc11/m68hc11.h +++ b/gcc/config/m68hc11/m68hc11.h @@ -1194,21 +1194,6 @@ typedef struct m68hc11_args m68hc11_initialize_trampoline ((TRAMP), (FNADDR), (CXT)) - -/* If defined, a C expression whose value is nonzero if IDENTIFIER - with arguments ARGS is a valid machine specific attribute for DECL. - The attributes in ATTRIBUTES have previously been assigned to DECL. */ - -#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, NAME, ARGS) \ - (m68hc11_valid_decl_attribute_p (DECL, ATTRIBUTES, NAME, ARGS)) - -/* If defined, a C expression whose value is nonzero if IDENTIFIER - with arguments ARGS is a valid machine specific attribute for TYPE. - The attributes in ATTRIBUTES have previously been assigned to TYPE. */ - -#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, NAME, ARGS) \ - (m68hc11_valid_type_attribute_p (TYPE, ATTRIBUTES, NAME, ARGS)) - /* If defined, a C expression whose value is zero if the attributes on TYPE1 and TYPE2 are incompatible, one if they are compatible, and two if they are nearly compatible (which causes a warning to be diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c index 8bd26a7..e377e77 100644 --- a/gcc/config/m68k/m68k.c +++ b/gcc/config/m68k/m68k.c @@ -34,6 +34,8 @@ Boston, MA 02111-1307, USA. */ #include "recog.h" #include "toplev.h" #include "tm_p.h" +#include "target.h" +#include "target-def.h" /* Needed for use_return_insn. */ #include "flags.h" @@ -75,7 +77,11 @@ int m68k_align_funcs; sCC expanders peek at this to determine what to do for the 68060, which has no fsCC instructions. */ int m68k_last_compare_had_fp_operands; + +/* Initialize the GCC target structure. */ +struct gcc_target target = TARGET_INITIALIZER; + /* Sometimes certain combinations of command options do not make sense on a particular target machine. You can define a macro `OVERRIDE_OPTIONS' to take account of this. This macro, if diff --git a/gcc/config/m88k/m88k.c b/gcc/config/m88k/m88k.c index 2e78848..38c6c66 100644 --- a/gcc/config/m88k/m88k.c +++ b/gcc/config/m88k/m88k.c @@ -39,6 +39,8 @@ Boston, MA 02111-1307, USA. */ #include "recog.h" #include "toplev.h" #include "tm_p.h" +#include "target.h" +#include "target-def.h" extern int flag_traditional; extern FILE *asm_out_file; @@ -61,6 +63,10 @@ rtx m88k_compare_op1; /* cmpsi operand 1 */ enum processor_type m88k_cpu; /* target cpu */ +/* Initialize the GCC target structure. */ + +struct gcc_target target = TARGET_INITIALIZER; + /* Determine what instructions are needed to manufacture the integer VALUE in the given MODE. */ diff --git a/gcc/config/mcore/mcore-protos.h b/gcc/config/mcore/mcore-protos.h index 50af008..8c2b1ba 100644 --- a/gcc/config/mcore/mcore-protos.h +++ b/gcc/config/mcore/mcore-protos.h @@ -37,8 +37,6 @@ extern int mcore_naked_function_p PARAMS ((void)); #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)); diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c index 8fd64e5..b775509 100644 --- a/gcc/config/mcore/mcore.c +++ b/gcc/config/mcore/mcore.c @@ -39,6 +39,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "function.h" #include "ggc.h" #include "toplev.h" +#include "target.h" +#include "target-def.h" /* Maximum size we are allowed to grow the stack in a single operation. If we want more, we must do it in increments of at most this size. @@ -128,6 +130,19 @@ static void mcore_mark_dllexport PARAMS ((tree)); static void mcore_mark_dllimport PARAMS ((tree)); static int mcore_dllexport_p PARAMS ((tree)); static int mcore_dllimport_p PARAMS ((tree)); +static int mcore_valid_decl_attribute PARAMS ((tree, tree, + tree, tree)); + +/* Initialize the GCC target structure. */ +#ifdef TARGET_DLLIMPORT_DECL_ATTRIBUTES +#undef TARGET_MERGE_DECL_ATTRIBUTES +#define TARGET_MERGE_DECL_ATTRIBUTES merge_dllimport_decl_attributes +#endif + +#undef TARGET_VALID_DECL_ATTRIBUTE +#define TARGET_VALID_DECL_ATTRIBUTE mcore_valid_decl_attribute + +struct gcc_target target = TARGET_INITIALIZER; /* Adjust the stack and return the number of bytes taken to do it. */ static void @@ -3496,8 +3511,8 @@ mcore_encode_section_info (decl) dllexport - for exporting a function/variable that will live in a dll dllimport - for importing a function/variable from a dll naked - do not create a function prologue/epilogue. */ -int -mcore_valid_machine_decl_attribute (decl, attributes, attr, args) +static int +mcore_valid_decl_attribute (decl, attributes, attr, args) tree decl; tree attributes ATTRIBUTE_UNUSED; tree attr; @@ -3537,57 +3552,6 @@ mcore_valid_machine_decl_attribute (decl, attributes, attr, args) 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 diff --git a/gcc/config/mcore/mcore.h b/gcc/config/mcore/mcore.h index ce1234a..3440dbd 100644 --- a/gcc/config/mcore/mcore.h +++ b/gcc/config/mcore/mcore.h @@ -35,15 +35,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ /* 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. diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 05edaff8..dd735cc 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -49,8 +49,9 @@ Boston, MA 02111-1307, USA. */ #include "output.h" #include "tm_p.h" #include "ggc.h" - #include "gstab.h" +#include "target.h" +#include "target-def.h" #ifdef __GNU_STAB__ #define STAB_CODE_TYPE enum __stab_debug_code @@ -427,7 +428,10 @@ enum reg_class mips_char_to_class[256] = NO_REGS, NO_REGS, NO_REGS, NO_REGS, NO_REGS, NO_REGS, NO_REGS, NO_REGS, }; + +/* Initialize the GCC target structure. */ +struct gcc_target target = TARGET_INITIALIZER; /* Return truth value of whether OP can be used as an operands where a register or 16 bit unsigned integer is needed. */ diff --git a/gcc/config/mn10200/mn10200.c b/gcc/config/mn10200/mn10200.c index 1a4f9dd..965d61c 100644 --- a/gcc/config/mn10200/mn10200.c +++ b/gcc/config/mn10200/mn10200.c @@ -38,6 +38,8 @@ Boston, MA 02111-1307, USA. */ #include "ggc.h" #include "toplev.h" #include "tm_p.h" +#include "target.h" +#include "target-def.h" /* Global registers known to hold the value zero. @@ -63,7 +65,11 @@ static void count_tst_insns PARAMS ((int *)); /* Note whether or not we need an out of line epilogue. */ static int out_of_line_epilogue; + +/* Initialize the GCC target structure. */ +struct gcc_target target = TARGET_INITIALIZER; + /* Indicate this file was compiled by gcc and what optimization level was used. */ void diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c index ee408d4..472b293 100644 --- a/gcc/config/mn10300/mn10300.c +++ b/gcc/config/mn10300/mn10300.c @@ -38,6 +38,8 @@ Boston, MA 02111-1307, USA. */ #include "obstack.h" #include "toplev.h" #include "tm_p.h" +#include "target.h" +#include "target-def.h" /* The size of the callee register save area. Right now we save everything on entry since it costs us nothing in code size. It does cost us from a @@ -48,7 +50,11 @@ Boston, MA 02111-1307, USA. */ + 4 * regs_ever_live[7] \ + 16 * (regs_ever_live[14] || regs_ever_live[15] \ || regs_ever_live[16] || regs_ever_live[17])) + +/* Initialize the GCC target structure. */ +struct gcc_target target = TARGET_INITIALIZER; + void asm_file_start (file) FILE *file; diff --git a/gcc/config/ns32k/ns32k-protos.h b/gcc/config/ns32k/ns32k-protos.h index 496d086..7c6da1b 100644 --- a/gcc/config/ns32k/ns32k-protos.h +++ b/gcc/config/ns32k/ns32k-protos.h @@ -40,8 +40,6 @@ extern int symbolic_reference_mentioned_p PARAMS ((rtx)); #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)); diff --git a/gcc/config/ns32k/ns32k.c b/gcc/config/ns32k/ns32k.c index 3fbde5a..ec5470a 100644 --- a/gcc/config/ns32k/ns32k.c +++ b/gcc/config/ns32k/ns32k.c @@ -35,6 +35,8 @@ Boston, MA 02111-1307, USA. */ #include "flags.h" #include "recog.h" #include "tm_p.h" +#include "target.h" +#include "target-def.h" #ifdef OSF_OS int ns32k_num_files = 0; @@ -62,7 +64,14 @@ const char *const ns32k_out_reg_names[] = OUTPUT_REGISTER_NAMES; static rtx gen_indexed_expr PARAMS ((rtx, rtx, rtx)); static const char *singlemove_string PARAMS ((rtx *)); static void move_tail PARAMS ((rtx[], int, int)); +static int ns32k_valid_type_attribute_p PARAMS ((tree, tree, tree, tree)); + +/* Initialize the GCC target structure. */ +#undef TARGET_VALID_TYPE_ATTRIBUTE +#define TARGET_VALID_TYPE_ATTRIBUTE ns32k_valid_type_attribute_p +struct gcc_target target = TARGET_INITIALIZER; + /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */ int hard_regno_mode_ok (regno, mode) @@ -634,24 +643,10 @@ symbolic_reference_mentioned_p (op) } /* Return nonzero if IDENTIFIER with arguments ARGS is a valid machine specific - attribute for DECL. The attributes in ATTRIBUTES have previously been - assigned to DECL. */ - -int -ns32k_valid_decl_attribute_p (decl, attributes, identifier, args) - tree decl ATTRIBUTE_UNUSED; - tree attributes ATTRIBUTE_UNUSED; - tree identifier ATTRIBUTE_UNUSED; - tree args ATTRIBUTE_UNUSED; -{ - return 0; -} - -/* Return nonzero if IDENTIFIER with arguments ARGS is a valid machine specific attribute for TYPE. The attributes in ATTRIBUTES have previously been assigned to TYPE. */ -int +static int ns32k_valid_type_attribute_p (type, attributes, identifier, args) tree type; tree attributes ATTRIBUTE_UNUSED; diff --git a/gcc/config/ns32k/ns32k.h b/gcc/config/ns32k/ns32k.h index 9a377b5..e92140b 100644 --- a/gcc/config/ns32k/ns32k.h +++ b/gcc/config/ns32k/ns32k.h @@ -1294,20 +1294,6 @@ while (0) { if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) \ goto LABEL;} -/* If defined, a C expression whose value is nonzero if IDENTIFIER - with arguments ARGS is a valid machine specific attribute for DECL. - The attributes in ATTRIBUTES have previously been assigned to DECL. */ - -#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, NAME, ARGS) \ - (ns32k_valid_decl_attribute_p (DECL, ATTRIBUTES, NAME, ARGS)) - -/* If defined, a C expression whose value is nonzero if IDENTIFIER - with arguments ARGS is a valid machine specific attribute for TYPE. - The attributes in ATTRIBUTES have previously been assigned to TYPE. */ - -#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, NAME, ARGS) \ - (ns32k_valid_type_attribute_p (TYPE, ATTRIBUTES, NAME, ARGS)) - /* If defined, a C expression whose value is zero if the attributes on TYPE1 and TYPE2 are incompatible, one if they are compatible, and two if they are nearly compatible (which causes a warning to be diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 2b7b17d..9100a80 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -41,6 +41,8 @@ Boston, MA 02111-1307, USA. */ #include "ggc.h" #include "recog.h" #include "tm_p.h" +#include "target.h" +#include "target-def.h" #ifndef DO_FRAME_NOTES #ifdef INCOMING_RETURN_ADDR_RTX @@ -105,7 +107,11 @@ struct deferred_plabel char *name; } *deferred_plabels = 0; int n_deferred_plabels = 0; + +/* Initialize the GCC target structure. */ +struct gcc_target target = TARGET_INITIALIZER; + void override_options () { diff --git a/gcc/config/pdp11/pdp11.c b/gcc/config/pdp11/pdp11.c index b298ea0..6da1531 100644 --- a/gcc/config/pdp11/pdp11.c +++ b/gcc/config/pdp11/pdp11.c @@ -35,6 +35,8 @@ Boston, MA 02111-1307, USA. */ #include "recog.h" #include "tree.h" #include "tm_p.h" +#include "target.h" +#include "target-def.h" /* #define FPU_REG_P(X) ((X)>=8 && (X)<14) @@ -50,7 +52,11 @@ int current_first_parm_offset; static rtx find_addr_reg PARAMS ((rtx)); static const char *singlemove_string PARAMS ((rtx *)); + +/* Initialize the GCC target structure. */ +struct gcc_target target = TARGET_INITIALIZER; + /* Nonzero if OP is a valid second operand for an arithmetic insn. */ int diff --git a/gcc/config/pj/pj.c b/gcc/config/pj/pj.c index febe299..1e0d3a8 100644 --- a/gcc/config/pj/pj.c +++ b/gcc/config/pj/pj.c @@ -99,6 +99,8 @@ Boston, MA 02111-1307, USA. */ #include "toplev.h" #include "basic-block.h" #include "ggc.h" +#include "target.h" +#include "target-def.h" /* Compare insns in pj.md store the information needed to generate branch instructions here. */ @@ -122,7 +124,11 @@ static int nfakes; /* Whether anything has been printed to the current assembly output line. */ int pj_stuff_on_line; + +/* Initialize the GCC target structure. */ +struct gcc_target target = TARGET_INITIALIZER; + /* printf to the asm_out_file, with special format control characters for decoding operands. diff --git a/gcc/config/romp/romp.c b/gcc/config/romp/romp.c index 8cabb46..aec840ca 100644 --- a/gcc/config/romp/romp.c +++ b/gcc/config/romp/romp.c @@ -38,6 +38,8 @@ Boston, MA 02111-1307, USA. */ #include "tree.h" #include "function.h" #include "tm_p.h" +#include "target.h" +#include "target-def.h" #define min(A,B) ((A) < (B) ? (A) : (B)) #define max(A,B) ((A) > (B) ? (A) : (B)) @@ -49,6 +51,10 @@ static void init_fpops PARAMS ((void)); static int memory_offset_in_range_p PARAMS ((rtx, enum machine_mode, int, int)); static unsigned int hash_rtx PARAMS ((rtx)); +/* Initialize the GCC target structure. */ + +struct gcc_target target = TARGET_INITIALIZER; + /* Return 1 if the insn using CC0 set by INSN does not contain any unsigned tests applied to the condition codes. diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h index 6307503..cbcd257 100644 --- a/gcc/config/rs6000/rs6000-protos.h +++ b/gcc/config/rs6000/rs6000-protos.h @@ -138,8 +138,6 @@ extern void setup_incoming_varargs PARAMS ((CUMULATIVE_ARGS *, 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)); diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 2267b06..45e6bd4 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -42,6 +42,8 @@ Boston, MA 02111-1307, USA. */ #include "ggc.h" #include "hashtab.h" #include "tm_p.h" +#include "target.h" +#include "target-def.h" #ifndef TARGET_NO_PROTOTYPE #define TARGET_NO_PROTOTYPE 0 @@ -123,6 +125,7 @@ static int constant_pool_expr_1 PARAMS ((rtx, int *, int *)); 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)); /* Default register names. */ char rs6000_reg_names[][8] = @@ -160,7 +163,13 @@ static char alt_reg_names[][8] = #ifndef MASK_STRICT_ALIGN #define MASK_STRICT_ALIGN 0 #endif + +/* Initialize the GCC target structure. */ +#undef TARGET_VALID_TYPE_ATTRIBUTE +#define TARGET_VALID_TYPE_ATTRIBUTE rs6000_valid_type_attribute_p +struct gcc_target target = TARGET_INITIALIZER; + /* Override command line options. Mostly we process the processor type and sometimes adjust other TARGET_ options. */ @@ -7821,24 +7830,10 @@ rs6000_initialize_trampoline (addr, fnaddr, cxt) /* If defined, a C expression whose value is nonzero if IDENTIFIER - with arguments ARGS is a valid machine specific attribute for DECL. - The attributes in ATTRIBUTES have previously been assigned to DECL. */ - -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; diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 230cdc8..ad4768f 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -1611,20 +1611,6 @@ typedef struct rs6000_args #define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, CXT) \ rs6000_initialize_trampoline (ADDR, FNADDR, CXT) -/* If defined, a C expression whose value is nonzero if IDENTIFIER - with arguments ARGS is a valid machine specific attribute for DECL. - The attributes in ATTRIBUTES have previously been assigned to DECL. */ - -#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, NAME, ARGS) \ - (rs6000_valid_decl_attribute_p (DECL, ATTRIBUTES, NAME, ARGS)) - -/* If defined, a C expression whose value is nonzero if IDENTIFIER - with arguments ARGS is a valid machine specific attribute for TYPE. - The attributes in ATTRIBUTES have previously been assigned to TYPE. */ - -#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, NAME, ARGS) \ - (rs6000_valid_type_attribute_p (TYPE, ATTRIBUTES, NAME, ARGS)) - /* If defined, a C expression whose value is zero if the attributes on TYPE1 and TYPE2 are incompatible, one if they are compatible, and two if they are nearly compatible (which causes a warning to be diff --git a/gcc/config/sh/sh-protos.h b/gcc/config/sh/sh-protos.h index fa4f7d1..2296e41 100644 --- a/gcc/config/sh/sh-protos.h +++ b/gcc/config/sh/sh-protos.h @@ -106,7 +106,6 @@ extern rtx sh_va_arg PARAMS ((tree, tree)); #ifdef TREE_CODE extern void sh_pragma_insert_attributes PARAMS ((tree, tree *, tree *)); -extern int sh_valid_machine_decl_attribute PARAMS ((tree, tree, tree, tree)); extern tree sh_build_va_list PARAMS ((void)); #endif /* TREE_CODE */ diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index db7ec5f..5cdc209 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -37,6 +37,8 @@ Boston, MA 02111-1307, USA. */ #include "recog.h" #include "c-pragma.h" #include "tm_p.h" +#include "target.h" +#include "target-def.h" int code_for_indirect_jump_scratch = CODE_FOR_indirect_jump_scratch; @@ -151,6 +153,13 @@ static int calc_live_regs PARAMS ((int *, int *)); static void mark_use PARAMS ((rtx, rtx *)); static HOST_WIDE_INT rounded_frame_size PARAMS ((int)); static rtx mark_constant_pool_use PARAMS ((rtx)); +static int sh_valid_decl_attribute PARAMS ((tree, tree, tree, tree)); + +/* Initialize the GCC target structure. */ +#undef TARGET_VALID_DECL_ATTRIBUTE +#define TARGET_VALID_DECL_ATTRIBUTE sh_valid_decl_attribute + +struct gcc_target target = TARGET_INITIALIZER; /* Print the operand address in x to the stream. */ @@ -4626,8 +4635,8 @@ sh_pragma_insert_attributes (node, attributes, prefix) 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; diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h index 0707977..0b36079 100644 --- a/gcc/config/sh/sh.h +++ b/gcc/config/sh/sh.h @@ -2298,12 +2298,6 @@ extern int current_function_interrupt; for interrupt functions. */ extern struct rtx_def *sp_switch; -/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS - is a valid machine specific attribute for DECL. - The attributes in ATTRIBUTES have previously been assigned to DECL. */ -#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \ -sh_valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS) - #define PRAGMA_INSERT_ATTRIBUTES(node, pattr, prefix_attr) \ sh_pragma_insert_attributes (node, pattr, prefix_attr) diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 0d5b363..ab24f0d 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -40,6 +40,8 @@ Boston, MA 02111-1307, USA. */ #include "toplev.h" #include "ggc.h" #include "tm_p.h" +#include "target.h" +#include "target-def.h" /* 1 if the caller has placed an "unimp" insn immediately after the call. This is used in v8 code when calling a function that returns a structure. @@ -175,7 +177,11 @@ struct sparc_cpu_select sparc_select[] = /* CPU type. This is set from TARGET_CPU_DEFAULT and -m{cpu,tune}=xxx. */ enum processor_type sparc_cpu; + +/* Initialize the GCC target structure. */ +struct gcc_target target = TARGET_INITIALIZER; + /* Validate and override various options, and do some machine dependent initialization. */ diff --git a/gcc/config/v850/v850-protos.h b/gcc/config/v850/v850-protos.h index cc52b0c..9d6d08a 100644 --- a/gcc/config/v850/v850-protos.h +++ b/gcc/config/v850/v850-protos.h @@ -72,7 +72,6 @@ extern rtx v850_va_arg PARAMS ((tree, tree)); #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)); diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c index 4883ab2..18ad632 100644 --- a/gcc/config/v850/v850.c +++ b/gcc/config/v850/v850.c @@ -40,6 +40,8 @@ Boston, MA 02111-1307, USA. */ #include "c-lex.h" #include "ggc.h" #include "tm_p.h" +#include "target.h" +#include "target-def.h" #ifndef streq #define streq(a,b) (strcmp (a, b) == 0) @@ -51,6 +53,7 @@ static int const_costs_int PARAMS ((HOST_WIDE_INT, int)); 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; @@ -78,7 +81,12 @@ static int v850_interrupt_cache_p = FALSE; /* Whether current function is an interrupt handler. */ static int v850_interrupt_p = FALSE; + +/* Initialize the GCC target structure. */ +#undef TARGET_VALID_DECL_ATTRIBUTE +#define TARGET_VALID_DECL_ATTRIBUTE v850_valid_decl_attribute +struct gcc_target target = TARGET_INITIALIZER; /* Sometimes certain combinations of command options do not make sense on a particular target machine. You can define a macro @@ -2003,9 +2011,10 @@ v850_set_data_area (decl, data_area) /* Return nonzero if ATTR is a valid attribute for DECL. ARGS are the arguments supplied with ATTR. */ -int -v850_valid_machine_decl_attribute (decl, attr, args) +static int +v850_valid_decl_attribute (decl, unused, attr, args) tree decl; + tree unused ATTRIBUTE_UNUSED; tree attr; tree args; { diff --git a/gcc/config/v850/v850.h b/gcc/config/v850/v850.h index 9b348c7..bde4bb3 100644 --- a/gcc/config/v850/v850.h +++ b/gcc/config/v850/v850.h @@ -1486,12 +1486,6 @@ do { char dstr[30]; \ so give the MEM rtx a byte's mode. */ #define FUNCTION_MODE QImode -/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS - is a valid machine specific attribute for DECL. - The attributes in ATTRIBUTES have previously been assigned to DECL. */ -#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \ - v850_valid_machine_decl_attribute (DECL, IDENTIFIER, ARGS) - /* A C statement that assigns default attributes to a newly created DECL. */ #define SET_DEFAULT_DECL_ATTRIBUTES(decl, attr) \ v850_set_default_decl_attr (decl) diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c index 574ffa5..43d6a9c 100644 --- a/gcc/config/vax/vax.c +++ b/gcc/config/vax/vax.c @@ -34,7 +34,13 @@ Boston, MA 02111-1307, USA. */ #include "tree.h" #endif #include "tm_p.h" +#include "target.h" +#include "target-def.h" + +/* Initialize the GCC target structure. */ +struct gcc_target target = TARGET_INITIALIZER; + /* This is like nonimmediate_operand with a restriction on the type of MEM. */ void diff --git a/gcc/config/we32k/we32k.c b/gcc/config/we32k/we32k.c index 6d5c00a..f7346a4 100644 --- a/gcc/config/we32k/we32k.c +++ b/gcc/config/we32k/we32k.c @@ -30,7 +30,13 @@ Boston, MA 02111-1307, USA. */ #include "recog.h" #include "output.h" #include "tm_p.h" +#include "target.h" +#include "target-def.h" + +/* Initialize the GCC target structure. */ +struct gcc_target target = TARGET_INITIALIZER; + void output_move_double (operands) rtx *operands; diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in index 9965c5e..07a2e5b 100644 --- a/gcc/cp/Make-lang.in +++ b/gcc/cp/Make-lang.in @@ -233,7 +233,7 @@ c++.stage4: stage4-start # # .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 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 0968220..350422b 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -43,6 +43,7 @@ Boston, MA 02111-1307, USA. */ #include "../hash.h" #include "ggc.h" #include "tm_p.h" +#include "target.h" extern int (*valid_lang_attribute) PARAMS ((tree, tree, tree, tree)); @@ -3483,7 +3484,7 @@ duplicate_decls (newdecl, olddecl) /* Copy all the DECL_... slots specified in the new decl except for any that we copy here from the old type. */ DECL_MACHINE_ATTRIBUTES (newdecl) - = merge_machine_decl_attributes (olddecl, newdecl); + = (*target.merge_decl_attributes) (olddecl, newdecl); if (TREE_CODE (newdecl) == TEMPLATE_DECL) { diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 56c4dbc..7d0ee46 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -45,6 +45,7 @@ Boston, MA 02111-1307, USA. */ #include "ggc.h" #include "timevar.h" #include "cpplib.h" +#include "target.h" extern cpp_reader *parse_in; /* This structure contains information about the initializations @@ -2455,13 +2456,15 @@ import_export_class (ctype) if (CLASSTYPE_INTERFACE_ONLY (ctype)) return; -#ifdef VALID_MACHINE_TYPE_ATTRIBUTE - /* FIXME this should really use some sort of target-independent macro. */ - if (lookup_attribute ("dllimport", TYPE_ATTRIBUTES (ctype))) - import_export = -1; - else if (lookup_attribute ("dllexport", TYPE_ATTRIBUTES (ctype))) - import_export = 1; -#endif + if (target.valid_type_attribute != NULL) + { + /* FIXME this should really use some sort of target-independent + macro. */ + if (lookup_attribute ("dllimport", TYPE_ATTRIBUTES (ctype))) + import_export = -1; + else if (lookup_attribute ("dllexport", TYPE_ATTRIBUTES (ctype))) + import_export = 1; + } /* If we got -fno-implicit-templates, we import template classes that weren't explicitly instantiated. */ diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 1256b6d..db1044a 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -41,6 +41,7 @@ Boston, MA 02111-1307, USA. */ #include "output.h" #include "toplev.h" #include "diagnostic.h" +#include "target.h" static tree convert_for_assignment PARAMS ((tree, tree, const char *, tree, int)); @@ -210,8 +211,8 @@ qualify_type_recursive (t1, t2) tree tt2 = TREE_TYPE (t2); tree b1; int type_quals; - tree target; - tree attributes = merge_machine_type_attributes (t1, t2); + tree tgt; + tree attributes = (*target.merge_type_attributes) (t1, t2); if (TREE_CODE (tt1) == OFFSET_TYPE) { @@ -223,11 +224,11 @@ qualify_type_recursive (t1, t2) b1 = NULL_TREE; type_quals = (CP_TYPE_QUALS (tt1) | CP_TYPE_QUALS (tt2)); - target = qualify_type_recursive (tt1, tt2); - target = cp_build_qualified_type (target, type_quals); + tgt = qualify_type_recursive (tt1, tt2); + tgt = cp_build_qualified_type (tgt, type_quals); if (b1) - target = build_offset_type (b1, target); - t1 = build_pointer_type (target); + tgt = build_offset_type (b1, tgt); + t1 = build_pointer_type (tgt); t1 = build_type_attribute_variant (t1, attributes); } return t1; @@ -342,7 +343,7 @@ type_after_usual_arithmetic_conversions (t1, t2) /* In what follows, we slightly generalize the rules given in [expr] so as to deal with `long long'. First, merge the attributes. */ - attributes = merge_machine_type_attributes (t1, t2); + attributes = (*target.merge_type_attributes) (t1, t2); /* If only one is real, use it as the result. */ if (code1 == REAL_TYPE && code2 != REAL_TYPE) @@ -548,7 +549,7 @@ common_type (t1, t2) return type_after_usual_arithmetic_conversions (t1, t2); /* Merge the attributes. */ - attributes = merge_machine_type_attributes (t1, t2); + attributes = (*target.merge_type_attributes) (t1, t2); /* Treat an enum type as the unsigned integer type of the same width. */ diff --git a/gcc/doc/gcc.texi b/gcc/doc/gcc.texi index 9c70610..40c28e3 100644 --- a/gcc/doc/gcc.texi +++ b/gcc/doc/gcc.texi @@ -272,7 +272,7 @@ bugs. It corresponds to GCC version 3.1. * 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 diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 1b1c566..24eed3a 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -4,7 +4,7 @@ @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 @@ -12,14 +12,20 @@ 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. @@ -44,6 +50,38 @@ includes @file{tm.h} and most compiler source files include * 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 @@ -8223,19 +8261,21 @@ pack value of zero resets the behaviour to the default. Successive 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 @@ -8247,23 +8287,36 @@ generated). @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 diff --git a/gcc/target-def.h b/gcc/target-def.h new file mode 100644 index 0000000..1af66c3 --- /dev/null +++ b/gcc/target-def.h @@ -0,0 +1,38 @@ +/* Default initializers for a generic GCC target. + Copyright (C) 2001 Free Software Foundation, Inc. + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + In other words, you are welcome to use, share and improve this program. + You are forbidden to forbid anyone else to use, share and improve + what you give them. Help stamp out software-hoarding! */ + +/* See target.h for a desciption of what this file contains and how to + use it. */ + +/* Both in tree.c. */ +#define TARGET_MERGE_DECL_ATTRIBUTES merge_decl_attributes +#define TARGET_MERGE_TYPE_ATTRIBUTES merge_type_attributes +#define TARGET_VALID_DECL_ATTRIBUTE 0 +#define TARGET_VALID_TYPE_ATTRIBUTE 0 + +/* The whole shebang. */ +#define TARGET_INITIALIZER \ +{ \ + TARGET_MERGE_DECL_ATTRIBUTES, \ + TARGET_MERGE_TYPE_ATTRIBUTES, \ + TARGET_VALID_DECL_ATTRIBUTE, \ + TARGET_VALID_TYPE_ATTRIBUTE \ +} diff --git a/gcc/target.h b/gcc/target.h new file mode 100644 index 0000000..08d0568 --- /dev/null +++ b/gcc/target.h @@ -0,0 +1,68 @@ +/* Data structure definitions for a generic GCC target. + Copyright (C) 2001 Free Software Foundation, Inc. + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + In other words, you are welcome to use, share and improve this program. + You are forbidden to forbid anyone else to use, share and improve + what you give them. Help stamp out software-hoarding! */ + +/* This file contains a data structure that describes a GCC target. + At present, it is incomplete, but in future it should grow to + contain most or all target machine and target O/S specific + information. + + This structure has its initializer declared in target-def.h in the + form of large macro TARGET_INITIALIZER that expands to many smaller + macros. + + The smaller macros each initialize one component of the structure, + and each has a default. Each target should have a file that + includes target.h and target-def.h, and overrides any inappropriate + defaults by undefining the relevant macro and defining a suitable + replacement. That file should then contain the definition of + "target" like so: + + struct gcc_target target = TARGET_INITIALIZER; + + Doing things this way allows us to bring together everything that + defines a target to GCC. By supplying a default that is + appropriate to most targets, we can easily add new items without + needing to edit dozens of target configuration files. It should + also allow us to gradually reduce the amount of conditional + compilation that is scattered throughout GCC. */ + +struct gcc_target +{ + /* Given two decls, merge their attributes and return the result. */ + tree (* merge_decl_attributes) PARAMS ((tree, tree)); + + /* Given two types, merge their attributes and return the result. */ + tree (* merge_type_attributes) PARAMS ((tree, tree)); + + /* Nonzero if IDENTIFIER with arguments ARGS is a valid machine + specific attribute for DECL. The attributes in ATTRIBUTES have + previously been assigned to DECL. */ + int (* valid_decl_attribute) PARAMS ((tree decl, tree attributes, + tree identifier, tree args)); + + /* Nonzero if IDENTIFIER with arguments ARGS is a valid machine + specific attribute for TYPE. The attributes in ATTRIBUTES have + previously been assigned to TYPE. */ + int (* valid_type_attribute) PARAMS ((tree type, tree attributes, + tree identifier, tree args)); +}; + +extern struct gcc_target target; @@ -44,6 +44,7 @@ Boston, MA 02111-1307, USA. */ #include "ggc.h" #include "hashtab.h" #include "output.h" +#include "target.h" #define obstack_chunk_alloc xmalloc #define obstack_chunk_free free @@ -2706,124 +2707,119 @@ build_type_attribute_variant (ttype, attribute) 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, @@ -2938,34 +2934,83 @@ merge_attributes (a1, a2) } /* Given types T1 and T2, merge their attributes and return - the result. */ + the result. */ tree -merge_machine_type_attributes (t1, t2) +merge_type_attributes (t1, t2) tree t1, t2; { -#ifdef MERGE_MACHINE_TYPE_ATTRIBUTES - return MERGE_MACHINE_TYPE_ATTRIBUTES (t1, t2); -#else return merge_attributes (TYPE_ATTRIBUTES (t1), TYPE_ATTRIBUTES (t2)); -#endif } /* Given decls OLDDECL and NEWDECL, merge their attributes and return the result. */ tree -merge_machine_decl_attributes (olddecl, newdecl) +merge_decl_attributes (olddecl, newdecl) tree olddecl, newdecl; { -#ifdef MERGE_MACHINE_DECL_ATTRIBUTES - return MERGE_MACHINE_DECL_ATTRIBUTES (olddecl, newdecl); -#else return merge_attributes (DECL_MACHINE_ATTRIBUTES (olddecl), DECL_MACHINE_ATTRIBUTES (newdecl)); -#endif } + +#ifdef TARGET_DLLIMPORT_DECL_ATTRIBUTES + +/* Specialization of merge_decl_attributes for various Windows targets. + + This handles the following situation: + + __declspec (dllimport) int foo; + int foo; + + The second instance of `foo' nullifies the dllimport. */ + +tree +merge_dllimport_decl_attributes (old, new) + tree old; + tree new; +{ + tree a; + int delete_dllimport_p; + + old = DECL_MACHINE_ATTRIBUTES (old); + new = DECL_MACHINE_ATTRIBUTES (new); + + /* What we need to do here is remove from `old' dllimport if it doesn't + appear in `new'. dllimport behaves like extern: if a declaration is + marked dllimport and a definition appears later, then the object + is not dllimport'd. */ + if (lookup_attribute ("dllimport", old) != NULL_TREE + && lookup_attribute ("dllimport", new) == NULL_TREE) + delete_dllimport_p = 1; + else + delete_dllimport_p = 0; + + a = merge_attributes (old, new); + + if (delete_dllimport_p) + { + tree prev,t; + + /* Scan the list for dllimport and delete it. */ + for (prev = NULL_TREE, t = a; t; prev = t, t = TREE_CHAIN (t)) + { + if (is_attribute_p ("dllimport", TREE_PURPOSE (t))) + { + if (prev == NULL_TREE) + a = TREE_CHAIN (a); + else + TREE_CHAIN (prev) = TREE_CHAIN (t); + break; + } + } + } + + return a; +} + +#endif /* TARGET_DLLIMPORT_DECL_ATTRIBUTES */ /* Set the type qualifiers for TYPE to TYPE_QUALS, which is a bitmask of the various TYPE_QUAL values. */ @@ -2039,8 +2039,8 @@ extern tree make_tree PARAMS ((tree, struct rtx_def *)); 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. */ @@ -2068,6 +2068,12 @@ extern tree lookup_attribute PARAMS ((const char *, tree)); 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. */ |