Skip to content

Commit eaddcf7

Browse files
committed
Add ability to get CPU features
1 parent 1986920 commit eaddcf7

25 files changed

+864
-7
lines changed

gcc/Makefile.in

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,8 @@ tm_p_file_list=@tm_p_file_list@
574574
tm_p_include_list=@tm_p_include_list@
575575
tm_d_file_list=@tm_d_file_list@
576576
tm_d_include_list=@tm_d_include_list@
577+
tm_jit_file_list=@tm_jit_file_list@
578+
tm_jit_include_list=@tm_jit_include_list@
577579
build_xm_file_list=@build_xm_file_list@
578580
build_xm_include_list=@build_xm_include_list@
579581
build_xm_defines=@build_xm_defines@
@@ -868,6 +870,7 @@ CONFIG_H = config.h $(host_xm_file_list)
868870
TCONFIG_H = tconfig.h $(xm_file_list)
869871
TM_P_H = tm_p.h $(tm_p_file_list)
870872
TM_D_H = tm_d.h $(tm_d_file_list)
873+
TM_JIT_H = tm_jit.h $(tm_jit_file_list)
871874
GTM_H = tm.h $(tm_file_list) insn-constants.h
872875
TM_H = $(GTM_H) insn-flags.h $(OPTIONS_H)
873876

@@ -926,10 +929,12 @@ TARGET_DEF = target.def target-hooks-macros.h target-insns.def
926929
C_TARGET_DEF = c-family/c-target.def target-hooks-macros.h
927930
COMMON_TARGET_DEF = common/common-target.def target-hooks-macros.h
928931
D_TARGET_DEF = d/d-target.def target-hooks-macros.h
932+
JIT_TARGET_DEF = jit/jit-target.def target-hooks-macros.h
929933
TARGET_H = $(TM_H) target.h $(TARGET_DEF) insn-modes.h insn-codes.h
930934
C_TARGET_H = c-family/c-target.h $(C_TARGET_DEF)
931935
COMMON_TARGET_H = common/common-target.h $(INPUT_H) $(COMMON_TARGET_DEF)
932936
D_TARGET_H = d/d-target.h $(D_TARGET_DEF)
937+
JIT_TARGET_H = jit/jit-target.h $(JIT_TARGET_DEF)
933938
MACHMODE_H = machmode.h mode-classes.def
934939
HOOKS_H = hooks.h
935940
HOSTHOOKS_DEF_H = hosthooks-def.h $(HOOKS_H)
@@ -1230,6 +1235,9 @@ CXX_TARGET_OBJS=@cxx_target_objs@
12301235
# Target specific, D specific object file
12311236
D_TARGET_OBJS=@d_target_objs@
12321237

1238+
# Target specific, JIT specific object file
1239+
JIT_TARGET_OBJS=@jit_target_objs@
1240+
12331241
# Target specific, Fortran specific object file
12341242
FORTRAN_TARGET_OBJS=@fortran_target_objs@
12351243

@@ -1947,6 +1955,7 @@ tconfig.h: cs-tconfig.h ; @true
19471955
tm.h: cs-tm.h ; @true
19481956
tm_p.h: cs-tm_p.h ; @true
19491957
tm_d.h: cs-tm_d.h ; @true
1958+
tm_jit.h: cs-tm_jit.h ; @true
19501959

19511960
cs-config.h: Makefile
19521961
TARGET_CPU_DEFAULT="" \
@@ -1978,6 +1987,11 @@ cs-tm_d.h: Makefile
19781987
HEADERS="$(tm_d_include_list)" DEFINES="" \
19791988
$(SHELL) $(srcdir)/mkconfig.sh tm_d.h
19801989

1990+
cs-tm_jit.h: Makefile
1991+
TARGET_CPU_DEFAULT="" \
1992+
HEADERS="$(tm_jit_include_list)" DEFINES="" \
1993+
$(SHELL) $(srcdir)/mkconfig.sh tm_jit.h
1994+
19811995
# Don't automatically run autoconf, since configure.ac might be accidentally
19821996
# newer than configure. Also, this writes into the source directory which
19831997
# might be on a read-only file system. If configured for maintainer mode
@@ -2619,6 +2633,15 @@ s-d-target-hooks-def-h: build/genhooks$(build_exeext)
26192633
d/d-target-hooks-def.h
26202634
$(STAMP) s-d-target-hooks-def-h
26212635

