diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2015-09-30 21:35:47 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2015-09-30 21:35:47 +0000 |
commit | cc3cd79bc2050c45981d0c9d3efa7b7d27154eab (patch) | |
tree | ba753ab0a28be62f5e292c36f6d08ca0e7094301 /gcc | |
parent | c57173b69a617edf59ed2e73edda183e7aebf05e (diff) | |
download | gcc-cc3cd79bc2050c45981d0c9d3efa7b7d27154eab.zip gcc-cc3cd79bc2050c45981d0c9d3efa7b7d27154eab.tar.gz gcc-cc3cd79bc2050c45981d0c9d3efa7b7d27154eab.tar.bz2 |
mkoffload.c (process): Change offload data format.
gcc/
* config/nvptx/mkoffload.c (process): Change offload data format.
libgomp/
* plugin/plugin-nvptx.c (targ_fn_launch): Use GOMP_DIM_MAX.
(struct targ_ptx_obj): New.
(nvptx_tdata): Move earlier, change data format.
(link_ptx): Take targ_ptx_obj ptr and count. Allow multiple
objects.
(GOMP_OFFLOAD_load_image): Adjust.
Co-Authored-By: Bernd Schmidt <bernds@codesourcery.com>
From-SVN: r228308
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/config/nvptx/mkoffload.c | 28 |
2 files changed, 25 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ba25406..6b53048 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2015-09-30 Nathan Sidwell <nathan@codesourcery.com> + + * config/nvptx/mkoffload.c (process): Change offload data format. + 2015-09-30 Jeff Law <law@redhat.com> * tree-ssa-dom.c (optimize_stmt): Collapse control flow statements diff --git a/gcc/config/nvptx/mkoffload.c b/gcc/config/nvptx/mkoffload.c index 99c0254..926c82b 100644 --- a/gcc/config/nvptx/mkoffload.c +++ b/gcc/config/nvptx/mkoffload.c @@ -843,39 +843,53 @@ process (FILE *in, FILE *out) Token *tok = tokenize (input); const char *comma; id_map const *id; + unsigned obj_count = 0; + unsigned ix; do tok = parse_file (tok); while (tok->kind); - fprintf (out, "static const char ptx_code[] = \n"); + fprintf (out, "static const char ptx_code_%u[] = \n", obj_count++); write_stmts (out, rev_stmts (decls)); write_stmts (out, rev_stmts (vars)); write_stmts (out, rev_stmts (fns)); fprintf (out, ";\n\n"); + /* Dump out array of pointers to ptx object strings. */ + fprintf (out, "static const struct ptx_obj {\n" + " const char *code;\n" + " __SIZE_TYPE__ size;\n" + "} ptx_objs[] = {"); + for (comma = "", ix = 0; ix != obj_count; comma = ",", ix++) + fprintf (out, "%s\n\t{ptx_code_%u, sizeof (ptx_code_%u)}", comma, ix, ix); + fprintf (out, "\n};\n\n"); + + /* Dump out variable idents. */ fprintf (out, "static const char *const var_mappings[] = {"); for (comma = "", id = var_ids; id; comma = ",", id = id->next) fprintf (out, "%s\n\t%s", comma, id->ptx_name); fprintf (out, "\n};\n\n"); + /* Dump out function idents. */ fprintf (out, "static const struct nvptx_fn {\n" " const char *name;\n" - " unsigned short dim[3];\n" - "} func_mappings[] = {\n"); + " unsigned short dim[%d];\n" + "} func_mappings[] = {\n", GOMP_DIM_MAX); for (comma = "", id = func_ids; id; comma = ",", id = id->next) fprintf (out, "%s\n\t{%s}", comma, id->ptx_name); fprintf (out, "\n};\n\n"); fprintf (out, "static const struct nvptx_tdata {\n" - " const char *ptx_src;\n" + " const struct ptx_obj *ptx_objs;\n" + " unsigned ptx_num;\n" " const char *const *var_names;\n" - " __SIZE_TYPE__ var_num;\n" + " unsigned var_num;\n" " const struct nvptx_fn *fn_names;\n" - " __SIZE_TYPE__ fn_num;\n" + " unsigned fn_num;\n" "} target_data = {\n" - " ptx_code,\n" + " ptx_objs, sizeof (ptx_objs) / sizeof (ptx_objs[0]),\n" " var_mappings," " sizeof (var_mappings) / sizeof (var_mappings[0]),\n" " func_mappings," |