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-brig.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-brig.c')
-rw-r--r-- | gcc/hsa-brig.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/gcc/hsa-brig.c b/gcc/hsa-brig.c index 61cfd8b..2a301be 100644 --- a/gcc/hsa-brig.c +++ b/gcc/hsa-brig.c @@ -2006,8 +2006,6 @@ hsa_brig_emit_omp_symbols (void) emit_directive_variable (hsa_num_threads); } -static GTY(()) tree hsa_cdtor_statements[2]; - /* Create and return __hsa_global_variables symbol that contains all informations consumed by libgomp to link global variables with their string names used by an HSA kernel. */ @@ -2408,6 +2406,7 @@ hsa_output_libgomp_mapping (tree brig_decl) = builtin_decl_explicit (BUILT_IN_GOMP_OFFLOAD_REGISTER); gcc_checking_assert (offload_register); + tree *hsa_ctor_stmts = hsa_get_ctor_statements (); append_to_statement_list (build_call_expr (offload_register, 4, build_int_cstu (unsigned_type_node, @@ -2416,15 +2415,15 @@ hsa_output_libgomp_mapping (tree brig_decl) build_fold_addr_expr (hsa_libgomp_host_table), build_int_cst (integer_type_node, GOMP_DEVICE_HSA), build_fold_addr_expr (hsa_img_descriptor)), - &hsa_cdtor_statements[0]); + hsa_ctor_stmts); - cgraph_build_static_cdtor ('I', hsa_cdtor_statements[0], - DEFAULT_INIT_PRIORITY); + cgraph_build_static_cdtor ('I', *hsa_ctor_stmts, DEFAULT_INIT_PRIORITY); tree offload_unregister = builtin_decl_explicit (BUILT_IN_GOMP_OFFLOAD_UNREGISTER); gcc_checking_assert (offload_unregister); + tree *hsa_dtor_stmts = hsa_get_dtor_statements (); append_to_statement_list (build_call_expr (offload_unregister, 4, build_int_cstu (unsigned_type_node, @@ -2433,9 +2432,8 @@ hsa_output_libgomp_mapping (tree brig_decl) build_fold_addr_expr (hsa_libgomp_host_table), build_int_cst (integer_type_node, GOMP_DEVICE_HSA), build_fold_addr_expr (hsa_img_descriptor)), - &hsa_cdtor_statements[1]); - cgraph_build_static_cdtor ('D', hsa_cdtor_statements[1], - DEFAULT_INIT_PRIORITY); + hsa_dtor_stmts); + cgraph_build_static_cdtor ('D', *hsa_dtor_stmts, DEFAULT_INIT_PRIORITY); } /* Emit the brig module we have compiled to a section in the final assembly and |