2636+
jit/jit-target-hooks-def.h: s-jit-target-hooks-def-h; @true
2637+
2638+
s-jit-target-hooks-def-h: build/genhooks$(build_exeext)
2639+
$(RUN_GEN) build/genhooks$(build_exeext) "JIT Target Hook" \
2640+
> tmp-jit-target-hooks-def.h
2641+
$(SHELL) $(srcdir)/../move-if-change tmp-jit-target-hooks-def.h \
2642+
jit/jit-target-hooks-def.h
2643+
$(STAMP) s-jit-target-hooks-def-h
2644+
26222645
# check if someone mistakenly only changed tm.texi.
26232646
# We use a different pathname here to avoid a circular dependency.
26242647
s-tm-texi: $(srcdir)/doc/../doc/tm.texi
@@ -2794,7 +2817,7 @@ s-gtype: $(EXTRA_GTYPE_DEPS) build/gengtype$(build_exeext) \
27942817
-r gtype.state
27952818
$(STAMP) s-gtype
27962819

2797-
generated_files = config.h tm.h $(TM_P_H) $(TM_D_H) $(TM_H) multilib.h \
2820+
generated_files = config.h tm.h $(TM_P_H) $(TM_D_H) $(TM_JIT_H) $(TM_H) multilib.h \
27982821
$(simple_generated_h) specs.h \
27992822
tree-check.h genrtl.h insn-modes.h insn-modes-inline.h \
28002823
tm-preds.h tm-constrs.h \
@@ -2803,7 +2826,7 @@ generated_files = config.h tm.h $(TM_P_H) $(TM_D_H) $(TM_H) multilib.h \
28032826
common/common-target-hooks-def.h pass-instances.def \
28042827
gimple-match.cc generic-match.cc \
28052828
c-family/c-target-hooks-def.h d/d-target-hooks-def.h \
2806-
case-cfn-macros.h \
2829+
jit/jit-target-hooks-def.h case-cfn-macros.h \
28072830
cfn-operators.pd omp-device-properties.h
28082831

28092832
#
@@ -2937,7 +2960,7 @@ build/genrecog.o : genrecog.cc $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
29372960
$(CORETYPES_H) $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H) \
29382961
$(HASH_TABLE_H) inchash.h
29392962
build/genhooks.o : genhooks.cc $(TARGET_DEF) $(C_TARGET_DEF) \
2940-
$(COMMON_TARGET_DEF) $(D_TARGET_DEF) $(BCONFIG_H) $(SYSTEM_H) errors.h
2963+
$(COMMON_TARGET_DEF) $(D_TARGET_DEF) $(JIT_TARGET_DEF) $(BCONFIG_H) $(SYSTEM_H) errors.h
29412964
build/genmddump.o : genmddump.cc $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
29422965
$(CORETYPES_H) $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H)
29432966
build/genmatch.o : genmatch.cc $(BCONFIG_H) $(SYSTEM_H) \

gcc/config.gcc

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@
146146
# d_target_objs List of extra target-dependent objects that be
147147
# linked into the D compiler only.
148148
#
149+
# jit_target_objs List of extra target-dependent objects that be
150+
# linked into the jit compiler only.
151+
#
149152
# fortran_target_objs List of extra target-dependent objects that be
150153
# linked into the fortran compiler only.
151154
#
@@ -201,6 +204,9 @@
201204
#
202205
# target_has_targetdm Set to yes or no depending on whether the target
203206
# has its own definition of targetdm.
207+
#
208+
# target_has_targetjitm Set to yes or no depending on whether the target
209+
# has its own definition of targetdm.
204210

