aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-parloops.c
diff options
context:
space:
mode:
authorTom de Vries <tom@codesourcery.com>2015-03-21 10:14:10 +0000
committerTom de Vries <vries@gcc.gnu.org>2015-03-21 10:14:10 +0000
commita79b7ec516a40f54db581dc4223ef4ebaa8e6884 (patch)
tree3e31088bf1f5cd99f298747e11fb859e37c8927f /gcc/tree-parloops.c
parent2691415b63b472998f128ef2299146e7950918fc (diff)
downloadgcc-a79b7ec516a40f54db581dc4223ef4ebaa8e6884.zip
gcc-a79b7ec516a40f54db581dc4223ef4ebaa8e6884.tar.gz
gcc-a79b7ec516a40f54db581dc4223ef4ebaa8e6884.tar.bz2
Mark omp thread functions as parallelized
2015-03-21 Tom de Vries <tom@codesourcery.com> PR tree-optimization/65458 * cgraph.c (cgraph_node::dump): Handle parallelized_function field. * cgraph.h (cgraph_node): Add parallelized_function field. * lto-cgraph.c (lto_output_node): Write parallelized_function field. (input_overwrite_node): Read parallelized_function field. * omp-low.c (expand_omp_taskreg, finalize_task_copyfn): Set parallelized_function on cgraph_node for child_fn. * tree-parloops.c: Add include of plugin-api.h, ipa-ref.h and cgraph.h. Remove include of gt-tree-parloops.h. (parallelized_functions): Remove static variable. (parallelized_function_p): Rewrite using parallelized_function field of cgraph_node. (create_loop_fn): Remove adding to parallelized_functions. * Makefile.in (GTFILES): Remove tree-parloops.c From-SVN: r221551
Diffstat (limited to 'gcc/tree-parloops.c')
-rw-r--r--gcc/tree-parloops.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index a584460..62a6444 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -75,6 +75,9 @@ along with GCC; see the file COPYING3. If not see
#include "tree-parloops.h"
#include "omp-low.h"
#include "tree-nested.h"
+#include "plugin-api.h"
+#include "ipa-ref.h"
+#include "cgraph.h"
/* This pass tries to distribute iterations of loops into several threads.
The implementation is straightforward -- for each loop we test whether its
@@ -1422,21 +1425,14 @@ separate_decls_in_region (edge entry, edge exit,
}
}
-/* Bitmap containing uids of functions created by parallelization. We cannot
- allocate it from the default obstack, as it must live across compilation
- of several functions; we make it gc allocated instead. */
-
-static GTY(()) bitmap parallelized_functions;
-
-/* Returns true if FN was created by create_loop_fn. */
+/* Returns true if FN was created to run in parallel. */
bool
-parallelized_function_p (tree fn)
+parallelized_function_p (tree fndecl)
{
- if (!parallelized_functions || !DECL_ARTIFICIAL (fn))
- return false;
-
- return bitmap_bit_p (parallelized_functions, DECL_UID (fn));
+ cgraph_node *node = cgraph_node::get (fndecl);
+ gcc_assert (node != NULL);
+ return node->parallelized_function;
}
/* Creates and returns an empty function that will receive the body of
@@ -1459,10 +1455,6 @@ create_loop_fn (location_t loc)
type = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
decl = build_decl (loc, FUNCTION_DECL, name, type);
- if (!parallelized_functions)
- parallelized_functions = BITMAP_GGC_ALLOC ();
- bitmap_set_bit (parallelized_functions, DECL_UID (decl));
-
TREE_STATIC (decl) = 1;
TREE_USED (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
@@ -2314,6 +2306,3 @@ make_pass_parallelize_loops (gcc::context *ctxt)
{
return new pass_parallelize_loops (ctxt);
}
-
-
-#include "gt-tree-parloops.h"