summaryrefslogtreecommitdiff
path: root/gcc/cgraphunit.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-05-12 09:17:09 +0200
committerJakub Jelinek <jakub@redhat.com>2020-05-12 09:17:09 +0200
commitdc703151d4f4560e647649506d5b4ceb0ee11e90 (patch)
treee0982957d9abe22aec71e6199d1e306e9b0795ab /gcc/cgraphunit.c
parentfe8c8f1e5ed61f00c14ff36caf4f510a7a09781d (diff)
openmp: Implement discovery of implicit declare target to clausesHEADmaster
This attempts to implement what the OpenMP 5.0 spec in declare target section says as ammended by the 5.1 changes so far (related to device_type(host)), except that it doesn't have the device(ancestor: ...) handling yet because we do not support it yet, and I've left so far out the except lambda note, because I need that clarified. 2020-05-12 Jakub Jelinek <jakub@redhat.com> * omp-offload.h (omp_discover_implicit_declare_target): Declare. * omp-offload.c: Include context.h. (omp_declare_target_fn_p, omp_declare_target_var_p, omp_discover_declare_target_fn_r, omp_discover_declare_target_var_r, omp_discover_implicit_declare_target): New functions. * cgraphunit.c (analyze_functions): Call omp_discover_implicit_declare_target. * testsuite/libgomp.c/target-39.c: New test.
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r--gcc/cgraphunit.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 0563932a709..01b3f82a4b2 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -206,6 +206,7 @@ along with GCC; see the file COPYING3. If not see
#include "stringpool.h"
#include "attribs.h"
#include "ipa-inline.h"
+#include "omp-offload.h"
/* Queue of cgraph nodes scheduled to be added into cgraph. This is a
secondary queue used during optimization to accommodate passes that
@@ -1160,6 +1161,9 @@ analyze_functions (bool first_time)
node->fixup_same_cpp_alias_visibility (node->get_alias_target ());
build_type_inheritance_graph ();
+ if (flag_openmp && first_time)
+ omp_discover_implicit_declare_target ();
+
/* Analysis adds static variables that in turn adds references to new functions.
So we need to iterate the process until it stabilize. */
while (changed)