Hi, past participle of bind is bound, not binded (although ispell for some accepts it for some reason) and so I am going to fix this mistake in the name of the field. I know normally do not do this, but I believe that in this case the only out-of-tree patches affected are mine and so will make an exception.
Moreover, this patch allows for the field to be NULL, which will soon be handy on the branch. Thanks, Martin 2016-07-20 Martin Jambor <mjam...@suse.cz> gcc/ * hsa.h (hsa_function_summary): Rename m_binded_function to m_bound_function. * hsa-gen.c (hsa_get_host_function): Handle functions with no bound CPU implementation. Fix binded to bound. (get_brig_function_name): Likewise. * hsa.c (link_functions): Adjust after renaming m_binded_functions to m_bound_functions. * ipa-hsa.c (process_hsa_functions): Likewise. (ipa_hsa_write_summary): Likewise. (ipa_hsa_read_section): Likewise. --- gcc/hsa-gen.c | 8 +++++--- gcc/hsa.c | 4 ++-- gcc/hsa.h | 6 +++--- gcc/ipa-hsa.c | 12 ++++++------ 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/gcc/hsa-gen.c b/gcc/hsa-gen.c index 5208dab..e16a5c7 100644 --- a/gcc/hsa-gen.c +++ b/gcc/hsa-gen.c @@ -894,7 +894,7 @@ hsa_get_host_function (tree decl) gcc_assert (s->m_kind != HSA_NONE); gcc_assert (s->m_gpu_implementation_p); - return s->m_binded_function->decl; + return s->m_bound_function ? s->m_bound_function->decl : NULL; } /* Return true if function DECL has a host equivalent function. */ @@ -905,8 +905,10 @@ get_brig_function_name (tree decl) tree d = decl; hsa_function_summary *s = hsa_summaries->get (cgraph_node::get_create (d)); - if (s->m_kind != HSA_NONE && s->m_gpu_implementation_p) - d = s->m_binded_function->decl; + if (s->m_kind != HSA_NONE + && s->m_gpu_implementation_p + && s->m_bound_function) + d = s->m_bound_function->decl; /* IPA split can create a function that has no host equivalent. */ if (d == NULL) diff --git a/gcc/hsa.c b/gcc/hsa.c index caca939..9f02bba 100644 --- a/gcc/hsa.c +++ b/gcc/hsa.c @@ -847,8 +847,8 @@ hsa_summary_t::link_functions (cgraph_node *gpu, cgraph_node *host, gpu_summary->m_gridified_kernel_p = gridified_kernel_p; host_summary->m_gridified_kernel_p = gridified_kernel_p; - gpu_summary->m_binded_function = host; - host_summary->m_binded_function = gpu; + gpu_summary->m_bound_function = host; + host_summary->m_bound_function = gpu; process_gpu_implementation_attributes (gpu->decl); diff --git a/gcc/hsa.h b/gcc/hsa.h index 4d98bb3..092fd3b 100644 --- a/gcc/hsa.h +++ b/gcc/hsa.h @@ -1291,9 +1291,9 @@ struct hsa_function_summary hsa_function_kind m_kind; /* Pointer to a cgraph node which is a HSA implementation of the function. - In case of the function is a HSA function, the binded function points + In case of the function is a HSA function, the bound function points to the host function. */ - cgraph_node *m_binded_function; + cgraph_node *m_bound_function; /* Identifies if the function is an HSA function or a host function. */ bool m_gpu_implementation_p; @@ -1304,7 +1304,7 @@ struct hsa_function_summary inline hsa_function_summary::hsa_function_summary (): m_kind (HSA_NONE), - m_binded_function (NULL), m_gpu_implementation_p (false) + m_bound_function (NULL), m_gpu_implementation_p (false) { } diff --git a/gcc/ipa-hsa.c b/gcc/ipa-hsa.c index 769657f..9ab4927 100644 --- a/gcc/ipa-hsa.c +++ b/gcc/ipa-hsa.c @@ -79,7 +79,7 @@ process_hsa_functions (void) hsa_function_summary *s = hsa_summaries->get (node); /* A linked function is skipped. */ - if (s->m_binded_function != NULL) + if (s->m_bound_function != NULL) continue; if (s->m_kind != HSA_NONE) @@ -131,7 +131,7 @@ process_hsa_functions (void) hsa_function_summary *dst = hsa_summaries->get (e->callee); if (dst->m_kind != HSA_NONE && !dst->m_gpu_implementation_p) { - e->redirect_callee (dst->m_binded_function); + e->redirect_callee (dst->m_bound_function); if (dump_file) fprintf (dump_file, "Redirecting edge to HSA function: %s->%s\n", @@ -193,10 +193,10 @@ ipa_hsa_write_summary (void) bp = bitpack_create (ob->main_stream); bp_pack_value (&bp, s->m_kind, 2); bp_pack_value (&bp, s->m_gpu_implementation_p, 1); - bp_pack_value (&bp, s->m_binded_function != NULL, 1); + bp_pack_value (&bp, s->m_bound_function != NULL, 1); streamer_write_bitpack (&bp); - if (s->m_binded_function) - stream_write_tree (ob, s->m_binded_function->decl, true); + if (s->m_bound_function) + stream_write_tree (ob, s->m_bound_function->decl, true); } } @@ -249,7 +249,7 @@ ipa_hsa_read_section (struct lto_file_decl_data *file_data, const char *data, if (has_tree) { tree decl = stream_read_tree (&ib_main, data_in); - s->m_binded_function = cgraph_node::get_create (decl); + s->m_bound_function = cgraph_node::get_create (decl); } } lto_free_section_data (file_data, LTO_section_ipa_hsa, NULL, data, -- 2.9.0