+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
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"
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);
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");
"#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"
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"
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");
+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.
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);
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;
STATIC void
GOMP_OFFLOAD_unload_image (int n __attribute__ ((unused)),
- void *i __attribute__ ((unused)))
+ const void *t __attribute__ ((unused)))
{
}
struct ptx_image_data
{
- void *target_data;
+ const void *target_data;
CUmodule module;
struct ptx_image_data *next;
};
} 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;
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);
}
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;
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. */
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];
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);
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];
+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
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. */
corresponding target addresses. */
static void
-offload_image (void *target_image)
+offload_image (const void *target_image)
{
struct TargetImage {
int64_t size;
}
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);
}
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);