23 #include "pips_config.h"
33 #include "resources.h"
56 pips_debug(8,
"setting var %p as %s\n", var, is_glob?
"global":
"private");
85 "variable must be a pointer type");
92 is_glob?
"global":
"private", is_glob?
"private":
"global");
163 int dom = * (
int*) stuff;
165 pips_debug(5,
"marking entity %s as %s (%s)\n",
170 stuff, is_glob?
"global":
"private", why);
257 "assign left operator is a reference");
264 set_glopriv(glc, var,
true,
"assign global var ent");
271 set_glopriv(glc, var,
false,
"assign private var ent");
272 set_glopriv(glc, e1,
false,
"assign private lexpr");
427 bool try_again =
true;
433 pips_debug(3,
"propagating privates & globals iteration %d\n", iteration);
440 if (iteration > 1 && !glc->
changed)
454 pips_debug(8,
"considering variable %s (global=%d, private=%d)\n",
469 if (!var_is_global && !var_is_private)
502 "matching #arguments & #parameters");
517 pips_debug(5,
"skipping non pointer parameter %s:%d (%s)\n",
529 if (global_expr && private_expr)
532 "private & global\n",
534 if (global_expr && var_is_private)
536 "already private, cannot switch it to global\n",
538 if (private_expr && var_is_global)
540 "already global, cannot switch it to private\n",
548 if (!global_expr && !private_expr)
550 pips_debug(5,
"setting %s:%d (%s) as private by default\n",
583 debug_on(
"GPU_QUALIFY_POINTERS_DEBUG_LEVEL");
qualifier make_qualifier_private(void)
list gen_qualifier_cons(qualifier p, list l)
qualifier make_qualifier_global(void)
struct paramStruct params
struct _newgen_struct_expression_ * expression
int dummy
A dummy file, to prevent empty libraries from breaking builds.
const char * module_name(const char *s)
Return the module part of an entity name.
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
string gen_domain_name(int t)
GEN_DOMAIN_NAME returns the domain name, and may be used for debug purposes.
static void glc_cast(cast c, glopriv_context_t *glc)
static void collect_glopriv(void *stuff, glopriv_context_t *glc)
static void set_glopriv_qualifier(entity evar, bool is_glob)
add a qualifier to a variable, which should be a pointer...
static void set_variable_qualifier(variable var, bool is_glob)
bool gpu_qualify_pointers(const string module_name)
static void glc_call(call c, glopriv_context_t *glc)
ptr = ptr & reference...
static bool variable_is_qualified_as(variable var, enum qualifier_utype qt)
static void free_glopriv(glopriv_context_t **pglc)
static void set_global(entity evar)
static bool is_global(entity evar)
static void collect_glopriv_data(entity f, statement s, glopriv_context_t *glc)
static bool is_glopriv(entity evar, bool is_glob)
static void set_as_private(entity evar)
static glopriv_context_t * new_glopriv(void)
static bool is_private(entity evar)
static bool variable_is_glopriv(variable var, bool is_glob)
static void glc_ref(reference r, glopriv_context_t *glc)
void do_gpu_qualify_pointers(entity module, statement code, callees funcs, bool do_casts)
gpu_qualify_pointers.c
static void set_glopriv(glopriv_context_t *glc, void *stuff, bool is_glob, string why)
void reset_current_module_entity(void)
Reset the current module entity.
void reset_current_module_statement(void)
Reset the current module statement.
statement set_current_module_statement(statement)
Set the current module statement.
statement get_current_module_statement(void)
Get the current module statement.
entity set_current_module_entity(entity)
static.c
entity get_current_module_entity(void)
Get the entity of the current module.
void gen_context_multi_recurse(void *o, void *context,...)
Multi-recursion with context function visitor.
gen_chunk * gen_get_current_ancestor(int)
Return current object of that type...
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
#define NIL
The empty list (nil in Lisp)
size_t gen_length(const list l)
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
#define CAR(pcons)
Get the value of the first element of a list.
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 CDR(pcons)
Get the list less its first element.
gen_chunk gen_nth(int n, const list l)
to be used as ENTITY(gen_nth(3, l))...
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_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
hash_table hash_table_make(hash_key_type key_type, size_t size)
void * hash_get(const hash_table htp, const void *key)
this function retrieves in the hash table pointed to by htp the couple whose key is equal to key.
void hash_put(hash_table htp, const void *key, const void *val)
This functions stores a couple (key,val) in the hash table pointed to by htp.
void hash_update(hash_table htp, const void *key, const void *val)
update key->val in htp, that MUST be pre-existent.
void hash_table_free(hash_table htp)
this function deletes a hash table that is no longer useful.
bool hash_defined_p(const hash_table htp, const void *key)
true if key has e value in htp.
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
#define pips_user_warning
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
#define HASH_FOREACH(key_type, k, value_type, v, ht)
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 f(int off1, int off2, int n, float r[n], float a[n], float b[n])
#define ENTITY_ASSIGN_P(e)
#define ENTITY_MINUS_P(e)
#define ENTITY_PLUS_C_P(e)
#define entity_variable_p(e)
An entity_variable_p(e) may hide a typedef and hence a functional type.
#define ENTITY_MINUS_C_P(e)
#define ENTITY_ADDRESS_OF_P(e)
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
bool entity_array_p(entity e)
Is e a variable with an array type?
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
bool entity_function_p(entity e)
static int init
Maximal value set for Fortran 77.
bool entity_pointer_p(entity e)
bool expression_pointer_p(expression e)
we get the type of the expression by calling expression_to_type() which allocates a new one.
bool expression_reference_p(expression e)
Test if an expression is a reference.
reference expression_reference(expression e)
Short cut, meaningful only if expression_reference_p(e) holds.
bool pointer_type_p(type)
Check for scalar pointers.
bool formal_parameter_p(entity)
#define dummy_identifier(x)
struct _newgen_struct_callees_ * callees
#define expression_domain
newgen_execution_domain_defined
#define parameter_dummy(x)
#define parameter_type(x)
#define cast_domain
newgen_call_domain_defined
#define callees_callees(x)
#define reference_variable(x)
#define type_functional(x)
#define entity_storage(x)
#define code_declarations(x)
#define call_domain
newgen_callees_domain_defined
#define storage_formal(x)
#define EXPRESSION(x)
EXPRESSION.
#define cast_expression(x)
#define dummy_unknown_p(x)
#define reference_domain
newgen_range_domain_defined
#define functional_parameters(x)
#define PARAMETER(x)
PARAMETER.
#define variable_qualifiers(x)
#define call_arguments(x)
#define value_expression_p(x)
#define type_variable_p(x)
#define value_expression(x)
#define entity_domain
newgen_syntax_domain_defined
#define entity_initial(x)
int enclosing
This is an horrendous hack.
FI: I do not understand why the type is duplicated at the set level.
The structure used to build lists in NewGen.
structure to collect whether anything should be qualified as private or global, for OpenCL 1....