205211
out_file=
206212
common_out_file=
@@ -217,10 +223,12 @@ extra_options=
217223
c_target_objs=
218224
cxx_target_objs=
219225
d_target_objs=
226+
jit_target_objs=
220227
fortran_target_objs=
221228
target_has_targetcm=no
222229
target_has_targetm_common=yes
223230
target_has_targetdm=no
231+
target_has_targetjitm=no
224232
tm_defines=
225233
xm_defines=
226234
# Set this to force installation and use of collect2.
@@ -338,6 +346,7 @@ aarch64*-*-*)
338346
c_target_objs="aarch64-c.o"
339347
cxx_target_objs="aarch64-c.o"
340348
d_target_objs="aarch64-d.o"
349+
#jit_target_objs="aarch64-jit.o"
341350
extra_objs="aarch64-builtins.o aarch-common.o aarch64-sve-builtins.o aarch64-sve-builtins-shapes.o aarch64-sve-builtins-base.o aarch64-sve-builtins-sve2.o cortex-a57-fma-steering.o aarch64-speculation.o falkor-tag-collision-avoidance.o aarch64-bti-insert.o aarch64-cc-fusion.o"
342351
target_gtfiles="\$(srcdir)/config/aarch64/aarch64-builtins.cc \$(srcdir)/config/aarch64/aarch64-sve-builtins.h \$(srcdir)/config/aarch64/aarch64-sve-builtins.cc"
343352
target_has_targetm_common=yes
@@ -368,6 +377,7 @@ arm*-*-*)
368377
c_target_objs="arm-c.o"
369378
cxx_target_objs="arm-c.o"
370379
d_target_objs="arm-d.o"
380+
#jit_target_objs="arm-jit.o"
371381
extra_options="${extra_options} arm/arm-tables.opt"
372382
target_gtfiles="\$(srcdir)/config/arm/arm-builtins.cc \$(srcdir)/config/arm/arm-mve-builtins.h \$(srcdir)/config/arm/arm-mve-builtins.cc"
373383
;;
@@ -401,6 +411,7 @@ i[34567]86-*-* | x86_64-*-*)
401411
c_target_objs="i386-c.o"
402412
cxx_target_objs="i386-c.o"
403413
d_target_objs="i386-d.o"
414+
jit_target_objs="i386-jit.o"
404415
extra_objs="x86-tune-sched.o x86-tune-sched-bd.o x86-tune-sched-atom.o x86-tune-sched-core.o i386-options.o i386-builtins.o i386-expand.o i386-features.o"
405416
target_gtfiles="\$(srcdir)/config/i386/i386-builtins.cc \$(srcdir)/config/i386/i386-expand.cc \$(srcdir)/config/i386/i386-options.cc"
406417
extra_options="${extra_options} fused-madd.opt"
@@ -462,6 +473,7 @@ microblaze*-*-*)
462473
mips*-*-*)
463474
cpu_type=mips
464475
d_target_objs="mips-d.o"
476+
#jit_target_objs="mips-jit.o"
465477
extra_headers="loongson.h loongson-mmiintrin.h msa.h"
466478
extra_objs="frame-header-opt.o"
467479
extra_options="${extra_options} g.opt fused-madd.opt mips/mips-tables.opt"
@@ -532,6 +544,7 @@ riscv*)
532544
extra_objs="riscv-builtins.o riscv-c.o riscv-sr.o riscv-shorten-memrefs.o riscv-selftests.o riscv-v.o riscv-vsetvl.o"
533545
extra_objs="${extra_objs} riscv-vector-builtins.o riscv-vector-builtins-shapes.o riscv-vector-builtins-bases.o"
534546
d_target_objs="riscv-d.o"
547+
#jit_target_objs="riscv-jit.o"
535548
extra_headers="riscv_vector.h"
536549
target_gtfiles="$target_gtfiles \$(srcdir)/config/riscv/riscv-vector-builtins.cc"
537550
target_gtfiles="$target_gtfiles \$(srcdir)/config/riscv/riscv-vector-builtins.h"
@@ -548,11 +561,13 @@ sparc*-*-*)
548561
c_target_objs="sparc-c.o"
549562
cxx_target_objs="sparc-c.o"
550563
d_target_objs="sparc-d.o"
564+
#jit_target_objs="sparc-jit.o"
551565
extra_headers="visintrin.h"
552566
;;
553567
s390*-*-*)
554568
cpu_type=s390
555569
d_target_objs="s390-d.o"
570+
#jit_target_objs="s390-jit.o"
556571
extra_options="${extra_options} fused-madd.opt"
557572
extra_headers="s390intrin.h htmintrin.h htmxlintrin.h vecintrin.h"
558573
;;
@@ -588,6 +603,12 @@ then
588603
tm_d_file="${tm_d_file} ${cpu_type}/${cpu_type}-d.h"
589604
fi
590605

