On Tue, 16 Oct 2018 at 17:28, Richard Sandiford <richard.sandif...@arm.com> wrote: > > Iain Buclaw <ibuc...@gdcproject.org> writes: > > diff --git a/gcc/Makefile.in b/gcc/Makefile.in > > index 4b7cec82382..0b2daa320c3 100644 > > --- a/gcc/Makefile.in > > +++ b/gcc/Makefile.in > > @@ -2496,6 +2525,7 @@ s-tm-texi: build/genhooks$(build_exeext) > > $(srcdir)/doc/tm.texi.in > > && ( test $(srcdir)/doc/tm.texi -nt $(srcdir)/target.def \ > > || test $(srcdir)/doc/tm.texi -nt $(srcdir)/c-family/c-target.def > > \ > > || test $(srcdir)/doc/tm.texi -nt > > $(srcdir)/common/common-target.def \ > > + || test $(srcdir)/doc/tm.texi -nt $(srcdir)/d/d-target.def \ > > ); then \ > > echo >&2 ; \ > > echo You should edit $(srcdir)/doc/tm.texi.in rather than > > $(srcdir)/doc/tm.texi . >&2 ; \ > > [...] > > @@ -2784,7 +2815,7 @@ build/genrecog.o : genrecog.c $(RTL_BASE_H) > > $(BCONFIG_H) $(SYSTEM_H) \ > > $(CORETYPES_H) $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H) > > \ > > $(HASH_TABLE_H) inchash.h > > build/genhooks.o : genhooks.c $(TARGET_DEF) $(C_TARGET_DEF) \ > > - $(COMMON_TARGET_DEF) $(BCONFIG_H) $(SYSTEM_H) errors.h > > + $(COMMON_TARGET_DEF) $(D_TARGET_DEF) $(BCONFIG_H) $(SYSTEM_H) errors.h > > build/genmddump.o : genmddump.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) > > \ > > $(CORETYPES_H) $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H) > > build/genmatch.o : genmatch.c $(BCONFIG_H) $(SYSTEM_H) \ > > I was initially a bit worried about this because it makes the build > depend on the existence of the d/ directory. But it doesn't look > like we try to ship separate tarballs for specific source languages > any more, so that's probably not a problem. > > > @@ -10659,6 +10668,22 @@ unloaded. The default is to return false. > > Return target-specific mangling context of @var{decl} or @code{NULL_TREE}. > > @end deftypefn > > > > +@node D Language and ABI > > +@section D ABI parameters > > +@cindex parameters, d abi > > + > > +@deftypefn {D Target Hook} void TARGET_D_CPU_VERSIONS (void) > > +Declare all environmental version identifiers relating to the target CPU > > using the function @code{builtin_version}, which takes a string > > representing the name of the version. Version identifiers predefined by > > this hook apply to all modules and being compiled and imported. > > +@end deftypefn > > "and being"? Does this mean "that are being"? > > > +@deftypefn {D Target Hook} void TARGET_D_OS_VERSIONS (void) > > +Similarly to @code{TARGET_D_CPU_VERSIONS}, but is used for versions > > relating to the target operating system. > > +@end deftypefn > > + > > +@deftypefn {D Target Hook} unsigned TARGET_D_CRITSEC_SIZE (void) > > +Returns the size of the data structure used by the targeted operating > > system for critical sections and monitors. For example, on Microsoft > > Windows this would return the @code{sizeof(CRITICAL_SECTION)}, while other > > platforms that implement pthreads would return > > @code{sizeof(pthread_mutex_t)}. > > +@end deftypefn > > Please reflow the .def so that these fit within 80 chars. > > OK otherwise if no target maintainer objects to the changes to their port > (I think they've had plenty of time already :-)) >
Regenerated tm.texi with corrections. Regards -- Iain --- gcc/ChangeLog * gcc/Makefile.in (tm_d_file_list, tm_d_include_list, TM_D_H, D_TARGET_DEF, D_TARGET_H, D_TARGET_OBJS): New variables. (tm_d.h, cs-tm_d.h, default-d.o, d/d-target-hooks-def.h, s-d-target-hooks-def-h): New rules. (s-tm-texi): Also check timestamp on d-target.def. (generated_files): Add TM_D_H and d-target-hooks-def.h. (build/genhooks.o): Also depend on D_TARGET_DEF. * gcc/config.gcc (tm_d_file, d_target_objs, target_has_targetdm): New variables. * config/aarch64/aarch64-d.c: New file. * config/aarch64/aarch64-linux.h (GNU_USER_TARGET_D_CRITSEC_SIZE): Define. * config/aarch64/aarch64-protos.h (aarch64_d_target_versions): New prototype. * config/aarch64/aarch64.h (TARGET_D_CPU_VERSIONS): Define. * config/aarch64/t-aarch64 (aarch64-d.o): New rule. * config/arm/arm-d.c: New file. * config/arm/arm-protos.h (arm_d_target_versions): New prototype. * config/arm/arm.h (TARGET_D_CPU_VERSIONS): Define. * config/arm/linux-eabi.h (EXTRA_TARGET_D_OS_VERSIONS): Define. * config/arm/t-arm (arm-d.o): New rule. * config/default-d.c: New file. * config/glibc-d.c: New file. * config/gnu.h (GNU_USER_TARGET_D_OS_VERSIONS): Define. * config/i386/i386-d.c: New file. * config/i386/i386-protos.h (ix86_d_target_versions): New prototype. * config/i386/i386.h (TARGET_D_CPU_VERSIONS): Define. * config/i386/linux-common.h (EXTRA_TARGET_D_OS_VERSIONS, GNU_USER_TARGET_D_CRITSEC_SIZE): Define. * config/i386/t-i386 (i386-d.o): New rule. * config/kfreebsd-gnu.h (GNU_USER_TARGET_D_OS_VERSIONS): Define. * config/kopensolaris-gnu.h (GNU_USER_TARGET_D_OS_VERSIONS): Define. * config/linux-android.h (ANDROID_TARGET_D_OS_VERSIONS): Define. * config/linux.h (GNU_USER_TARGET_D_OS_VERSIONS): Define. * config/mips/linux-common.h (EXTRA_TARGET_D_OS_VERSIONS): Define. * config/mips/mips-d.c: New file. * config/mips/mips-protos.h (mips_d_target_versions): New prototype. * config/mips/mips.h (TARGET_D_CPU_VERSIONS): Define. * config/mips/t-mips (mips-d.o): New rule. * config/powerpcspe/linux.h (GNU_USER_TARGET_D_OS_VERSIONS): Define. * config/powerpcspe/linux64.h (GNU_USER_TARGET_D_OS_VERSIONS): Define. * config/powerpcspe/powerpcspe-d.c: New file. * config/powerpcspe/powerpcspe-protos.h (rs6000_d_target_versions): New prototype. * config/powerpcspe/powerpcspe.h (TARGET_D_CPU_VERSIONS): Define. * config/powerpcspe/t-powerpcspe (powerpcspe-d.o): New rule. * config/riscv/riscv-d.c: New file. * config/riscv/riscv-protos.h (riscv_d_target_versions): New prototype. * config/riscv/riscv.h (TARGET_D_CPU_VERSIONS): Define. * config/riscv/t-riscv (riscv-d.o): New rule. * config/rs6000/linux.h (GNU_USER_TARGET_D_OS_VERSIONS): Define. * config/rs6000/linux64.h (GNU_USER_TARGET_D_OS_VERSIONS): Define. * config/rs6000/rs6000-d.c: New file. * config/rs6000/rs6000-protos.h (rs6000_d_target_versions): New prototype. * config/rs6000/t-rs6000 (rs6000-d.o): New rule. * config/s390/s390-d.c: New file. * config/s390/s390-protos.h (s390_d_target_versions): New prototype. * config/s390/s390.h (TARGET_D_CPU_VERSIONS): Define. * config/s390/t-s390 (s390-d.o): New rule. * config/sparc/sparc-d.c: New file. * config/sparc/sparc-protos.h (sparc_d_target_versions): New prototype. * config/sparc/sparc.h (TARGET_D_CPU_VERSIONS): Define. * config/sparc/t-sparc (sparc-d.o): New rule. * config/t-glibc (glibc-d.o): New rule. * gcc/configure.ac (tm_d_file): New variable. (tm_d_file_list, tm_d_include_list, d_target_objs): Add substitute. * gcc/configure: Regenerated. * doc/tm.texi.in: Add @node for D language, and @hook for TARGET_D_CPU_VERSIONS, TARGET_D_OS_VERSIONS, and TARGET_D_CRITSEC_SIZE. * doc/tm.texi: Regenerated. * gcc/genhooks.c: Include d/d-target.def.
--- gcc/Makefile.in | 37 ++++++++++++++++-- gcc/config.gcc | 29 ++++++++++++++ gcc/config/aarch64/aarch64-d.c | 31 +++++++++++++++ gcc/config/aarch64/aarch64-linux.h | 2 + gcc/config/aarch64/aarch64-protos.h | 3 ++ gcc/config/aarch64/aarch64.h | 3 ++ gcc/config/aarch64/t-aarch64 | 4 ++ gcc/config/arm/arm-d.c | 53 +++++++++++++++++++++++++ gcc/config/arm/arm-protos.h | 3 ++ gcc/config/arm/arm.h | 3 ++ gcc/config/arm/linux-eabi.h | 3 ++ gcc/config/arm/t-arm | 4 ++ gcc/config/default-d.c | 25 ++++++++++++ gcc/config/glibc-d.c | 64 +++++++++++++++++++++++++++++++ gcc/config/gnu.h | 6 +++ gcc/config/i386/i386-d.c | 44 +++++++++++++++++++++ gcc/config/i386/i386-protos.h | 3 ++ gcc/config/i386/i386.h | 3 ++ gcc/config/i386/linux-common.h | 6 +++ gcc/config/i386/t-i386 | 4 ++ gcc/config/kfreebsd-gnu.h | 6 +++ gcc/config/kopensolaris-gnu.h | 6 +++ gcc/config/linux-android.h | 6 +++ gcc/config/linux.h | 13 +++++++ gcc/config/mips/linux-common.h | 3 ++ gcc/config/mips/mips-d.c | 56 +++++++++++++++++++++++++++ gcc/config/mips/mips-protos.h | 3 ++ gcc/config/mips/mips.h | 3 ++ gcc/config/mips/t-mips | 4 ++ gcc/config/powerpcspe/linux.h | 13 +++++++ gcc/config/powerpcspe/linux64.h | 13 +++++++ gcc/config/powerpcspe/powerpcspe-d.c | 45 ++++++++++++++++++++++ gcc/config/powerpcspe/powerpcspe-protos.h | 3 ++ gcc/config/powerpcspe/powerpcspe.h | 3 ++ gcc/config/powerpcspe/t-powerpcspe | 4 ++ gcc/config/riscv/riscv-d.c | 39 +++++++++++++++++++ gcc/config/riscv/riscv-protos.h | 3 ++ gcc/config/riscv/riscv.h | 3 ++ gcc/config/riscv/t-riscv | 5 +++ gcc/config/rs6000/linux.h | 13 +++++++ gcc/config/rs6000/linux64.h | 13 +++++++ gcc/config/rs6000/rs6000-d.c | 45 ++++++++++++++++++++++ gcc/config/rs6000/rs6000-protos.h | 3 ++ gcc/config/rs6000/rs6000.h | 3 ++ gcc/config/rs6000/t-rs6000 | 4 ++ gcc/config/s390/s390-d.c | 41 ++++++++++++++++++++ gcc/config/s390/s390-protos.h | 3 ++ gcc/config/s390/s390.h | 3 ++ gcc/config/s390/t-s390 | 4 ++ gcc/config/sparc/sparc-d.c | 48 +++++++++++++++++++++++ gcc/config/sparc/sparc-protos.h | 3 ++ gcc/config/sparc/sparc.h | 3 ++ gcc/config/sparc/t-sparc | 4 ++ gcc/config/t-glibc | 4 ++ gcc/configure | 26 ++++++++++++- gcc/configure.ac | 19 +++++++++ gcc/doc/tm.texi | 32 ++++++++++++++++ gcc/doc/tm.texi.in | 19 +++++++++ gcc/genhooks.c | 1 + 59 files changed, 847 insertions(+), 5 deletions(-) diff --git a/gcc/Makefile.in b/gcc/Makefile.in index d2da9ff5f07..a1643321408 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -554,6 +554,8 @@ tm_include_list=@tm_include_list@ tm_defines=@tm_defines@ tm_p_file_list=@tm_p_file_list@ tm_p_include_list=@tm_p_include_list@ +tm_d_file_list=@tm_d_file_list@ +tm_d_include_list=@tm_d_include_list@ build_xm_file_list=@build_xm_file_list@ build_xm_include_list=@build_xm_include_list@ build_xm_defines=@build_xm_defines@ @@ -848,6 +850,7 @@ BCONFIG_H = bconfig.h $(build_xm_file_list) CONFIG_H = config.h $(host_xm_file_list) TCONFIG_H = tconfig.h $(xm_file_list) TM_P_H = tm_p.h $(tm_p_file_list) +TM_D_H = tm_d.h $(tm_d_file_list) GTM_H = tm.h $(tm_file_list) insn-constants.h TM_H = $(GTM_H) insn-flags.h $(OPTIONS_H) @@ -905,9 +908,11 @@ EXCEPT_H = except.h $(HASHTAB_H) TARGET_DEF = target.def target-hooks-macros.h target-insns.def C_TARGET_DEF = c-family/c-target.def target-hooks-macros.h COMMON_TARGET_DEF = common/common-target.def target-hooks-macros.h +D_TARGET_DEF = d/d-target.def target-hooks-macros.h TARGET_H = $(TM_H) target.h $(TARGET_DEF) insn-modes.h insn-codes.h C_TARGET_H = c-family/c-target.h $(C_TARGET_DEF) COMMON_TARGET_H = common/common-target.h $(INPUT_H) $(COMMON_TARGET_DEF) +D_TARGET_H = d/d-target.h $(D_TARGET_DEF) MACHMODE_H = machmode.h mode-classes.def HOOKS_H = hooks.h HOSTHOOKS_DEF_H = hosthooks-def.h $(HOOKS_H) @@ -1187,6 +1192,9 @@ C_TARGET_OBJS=@c_target_objs@ # Target specific, C++ specific object file CXX_TARGET_OBJS=@cxx_target_objs@ +# Target specific, D specific object file +D_TARGET_OBJS=@d_target_objs@ + # Target specific, Fortran specific object file FORTRAN_TARGET_OBJS=@fortran_target_objs@ @@ -1786,6 +1794,7 @@ bconfig.h: cs-bconfig.h ; @true tconfig.h: cs-tconfig.h ; @true tm.h: cs-tm.h ; @true tm_p.h: cs-tm_p.h ; @true +tm_d.h: cs-tm_d.h ; @true cs-config.h: Makefile TARGET_CPU_DEFAULT="" \ @@ -1812,6 +1821,11 @@ cs-tm_p.h: Makefile HEADERS="$(tm_p_include_list)" DEFINES="" \ $(SHELL) $(srcdir)/mkconfig.sh tm_p.h +cs-tm_d.h: Makefile + TARGET_CPU_DEFAULT="" \ + HEADERS="$(tm_d_include_list)" DEFINES="" \ + $(SHELL) $(srcdir)/mkconfig.sh tm_d.h + # Don't automatically run autoconf, since configure.ac might be accidentally # newer than configure. Also, this writes into the source directory which # might be on a read-only file system. If configured for maintainer mode @@ -2136,6 +2150,12 @@ default-c.o: config/default-c.c CFLAGS-prefix.o += -DPREFIX=\"$(prefix)\" -DBASEVER=$(BASEVER_s) prefix.o: $(BASEVER) +# Files used by the D language front end. + +default-d.o: config/default-d.c + $(COMPILE) $< + $(POSTCOMPILE) + # Language-independent files. DRIVER_DEFINES = \ @@ -2432,6 +2452,15 @@ s-common-target-hooks-def-h: build/genhooks$(build_exeext) common/common-target-hooks-def.h $(STAMP) s-common-target-hooks-def-h +d/d-target-hooks-def.h: s-d-target-hooks-def-h; @true + +s-d-target-hooks-def-h: build/genhooks$(build_exeext) + $(RUN_GEN) build/genhooks$(build_exeext) "D Target Hook" \ + > tmp-d-target-hooks-def.h + $(SHELL) $(srcdir)/../move-if-change tmp-d-target-hooks-def.h \ + d/d-target-hooks-def.h + $(STAMP) s-d-target-hooks-def-h + # check if someone mistakenly only changed tm.texi. # We use a different pathname here to avoid a circular dependency. s-tm-texi: $(srcdir)/doc/../doc/tm.texi @@ -2455,6 +2484,7 @@ s-tm-texi: build/genhooks$(build_exeext) $(srcdir)/doc/tm.texi.in && ( test $(srcdir)/doc/tm.texi -nt $(srcdir)/target.def \ || test $(srcdir)/doc/tm.texi -nt $(srcdir)/c-family/c-target.def \ || test $(srcdir)/doc/tm.texi -nt $(srcdir)/common/common-target.def \ + || test $(srcdir)/doc/tm.texi -nt $(srcdir)/d/d-target.def \ ); then \ echo >&2 ; \ echo You should edit $(srcdir)/doc/tm.texi.in rather than $(srcdir)/doc/tm.texi . >&2 ; \ @@ -2592,14 +2622,15 @@ s-gtype: build/gengtype$(build_exeext) $(filter-out [%], $(GTFILES)) \ -r gtype.state $(STAMP) s-gtype -generated_files = config.h tm.h $(TM_P_H) $(TM_H) multilib.h \ +generated_files = config.h tm.h $(TM_P_H) $(TM_D_H) $(TM_H) multilib.h \ $(simple_generated_h) specs.h \ tree-check.h genrtl.h insn-modes.h insn-modes-inline.h \ tm-preds.h tm-constrs.h \ $(ALL_GTFILES_H) gtype-desc.c gtype-desc.h gcov-iov.h \ options.h target-hooks-def.h insn-opinit.h \ common/common-target-hooks-def.h pass-instances.def \ - c-family/c-target-hooks-def.h params.list params.options case-cfn-macros.h \ + c-family/c-target-hooks-def.h d/d-target-hooks-def.h \ + params.list params.options case-cfn-macros.h \ cfn-operators.pd # @@ -2743,7 +2774,7 @@ build/genrecog.o : genrecog.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \ $(CORETYPES_H) $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H) \ $(HASH_TABLE_H) inchash.h build/genhooks.o : genhooks.c $(TARGET_DEF) $(C_TARGET_DEF) \ - $(COMMON_TARGET_DEF) $(BCONFIG_H) $(SYSTEM_H) errors.h + $(COMMON_TARGET_DEF) $(D_TARGET_DEF) $(BCONFIG_H) $(SYSTEM_H) errors.h build/genmddump.o : genmddump.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \ $(CORETYPES_H) $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H) build/genmatch.o : genmatch.c $(BCONFIG_H) $(SYSTEM_H) \ diff --git a/gcc/config.gcc b/gcc/config.gcc index 720e6a7373d..c92ac1c3455 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -86,6 +86,9 @@ # tm_p_file Location of file with declarations for functions # in $out_file. # +# tm_d_file A list of headers with definitions of target hook +# macros for the D compiler. +# # out_file The name of the machine description C support # file, if different from "$cpu_type/$cpu_type.c". # @@ -139,6 +142,9 @@ # cxx_target_objs List of extra target-dependent objects that be # linked into the C++ compiler only. # +# d_target_objs List of extra target-dependent objects that be +# linked into the D compiler only. +# # fortran_target_objs List of extra target-dependent objects that be # linked into the fortran compiler only. # @@ -191,6 +197,9 @@ # # target_has_targetm_common Set to yes or no depending on whether the # target has its own definition of targetm_common. +# +# target_has_targetdm Set to yes or no depending on whether the target +# has its own definition of targetdm. out_file= common_out_file= @@ -206,9 +215,11 @@ extra_gcc_objs= extra_options= c_target_objs= cxx_target_objs= +d_target_objs= fortran_target_objs= target_has_targetcm=no target_has_targetm_common=yes +target_has_targetdm=no tm_defines= xm_defines= # Set this to force installation and use of collect2. @@ -305,6 +316,7 @@ aarch64*-*-*) extra_headers="arm_fp16.h arm_neon.h arm_acle.h" c_target_objs="aarch64-c.o" cxx_target_objs="aarch64-c.o" + d_target_objs="aarch64-d.o" extra_objs="aarch64-builtins.o aarch-common.o cortex-a57-fma-steering.o aarch64-speculation.o falkor-tag-collision-avoidance.o" target_gtfiles="\$(srcdir)/config/aarch64/aarch64-builtins.c" target_has_targetm_common=yes @@ -330,6 +342,7 @@ arm*-*-*) target_type_format_char='%' c_target_objs="arm-c.o" cxx_target_objs="arm-c.o" + d_target_objs="arm-d.o" extra_options="${extra_options} arm/arm-tables.opt" target_gtfiles="\$(srcdir)/config/arm/arm-builtins.c" ;; @@ -362,6 +375,7 @@ i[34567]86-*-*) cpu_type=i386 c_target_objs="i386-c.o" cxx_target_objs="i386-c.o" + d_target_objs="i386-d.o" extra_objs="x86-tune-sched.o x86-tune-sched-bd.o x86-tune-sched-atom.o x86-tune-sched-core.o" extra_options="${extra_options} fused-madd.opt" extra_headers="cpuid.h mmintrin.h mm3dnow.h xmmintrin.h emmintrin.h @@ -392,6 +406,7 @@ x86_64-*-*) cpu_type=i386 c_target_objs="i386-c.o" cxx_target_objs="i386-c.o" + d_target_objs="i386-d.o" extra_options="${extra_options} fused-madd.opt" extra_objs="x86-tune-sched.o x86-tune-sched-bd.o x86-tune-sched-atom.o x86-tune-sched-core.o" extra_headers="cpuid.h mmintrin.h mm3dnow.h xmmintrin.h emmintrin.h @@ -442,6 +457,7 @@ microblaze*-*-*) ;; mips*-*-*) cpu_type=mips + d_target_objs="mips-d.o" extra_headers="loongson.h msa.h" extra_objs="frame-header-opt.o" extra_options="${extra_options} g.opt fused-madd.opt mips/mips-tables.opt" @@ -498,6 +514,7 @@ powerpc*-*-*) riscv*) cpu_type=riscv extra_objs="riscv-builtins.o riscv-c.o" + d_target_objs="riscv-d.o" ;; rs6000*-*-*) extra_options="${extra_options} g.opt fused-madd.opt rs6000/rs6000-tables.opt" @@ -507,6 +524,7 @@ sparc*-*-*) cpu_type=sparc c_target_objs="sparc-c.o" cxx_target_objs="sparc-c.o" + d_target_objs="sparc-d.o" extra_headers="visintrin.h" ;; spu*-*-*) @@ -514,6 +532,7 @@ spu*-*-*) ;; s390*-*-*) cpu_type=s390 + d_target_objs="s390-d.o" extra_options="${extra_options} fused-madd.opt" extra_headers="s390intrin.h htmintrin.h htmxlintrin.h vecintrin.h" ;; @@ -543,10 +562,13 @@ tilepro*-*-*) esac tm_file=${cpu_type}/${cpu_type}.h +tm_d_file=${cpu_type}/${cpu_type}.h if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-protos.h then tm_p_file=${cpu_type}/${cpu_type}-protos.h + tm_d_file="${tm_d_file} ${cpu_type}/${cpu_type}-protos.h" fi + extra_modes= if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-modes.def then @@ -810,8 +832,10 @@ case ${target} in esac c_target_objs="${c_target_objs} glibc-c.o" cxx_target_objs="${cxx_target_objs} glibc-c.o" + d_target_objs="${d_target_objs} glibc-d.o" tmake_file="${tmake_file} t-glibc" target_has_targetcm=yes + target_has_targetdm=yes ;; *-*-netbsd*) tm_p_file="${tm_p_file} netbsd-protos.h" @@ -3232,6 +3256,10 @@ if [ "$common_out_file" = "" ]; then fi fi +if [ "$target_has_targetdm" = "no" ]; then + d_target_objs="$d_target_objs default-d.o" +fi + # Support for --with-cpu and related options (and a few unrelated options, # too). case ${with_cpu} in @@ -4858,6 +4886,7 @@ case ${target} in out_file="${cpu_type}/${cpu_type}.c" c_target_objs="${c_target_objs} ${cpu_type}-c.o" cxx_target_objs="${cxx_target_objs} ${cpu_type}-c.o" + d_target_objs="${d_target_objs} ${cpu_type}-d.o" tmake_file="${cpu_type}/t-${cpu_type} ${tmake_file}" ;; diff --git a/gcc/config/aarch64/aarch64-d.c b/gcc/config/aarch64/aarch64-d.c new file mode 100644 index 00000000000..1394f1fb7d3 --- /dev/null +++ b/gcc/config/aarch64/aarch64-d.c @@ -0,0 +1,31 @@ +/* Subroutines for the D front end on the AArch64 architecture. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + +GCC 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 3, or (at your option) +any later version. + +GCC 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 GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "d/d-target.h" +#include "d/d-target-def.h" + +/* Implement TARGET_D_CPU_VERSIONS for AArch64 targets. */ + +void +aarch64_d_target_versions (void) +{ + d_add_builtin_version ("AArch64"); + d_add_builtin_version ("D_HardFloat"); +} diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h index bf1327e98cc..2bee7e5baea 100644 --- a/gcc/config/aarch64/aarch64-linux.h +++ b/gcc/config/aarch64/aarch64-linux.h @@ -81,6 +81,8 @@ } \ while (0) +#define GNU_USER_TARGET_D_CRITSEC_SIZE 48 + #define TARGET_ASM_FILE_END file_end_indicate_exec_stack /* Uninitialized common symbols in non-PIE executables, even with diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h index 5f18837418e..776e8696ebe 100644 --- a/gcc/config/aarch64/aarch64-protos.h +++ b/gcc/config/aarch64/aarch64-protos.h @@ -620,6 +620,9 @@ enum aarch64_parse_opt_result aarch64_parse_extension (const char *, std::string aarch64_get_extension_string_for_isa_flags (unsigned long, unsigned long); +/* Defined in aarch64-d.c */ +extern void aarch64_d_target_versions (void); + rtl_opt_pass *make_pass_fma_steering (gcc::context *); rtl_opt_pass *make_pass_track_speculation (gcc::context *); rtl_opt_pass *make_pass_tag_collision_avoidance (gcc::context *); diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h index fa9af26fd40..0c833a8fdfd 100644 --- a/gcc/config/aarch64/aarch64.h +++ b/gcc/config/aarch64/aarch64.h @@ -26,6 +26,9 @@ #define TARGET_CPU_CPP_BUILTINS() \ aarch64_cpu_cpp_builtins (pfile) +/* Target CPU versions for D. */ +#define TARGET_D_CPU_VERSIONS aarch64_d_target_versions + #define REGISTER_TARGET_PRAGMAS() aarch64_register_pragmas () diff --git a/gcc/config/aarch64/t-aarch64 b/gcc/config/aarch64/t-aarch64 index 1576d05ba9d..e91dccea995 100644 --- a/gcc/config/aarch64/t-aarch64 +++ b/gcc/config/aarch64/t-aarch64 @@ -56,6 +56,10 @@ aarch64-c.o: $(srcdir)/config/aarch64/aarch64-c.c $(CONFIG_H) $(SYSTEM_H) \ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ $(srcdir)/config/aarch64/aarch64-c.c +aarch64-d.o: $(srcdir)/config/aarch64/aarch64-d.c + $(COMPILE) $< + $(POSTCOMPILE) + PASSES_EXTRA += $(srcdir)/config/aarch64/aarch64-passes.def cortex-a57-fma-steering.o: $(srcdir)/config/aarch64/cortex-a57-fma-steering.c \ diff --git a/gcc/config/arm/arm-d.c b/gcc/config/arm/arm-d.c new file mode 100644 index 00000000000..dbcf07efbc8 --- /dev/null +++ b/gcc/config/arm/arm-d.c @@ -0,0 +1,53 @@ +/* Subroutines for the D front end on the ARM architecture. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + +GCC 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 3, or (at your option) +any later version. + +GCC 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 GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "tm_p.h" +#include "d/d-target.h" +#include "d/d-target-def.h" + +/* Implement TARGET_D_CPU_VERSIONS for ARM targets. */ + +void +arm_d_target_versions (void) +{ + d_add_builtin_version ("ARM"); + + if (TARGET_THUMB || TARGET_THUMB2) + { + d_add_builtin_version ("Thumb"); + d_add_builtin_version ("ARM_Thumb"); + } + + if (TARGET_HARD_FLOAT_ABI) + d_add_builtin_version ("ARM_HardFloat"); + else + { + if (TARGET_SOFT_FLOAT) + d_add_builtin_version ("ARM_SoftFloat"); + else if (TARGET_HARD_FLOAT) + d_add_builtin_version ("ARM_SoftFP"); + } + + if (TARGET_SOFT_FLOAT) + d_add_builtin_version ("D_SoftFloat"); + else if (TARGET_HARD_FLOAT) + d_add_builtin_version ("D_HardFloat"); +} diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index 0dfb3ac59a6..cea98669111 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -375,6 +375,9 @@ extern void arm_lang_object_attributes_init (void); extern void arm_register_target_pragmas (void); extern void arm_cpu_cpp_builtins (struct cpp_reader *); +/* Defined in arm-d.c */ +extern void arm_d_target_versions (void); + extern bool arm_is_constant_pool_ref (rtx); /* The bits in this mask specify which instruction scheduling options should diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 34894c090dd..8472312487b 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -47,6 +47,9 @@ extern char arm_arch_name[]; /* Target CPU builtins. */ #define TARGET_CPU_CPP_BUILTINS() arm_cpu_cpp_builtins (pfile) +/* Target CPU versions for D. */ +#define TARGET_D_CPU_VERSIONS arm_d_target_versions + #include "config/arm/arm-opts.h" /* The processor for which instructions should be scheduled. */ diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h index 8585fde3d41..4254b19212d 100644 --- a/gcc/config/arm/linux-eabi.h +++ b/gcc/config/arm/linux-eabi.h @@ -30,6 +30,9 @@ } \ while (false) +#define EXTRA_TARGET_D_OS_VERSIONS() \ + ANDROID_TARGET_D_OS_VERSIONS(); + /* We default to a soft-float ABI so that binaries can run on all target hardware. If you override this to use the hard-float ABI then change the setting of GLIBC_DYNAMIC_LINKER_DEFAULT as well. */ diff --git a/gcc/config/arm/t-arm b/gcc/config/arm/t-arm index c3a8c7773ba..02b46260686 100644 --- a/gcc/config/arm/t-arm +++ b/gcc/config/arm/t-arm @@ -152,6 +152,10 @@ arm-c.o: $(srcdir)/config/arm/arm-c.c $(CONFIG_H) $(SYSTEM_H) \ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ $(srcdir)/config/arm/arm-c.c +arm-d.o: $(srcdir)/config/arm/arm-d.c + $(COMPILE) $< + $(POSTCOMPILE) + arm-common.o: arm-cpu-cdata.h driver-arm.o: arm-native.h diff --git a/gcc/config/default-d.c b/gcc/config/default-d.c new file mode 100644 index 00000000000..6c952052088 --- /dev/null +++ b/gcc/config/default-d.c @@ -0,0 +1,25 @@ +/* Default D language target hooks initializer. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + +GCC 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 3, or (at your option) any later +version. + +GCC 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 GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm_d.h" +#include "d/d-target.h" +#include "d/d-target-def.h" + +struct gcc_targetdm targetdm = TARGETDM_INITIALIZER; diff --git a/gcc/config/glibc-d.c b/gcc/config/glibc-d.c new file mode 100644 index 00000000000..b73ee01f21d --- /dev/null +++ b/gcc/config/glibc-d.c @@ -0,0 +1,64 @@ +/* Glibc support needed only by D front-end. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + +GCC 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 3, or (at your option) any later +version. + +GCC 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 GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "memmodel.h" +#include "tm_p.h" +#include "d/d-target.h" +#include "d/d-target-def.h" + +/* Implement TARGET_D_OS_VERSIONS for Glibc targets. */ + +static void +glibc_d_os_builtins (void) +{ + d_add_builtin_version ("Posix"); + +#define builtin_version(TXT) d_add_builtin_version (TXT) + +#ifdef GNU_USER_TARGET_D_OS_VERSIONS + GNU_USER_TARGET_D_OS_VERSIONS (); +#endif + +#ifdef EXTRA_TARGET_D_OS_VERSIONS + EXTRA_TARGET_D_OS_VERSIONS (); +#endif +} + +/* Implement TARGET_D_CRITSEC_SIZE for Glibc targets. */ + +static unsigned +glibc_d_critsec_size (void) +{ + /* This is the sizeof pthread_mutex_t. */ +#ifdef GNU_USER_TARGET_D_CRITSEC_SIZE + return GNU_USER_TARGET_D_CRITSEC_SIZE; +#else + return (POINTER_SIZE == 64) ? 40 : 24; +#endif +} + +#undef TARGET_D_OS_VERSIONS +#define TARGET_D_OS_VERSIONS glibc_d_os_builtins + +#undef TARGET_D_CRITSEC_SIZE +#define TARGET_D_CRITSEC_SIZE glibc_d_critsec_size + +struct gcc_targetdm targetdm = TARGETDM_INITIALIZER; diff --git a/gcc/config/gnu.h b/gcc/config/gnu.h index 1cc744b13be..3aca4e35983 100644 --- a/gcc/config/gnu.h +++ b/gcc/config/gnu.h @@ -31,3 +31,9 @@ along with GCC. If not, see <http://www.gnu.org/licenses/>. builtin_assert ("system=unix"); \ builtin_assert ("system=posix"); \ } while (0) + +#define GNU_USER_TARGET_D_OS_VERSIONS() \ + do { \ + builtin_version ("Hurd"); \ + builtin_version ("CRuntime_Glibc"); \ + } while (0) diff --git a/gcc/config/i386/i386-d.c b/gcc/config/i386/i386-d.c new file mode 100644 index 00000000000..34304b84a36 --- /dev/null +++ b/gcc/config/i386/i386-d.c @@ -0,0 +1,44 @@ +/* Subroutines for the D front end on the x86 architecture. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + +GCC 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 3, or (at your option) +any later version. + +GCC 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 GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "d/d-target.h" +#include "d/d-target-def.h" + +/* Implement TARGET_D_CPU_VERSIONS for x86 targets. */ + +void +ix86_d_target_versions (void) +{ + if (TARGET_64BIT) + { + d_add_builtin_version ("X86_64"); + + if (TARGET_X32) + d_add_builtin_version ("D_X32"); + } + else + d_add_builtin_version ("X86"); + + if (TARGET_80387) + d_add_builtin_version ("D_HardFloat"); + else + d_add_builtin_version ("D_SoftFloat"); +} diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h index d1d59633dc0..258bdd18cb5 100644 --- a/gcc/config/i386/i386-protos.h +++ b/gcc/config/i386/i386-protos.h @@ -236,6 +236,9 @@ extern void ix86_expand_sse2_abs (rtx, rtx); extern void ix86_target_macros (void); extern void ix86_register_pragmas (void); +/* In i386-d.c */ +extern void ix86_d_target_versions (void); + /* In winnt.c */ extern void i386_pe_unique_section (tree, int); extern void i386_pe_declare_function_type (FILE *, const char *, int); diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index b0d2f249db7..01d49a7263b 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -718,6 +718,9 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); /* Target Pragmas. */ #define REGISTER_TARGET_PRAGMAS() ix86_register_pragmas () +/* Target CPU versions for D. */ +#define TARGET_D_CPU_VERSIONS ix86_d_target_versions + #ifndef CC1_SPEC #define CC1_SPEC "%(cc1_cpu) " #endif diff --git a/gcc/config/i386/linux-common.h b/gcc/config/i386/linux-common.h index 3eeb66c1618..1e7a0550839 100644 --- a/gcc/config/i386/linux-common.h +++ b/gcc/config/i386/linux-common.h @@ -27,6 +27,12 @@ along with GCC; see the file COPYING3. If not see } \ while (0) +#define EXTRA_TARGET_D_OS_VERSIONS() \ + ANDROID_TARGET_D_OS_VERSIONS(); + +#define GNU_USER_TARGET_D_CRITSEC_SIZE \ + (TARGET_64BIT ? (POINTER_SIZE == 64 ? 40 : 32) : 24) + #undef CC1_SPEC #define CC1_SPEC \ LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC, \ diff --git a/gcc/config/i386/t-i386 b/gcc/config/i386/t-i386 index 8a5808cfe79..261739e8778 100644 --- a/gcc/config/i386/t-i386 +++ b/gcc/config/i386/t-i386 @@ -40,6 +40,10 @@ x86-tune-sched-core.o: $(srcdir)/config/i386/x86-tune-sched-core.c $(COMPILE) $< $(POSTCOMPILE) +i386-d.o: $(srcdir)/config/i386/i386-d.c + $(COMPILE) $< + $(POSTCOMPILE) + i386.o: i386-builtin-types.inc i386-builtin-types.inc: s-i386-bt ; @true diff --git a/gcc/config/kfreebsd-gnu.h b/gcc/config/kfreebsd-gnu.h index aaeea44da75..923e7e41508 100644 --- a/gcc/config/kfreebsd-gnu.h +++ b/gcc/config/kfreebsd-gnu.h @@ -29,6 +29,12 @@ along with GCC; see the file COPYING3. If not see } \ while (0) +#define GNU_USER_TARGET_D_OS_VERSIONS() \ + do { \ + builtin_version ("FreeBSD"); \ + builtin_version ("CRuntime_Glibc"); \ + } while (0) + #define GNU_USER_DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER #define GNU_USER_DYNAMIC_LINKER32 GLIBC_DYNAMIC_LINKER32 #define GNU_USER_DYNAMIC_LINKER64 GLIBC_DYNAMIC_LINKER64 diff --git a/gcc/config/kopensolaris-gnu.h b/gcc/config/kopensolaris-gnu.h index 541f749be9f..4b303ccf544 100644 --- a/gcc/config/kopensolaris-gnu.h +++ b/gcc/config/kopensolaris-gnu.h @@ -30,5 +30,11 @@ along with GCC; see the file COPYING3. If not see } \ while (0) +#define GNU_USER_TARGET_D_OS_VERSIONS() \ + do { \ + builtin_version ("Solaris"); \ + builtin_version ("CRuntime_Glibc"); \ + } while (0) + #undef GNU_USER_DYNAMIC_LINKER #define GNU_USER_DYNAMIC_LINKER "/lib/ld.so.1" diff --git a/gcc/config/linux-android.h b/gcc/config/linux-android.h index 9f3985d23b8..40da4c178e8 100644 --- a/gcc/config/linux-android.h +++ b/gcc/config/linux-android.h @@ -25,6 +25,12 @@ builtin_define ("__ANDROID__"); \ } while (0) +#define ANDROID_TARGET_D_OS_VERSIONS() \ + do { \ + if (TARGET_ANDROID) \ + builtin_version ("Android"); \ + } while (0) + #if ANDROID_DEFAULT # define NOANDROID "mno-android" #else diff --git a/gcc/config/linux.h b/gcc/config/linux.h index 2ea4ff92c1d..02553599024 100644 --- a/gcc/config/linux.h +++ b/gcc/config/linux.h @@ -53,6 +53,19 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see builtin_assert ("system=posix"); \ } while (0) +#define GNU_USER_TARGET_D_OS_VERSIONS() \ + do { \ + builtin_version ("linux"); \ + if (OPTION_GLIBC) \ + builtin_version ("CRuntime_Glibc"); \ + else if (OPTION_UCLIBC) \ + builtin_version ("CRuntime_UClibc"); \ + else if (OPTION_BIONIC) \ + builtin_version ("CRuntime_Bionic"); \ + else if (OPTION_MUSL) \ + builtin_version ("CRuntime_Musl"); \ + } while (0) + /* Determine which dynamic linker to use depending on whether GLIBC or uClibc or Bionic or musl is the default C library and whether -muclibc or -mglibc or -mbionic or -mmusl has been passed to change diff --git a/gcc/config/mips/linux-common.h b/gcc/config/mips/linux-common.h index 570151f6a87..da9be6b369d 100644 --- a/gcc/config/mips/linux-common.h +++ b/gcc/config/mips/linux-common.h @@ -27,6 +27,9 @@ along with GCC; see the file COPYING3. If not see ANDROID_TARGET_OS_CPP_BUILTINS(); \ } while (0) +#define EXTRA_TARGET_D_OS_VERSIONS() \ + ANDROID_TARGET_D_OS_VERSIONS(); + #undef LINK_SPEC #define LINK_SPEC \ LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LINK_SPEC, \ diff --git a/gcc/config/mips/mips-d.c b/gcc/config/mips/mips-d.c new file mode 100644 index 00000000000..8f0d9679456 --- /dev/null +++ b/gcc/config/mips/mips-d.c @@ -0,0 +1,56 @@ +/* Subroutines for the D front end on the MIPS architecture. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + +GCC 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 3, or (at your option) +any later version. + +GCC 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 GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "d/d-target.h" +#include "d/d-target-def.h" + +/* Implement TARGET_D_CPU_VERSIONS for MIPS targets. */ + +void +mips_d_target_versions (void) +{ + if (TARGET_64BIT) + d_add_builtin_version ("MIPS64"); + else + d_add_builtin_version ("MIPS32"); + + if (mips_abi == ABI_32) + d_add_builtin_version ("MIPS_O32"); + else if (mips_abi == ABI_EABI) + d_add_builtin_version ("MIPS_EABI"); + else if (mips_abi == ABI_N32) + d_add_builtin_version ("MIPS_N32"); + else if (mips_abi == ABI_64) + d_add_builtin_version ("MIPS_N64"); + else if (mips_abi == ABI_O64) + d_add_builtin_version ("MIPS_O64"); + + if (TARGET_HARD_FLOAT_ABI) + { + d_add_builtin_version ("MIPS_HardFloat"); + d_add_builtin_version ("D_HardFloat"); + } + else if (TARGET_SOFT_FLOAT_ABI) + { + d_add_builtin_version ("MIPS_SoftFloat"); + d_add_builtin_version ("D_SoftFloat"); + } +} diff --git a/gcc/config/mips/mips-protos.h b/gcc/config/mips/mips-protos.h index d9d6e92cb67..099120db7b4 100644 --- a/gcc/config/mips/mips-protos.h +++ b/gcc/config/mips/mips-protos.h @@ -385,4 +385,7 @@ extern mulsidi3_gen_fn mips_mulsidi3_gen_fn (enum rtx_code); extern void mips_register_frame_header_opt (void); extern void mips_expand_vec_cond_expr (machine_mode, machine_mode, rtx *); +/* Routines implemented in mips-d.c */ +extern void mips_d_target_versions (void); + #endif /* ! GCC_MIPS_PROTOS_H */ diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index 6804b792ff1..32a88edc910 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -645,6 +645,9 @@ struct mips_cpu_info { } \ while (0) +/* Target CPU versions for D. */ +#define TARGET_D_CPU_VERSIONS mips_d_target_versions + /* Default target_flags if no switches are specified */ #ifndef TARGET_DEFAULT diff --git a/gcc/config/mips/t-mips b/gcc/config/mips/t-mips index 7bdf83ccee7..0466ba2a97d 100644 --- a/gcc/config/mips/t-mips +++ b/gcc/config/mips/t-mips @@ -24,3 +24,7 @@ $(srcdir)/config/mips/mips-tables.opt: $(srcdir)/config/mips/genopt.sh \ frame-header-opt.o: $(srcdir)/config/mips/frame-header-opt.c $(COMPILE) $< $(POSTCOMPILE) + +mips-d.o: $(srcdir)/config/mips/mips-d.c + $(COMPILE) $< + $(POSTCOMPILE) diff --git a/gcc/config/powerpcspe/linux.h b/gcc/config/powerpcspe/linux.h index c899f9dd4d2..fe755ef08da 100644 --- a/gcc/config/powerpcspe/linux.h +++ b/gcc/config/powerpcspe/linux.h @@ -57,6 +57,19 @@ } \ while (0) +#define GNU_USER_TARGET_D_OS_VERSIONS() \ + do { \ + builtin_version ("linux"); \ + if (OPTION_GLIBC) \ + builtin_version ("CRuntime_Glibc"); \ + else if (OPTION_UCLIBC) \ + builtin_version ("CRuntime_UClibc"); \ + else if (OPTION_BIONIC) \ + builtin_version ("CRuntime_Bionic"); \ + else if (OPTION_MUSL) \ + builtin_version ("CRuntime_Musl"); \ + } while (0) + #undef CPP_OS_DEFAULT_SPEC #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)" diff --git a/gcc/config/powerpcspe/linux64.h b/gcc/config/powerpcspe/linux64.h index b3a0cc4e46c..f0e3f09eea5 100644 --- a/gcc/config/powerpcspe/linux64.h +++ b/gcc/config/powerpcspe/linux64.h @@ -391,6 +391,19 @@ extern int dot_symbols; } \ while (0) +#define GNU_USER_TARGET_D_OS_VERSIONS() \ + do { \ + builtin_version ("linux"); \ + if (OPTION_GLIBC) \ + builtin_version ("CRuntime_Glibc"); \ + else if (OPTION_UCLIBC) \ + builtin_version ("CRuntime_UClibc"); \ + else if (OPTION_BIONIC) \ + builtin_version ("CRuntime_Bionic"); \ + else if (OPTION_MUSL) \ + builtin_version ("CRuntime_Musl"); \ + } while (0) + #undef CPP_OS_DEFAULT_SPEC #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux) %(include_extra)" diff --git a/gcc/config/powerpcspe/powerpcspe-d.c b/gcc/config/powerpcspe/powerpcspe-d.c new file mode 100644 index 00000000000..84eb4e93df9 --- /dev/null +++ b/gcc/config/powerpcspe/powerpcspe-d.c @@ -0,0 +1,45 @@ +/* Subroutines for the D front end on the PowerPC architecture. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + +GCC 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 3, or (at your option) +any later version. + +GCC 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 GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "d/d-target.h" +#include "d/d-target-def.h" + +/* Implement TARGET_D_CPU_VERSIONS for PowerPC targets. */ + +void +rs6000_d_target_versions (void) +{ + if (TARGET_64BIT) + d_add_builtin_version ("PPC64"); + else + d_add_builtin_version ("PPC"); + + if (TARGET_HARD_FLOAT) + { + d_add_builtin_version ("PPC_HardFloat"); + d_add_builtin_version ("D_HardFloat"); + } + else if (TARGET_SOFT_FLOAT) + { + d_add_builtin_version ("PPC_SoftFloat"); + d_add_builtin_version ("D_SoftFloat"); + } +} diff --git a/gcc/config/powerpcspe/powerpcspe-protos.h b/gcc/config/powerpcspe/powerpcspe-protos.h index 8ff9f4b0df3..575a3ed3e6a 100644 --- a/gcc/config/powerpcspe/powerpcspe-protos.h +++ b/gcc/config/powerpcspe/powerpcspe-protos.h @@ -231,6 +231,9 @@ extern void rs6000_target_modify_macros (bool, HOST_WIDE_INT, HOST_WIDE_INT); extern void (*rs6000_target_modify_macros_ptr) (bool, HOST_WIDE_INT, HOST_WIDE_INT); +/* Declare functions in powerpcspe-d.c */ +extern void rs6000_d_target_versions (void); + #if TARGET_MACHO char *output_call (rtx_insn *, rtx *, int, int); #endif diff --git a/gcc/config/powerpcspe/powerpcspe.h b/gcc/config/powerpcspe/powerpcspe.h index df0676a72a4..2305ce3c327 100644 --- a/gcc/config/powerpcspe/powerpcspe.h +++ b/gcc/config/powerpcspe/powerpcspe.h @@ -702,6 +702,9 @@ extern unsigned char rs6000_recip_bits[]; #define TARGET_CPU_CPP_BUILTINS() \ rs6000_cpu_cpp_builtins (pfile) +/* Target CPU versions for D. */ +#define TARGET_D_CPU_VERSIONS rs6000_d_target_versions + /* This is used by rs6000_cpu_cpp_builtins to indicate the byte order we're compiling for. Some configurations may need to override it. */ #define RS6000_CPU_CPP_ENDIAN_BUILTINS() \ diff --git a/gcc/config/powerpcspe/t-powerpcspe b/gcc/config/powerpcspe/t-powerpcspe index 460dd5d71c0..e67c21cf6a5 100644 --- a/gcc/config/powerpcspe/t-powerpcspe +++ b/gcc/config/powerpcspe/t-powerpcspe @@ -26,6 +26,10 @@ powerpcspe-c.o: $(srcdir)/config/powerpcspe/powerpcspe-c.c $(COMPILE) $< $(POSTCOMPILE) +powerpcspe-d.o: $(srcdir)/config/powerpcspe/powerpcspe-d.c + $(COMPILE) $< + $(POSTCOMPILE) + $(srcdir)/config/powerpcspe/powerpcspe-tables.opt: $(srcdir)/config/powerpcspe/genopt.sh \ $(srcdir)/config/powerpcspe/powerpcspe-cpus.def $(SHELL) $(srcdir)/config/powerpcspe/genopt.sh $(srcdir)/config/powerpcspe > \ diff --git a/gcc/config/riscv/riscv-d.c b/gcc/config/riscv/riscv-d.c new file mode 100644 index 00000000000..9cad9dd8f5e --- /dev/null +++ b/gcc/config/riscv/riscv-d.c @@ -0,0 +1,39 @@ +/* Subroutines for the D front end on the RISC-V architecture. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + +GCC 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 3, or (at your option) +any later version. + +GCC 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 GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "target.h" +#include "d/d-target.h" +#include "d/d-target-def.h" + +/* Implement TARGET_D_CPU_VERSIONS for RISC-V targets. */ + +void +riscv_d_target_versions (void) +{ + if (TARGET_64BIT) + d_add_builtin_version ("RISCV64"); + else + d_add_builtin_version ("RISCV32"); + + if (TARGET_HARD_FLOAT) + d_add_builtin_version ("D_HardFloat"); + else + d_add_builtin_version ("D_SoftFloat"); +} diff --git a/gcc/config/riscv/riscv-protos.h b/gcc/config/riscv/riscv-protos.h index f158ed007dd..5dce9c43398 100644 --- a/gcc/config/riscv/riscv-protos.h +++ b/gcc/config/riscv/riscv-protos.h @@ -75,6 +75,9 @@ extern bool riscv_expand_block_move (rtx, rtx, rtx); /* Routines implemented in riscv-c.c. */ void riscv_cpu_cpp_builtins (cpp_reader *); +/* Routines implemented in riscv-d.c */ +extern void riscv_d_target_versions (void); + /* Routines implemented in riscv-builtins.c. */ extern void riscv_atomic_assign_expand_fenv (tree *, tree *, tree *); extern rtx riscv_expand_builtin (tree, rtx, rtx, machine_mode, int); diff --git a/gcc/config/riscv/riscv.h b/gcc/config/riscv/riscv.h index 3c9f96d6b4d..13e15cc852b 100644 --- a/gcc/config/riscv/riscv.h +++ b/gcc/config/riscv/riscv.h @@ -27,6 +27,9 @@ along with GCC; see the file COPYING3. If not see /* Target CPU builtins. */ #define TARGET_CPU_CPP_BUILTINS() riscv_cpu_cpp_builtins (pfile) +/* Target CPU versions for D. */ +#define TARGET_D_CPU_VERSIONS riscv_d_target_versions + /* Default target_flags if no switches are specified */ #ifndef TARGET_DEFAULT diff --git a/gcc/config/riscv/t-riscv b/gcc/config/riscv/t-riscv index 0765b49f90f..ece3a75d512 100644 --- a/gcc/config/riscv/t-riscv +++ b/gcc/config/riscv/t-riscv @@ -9,3 +9,8 @@ riscv-c.o: $(srcdir)/config/riscv/riscv-c.c $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TM_H) $(TREE_H) output.h $(C_COMMON_H) $(TARGET_H) $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ $(srcdir)/config/riscv/riscv-c.c + +riscv-d.o: $(srcdir)/config/riscv/riscv-d.c + $(COMPILE) $< + $(POSTCOMPILE) + diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h index 01b40c762f6..fd06b14d837 100644 --- a/gcc/config/rs6000/linux.h +++ b/gcc/config/rs6000/linux.h @@ -57,6 +57,19 @@ } \ while (0) +#define GNU_USER_TARGET_D_OS_VERSIONS() \ + do { \ + builtin_version ("linux"); \ + if (OPTION_GLIBC) \ + builtin_version ("CRuntime_Glibc"); \ + else if (OPTION_UCLIBC) \ + builtin_version ("CRuntime_UClibc"); \ + else if (OPTION_BIONIC) \ + builtin_version ("CRuntime_Bionic"); \ + else if (OPTION_MUSL) \ + builtin_version ("CRuntime_Musl"); \ + } while (0) + #undef CPP_OS_DEFAULT_SPEC #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)" diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h index 44eab40a234..e6b4fd22d73 100644 --- a/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h @@ -391,6 +391,19 @@ extern int dot_symbols; } \ while (0) +#define GNU_USER_TARGET_D_OS_VERSIONS() \ + do { \ + builtin_version ("linux"); \ + if (OPTION_GLIBC) \ + builtin_version ("CRuntime_Glibc"); \ + else if (OPTION_UCLIBC) \ + builtin_version ("CRuntime_UClibc"); \ + else if (OPTION_BIONIC) \ + builtin_version ("CRuntime_Bionic"); \ + else if (OPTION_MUSL) \ + builtin_version ("CRuntime_Musl"); \ + } while (0) + #undef CPP_OS_DEFAULT_SPEC #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux) %(include_extra)" diff --git a/gcc/config/rs6000/rs6000-d.c b/gcc/config/rs6000/rs6000-d.c new file mode 100644 index 00000000000..84eb4e93df9 --- /dev/null +++ b/gcc/config/rs6000/rs6000-d.c @@ -0,0 +1,45 @@ +/* Subroutines for the D front end on the PowerPC architecture. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + +GCC 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 3, or (at your option) +any later version. + +GCC 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 GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "d/d-target.h" +#include "d/d-target-def.h" + +/* Implement TARGET_D_CPU_VERSIONS for PowerPC targets. */ + +void +rs6000_d_target_versions (void) +{ + if (TARGET_64BIT) + d_add_builtin_version ("PPC64"); + else + d_add_builtin_version ("PPC"); + + if (TARGET_HARD_FLOAT) + { + d_add_builtin_version ("PPC_HardFloat"); + d_add_builtin_version ("D_HardFloat"); + } + else if (TARGET_SOFT_FLOAT) + { + d_add_builtin_version ("PPC_SoftFloat"); + d_add_builtin_version ("D_SoftFloat"); + } +} diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h index f1d5dff5788..bb2584b7b48 100644 --- a/gcc/config/rs6000/rs6000-protos.h +++ b/gcc/config/rs6000/rs6000-protos.h @@ -224,6 +224,9 @@ extern void rs6000_target_modify_macros (bool, HOST_WIDE_INT, HOST_WIDE_INT); extern void (*rs6000_target_modify_macros_ptr) (bool, HOST_WIDE_INT, HOST_WIDE_INT); +/* Declare functions in rs6000-d.c */ +extern void rs6000_d_target_versions (void); + #if TARGET_MACHO char *output_call (rtx_insn *, rtx *, int, int); #endif diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 4ab027ca3ea..f59c0b6b685 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -613,6 +613,9 @@ extern unsigned char rs6000_recip_bits[]; #define TARGET_CPU_CPP_BUILTINS() \ rs6000_cpu_cpp_builtins (pfile) +/* Target CPU versions for D. */ +#define TARGET_D_CPU_VERSIONS rs6000_d_target_versions + /* This is used by rs6000_cpu_cpp_builtins to indicate the byte order we're compiling for. Some configurations may need to override it. */ #define RS6000_CPU_CPP_ENDIAN_BUILTINS() \ diff --git a/gcc/config/rs6000/t-rs6000 b/gcc/config/rs6000/t-rs6000 index ad274d9d162..d9249b079f2 100644 --- a/gcc/config/rs6000/t-rs6000 +++ b/gcc/config/rs6000/t-rs6000 @@ -35,6 +35,10 @@ rs6000-p8swap.o: $(srcdir)/config/rs6000/rs6000-p8swap.c $(COMPILE) $< $(POSTCOMPILE) +rs6000-d.o: $(srcdir)/config/rs6000/rs6000-d.c + $(COMPILE) $< + $(POSTCOMPILE) + $(srcdir)/config/rs6000/rs6000-tables.opt: $(srcdir)/config/rs6000/genopt.sh \ $(srcdir)/config/rs6000/rs6000-cpus.def $(SHELL) $(srcdir)/config/rs6000/genopt.sh $(srcdir)/config/rs6000 > \ diff --git a/gcc/config/s390/s390-d.c b/gcc/config/s390/s390-d.c new file mode 100644 index 00000000000..1ea0a9d3379 --- /dev/null +++ b/gcc/config/s390/s390-d.c @@ -0,0 +1,41 @@ +/* Subroutines for the D front end on the IBM S/390 and zSeries architectures. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + +GCC 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 3, or (at your option) +any later version. + +GCC 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 GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "d/d-target.h" +#include "d/d-target-def.h" + +/* Implement TARGET_D_CPU_VERSIONS for S/390 and zSeries targets. */ + +void +s390_d_target_versions (void) +{ + if (TARGET_ZARCH) + d_add_builtin_version ("SystemZ"); + else if (TARGET_64BIT) + d_add_builtin_version ("S390X"); + else + d_add_builtin_version ("S390"); + + if (TARGET_SOFT_FLOAT) + d_add_builtin_version ("D_SoftFloat"); + else if (TARGET_HARD_FLOAT) + d_add_builtin_version ("D_HardFloat"); +} diff --git a/gcc/config/s390/s390-protos.h b/gcc/config/s390/s390-protos.h index 45fce6ce865..96fa705f879 100644 --- a/gcc/config/s390/s390-protos.h +++ b/gcc/config/s390/s390-protos.h @@ -166,6 +166,9 @@ extern void s390_register_target_pragmas (void); /* Routines for s390-c.c */ extern bool s390_const_operand_ok (tree, int, int, tree); +/* s390-d.c routines */ +extern void s390_d_target_versions (void); + /* Pass management. */ namespace gcc { class context; } class rtl_opt_pass; diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h index bf40b4c0644..3cfd3452d48 100644 --- a/gcc/config/s390/s390.h +++ b/gcc/config/s390/s390.h @@ -200,6 +200,9 @@ enum processor_flags /* Target CPU builtins. */ #define TARGET_CPU_CPP_BUILTINS() s390_cpu_cpp_builtins (pfile) +/* Target CPU versions for D. */ +#define TARGET_D_CPU_VERSIONS s390_d_target_versions + #ifdef DEFAULT_TARGET_64BIT #define TARGET_DEFAULT (MASK_64BIT | MASK_ZARCH | MASK_HARD_DFP \ | MASK_OPT_HTM | MASK_OPT_VX) diff --git a/gcc/config/s390/t-s390 b/gcc/config/s390/t-s390 index 8ca0c7879c9..97e6bf7d9eb 100644 --- a/gcc/config/s390/t-s390 +++ b/gcc/config/s390/t-s390 @@ -26,3 +26,7 @@ s390-c.o: $(srcdir)/config/s390/s390-c.c \ $(TARGET_H) $(TARGET_DEF_H) $(CPPLIB_H) $(C_PRAGMA_H) $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ $(srcdir)/config/s390/s390-c.c + +s390-d.o: $(srcdir)/config/s390/s390-d.c + $(COMPILE) $< + $(POSTCOMPILE) diff --git a/gcc/config/sparc/sparc-d.c b/gcc/config/sparc/sparc-d.c new file mode 100644 index 00000000000..19fe5be6d73 --- /dev/null +++ b/gcc/config/sparc/sparc-d.c @@ -0,0 +1,48 @@ +/* Subroutines for the D front end on the SPARC architecture. + Copyright (C) 2017-2018 Free Software Foundation, Inc. + +GCC 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 3, or (at your option) +any later version. + +GCC 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 GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "d/d-target.h" +#include "d/d-target-def.h" + +/* Implement TARGET_D_CPU_VERSIONS for SPARC targets. */ + +void +sparc_d_target_versions (void) +{ + if (TARGET_64BIT) + d_add_builtin_version ("SPARC64"); + else + d_add_builtin_version ("SPARC"); + + if (TARGET_V8PLUS) + d_add_builtin_version ("SPARC_V8Plus"); + + if (TARGET_FPU) + { + d_add_builtin_version ("D_HardFloat"); + d_add_builtin_version ("SPARC_HardFloat"); + } + else + { + d_add_builtin_version ("D_SoftFloat"); + d_add_builtin_version ("SPARC_SoftFloat"); + } +} diff --git a/gcc/config/sparc/sparc-protos.h b/gcc/config/sparc/sparc-protos.h index 12613dbc516..59c9b2a90b5 100644 --- a/gcc/config/sparc/sparc-protos.h +++ b/gcc/config/sparc/sparc-protos.h @@ -111,4 +111,7 @@ unsigned int sparc_regmode_natural_size (machine_mode); extern rtl_opt_pass *make_pass_work_around_errata (gcc::context *); +/* Routines implemented in sparc-d.c */ +extern void sparc_d_target_versions (void); + #endif /* __SPARC_PROTOS_H__ */ diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index 520a6b32083..8c15e2a958d 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -27,6 +27,9 @@ along with GCC; see the file COPYING3. If not see #define TARGET_CPU_CPP_BUILTINS() sparc_target_macros () +/* Target CPU versions for D. */ +#define TARGET_D_CPU_VERSIONS sparc_d_target_versions + /* Specify this in a cover file to provide bi-architecture (32/64) support. */ /* #define SPARC_BI_ARCH */ diff --git a/gcc/config/sparc/t-sparc b/gcc/config/sparc/t-sparc index 7fb3029fa54..30f15c9005a 100644 --- a/gcc/config/sparc/t-sparc +++ b/gcc/config/sparc/t-sparc @@ -23,3 +23,7 @@ PASSES_EXTRA += $(srcdir)/config/sparc/sparc-passes.def sparc-c.o: $(srcdir)/config/sparc/sparc-c.c $(COMPILE) $< $(POSTCOMPILE) + +sparc-d.o: $(srcdir)/config/sparc/sparc-d.c + $(COMPILE) $< + $(POSTCOMPILE) diff --git a/gcc/config/t-glibc b/gcc/config/t-glibc index 582215f9a7d..29d70867e63 100644 --- a/gcc/config/t-glibc +++ b/gcc/config/t-glibc @@ -19,3 +19,7 @@ glibc-c.o: config/glibc-c.c $(COMPILE) $< $(POSTCOMPILE) + +glibc-d.o: config/glibc-d.c + $(COMPILE) $< + $(POSTCOMPILE) diff --git a/gcc/configure b/gcc/configure index fb1c707f6cf..fe7e0b36e21 100755 --- a/gcc/configure +++ b/gcc/configure @@ -612,6 +612,7 @@ ISLLIBS GMPINC GMPLIBS target_cpu_default +d_target_objs fortran_target_objs cxx_target_objs c_target_objs @@ -619,6 +620,8 @@ use_gcc_stdint xm_defines xm_include_list xm_file_list +tm_d_include_list +tm_d_file_list tm_p_include_list tm_p_file_list tm_defines @@ -11858,6 +11861,7 @@ fi tm_file="${tm_file} defaults.h" tm_p_file="${tm_p_file} tm-preds.h" +tm_d_file="${tm_d_file} defaults.h" host_xm_file="auto-host.h ansidecl.h ${host_xm_file}" build_xm_file="${build_auto} ansidecl.h ${build_xm_file}" # We don't want ansidecl.h in target files, write code there in ISO/GNU C. @@ -12241,6 +12245,21 @@ for f in $tm_p_file; do esac done +tm_d_file_list= +tm_d_include_list="options.h insn-constants.h" +for f in $tm_d_file; do + case $f in + defaults.h ) + tm_d_file_list="${tm_d_file_list} \$(srcdir)/$f" + tm_d_include_list="${tm_d_include_list} $f" + ;; + * ) + tm_d_file_list="${tm_d_file_list} \$(srcdir)/config/$f" + tm_d_include_list="${tm_d_include_list} config/$f" + ;; + esac +done + xm_file_list= xm_include_list= for f in $xm_file; do @@ -18510,7 +18529,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 18513 "configure" +#line 18532 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -18616,7 +18635,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 18619 "configure" +#line 18638 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -29463,6 +29482,9 @@ fi + + + diff --git a/gcc/configure.ac b/gcc/configure.ac index 3b70d5310a4..a7e8084d6da 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -1752,6 +1752,7 @@ AC_SUBST(build_subdir) tm_file="${tm_file} defaults.h" tm_p_file="${tm_p_file} tm-preds.h" +tm_d_file="${tm_d_file} defaults.h" host_xm_file="auto-host.h ansidecl.h ${host_xm_file}" build_xm_file="${build_auto} ansidecl.h ${build_xm_file}" # We don't want ansidecl.h in target files, write code there in ISO/GNU C. @@ -1984,6 +1985,21 @@ for f in $tm_p_file; do esac done +tm_d_file_list= +tm_d_include_list="options.h insn-constants.h" +for f in $tm_d_file; do + case $f in + defaults.h ) + tm_d_file_list="${tm_d_file_list} \$(srcdir)/$f" + tm_d_include_list="${tm_d_include_list} $f" + ;; + * ) + tm_d_file_list="${tm_d_file_list} \$(srcdir)/config/$f" + tm_d_include_list="${tm_d_include_list} config/$f" + ;; + esac +done + xm_file_list= xm_include_list= for f in $xm_file; do @@ -6321,6 +6337,8 @@ AC_SUBST(tm_include_list) AC_SUBST(tm_defines) AC_SUBST(tm_p_file_list) AC_SUBST(tm_p_include_list) +AC_SUBST(tm_d_file_list) +AC_SUBST(tm_d_include_list) AC_SUBST(xm_file_list) AC_SUBST(xm_include_list) AC_SUBST(xm_defines) @@ -6328,6 +6346,7 @@ AC_SUBST(use_gcc_stdint) AC_SUBST(c_target_objs) AC_SUBST(cxx_target_objs) AC_SUBST(fortran_target_objs) +AC_SUBST(d_target_objs) AC_SUBST(target_cpu_default) AC_SUBST_FILE(language_hooks) diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 0fcf8069b8c..f841527f971 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -52,6 +52,7 @@ through the macros defined in the @file{.h} file. * MIPS Coprocessors:: MIPS coprocessor support and how to customize it. * PCH Target:: Validity checking for precompiled headers. * C++ ABI:: Controlling C++ ABI changes. +* D Language and ABI:: Controlling D ABI changes. * Named Address Spaces:: Adding support for named address spaces * Misc:: Everything else. @end menu @@ -106,6 +107,14 @@ documented as ``Common Target Hook''. This is declared in @code{target_has_targetm_common=yes} in @file{config.gcc}; otherwise a default definition is used. +Similarly, there is a @code{targetdm} variable for hooks that are +specific to the D language front end, documented as ``D Target Hook''. +This is declared in @file{d/d-target.h}, the initializer +@code{TARGETDM_INITIALIZER} in @file{d/d-target-def.h}. If targets +initialize @code{targetdm} themselves, they should set +@code{target_has_targetdm=yes} in @file{config.gcc}; otherwise a default +definition is used. + @node Driver @section Controlling the Compilation Driver, @file{gcc} @cindex driver @@ -10667,6 +10676,29 @@ unloaded. The default is to return false. Return target-specific mangling context of @var{decl} or @code{NULL_TREE}. @end deftypefn +@node D Language and ABI +@section D ABI parameters +@cindex parameters, d abi + +@deftypefn {D Target Hook} void TARGET_D_CPU_VERSIONS (void) +Declare all environmental version identifiers relating to the target CPU +using the function @code{builtin_version}, which takes a string representing +the name of the version. Version identifiers predefined by this hook apply +to all modules that are being compiled and imported. +@end deftypefn + +@deftypefn {D Target Hook} void TARGET_D_OS_VERSIONS (void) +Similarly to @code{TARGET_D_CPU_VERSIONS}, but is used for versions +relating to the target operating system. +@end deftypefn + +@deftypefn {D Target Hook} unsigned TARGET_D_CRITSEC_SIZE (void) +Returns the size of the data structure used by the target operating system +for critical sections and monitors. For example, on Microsoft Windows this +would return the @code{sizeof(CRITICAL_SECTION)}, while other platforms that +implement pthreads would return @code{sizeof(pthread_mutex_t)}. +@end deftypefn + @node Named Address Spaces @section Adding support for named address spaces @cindex named address spaces diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 63b0c0a98aa..967ef3ad22f 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -52,6 +52,7 @@ through the macros defined in the @file{.h} file. * MIPS Coprocessors:: MIPS coprocessor support and how to customize it. * PCH Target:: Validity checking for precompiled headers. * C++ ABI:: Controlling C++ ABI changes. +* D Language and ABI:: Controlling D ABI changes. * Named Address Spaces:: Adding support for named address spaces * Misc:: Everything else. @end menu @@ -106,6 +107,14 @@ documented as ``Common Target Hook''. This is declared in @code{target_has_targetm_common=yes} in @file{config.gcc}; otherwise a default definition is used. +Similarly, there is a @code{targetdm} variable for hooks that are +specific to the D language front end, documented as ``D Target Hook''. +This is declared in @file{d/d-target.h}, the initializer +@code{TARGETDM_INITIALIZER} in @file{d/d-target-def.h}. If targets +initialize @code{targetdm} themselves, they should set +@code{target_has_targetdm=yes} in @file{config.gcc}; otherwise a default +definition is used. + @node Driver @section Controlling the Compilation Driver, @file{gcc} @cindex driver @@ -7310,6 +7319,16 @@ floating-point support; they are not included in this mechanism. @hook TARGET_CXX_DECL_MANGLING_CONTEXT +@node D Language and ABI +@section D ABI parameters +@cindex parameters, d abi + +@hook TARGET_D_CPU_VERSIONS + +@hook TARGET_D_OS_VERSIONS + +@hook TARGET_D_CRITSEC_SIZE + @node Named Address Spaces @section Adding support for named address spaces @cindex named address spaces diff --git a/gcc/genhooks.c b/gcc/genhooks.c index 70f19a16b8a..9b6ab05507c 100644 --- a/gcc/genhooks.c +++ b/gcc/genhooks.c @@ -34,6 +34,7 @@ static struct hook_desc hook_array[] = { #include "target.def" #include "c-family/c-target.def" #include "common/common-target.def" +#include "d/d-target.def" #undef DEFHOOK };