@@ -1,3 +1,8 @@
+2014-04-02 Thomas Schwinge <thomas@codesourcery.com>
+
+ * omp-low.c (expand_oacc_offload): Handle __OPENMP_TARGET__
+ symbol.
+
2014-03-20 Thomas Schwinge <thomas@codesourcery.com>
* gimple.h (enum gf_mask): Add GF_OMP_FOR_KIND_OACC_LOOP.
@@ -5138,13 +5138,15 @@ expand_oacc_offload (struct omp_region *region)
}
gimple g;
- /* FIXME: This will be address of
- extern char __OPENMP_TARGET__[] __attribute__((visibility ("hidden")))
- symbol, as soon as the linker plugin is able to create it for us. */
- tree openmp_target = build_zero_cst (ptr_type_node);
+ tree openmp_target
+ = build_decl (UNKNOWN_LOCATION, VAR_DECL,
+ get_identifier ("__OPENMP_TARGET__"), ptr_type_node);
+ TREE_PUBLIC (openmp_target) = 1;
+ DECL_EXTERNAL (openmp_target) = 1;
tree fnaddr = build_fold_addr_expr (child_fn);
- g = gimple_build_call (builtin_decl_explicit (start_ix),
- 10, device, fnaddr, openmp_target, t1, t2, t3, t4,
+ g = gimple_build_call (builtin_decl_explicit (start_ix), 10, device,
+ fnaddr, build_fold_addr_expr (openmp_target),
+ t1, t2, t3, t4,
t_num_gangs, t_num_workers, t_vector_length);
gimple_set_location (g, gimple_location (entry_stmt));
gsi_insert_before (&gsi, g, GSI_SAME_STMT);
> +/* Create new symbol containing (address, size) pairs for omp-marked
> + functions and global variables. */
> +void
> +omp_finish_file (void)
> +{
> + struct cgraph_node *node;
> + struct varpool_node *vnode;
> + const char *funcs_section_name = ".offload_func_table_section";
> + const char *vars_section_name = ".offload_var_table_section";
> + vec<tree, va_gc> *v_funcs, *v_vars;
> +
> + vec_alloc (v_vars, 0);
> + vec_alloc (v_funcs, 0);
> +
> + [...]
> + unsigned num_vars = vec_safe_length (v_vars);
> + unsigned num_funcs = vec_safe_length (v_funcs);
> + [...]
> + if (targetm_common.have_named_sections)
> + {
> + [...]
> + }
> + else
> + {
> + for (unsigned i = 0; i < num_funcs; i++)
> + {
> + tree it = (*v_funcs)[i];
> + targetm.record_offload_symbol (it);
> + }
> + for (unsigned i = 0; i < num_funcs; i++)
> + {
> + tree it = (*v_vars)[i];
> + targetm.record_offload_symbol (it);
> + }
> + }
> +}
Committed in r209014:
commit abae7b762c0b9787dd21e863561af44472096eb3
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed Apr 2 08:29:07 2014 +0000
Fix typo/copy'n'pasto.
gcc/
* omp-low.c (omp_finish_file): Use num_vars instead of num_funcs
when recording offload symbols v_vars.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@209014 138bc75d-0d04-0410-961f-82ee72b054a4
---
gcc/ChangeLog.gomp | 3 +++
gcc/omp-low.c | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
@@ -1,5 +1,8 @@
2014-04-02 Thomas Schwinge <thomas@codesourcery.com>
+ * omp-low.c (omp_finish_file): Use num_vars instead of num_funcs
+ when recording offload symbols v_vars.
+
* omp-low.c (expand_oacc_offload): Handle __OPENMP_TARGET__
symbol.
@@ -12934,7 +12934,7 @@ omp_finish_file (void)
tree it = (*v_funcs)[i];
targetm.record_offload_symbol (it);
}
- for (unsigned i = 0; i < num_funcs; i++)
+ for (unsigned i = 0; i < num_vars; i++)
{
tree it = (*v_vars)[i];
targetm.record_offload_symbol (it);