606+
tm_jit_file=
607+
if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-jit.h
608+
then
609+
tm_jit_file="${tm_jit_file} ${cpu_type}/${cpu_type}-jit.h"
610+
fi
611+
591612
extra_modes=
592613
if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-modes.def
593614
then
@@ -754,9 +775,11 @@ case ${target} in
754775
c_target_objs="${c_target_objs} darwin-c.o"
755776
cxx_target_objs="${cxx_target_objs} darwin-c.o"
756777
d_target_objs="${d_target_objs} darwin-d.o"
778+
#jit_target_objs="${jit_target_objs} darwin-jit.o"
757779
fortran_target_objs="darwin-f.o"
758780
target_has_targetcm=yes
759781
target_has_targetdm=yes
782+
#target_has_targetjitm=yes
760783
extra_objs="${extra_objs} darwin.o"
761784
extra_gcc_objs="darwin-driver.o"
762785
default_use_cxa_atexit=yes
@@ -785,8 +808,10 @@ case ${target} in
785808
default_use_cxa_atexit=yes
786809
use_gcc_stdint=wrap
787810
d_target_objs="${d_target_objs} dragonfly-d.o"
811+
#jit_target_objs="${jit_target_objs} dragonfly-jit.o"
788812
tmake_file="${tmake_file} t-dragonfly"
789813
target_has_targetdm=yes
814+
#target_has_targetjitm=yes
790815
;;
791816
*-*-freebsd*)
792817
# This is the generic ELF configuration of FreeBSD. Later
@@ -836,8 +861,10 @@ case ${target} in
836861
esac
837862
use_gcc_stdint=wrap
838863
d_target_objs="${d_target_objs} freebsd-d.o"
864+
#jit_target_objs="${jit_target_objs} freebsd-jit.o"
839865
tmake_file="${tmake_file} t-freebsd"
840866
target_has_targetdm=yes
867+
#target_has_targetjitm=yes
841868
;;
842869
*-*-fuchsia*)
843870
native_system_header_dir=/include
@@ -910,19 +937,27 @@ case ${target} in
910937
case $target in
911938
*-*-*linux*)
912939
d_target_objs="${d_target_objs} linux-d.o"
940+
jit_target_objs="${jit_target_objs} linux-jit.o"
913941
target_has_targetdm=yes
942+
target_has_targetjitm=yes
914943
;;
915944
*-*-kfreebsd*-gnu)
916945
d_target_objs="${d_target_objs} kfreebsd-d.o"
946+
#jit_target_objs="${jit_target_objs} kfreebsd-jit.o"
917947
target_has_targetdm=yes
948+
#target_has_targetjitm=yes
918949
;;
919950
*-*-kopensolaris*-gnu)
920951
d_target_objs="${d_target_objs} kopensolaris-d.o"
952+
#jit_target_objs="${jit_target_objs} kopensolaris-jit.o"
921953
target_has_targetdm=yes
954+
#target_has_targetjitm=yes
922955
;;
923956
*-*-gnu*)
924957
d_target_objs="${d_target_objs} gnu-d.o"
958+
#jit_target_objs="${jit_target_objs} gnu-jit.o"
925959
target_has_targetdm=yes
960+
#target_has_targetjitm=yes
926961
;;
927962
esac
928963
;;
@@ -931,6 +966,7 @@ case ${target} in
931966
tmake_file="t-netbsd t-slibgcc"
932967
extra_objs="${extra_objs} netbsd.o"
933968
d_target_objs="${d_target_objs} netbsd-d.o"
969+
#jit_target_objs="${jit_target_objs} netbsd-jit.o"
934970
gas=yes
935971
gnu_ld=yes
936972
use_gcc_stdint=wrap
@@ -940,6 +976,7 @@ case ${target} in
940976
nbsd_tm_file="netbsd.h netbsd-stdint.h netbsd-elf.h"
941977
default_use_cxa_atexit=yes
942978
target_has_targetdm=yes
979+
#target_has_targetjitm=yes
943980
case ${target} in
944981
arm*-* | i[34567]86-* | powerpc*-* | sparc*-* | x86_64-*)
945982
default_gnu_indirect_function=yes
@@ -959,7 +996,9 @@ case ${target} in
959996
;;
960997
esac
961998
d_target_objs="${d_target_objs} openbsd-d.o"
999+
#jit_target_objs="${jit_target_objs} openbsd-jit.o"
9621000
target_has_targetdm=yes
1001+
#target_has_targetjitm=yes
9631002
;;
9641003
*-*-phoenix*)
9651004
gas=yes
@@ -1016,6 +1055,7 @@ case ${target} in
10161055
c_target_objs="${c_target_objs} sol2-c.o"
10171056
cxx_target_objs="${cxx_target_objs} sol2-c.o sol2-cxx.o"
10181057
d_target_objs="${d_target_objs} sol2-d.o"
1058+
#jit_target_objs="${jit_target_objs} sol2-jit.o"
10191059
extra_objs="${extra_objs} sol2.o sol2-stubs.o"
10201060
extra_options="${extra_options} sol2.opt"
10211061
case ${enable_threads}:${have_pthread_h}:${have_thread_h} in
@@ -1024,6 +1064,7 @@ case ${target} in
10241064
;;
10251065
esac
10261066
target_has_targetdm=yes
1067+
#target_has_targetjitm=yes
10271068
;;
10281069
*-*-*vms*)
10291070
extra_options="${extra_options} vms/vms.opt"
@@ -1760,6 +1801,7 @@ hppa*64*-*-linux*)
17601801
pa/pa64-linux.h"
17611802
tmake_file="${tmake_file} pa/t-pa pa/t-linux"
17621803
d_target_objs="${d_target_objs} pa-d.o"
1804+
#jit_target_objs="${jit_target_objs} pa-jit.o"
17631805
gas=yes gnu_ld=yes
17641806
;;
17651807
hppa*-*-linux*)
@@ -1768,6 +1810,7 @@ hppa*-*-linux*)
17681810
pa/pa32-regs.h pa/pa32-linux.h"
17691811
tmake_file="${tmake_file} pa/t-pa pa/t-linux"
17701812
d_target_objs="${d_target_objs} pa-d.o"
1813+
#jit_target_objs="${jit_target_objs} pa-jit.o"
17711814
;;
17721815
hppa*-*-openbsd*)
17731816
target_cpu_default="MASK_PA_11"
@@ -1776,6 +1819,7 @@ hppa*-*-openbsd*)
17761819
extra_options="${extra_options} openbsd.opt"
17771820
tmake_file="pa/t-pa"
17781821
d_target_objs="${d_target_objs} pa-d.o"
1822+
#jit_target_objs="${jit_target_objs} pa-jit.o"
17791823
gas=yes
17801824
gnu_ld=yes
17811825
;;
@@ -1813,6 +1857,7 @@ hppa*64*-*-hpux11*)
18131857
pa/pa-hpux1010.opt pa/pa64-hpux.opt hpux11.opt"
18141858
tmake_file="pa/t-pa t-slibgcc"
18151859
d_target_objs="${d_target_objs} pa-d.o"
1860+
#jit_target_objs="${jit_target_objs} pa-jit.o"
18161861
case x${enable_threads} in
18171862
x | xyes | xposix )
18181863
thread_file=posix
@@ -2086,7 +2131,9 @@ i[34567]86-*-cygwin*)
20862131
c_target_objs="${c_target_objs} msformat-c.o"
20872132
cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o"
20882133
d_target_objs="${d_target_objs} cygwin-d.o"
2134+
#jit_target_objs="${jit_target_objs} cygwin-jit.o"
20892135
target_has_targetdm="yes"
2136+
#target_has_targetjitm=yes
20902137
if test x$enable_threads = xyes; then
20912138
thread_file='posix'
20922139
fi
@@ -2104,7 +2151,9 @@ x86_64-*-cygwin*)
21042151
c_target_objs="${c_target_objs} msformat-c.o"
21052152
cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o"
21062153
d_target_objs="${d_target_objs} cygwin-d.o"
2154+
#jit_target_objs="${jit_target_objs} cygwin-jit.o"
21072155
target_has_targetdm="yes"
2156+
#target_has_targetjitm=yes
21082157
if test x$enable_threads = xyes; then
21092158
thread_file='posix'
21102159
fi
@@ -2118,8 +2167,10 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
21182167
c_target_objs="${c_target_objs} winnt-c.o"
21192168
cxx_target_objs="${cxx_target_objs} winnt-c.o"
21202169
d_target_objs="${d_target_objs} winnt-d.o"
2170+
#jit_target_objs="${jit_target_objs} winnt-jit.o"
21212171
target_has_targetcm="yes"
21222172
target_has_targetdm="yes"
2173+
#target_has_targetjitm=yes
21232174
case ${target} in
21242175
x86_64-*-* | *-w64-*)
21252176
need_64bit_isa=yes
@@ -3582,6 +3633,10 @@ if [ "$target_has_targetdm" = "no" ]; then
35823633
d_target_objs="$d_target_objs default-d.o"
35833634
fi
35843635

3636+
if [ "$target_has_targetjitm" = "no" ]; then
3637+
jit_target_objs="$jit_target_objs default-jit.o"
3638+
fi
3639+
35853640
# Support for --with-cpu and related options (and a few unrelated options,
35863641
# too).
35873642
case ${with_cpu} in
@@ -5752,6 +5807,7 @@ case ${target} in
57525807
c_target_objs="${c_target_objs} ${cpu_type}-c.o"
57535808
cxx_target_objs="${cxx_target_objs} ${cpu_type}-c.o"
57545809
d_target_objs="${d_target_objs} ${cpu_type}-d.o"
5810+
jit_target_objs="${jit_target_objs} ${cpu_type}-jit.o"
57555811
tmake_file="${cpu_type}/t-${cpu_type} ${tmake_file}"
57565812
;;
57575813

0 commit comments

Comments
 (0)