diff options
author | Martin Jambor <mjambor@suse.cz> | 2016-03-07 19:31:53 +0100 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2016-03-07 19:31:53 +0100 |
commit | 4bf1cec711415449e6c604b9da5142853572b52f (patch) | |
tree | 55b94d15f9b30b1f8259bd8e5bd89d53399bac83 /gcc/hsa-gen.c | |
parent | 94156b3f3796d1fe59a48c3dab36aa5a2254f8f9 (diff) | |
download | gcc-4bf1cec711415449e6c604b9da5142853572b52f.zip gcc-4bf1cec711415449e6c604b9da5142853572b52f.tar.gz gcc-4bf1cec711415449e6c604b9da5142853572b52f.tar.bz2 |
[hsa] Consodlidate GTY roots for trees used during expansion to HSA
2016-03-07 Martin Jambor <mjambor@suse.cz>
* hsa.h (hsa_get_ctor_statements): Declare.
(hsa_get_dtor_statements): Likewise.
(hsa_get_kernel_dispatch_type): Likewise.
* hsa.c (hsa_get_ctor_statements): New function.
(hsa_get_dtor_statements): Likewise.
(hsa_get_kernel_dispatch_type): Likewise.
* hsa-brig.c (hsa_cdtor_statements): Removed.
(hsa_output_libgomp_mapping): Use hsa_get_ctor_statements and
hsa_get_dtor_statements.
* hsa-gen.c (hsa_kernel_dispatch_type): Removed.
(get_hsa_kernel_dispatch_offset): Use hsa_get_kernel_dispatch_type.
From-SVN: r234042
Diffstat (limited to 'gcc/hsa-gen.c')
-rw-r--r-- | gcc/hsa-gen.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/gcc/hsa-gen.c b/gcc/hsa-gen.c index 4881f24..5939a57 100644 --- a/gcc/hsa-gen.c +++ b/gcc/hsa-gen.c @@ -3772,20 +3772,19 @@ gen_set_num_threads (tree value, hsa_bb *hbb) hbb->append_insn (basic); } -static GTY (()) tree hsa_kernel_dispatch_type = NULL; - /* Return byte offset of a FIELD_NAME in GOMP_hsa_kernel_dispatch which is defined in plugin-hsa.c. */ static HOST_WIDE_INT get_hsa_kernel_dispatch_offset (const char *field_name) { - if (hsa_kernel_dispatch_type == NULL) + tree *hsa_kernel_dispatch_type = hsa_get_kernel_dispatch_type (); + if (*hsa_kernel_dispatch_type == NULL) { /* Collection of information needed for a dispatch of a kernel from a kernel. Keep in sync with libgomp's plugin-hsa.c. */ - hsa_kernel_dispatch_type = make_node (RECORD_TYPE); + *hsa_kernel_dispatch_type = make_node (RECORD_TYPE); tree id_f1 = build_decl (BUILTINS_LOCATION, FIELD_DECL, get_identifier ("queue"), ptr_type_node); DECL_CHAIN (id_f1) = NULL_TREE; @@ -3835,12 +3834,12 @@ get_hsa_kernel_dispatch_offset (const char *field_name) DECL_CHAIN (id_f12) = id_f11; - finish_builtin_struct (hsa_kernel_dispatch_type, "__hsa_kernel_dispatch", + finish_builtin_struct (*hsa_kernel_dispatch_type, "__hsa_kernel_dispatch", id_f12, NULL_TREE); - TYPE_ARTIFICIAL (hsa_kernel_dispatch_type) = 1; + TYPE_ARTIFICIAL (*hsa_kernel_dispatch_type) = 1; } - for (tree chain = TYPE_FIELDS (hsa_kernel_dispatch_type); + for (tree chain = TYPE_FIELDS (*hsa_kernel_dispatch_type); chain != NULL_TREE; chain = TREE_CHAIN (chain)) if (strcmp (field_name, IDENTIFIER_POINTER (DECL_NAME (chain))) == 0) return int_byte_position (chain); |