mkoffload.c (process): Constify target data.
gcc/ * config/nvptx/mkoffload.c (process): Constify target data. * config/i386/intelmic-mkoffload.c (generate_target_descr_file): Constify target data. (generate_target_offloadend_file): Likewise. libgomp/ * libgomp.h (gomp_device_descr): Constify target data arguments. * target.c (struct offload_image_descr): Constify target_data. (gomp_offload_image_to_device): Likewise. (GOMP_offload_register): Likewise. (GOMP_offload_unrefister): Likewise. * plugin/plugin-host.c (GOMP_OFFLOAD_load_image, GOMP_OFFLOAD_unload_image): Constify target data. * plugin/plugin-nvptx.c (struct ptx_image_data): Constify target data. (GOMP_OFFLOAD_load_image, GOMP_OFFLOAD_unload_image): Likewise. liboffloadmic/ * plugin/libgomp-plugin-intelmic.cpp (ImgDevAddrMap): Constify. (offload_image, GOMP_OFFLOAD_load_image, OMP_OFFLOAD_unload_image): Constify target data. From-SVN: r225936
This commit is contained in:
parent
996d027a36
commit
afb2d80bc5
@ -1,3 +1,10 @@
|
||||
2015-07-17 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* config/nvptx/mkoffload.c (process): Constify target data.
|
||||
* config/i386/intelmic-mkoffload.c (generate_target_descr_file):
|
||||
Constify target data.
|
||||
(generate_target_offloadend_file): Likewise.
|
||||
|
||||
2015-07-17 Yuri Rumyantsev <ysrumyan@gmail.com>
|
||||
|
||||
* tree-vect-loop-manip.c (rename_variables_in_bb): Add argument
|
||||
|
@ -241,18 +241,18 @@ generate_target_descr_file (const char *target_compiler)
|
||||
fatal_error (input_location, "cannot open '%s'", src_filename);
|
||||
|
||||
fprintf (src_file,
|
||||
"extern void *__offload_funcs_end[];\n"
|
||||
"extern void *__offload_vars_end[];\n\n"
|
||||
"extern const void *const __offload_funcs_end[];\n"
|
||||
"extern const void *const __offload_vars_end[];\n\n"
|
||||
|
||||
"void *__offload_func_table[0]\n"
|
||||
"const void *const __offload_func_table[0]\n"
|
||||
"__attribute__ ((__used__, visibility (\"hidden\"),\n"
|
||||
"section (\".gnu.offload_funcs\"))) = { };\n\n"
|
||||
|
||||
"void *__offload_var_table[0]\n"
|
||||
"const void *const __offload_var_table[0]\n"
|
||||
"__attribute__ ((__used__, visibility (\"hidden\"),\n"
|
||||
"section (\".gnu.offload_vars\"))) = { };\n\n"
|
||||
|
||||
"void *__OFFLOAD_TARGET_TABLE__[]\n"
|
||||
"const void *const __OFFLOAD_TARGET_TABLE__[]\n"
|
||||
"__attribute__ ((__used__, visibility (\"hidden\"))) = {\n"
|
||||
" &__offload_func_table, &__offload_funcs_end,\n"
|
||||
" &__offload_var_table, &__offload_vars_end\n"
|
||||
@ -301,11 +301,11 @@ generate_target_offloadend_file (const char *target_compiler)
|
||||
fatal_error (input_location, "cannot open '%s'", src_filename);
|
||||
|
||||
fprintf (src_file,
|
||||
"void *__offload_funcs_end[0]\n"
|
||||
"const void *const __offload_funcs_end[0]\n"
|
||||
"__attribute__ ((__used__, visibility (\"hidden\"),\n"
|
||||
"section (\".gnu.offload_funcs\"))) = { };\n\n"
|
||||
|
||||
"void *__offload_vars_end[0]\n"
|
||||
"const void *const __offload_vars_end[0]\n"
|
||||
"__attribute__ ((__used__, visibility (\"hidden\"),\n"
|
||||
"section (\".gnu.offload_vars\"))) = { };\n");
|
||||
fclose (src_file);
|
||||
@ -339,10 +339,10 @@ generate_host_descr_file (const char *host_compiler)
|
||||
|
||||
fprintf (src_file,
|
||||
"extern void *__OFFLOAD_TABLE__;\n"
|
||||
"extern void *__offload_image_intelmic_start;\n"
|
||||
"extern void *__offload_image_intelmic_end;\n\n"
|
||||
"extern const void *const __offload_image_intelmic_start;\n"
|
||||
"extern const void *const __offload_image_intelmic_end;\n\n"
|
||||
|
||||
"static const void *__offload_target_data[] = {\n"
|
||||
"static const void *const __offload_target_data[] = {\n"
|
||||
" &__offload_image_intelmic_start, &__offload_image_intelmic_end\n"
|
||||
"};\n\n");
|
||||
|
||||
@ -350,11 +350,11 @@ generate_host_descr_file (const char *host_compiler)
|
||||
"#ifdef __cplusplus\n"
|
||||
"extern \"C\"\n"
|
||||
"#endif\n"
|
||||
"void GOMP_offload_register (void *, int, void *);\n"
|
||||
"void GOMP_offload_register (void *, int, const void *);\n"
|
||||
"#ifdef __cplusplus\n"
|
||||
"extern \"C\"\n"
|
||||
"#endif\n"
|
||||
"void GOMP_offload_unregister (void *, int, void *);\n\n"
|
||||
"void GOMP_offload_unregister (void *, int, const void *);\n\n"
|
||||
|
||||
"__attribute__((constructor))\n"
|
||||
"static void\n"
|
||||
|
@ -863,7 +863,7 @@ process (FILE *in, FILE *out)
|
||||
fprintf (out, "};\n\n");
|
||||
|
||||
fprintf (out,
|
||||
"static struct nvptx_tdata {\n"
|
||||
"static const struct nvptx_tdata {\n"
|
||||
" const char *ptx_src;\n"
|
||||
" const char *const *var_names;\n"
|
||||
" __SIZE_TYPE__ var_num;\n"
|
||||
@ -880,7 +880,8 @@ process (FILE *in, FILE *out)
|
||||
fprintf (out, "#ifdef __cplusplus\n"
|
||||
"extern \"C\" {\n"
|
||||
"#endif\n");
|
||||
fprintf (out, "extern void GOMP_offload_register (void *, int, void *);\n");
|
||||
fprintf (out, "extern void GOMP_offload_register"
|
||||
" (void *, int, const void *);\n");
|
||||
fprintf (out, "#ifdef __cplusplus\n"
|
||||
"}\n"
|
||||
"#endif\n");
|
||||
|
@ -1,3 +1,15 @@
|
||||
2015-07-17 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* libgomp.h (gomp_device_descr): Constify target data arguments.
|
||||
* target.c (struct offload_image_descr): Constify target_data.
|
||||
(gomp_offload_image_to_device): Likewise.
|
||||
(GOMP_offload_register): Likewise.
|
||||
(GOMP_offload_unrefister): Likewise.
|
||||
* plugin/plugin-host.c (GOMP_OFFLOAD_load_image,
|
||||
GOMP_OFFLOAD_unload_image): Constify target data.
|
||||
* plugin/plugin-nvptx.c (struct ptx_image_data): Constify target data.
|
||||
(GOMP_OFFLOAD_load_image, GOMP_OFFLOAD_unload_image): Likewise.
|
||||
|
||||
2015-07-16 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* plugin/plugin-nvptx.c (link_ptx): Constify string argument.
|
||||
|
@ -748,8 +748,8 @@ struct gomp_device_descr
|
||||
int (*get_num_devices_func) (void);
|
||||
void (*init_device_func) (int);
|
||||
void (*fini_device_func) (int);
|
||||
int (*load_image_func) (int, void *, struct addr_pair **);
|
||||
void (*unload_image_func) (int, void *);
|
||||
int (*load_image_func) (int, const void *, struct addr_pair **);
|
||||
void (*unload_image_func) (int, const void *);
|
||||
void *(*alloc_func) (int, size_t);
|
||||
void (*free_func) (int, void *);
|
||||
void *(*dev2host_func) (int, void *, const void *, size_t);
|
||||
|
@ -111,7 +111,7 @@ GOMP_OFFLOAD_fini_device (int n __attribute__ ((unused)))
|
||||
|
||||
STATIC int
|
||||
GOMP_OFFLOAD_load_image (int n __attribute__ ((unused)),
|
||||
void *i __attribute__ ((unused)),
|
||||
const void *t __attribute__ ((unused)),
|
||||
struct addr_pair **r __attribute__ ((unused)))
|
||||
{
|
||||
return 0;
|
||||
@ -119,7 +119,7 @@ GOMP_OFFLOAD_load_image (int n __attribute__ ((unused)),
|
||||
|
||||
STATIC void
|
||||
GOMP_OFFLOAD_unload_image (int n __attribute__ ((unused)),
|
||||
void *i __attribute__ ((unused)))
|
||||
const void *t __attribute__ ((unused)))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -334,7 +334,7 @@ struct ptx_event
|
||||
|
||||
struct ptx_image_data
|
||||
{
|
||||
void *target_data;
|
||||
const void *target_data;
|
||||
CUmodule module;
|
||||
struct ptx_image_data *next;
|
||||
};
|
||||
@ -1633,7 +1633,7 @@ typedef struct nvptx_tdata
|
||||
} nvptx_tdata_t;
|
||||
|
||||
int
|
||||
GOMP_OFFLOAD_load_image (int ord, void *target_data,
|
||||
GOMP_OFFLOAD_load_image (int ord, const void *target_data,
|
||||
struct addr_pair **target_table)
|
||||
{
|
||||
CUmodule module;
|
||||
@ -1641,7 +1641,7 @@ GOMP_OFFLOAD_load_image (int ord, void *target_data,
|
||||
unsigned int fn_entries, var_entries, i, j;
|
||||
CUresult r;
|
||||
struct targ_fn_descriptor *targ_fns;
|
||||
nvptx_tdata_t const *img_header = (nvptx_tdata_t const *) target_data;
|
||||
const nvptx_tdata_t *img_header = (const nvptx_tdata_t *) target_data;
|
||||
struct ptx_image_data *new_image;
|
||||
|
||||
GOMP_OFFLOAD_init_device (ord);
|
||||
@ -1704,9 +1704,10 @@ GOMP_OFFLOAD_load_image (int ord, void *target_data,
|
||||
}
|
||||
|
||||
void
|
||||
GOMP_OFFLOAD_unload_image (int tid __attribute__((unused)), void *target_data)
|
||||
GOMP_OFFLOAD_unload_image (int tid __attribute__((unused)),
|
||||
const void *target_data)
|
||||
{
|
||||
void **img_header = (void **) target_data;
|
||||
const void *const *img_header = (const void *const *) target_data;
|
||||
struct targ_fn_descriptor *targ_fns
|
||||
= (struct targ_fn_descriptor *) img_header[0];
|
||||
struct ptx_image_data *image, *prev = NULL, *newhd = NULL;
|
||||
|
@ -58,7 +58,7 @@ static gomp_mutex_t register_lock;
|
||||
struct offload_image_descr {
|
||||
enum offload_target_type type;
|
||||
void *host_table;
|
||||
void *target_data;
|
||||
const void *target_data;
|
||||
};
|
||||
|
||||
/* Array of descriptors of offload images. */
|
||||
@ -642,7 +642,7 @@ gomp_update (struct gomp_device_descr *devicep, size_t mapnum, void **hostaddrs,
|
||||
|
||||
static void
|
||||
gomp_offload_image_to_device (struct gomp_device_descr *devicep,
|
||||
void *host_table, void *target_data,
|
||||
void *host_table, const void *target_data,
|
||||
bool is_register_lock)
|
||||
{
|
||||
void **host_func_table = ((void ***) host_table)[0];
|
||||
@ -731,7 +731,7 @@ gomp_offload_image_to_device (struct gomp_device_descr *devicep,
|
||||
|
||||
void
|
||||
GOMP_offload_register (void *host_table, enum offload_target_type target_type,
|
||||
void *target_data)
|
||||
const void *target_data)
|
||||
{
|
||||
int i;
|
||||
gomp_mutex_lock (®ister_lock);
|
||||
@ -765,7 +765,7 @@ GOMP_offload_register (void *host_table, enum offload_target_type target_type,
|
||||
|
||||
void
|
||||
GOMP_offload_unregister (void *host_table, enum offload_target_type target_type,
|
||||
void *target_data)
|
||||
const void *target_data)
|
||||
{
|
||||
void **host_func_table = ((void ***) host_table)[0];
|
||||
void **host_funcs_end = ((void ***) host_table)[1];
|
||||
|
@ -1,3 +1,10 @@
|
||||
2015-07-17 Nathan Sidwell <nathan@acm.org>
|
||||
Ilya Verbin <iverbin@gmail.com>
|
||||
|
||||
* plugin/libgomp-plugin-intelmic.cpp (ImgDevAddrMap): Constify.
|
||||
(offload_image, GOMP_OFFLOAD_load_image,
|
||||
OMP_OFFLOAD_unload_image): Constify target data.
|
||||
|
||||
2015-07-08 Thomas Schwinge <thomas@codesourcery.com>
|
||||
|
||||
* plugin/Makefile.am (main_target_image.h): Change type of data
|
||||
|
@ -61,7 +61,7 @@ typedef std::vector<addr_pair> AddrVect;
|
||||
typedef std::vector<AddrVect> DevAddrVect;
|
||||
|
||||
/* Addresses for all images and all devices. */
|
||||
typedef std::map<void *, DevAddrVect> ImgDevAddrMap;
|
||||
typedef std::map<const void *, DevAddrVect> ImgDevAddrMap;
|
||||
|
||||
|
||||
/* Total number of available devices. */
|
||||
@ -255,7 +255,7 @@ get_target_table (int device, int &num_funcs, int &num_vars, void **&table)
|
||||
corresponding target addresses. */
|
||||
|
||||
static void
|
||||
offload_image (void *target_image)
|
||||
offload_image (const void *target_image)
|
||||
{
|
||||
struct TargetImage {
|
||||
int64_t size;
|
||||
@ -328,7 +328,8 @@ offload_image (void *target_image)
|
||||
}
|
||||
|
||||
extern "C" int
|
||||
GOMP_OFFLOAD_load_image (int device, void *target_image, addr_pair **result)
|
||||
GOMP_OFFLOAD_load_image (int device, const void *target_image,
|
||||
addr_pair **result)
|
||||
{
|
||||
TRACE ("(device = %d, target_image = %p)", device, target_image);
|
||||
|
||||
@ -352,7 +353,7 @@ GOMP_OFFLOAD_load_image (int device, void *target_image, addr_pair **result)
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
GOMP_OFFLOAD_unload_image (int device, void *target_image)
|
||||
GOMP_OFFLOAD_unload_image (int device, const void *target_image)
|
||||
{
|
||||
TRACE ("(device = %d, target_image = %p)", device, target_image);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user