25 #include "pips_config.h"
41 #include "constants.h"
50 #include "resources.h"
65 char * found_s = strstr(e_name,
prefix);
66 return found_s != NULL;
89 size_t prefix_size = strlen(
prefix);
95 pips_debug(5,
"looking for %s server variable name\n", buffer_name);
98 pips_assert(
"the input entity is a sesam_buffer var",
99 strstr(buffer_name,
prefix)!=NULL);
102 const char * name_without_prefix = &buffer_name[prefix_size];
103 pips_debug(5,
"name_without_prefix is %s\n", name_without_prefix);
104 size_t s_without_prefix = strlen(name_without_prefix);
106 string found_suffix = strstr(name_without_prefix, suffix);
107 pips_debug(5,
"found_suffix is %s\n", found_suffix);
109 size_t s_name_end = strlen(found_suffix);
111 size_t size_var_name = s_without_prefix - s_name_end;
112 pips_debug(5,
"s_without_prefix = %zd\n", s_without_prefix);
113 pips_debug(5,
"s_name_end = %zd\n", s_name_end);
114 pips_debug(5,
"size_var_name = %zd\n", size_var_name);
116 char *res_name =
strndup(name_without_prefix, size_var_name);
118 pips_debug(5,
"found server variable name: %s\n", res_name);
136 pips_debug(5,
"checking entity %s\n", e_name);
138 char * found_s = strstr(e_name,
prefix);
140 return (found_s != NULL);
293 const char * task_prefix)
300 fprintf(fp,
"\n%s%s%s\n",
"#ifdef ", task_prefix, task_name);
301 fprintf(fp,
"#define %s%s_p 1\n", task_prefix, task_name);
319 fprintf(fp,
"#define %s%s_p 0\n", task_prefix, task_name);
333 string buffers_header_name = NULL;
334 string local_buffers_header_name = NULL;
336 local_buffers_header_name =
339 buffers_header_name =
341 "/", local_buffers_header_name, NULL));
351 fprintf(fp,
"%s%d\n",
"#define NB_BUFFERS ",
362 "_id ",
int2a(buf_id));
392 free(buffers_header_name);
395 char * server_file_name =
408 free(server_file_name);
411 local_buffers_header_name);
424 "SCALOPES_DEBUG_LEVEL");
453 "SCALOPES_DEBUG_LEVEL");
void extend_entity_task_buffers(entity_task_buffers f, entity k, task_buffers v)
bool bound_entity_task_buffers_p(entity_task_buffers f, entity k)
sesam_buffers_processing_context make_sesam_buffers_processing_context(set a1, set a2, entity_task_buffers a3, entity_task_buffers a4, set a5)
task_buffers make_task_buffers(set a1, set a2)
entity_task_buffers make_entity_task_buffers(void)
task_buffers apply_entity_task_buffers(entity_task_buffers f, entity k)
void free_sesam_buffers_processing_context(sesam_buffers_processing_context p)
static statement module_statement
#define pips_debug_effect(level, message, eff)
for debug
void set_cumulated_rw_effects(statement_effects)
list load_cumulated_rw_effects_list(statement)
void reset_cumulated_rw_effects(void)
void reset_methods_for_effects_prettyprint(const char *)
void set_methods_for_rw_effects_prettyprint(const char *)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
#define effect_read_p(eff)
#define effect_scalar_p(eff) entity_scalar_p(effect_entity(eff))
entity effect_entity(effect)
cproto-generated files
const char * module_name(const char *s)
Return the module part of an entity name.
FILE * safe_fopen(const char *filename, const char *what)
char * get_string_property(const char *)
int safe_fclose(FILE *stream, const char *filename)
#define gen_context_recurse(start, ctxt, domain_number, flt, rwt)
const char * get_current_module_name(void)
Get the name of the current module.
void gen_null2(__attribute__((unused)) void *u1, __attribute__((unused)) void *u2)
idem with 2 args, to please overpeaky compiler checks
#define ENDP(l)
Test if a list is empty.
size_t gen_length(const list l)
void gen_free_list(list l)
free the spine of the list
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
#define PIPS_PHASE_POSTLUDE(new_module_statement)
End a transformation phase by putting back into PIPS the (possibly) modified statement.
#define PIPS_PHASE_PRELUDE(module_name, debug_env_var)
Start a phase that use a module CODE.
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
#define DB_PUT_FILE_RESOURCE
Put a file resource into the current workspace database.
string db_build_file_resource_name(const char *rname, const char *oname, const char *suffix)
returns an allocated file name for a file resource.
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
#define TOP_LEVEL_MODULE_NAME
Module containing the global variables in Fortran and C.
string concatenate(const char *,...)
Return the concatenation of the given strings.
list set_to_sorted_list(const set, gen_cmp_func_t)
bool set_belong_p(const set, const void *)
set set_make(set_type)
Create an empty set of any type but hash_private.
set set_add_element(set, const set, const void *)
int(* gen_cmp_func_t)(const void *, const void *)
string db_get_current_workspace_directory(void)
static const char * prefix
const char * entity_user_name(entity e)
Since entity_local_name may contain PIPS special characters such as prefixes (label,...
entity FindEntity(const char *package, const char *name)
Retrieve an entity from its package/module name and its local name.
int compare_entities(const entity *pe1, const entity *pe2)
Comparison function for qsort.
entity FindEntityFromUserName(const char *package, const char *name)
#define statement_domain
newgen_sizeofexpression_domain_defined
#define statement_label(x)
#define entity_undefined_p(x)
#define reference_indices(x)
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
#define sesam_buffers_processing_context_undefined
#define sesam_buffers_processing_context_buffers(x)
#define sesam_buffers_processing_context_server_buffers(x)
#define sesam_buffers_processing_context_kernel_buffers(x)
#define sesam_buffers_processing_context_server_tasks(x)
#define task_buffers_output(x)
#define task_buffers_input(x)
#define sesam_buffers_processing_context_kernel_tasks(x)
static bool sesam_task_label_p(entity e)
returns true if the input label entity name is prefixed by SCALOPES_KERNEL_TASK_PREFIX
static void print_sesam_tasks_buffers_header(const char *module_name, sesam_buffers_processing_context sbp_context)
prints a header file describing how the targeted sesam application uses buffers
static bool entity_sesam_buffer_p(entity e)
returns true if the entity name is prefixed by ISOLATE_STATEMENT_VAR_PREFIX.
static entity sesam_buffer_to_server_entity(entity buffer)
retrieves the original entity from an entity generated by isolate_statement
static void sbp_context_init(sesam_buffers_processing_context *sbp_context)
initalizes the object describing how the targeted sesam application uses buffers all sets and hash ta...
bool sesam_buffers_processing(const char *module_name)
PIPS phase that takes a module transformed by isolated statements and produces a header file describi...
static void print_entity_task_buffers(FILE *fp, set tasks, entity_task_buffers tasks_to_buffers, list l_buffers, const char *task_prefix)
prettyprints in input file how each task uses the buffers
static bool update_sesam_tasks_buffers(statement stmt, sesam_buffers_processing_context *sbp_context)
update the object describing how the targeted sesam application uses buffers with the current stateme...
bool sesam_servers_processing(const char *module_name)
static void sbp_context_add_kernel_task_buffer(sesam_buffers_processing_context *sbp_context, entity k_task, entity buffer, bool in_p)
updates sbp_context knowing that buffer will be a buffer (input if in_p is true, output otherwise) of...
char * strndup(char const *s, size_t n)
A replacement function, for systems that lack strndup.
FI: I do not understand why the type is duplicated at the set level.
The structure used to build lists in NewGen.