Created
February 4, 2018 20:13
-
-
Save jpf91/6168f248b72000d1a9010e814e120933 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ur gcc-8-20171210.old/gcc/config/aarch64/aarch64.c gcc-8-20171210.new/gcc/config/aarch64/aarch64.c | |
--- gcc-8-20171210.old/gcc/config/aarch64/aarch64.c 2017-12-07 19:43:40.000000000 +0100 | |
+++ gcc-8-20171210.new/gcc/config/aarch64/aarch64.c 2018-02-04 21:02:13.337405884 +0100 | |
@@ -132,8 +132,8 @@ | |
#define TARGET_HAVE_TLS 1 | |
#endif | |
-static bool aarch64_composite_type_p (const_tree, machine_mode); | |
-static bool aarch64_vfp_is_call_or_return_candidate (machine_mode, | |
+bool aarch64_composite_type_p (const_tree, machine_mode); | |
+bool aarch64_vfp_is_call_or_return_candidate (machine_mode, | |
const_tree, | |
machine_mode *, int *, | |
bool *); | |
@@ -11176,7 +11176,7 @@ | |
(i.e. BLKmode) in certain circumstances. In other words, MODE cannot be | |
solely relied on. */ | |
-static bool | |
+bool | |
aarch64_composite_type_p (const_tree type, | |
machine_mode mode) | |
{ | |
@@ -11203,7 +11203,7 @@ | |
is not NULL, *IS_HA indicates whether or not the argument is a homogeneous | |
floating-point aggregate or a homogeneous short-vector aggregate. */ | |
-static bool | |
+bool | |
aarch64_vfp_is_call_or_return_candidate (machine_mode mode, | |
const_tree type, | |
machine_mode *base_mode, | |
diff -ur gcc-8-20171210.old/gcc/config/aarch64/aarch64-d.c gcc-8-20171210.new/gcc/config/aarch64/aarch64-d.c | |
--- gcc-8-20171210.old/gcc/config/aarch64/aarch64-d.c 2018-02-04 21:10:55.408792889 +0100 | |
+++ gcc-8-20171210.new/gcc/config/aarch64/aarch64-d.c 2018-02-04 21:02:13.349406238 +0100 | |
@@ -20,6 +20,28 @@ | |
#include "coretypes.h" | |
#include "d/d-target.h" | |
#include "d/d-target-def.h" | |
+#if __LP64__ | |
+// Be careful not to care about sign when using dinteger_t | |
+// use this instead of integer_t to | |
+// avoid conflicts with system #include's | |
+typedef unsigned long dinteger_t; | |
+// Signed and unsigned variants | |
+typedef long sinteger_t; | |
+typedef unsigned long uinteger_t; | |
+#else | |
+typedef unsigned long long dinteger_t; | |
+typedef long long sinteger_t; | |
+typedef unsigned long long uinteger_t; | |
+#endif | |
+// Hack | |
+typedef void* real_t; | |
+#include "d/d-tree.h" | |
+ | |
+extern bool aarch64_composite_type_p (const_tree, machine_mode); | |
+extern bool aarch64_vfp_is_call_or_return_candidate (machine_mode, | |
+ const_tree, | |
+ machine_mode *, int *, | |
+ bool *); | |
/* Implement TARGET_D_CPU_VERSIONS for AArch64 targets. */ | |
@@ -29,3 +51,66 @@ | |
d_add_builtin_version ("AArch64"); | |
d_add_builtin_version ("D_HardFloat"); | |
} | |
+ | |
+/* This is needed in aarch64-d.c. Defined in aarch64.c. */ | |
+extern bool aarch64_composite_type_p (const_tree, machine_mode); | |
+extern bool aarch64_vfp_is_call_or_return_candidate (machine_mode, | |
+ const_tree, | |
+ machine_mode *, int *, | |
+ bool *); | |
+ | |
+tree | |
+aarch64_d_vaarg_ti_types (d_tinfo_kind ti) | |
+{ | |
+ tree result = build_tree_list(0, ubyte_type_node); | |
+ result = chainon (result, build_tree_list(0, ubyte_type_node)); | |
+ result = chainon (result, build_tree_list(0, ubyte_type_node)); | |
+ | |
+ switch (ti) | |
+ { | |
+ case D_TK_STRUCT_TYPE: | |
+ case D_TK_STATICARRAY_TYPE: | |
+ case D_TK_VECTOR_TYPE: | |
+ return result; | |
+ | |
+ default: | |
+ return build_tree_list(0, void_type_node); | |
+ } | |
+} | |
+ | |
+tree | |
+aarch64_d_vaarg_ti_values (d_tinfo_kind ti, tree type) | |
+{ | |
+ if (ti == D_TK_STRUCT_TYPE || ti == D_TK_STATICARRAY_TYPE || | |
+ ti == D_TK_VECTOR_TYPE) | |
+ { | |
+ bool is_ha; | |
+ int nregs; | |
+ machine_mode ag_mode = VOIDmode; | |
+ bool is_composite; | |
+ | |
+ bool is_freg = aarch64_vfp_is_call_or_return_candidate(TYPE_MODE (type), type, | |
+ &ag_mode, &nregs, &is_ha); | |
+ is_composite = aarch64_composite_type_p(type, TYPE_MODE(type)); | |
+ | |
+ u_int8_t flags = 0; | |
+ if (is_composite) | |
+ flags |= 0x1; | |
+ | |
+ if (is_freg) | |
+ flags |= 0x2; | |
+ | |
+ u_int8_t ha_elem = (u_int8_t)GET_MODE_SIZE (ag_mode); | |
+ u_int8_t ha_num = (u_int8_t)nregs; | |
+ | |
+ tree result = build_tree_list(0, build_integer_cst(flags, ubyte_type_node)); | |
+ result = chainon (result, build_tree_list(0, build_integer_cst(ha_elem, ubyte_type_node))); | |
+ result = chainon (result, build_tree_list(0, build_integer_cst(ha_num, ubyte_type_node))); | |
+ | |
+ return result; | |
+ } | |
+ else | |
+ { | |
+ return NULL_TREE; | |
+ } | |
+} | |
diff -ur gcc-8-20171210.old/gcc/config/aarch64/aarch64.h gcc-8-20171210.new/gcc/config/aarch64/aarch64.h | |
--- gcc-8-20171210.old/gcc/config/aarch64/aarch64.h 2018-02-04 21:10:55.412793007 +0100 | |
+++ gcc-8-20171210.new/gcc/config/aarch64/aarch64.h 2018-02-04 21:02:13.321405413 +0100 | |
@@ -29,6 +29,9 @@ | |
/* Target CPU versions for D. */ | |
#define TARGET_D_CPU_VERSIONS aarch64_d_target_versions | |
+#define TARGET_D_VAARG_TI_TYPES aarch64_d_vaarg_ti_types | |
+#define TARGET_D_VAARG_TI_VALUES aarch64_d_vaarg_ti_values | |
+ | |
#define REGISTER_TARGET_PRAGMAS() aarch64_register_pragmas () | |
diff -ur gcc-8-20171210.old/gcc/config/aarch64/aarch64-protos.h gcc-8-20171210.new/gcc/config/aarch64/aarch64-protos.h | |
--- gcc-8-20171210.old/gcc/config/aarch64/aarch64-protos.h 2018-02-04 21:10:55.412793007 +0100 | |
+++ gcc-8-20171210.new/gcc/config/aarch64/aarch64-protos.h 2018-02-04 21:02:13.349406238 +0100 | |
@@ -23,6 +23,7 @@ | |
#define GCC_AARCH64_PROTOS_H | |
#include "input.h" | |
+#include "d/d-target.h" | |
/* SYMBOL_SMALL_ABSOLUTE: Generate symbol accesses through | |
high and lo relocs that calculate the base address using a PC | |
@@ -497,6 +498,8 @@ | |
/* Defined in aarch64-d.c */ | |
extern void aarch64_d_target_versions (void); | |
+extern tree aarch64_d_vaarg_ti_types (d_tinfo_kind); | |
+extern tree aarch64_d_vaarg_ti_values (d_tinfo_kind, tree); | |
rtl_opt_pass *make_pass_fma_steering (gcc::context *ctxt); | |
Nur in gcc-8-20171210.new/gcc/config/aarch64: .goutputstream-FHWPDZ. | |
diff -ur gcc-8-20171210.old/gcc/config/default-d.c gcc-8-20171210.new/gcc/config/default-d.c | |
--- gcc-8-20171210.old/gcc/config/default-d.c 2018-02-04 21:10:55.484795129 +0100 | |
+++ gcc-8-20171210.new/gcc/config/default-d.c 2018-02-04 21:02:13.449409186 +0100 | |
@@ -23,3 +23,19 @@ | |
#include "d/d-target-def.h" | |
struct gcc_targetdm targetdm = TARGETDM_INITIALIZER; | |
+ | |
+/* Default target specific typeinfo fields: none. */ | |
+ | |
+tree | |
+d_default_vaarg_ti_types (d_tinfo_kind ti) | |
+{ | |
+ return build_tree_list(0, void_type_node); | |
+} | |
+ | |
+/* Default target specific typeinfo fields: none. */ | |
+ | |
+tree | |
+d_default_vaarg_ti_values (d_tinfo_kind ti, tree type) | |
+{ | |
+ return NULL_TREE; | |
+} | |
diff -ur gcc-8-20171210.old/gcc/doc/tm.texi gcc-8-20171210.new/gcc/doc/tm.texi | |
--- gcc-8-20171210.old/gcc/doc/tm.texi 2018-02-04 21:10:55.680800905 +0100 | |
+++ gcc-8-20171210.new/gcc/doc/tm.texi 2018-02-04 21:02:33.842010280 +0100 | |
@@ -10523,6 +10523,14 @@ | |
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 | |
+@deftypefn {D Target Hook} tree TARGET_D_VAARG_TI_TYPES (d_tinfo_kind) | |
+Returns types of target-specific fields which need to be inserted into TypeInfo to support the va_arg variant taking a TypeInfo argument. The va_arg imlementation can be found in core/stdc/stdarg.d. This function's first parameter is a @code{tinfo_kind} as fields can be differnt depending on the kind of TypeInfo. Returns a @code{TREE_LIST} of types and void_zero_node if no extra fields are needed. | |
+@end deftypefn | |
+ | |
+@deftypefn {D Target Hook} tree TARGET_D_VAARG_TI_VALUES (d_tinfo_kind, @var{tree}) | |
+Returns initial values for target-specific fields which need to be inserted into TypeInfo to support the va_arg variant taking a TypeInfo argument. The va_arg imlementation can be found in core/stdc/stdarg.d. This function's first parameter is a @code{tree} for the type described by the TypeInfo instance. Returns a @code{TREE_LIST} of initial values and NULL_TREE if no extra fields are needed. | |
+@end deftypefn | |
+ | |
@node Named Address Spaces | |
@section Adding support for named address spaces | |
@cindex named address spaces | |
diff -ur gcc-8-20171210.old/gcc/doc/tm.texi.in gcc-8-20171210.new/gcc/doc/tm.texi.in | |
--- gcc-8-20171210.old/gcc/doc/tm.texi.in 2018-02-04 21:10:55.684801023 +0100 | |
+++ gcc-8-20171210.new/gcc/doc/tm.texi.in 2018-02-04 21:02:33.958013700 +0100 | |
@@ -7257,6 +7257,10 @@ | |
@hook TARGET_D_CRITSEC_SIZE | |
+@hook TARGET_D_VAARG_TI_TYPES | |
+ | |
+@hook TARGET_D_VAARG_TI_VALUES | |
+ | |
@node Named Address Spaces | |
@section Adding support for named address spaces | |
@cindex named address spaces |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment