27 #if defined(BUILDER_SCALARIZATION) || \
28 defined(BUILDER_CONSTANT_ARRAY_SCALARIZATION) || \
29 defined(BUILDER_QUICK_SCALARIZATION)
32 #include "pips_config.h"
83 static int scalarization_across_control_test_level = 0;
85 static bool scalarization_across_control_test_is_exactness_p()
87 return (scalarization_across_control_test_level == 0);
90 static bool scalarization_across_control_test_is_strict_test_p()
92 return (scalarization_across_control_test_level == 1);
95 static void scalarization_across_control_test_level_init()
100 if (strstr(test_s,
"strict"))
101 scalarization_across_control_test_level = 1;
102 else if (strstr(test_s,
"cheap"))
103 scalarization_across_control_test_level = 2;
105 scalarization_across_control_test_level = 0;
108 static void scalarization_across_control_test_level_reset()
110 scalarization_across_control_test_level = 0;
121 Pbase gb = sc_base(g);
137 Pbase tb = sc_base(g);
189 bool functional_p =
true;
194 Pbase gb = sc_base(g);
197 functional_p =
false;
208 g2 = sc_add_offset_variables(g2, r, dr);
212 g1 = sc_elim_redond(g1);
222 sc_projection_along_variables_ofl_ctrl(&g1, dr4,
OFL_CTRL);
231 functional_p =
false;
243 functional_p =
false;
262 static bool sc_totally_functional_graph_p(
Psysteme g,
269 bool totally_functional_p =
false;
271 if (sc_functional_graph_p(g, d, r, dr)) {
278 sc_projection_along_variables_ofl_ctrl(&g1, r,
OFL_CTRL);
284 return totally_functional_p;
292 struct subst_ref_ctx {
294 entity scalarized_replacement_variable;
299 static bool reference_substitute(
reference r,
struct subst_ref_ctx *ctx) {
306 if(v==scalarized_v) {
319 static bool declarations_reference_substitute(
statement st,
320 struct subst_ref_ctx *ctx) {
333 static void statement_substitute_scalarized_array_references(
statement st,
337 struct subst_ref_ctx ctx;
338 ctx.scalarized_reference = pvr;
339 ctx.scalarized_replacement_variable = s;
347 static void * car_effect_to_variable(
gen_chunk car) {
352 static Pbase make_phi_base(
int phi_min,
int phi_max) {
355 for(i=phi_min; i<=phi_max; i++) {
362 static effect effect_write_or_read_on_variable(
list el,
459 static bool region_totally_functional_graph_p(
effect pr,
460 Pbase loop_indices_b,
471 Pbase phi_b = make_phi_base(1, nd);
482 rtfg_p = sc_totally_functional_graph_p(
sc_union, loop_indices_b,
491 static bool singleton_region_in_context_p(
effect pr,
493 Pbase loop_indices_b,
495 bool singleton_p =
false;
512 Pbase phi_b = make_phi_base(1, nd);
525 singleton_p = sc_totally_functional_graph_p(
sc_union, loop_indices_b,
530 singleton_p = sc_functional_graph_p(
sc_union, loop_indices_b,
545 static void scalarize_variable_in_statement(
entity pv,
564 pips_debug(3,
"begin for entity %s and statement:\n",
574 const char* epref = strlen(dpref)==0?
604 pips_debug(1,
"Creating variable %s for variable %s\n",
608 statement_substitute_scalarized_array_references(s, pvr, sv);
611 pips_debug(3,
"statement after substitution by sv (%s):\n",
646 "Other languages are not supported by "
677 if ((pr1 = effect_write_or_read_on_variable(crwl, pv,
true))
690 if ((pr2 = effect_write_or_read_on_variable(crwl, pv,
false))
705 if (!scalarization_across_control_test_is_exactness_p()
708 if (!SC_UNDEFINED_P(sc1) && sc_dimension(sc1) !=0) {
709 if (!SC_UNDEFINED_P(sc2) && sc_dimension(sc2) !=0) {
715 if (!SC_UNDEFINED_P(sc2) && sc_dimension(sc2) !=0) {
733 struct scalarization_ctx {
735 list scalarized_variables;
741 bool keep_perfect_parallel;
744 set blacklisted_loops;
747 bool skip_address_of_variables;
751 static void blacklist_perfectly_nested_parallel_loop(
statement s,
752 set blacklisted_loops) {
755 for(
int d=2;d<=
depth;d++) {
768 static bool loop_scalarization(
loop l,
struct scalarization_ctx *ctx)
786 bool memory_in_out_regions_only_p =
793 if (!memory_effects_only_p) {
797 if (!memory_in_out_regions_only_p) {
805 "Entering level-%d loop, index=%s\n",
822 car_effect_to_variable);
827 car_effect_to_variable);
839 effect pru = unified_rw_effect_of_variable(pv, crwl);
868 "Legality criterion not met: %d!=%d (nvo!=neo)\n",
875 bool read_and_written_pv = read_pv && written_pv;
899 (neo < 2 || read_and_written_pv) &&
904 pips_debug(2,
"Profitability criterion not met: (nd) %d>0 (scalar) "
905 "or not one of the following: (%d&&%d&&%d) "
907 "((neo) %d <= 1 || %d read_and_written_pv) and "
908 "(%d (!entity_undefined_p(iv)) || %d (!entity_undefined_p(ov)))\n",
911 (neo <= 1 || read_and_written_pv),
915 !read_and_written_pv,
920 if(region_totally_functional_graph_p(pru,
925 scalarize_variable_in_statement(pv, s, iv, ov);
941 if (!memory_in_out_regions_only_p) {
945 if (!memory_effects_only_p) {
955 } reference_testing_ctxt;
957 static bool reference_constant_wrt_ctxt_p(
reference ref,
958 reference_testing_ctxt *ctxt) {
959 bool continue_p =
true;
972 ctxt->constant_p =
false;
974 ctxt->constant_p =
false;
978 if (!ctxt->constant_p) {
982 continue_p = ctxt->constant_p;
988 static bool declarations_reference_constant_wrt_ctxt_p(
statement st,
989 reference_testing_ctxt *p_ctxt) {
1003 static bool statement_entity_references_constant_in_context_p(
statement s,
1005 list l_modified_variables) {
1013 reference_testing_ctxt ctxt;
1014 ctxt.constant_p =
true;
1016 ctxt.trans_args = l_modified_variables;
1031 bool used_through_external_calls;
1037 static bool entity_accessed_in_call_in(
call c, calls_test_ctxt *ctxt)
1050 if (!
ENDP(l_conflicts))
1052 ctxt->used_through_external_calls =
true;
1056 return (!ctxt->used_through_external_calls);
1059 static bool entity_accessed_in_statement_declarations_calls_in(
statement s, calls_test_ctxt * ctxt)
1070 return (!ctxt->used_through_external_calls);
1073 static bool entity_accessed_through_calls_in_statement_p(
entity e,
statement s)
1075 calls_test_ctxt ctxt;
1077 ctxt.used_through_external_calls =
false;
1081 return (ctxt.used_through_external_calls);
1089 static bool statement_scalarization(
statement s,
1090 struct scalarization_ctx *ctx) {
1101 bool memory_in_out_regions_only_p =
1112 if (!memory_effects_only_p) {
1116 if (!memory_in_out_regions_only_p) {
1129 list forbiden_variables_in_subscript =
set_to_list(declared_entities);
1133 list local_scalarized_variables =
NIL;
1172 car_effect_to_variable);
1177 car_effect_to_variable);
1190 effect pru = unified_rw_effect_of_variable(pv, crwl);
1210 "Legality criterion not met : %d!=%d (nvo!=neo)\n",
1217 bool read_and_written_pv = read_pv && written_pv;
1222 "least 2\nCheck property SCALARIZATION_THRESHOLD\n");
1245 if (nd <= 0 // Scalar -> FI:
this is already tested above...
1246 || (neo <= threshold &&
1247 (neo < threshold || read_and_written_pv) &&
1252 pips_debug(2,
"Profitability criterion not met: (nd) %d>0 (scalar) "
1253 "or not one of the following : (%d&&%d&&%d) "
1254 "(neo) %d <= 2 and "
1255 "((neo) %d <= 1 || %d read_and_written_pv) and "
1256 "(%d (!entity_undefined_p(iv)) || %d (!entity_undefined_p(ov)))\n",
1259 (neo <= 1 || read_and_written_pv),
1263 !read_and_written_pv,
1268 pips_debug(1,
"Profitability criterion met \n");
1269 bool strict_p = scalarization_across_control_test_is_strict_test_p();
1290 statement_entity_references_constant_in_context_p(s,
1292 forbiden_variables_in_subscript )
1293 && singleton_region_in_context_p(pru, prec,
1294 loop_indices_b, strict_p)) {
1299 local_scalarized_variables =
1301 ctx->scalarized_variables =
1316 hash_put(ctx->statement_scalarized_variables,
1318 (
void *) local_scalarized_variables);
1321 if (!memory_in_out_regions_only_p) {
1325 if (!memory_effects_only_p) {
1337 static bool scalarization_loop_statement_in(
statement ls,
1338 struct scalarization_ctx *ctx) {
1339 bool result_p =
true;
1355 result_p = loop_scalarization(l,ctx);
1366 static void scalarization_loop_statement_out(
statement s,
1367 struct scalarization_ctx *ctx) {
1373 pips_debug(1,
"Exiting loop with index %s, size=%d\n",
1379 for (
list el=ctx->scalarized_variables; !
ENDP(el);
POP(el)) {
1399 static bool scalarization_statement_in(
statement s,
1400 struct scalarization_ctx *ctx) {
1401 bool result_p =
true;
1414 result_p = statement_scalarization(s,ctx);
1420 pips_debug(1,
"Exiting loop with index %s, size=%d\n",
1425 if(ctx->keep_perfect_parallel) {
1426 blacklist_perfectly_nested_parallel_loop(s, ctx->blacklisted_loops);
1440 static void aov_call(
call c, aov_ctx * ctx)
1455 static void aov_cast(
cast c, aov_ctx * ctx)
1467 static void aov_ref(
reference r, aov_ctx * ctx)
1501 static void scalarization_statement_out(
statement s,
1502 struct scalarization_ctx *ctx) {
1516 pips_debug(1,
"Exiting loop with index %s, size=%d\n",
1523 list local_scalarized_variables =
1524 (
list)
hash_get(ctx->statement_scalarized_variables, (
void *) s);
1526 if(!
ENDP(local_scalarized_variables)) {
1531 bool memory_in_out_regions_only_p =
1539 if (!memory_in_out_regions_only_p) {
1544 pips_debug(3,
"statement before replacements:\n");
1549 if (ctx->skip_address_of_variables &&
1550 address_of_variable_in_statement(s, pv))
1561 scalarize_variable_in_statement(pv, s, iv, ov);
1573 ctx->scalarized_variables =
1575 local_scalarized_variables);
1584 if (!memory_in_out_regions_only_p) {
1631 debug_on(
"SCALARIZATION_DEBUG_LEVEL");
1635 struct scalarization_ctx ctx;
1636 ctx.keep_perfect_parallel =
1639 ctx.skip_address_of_variables =
1642 scalarization_across_control_test_level_init();
1648 ctx.scalarized_variables =
NIL;
1652 scalarization_loop_statement_in,
1653 scalarization_loop_statement_out);
1660 ctx.scalarized_variables =
NIL;
1665 scalarization_statement_in,
1666 scalarization_statement_out);
1672 ENDP(ctx.scalarized_variables));
1679 scalarization_across_control_test_level_reset();
1703 bool good_result_p =
true;
1705 return (good_result_p);
1717 } references_constant_param;
1719 static void all_array_references_constant_walker(
reference ref,
1720 references_constant_param* p) {
1730 references_constant_param p = {
array,
true};
1734 all_array_references_constant_walker);
1735 return p.constant_p;
1741 } replace_references_constant_param;
1743 static void replace_constant_array_references_walker(
reference ref,
1744 replace_references_constant_param *p) {
1780 replace_references_constant_param p = {
array,
1785 replace_constant_array_references_walker);
1792 static int inverse_compare_entities(
const entity *pe1,
const entity *pe2)
1813 all_array_references_constant_p(cms,e)) {
1834 "because its initialization should be split. "
1835 "\nApply pass split_initialization first.\n",
1844 "because the resulting code is likely to be wrong\n",
1852 replace_constant_array_references(cms,e);
1857 replace_constant_array_references(cms,e);
1889 static bool array_effect_p(
effect eff) {
1890 bool result =
false;
1914 static bool entity_module_main_p(
entity e) {
1916 static bool current_module_main_p =
false;
1917 bool result =
false;
1924 current_module_main_p =
true;
1926 pips_debug(8,
"module name: %s, local_name: %s, returning %s\n",
1936 if (current_module_main_p) {
1938 pips_debug(8,
"does entity %s belong to module main? %s\n ",
1950 static bool scalarizable_entity_p(
entity e) {
1955 "checking entity %s, with storage %s \n",
1961 " and section %s\n",
1981 && entity_module_main_p(e)))
1998 static bool statement_compute_scalarizable_candidates(
statement st,
2005 pips_debug(1,
"Entering loop statement %td (ordering %03zd)\n",
2015 && scalarizable_entity_p(e)
2017 && array_effect_p(eff)
2020 set_add_element(scalarizable_candidates, scalarizable_candidates, e) ;
2028 && scalarizable_entity_p(e)
2031 set_add_element(scalarizable_candidates, scalarizable_candidates, e) ;
2044 hash_put(loops_scalarizable_candidates, l, scalarizable_candidates);
2055 static void remove_scalarizable_candidate_from_loops(
list prefix,
2072 set scalarizable_candidates =
2076 pips_debug(1,
"Variable %s is removed from scalarizable candidates of "
2081 pips_debug(1,
"ls is empty, end of recursion\n");
2084 pips_assert(
"The first statements in prefix and in ls are the same statement",
2089 remove_scalarizable_candidate_from_loops(
CDR(
prefix),
CDR(ls), e,
2090 loops_scalarizable_candidates);
2114 pips_debug(1,
"Trying to scalarize %s in loop statement %td "
2118 pips_debug(1,
"Trying to scalarize %s in statement %td\n",
2169 POP(sc_inds),
POP(sk_inds)) {
2198 pips_debug(5,
"Conflict for %s between statements %td and %td\n",
2207 pips_debug(5,
"remove %s from candidates in non common enclosing loops\n",
2217 remove_scalarizable_candidate_from_loops(
prefix,
2220 loops_scalarizable_candidates);
2221 remove_scalarizable_candidate_from_loops(
prefix,
2224 loops_scalarizable_candidates);
2240 list l_inds_first_ref;
2241 } scalarizability_test_ctxt;
2247 static bool entity_can_be_scalarized_in_statement_in(
statement s,
2248 scalarizability_test_ctxt *ctxt) {
2252 bool continue_p =
true;
2271 ctxt->first_ref = eff_ref;
2277 pips_assert(
"all scalarizable references have the same number "
2281 list l_first = ctxt->l_inds_first_ref;
2285 ctxt->result =
false;
2310 static bool entity_can_be_scalarized_in_statement_p(
entity e,
statement s,
2311 list l_modified_variables)
2315 pips_debug(2,
"checking for entity %s in statement %td\n",
2327 "First legality criterion not met: %d!=%d (nvo!=neo)\n",
2331 scalarizability_test_ctxt ctxt;
2335 ctxt.l_inds_first_ref =
NIL;
2338 result = ctxt.result;
2340 pips_debug(2,
"Second legality criterion not met\n");
2342 pips_debug(2,
"No remaining reference found\n");
2348 pips_debug(3,
"checking reference %s wrt entities:\n",
2352 reference_testing_ctxt ref_test_ctxt;
2353 ref_test_ctxt.constant_p =
true;
2354 ref_test_ctxt.e = e;
2355 ref_test_ctxt.trans_args = l_modified_variables;
2356 (void) reference_constant_wrt_ctxt_p(ctxt.first_ref, &ref_test_ctxt);
2357 ref_test_ctxt.trans_args =
NIL;
2358 result = ref_test_ctxt.constant_p;
2359 pips_debug(2,
"Third legality criterion %s met\n", result?
"" :
"not");
2375 static void check_loop_scalarizable_candidates(
loop l,
2377 set loop_scalarizable_candidates =
hash_get(loops_scalarizable_candidates, l);
2381 list l_modified_variables =
2385 l_modified_variables =
CONS(
ENTITY, e, l_modified_variables);
2390 if (!entity_can_be_scalarized_in_statement_p(e,
2392 l_modified_variables)) {
2393 remove_scalarizable_candidate_from_loops(
NIL,
2396 loops_scalarizable_candidates);
2414 static void check_scalarizable_candidates(
statement s,
2424 static void loop_scalarize_candidates(
loop l,
2426 set loop_scalarizable_candidates =
hash_get(loops_scalarizable_candidates, l);
2429 list l_loop_scalarizable_candidates =
2434 pips_debug(3,
"entity %s is going to be scalarized in loop with index %s\n",
2436 scalarize_variable_in_statement(e,
2450 static void scalarize_candidates(
statement s,
2485 debug_on(
"SCALARIZATION_DEBUG_LEVEL");
2509 update_scalarizable_candidates( v, st, eff,
2510 loops_scalarizable_candidates) ;
2519 check_scalarizable_candidates(module_stat, loops_scalarizable_candidates);
2520 scalarize_candidates(module_stat, loops_scalarizable_candidates);
float a2sf[2] __attribute__((aligned(16)))
USER generates a user error (i.e., non fatal) by printing the given MSG according to the FMT.
static hash_table seen
static function to store whether a module has been seen during the recursive generation of the daVinc...
int get_int_property(const string)
static string current_module
action make_action_read(action_kind _field_)
cell make_cell_reference(reference _field_)
action_kind make_action_kind_store(void)
void free_effect(effect p)
descriptor make_descriptor_convex(Psysteme _field_)
approximation make_approximation_may(void)
effect make_effect(cell a1, action a2, approximation a3, descriptor a4)
value make_value_expression(expression _field_)
basic copy_basic(basic p)
BASIC.
reference make_reference(entity a1, list a2)
void free_expression(expression p)
reference copy_reference(reference p)
REFERENCE.
struct _newgen_struct_entity_ * entity
dg_vertex_label vertex_label
static graph dependence_graph
static reference ref
Current stmt (an integer)
struct _newgen_struct_expression_ * expression
bool entity_abstract_location_p(entity al)
bool entity_is_argument_p(entity e, cons *args)
cons * arguments_add_entity(cons *a, entity e)
cons * arguments_difference(cons *a1, cons *a2)
set difference: a1 - a2 ; similar to set intersection
#define value_eq(v1, v2)
bool operators on values
Pbase base_add_variable(Pbase b, Variable var)
Pbase base_add_variable(Pbase b, Variable v): add variable v as a new dimension to basis b at the end...
Pbase base_remove_variable(Pbase b, Variable v)
Pbase base_remove_variable(b, v): remove basis vector relative to v from b; abort if v is not in b;.
Variable base_find_variable(Pbase b, Variable v)
Variable base_find_variable(Pbase b, Variable v): returns variable v if variable v is one of b's elem...
bool base_included_p(Pbase b1, Pbase b2)
Pbase base_included_p(Pbase b1, Pbase b2): include_p = b1 is included in b2 – with the set meaning re...
Pbase base_union(Pbase b1, Pbase b2)
Pbase base_union(Pbase b1, Pbase b2): compute a new basis containing all elements of b1 and all eleme...
static Psysteme sc_union(Psysteme sc1, Psysteme sc2)
#define CONTRAINTE_UNDEFINED_P(c)
#define contrainte_succ(c)
#define contrainte_vecteur(c)
passage au champ vecteur d'une contrainte "a la Newgen"
#define CONTRAINTE_UNDEFINED
#define dg_vertex_label_statement(x)
struct _newgen_struct_dg_arc_label_ * dg_arc_label
#define CONFLICT(x)
CONFLICT.
#define dg_arc_label_conflicts(x)
#define conflict_source(x)
struct _newgen_struct_dg_vertex_label_ * dg_vertex_label
entity make_phi_entity(int)
effects load_out_effects(statement)
list effects_store_effects(list)
effects load_in_effects(statement)
list load_proper_rw_effects_list(statement)
void reset_out_effects(void)
void reset_proper_rw_effects(void)
void set_proper_rw_effects(statement_effects)
void set_cumulated_rw_effects(statement_effects)
void set_out_effects(statement_effects)
void set_in_effects(statement_effects)
void reset_in_effects(void)
list load_cumulated_rw_effects_list(statement)
effects load_cumulated_rw_effects(statement)
list effects_to_written_scalar_entities(list)
void reset_cumulated_rw_effects(void)
list proper_effects_of_expression(expression)
bool is_implied_do_index(entity, instruction)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
#define effect_approximation_tag(eff)
#define effect_variable(e)
For COMPATIBILITY purpose only - DO NOT USE anymore.
bool effects_read_variable_p(list, entity)
list effect_words_reference(reference)
prettyprint.c
bool effects_write_variable_p(list, entity)
entity effect_entity(effect)
cproto-generated files
bool store_effect_p(effect)
tag approximation_or(tag, tag)
tag approximation_or(tag t1, tag t2) input : two approximation tags.
list effects_to_list(effects)
#define effect_undefined_p(x)
#define action_write_p(x)
#define descriptor_convex_p(x)
#define effect_descriptor(x)
#define effects_effects(x)
#define descriptor_convex(x)
const char * module_name(const char *s)
Return the module part of an entity name.
char * get_string_property(const char *)
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
#define gen_context_recurse(start, ctxt, domain_number, flt, rwt)
void gen_full_free_list(list l)
#define successor_vertex(x)
#define successor_arc_label(x)
struct _newgen_struct_graph_ * graph
#define vertex_vertex_label(x)
#define vertex_successors(x)
#define SUCCESSOR(x)
SUCCESSOR.
#define graph_vertices(x)
bool effects_may_read_or_write_memory_paths_from_entity_p(list l_eff, entity e)
tests whether the input effects list may contain effects with a memory path from the input entity e; ...
list effects_entities_which_may_conflict_with_scalar_entity(list fx, entity e)
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_recurse_stop(void *obj)
Tells the recursion not to go in this object.
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...
gen_chunk * gen_get_ancestor(int, const void *)
return the first ancestor object found of the given type.
void gen_null2(__attribute__((unused)) void *u1, __attribute__((unused)) void *u2)
idem with 2 args, to please overpeaky compiler checks
bool gen_true2(__attribute__((unused)) gen_chunk *u1, __attribute__((unused)) void *u2)
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
void clean_enclosing_loops(void)
statement get_first_inner_perfectly_nested_loop(statement stat)
Return the inner loop in a perfect loop-nest.
statement_mapping loops_mapping_of_statement(statement stat)
int depth_of_parallel_perfect_loop_nest(statement s)
Compute the depth of a parallel perfect loop-nest.
#define ENDP(l)
Test if a list is empty.
list gen_nreverse(list cp)
reverse a list in place
#define POP(l)
Modify a list pointer to point on the next element of the list.
#define NIL
The empty list (nil in Lisp)
size_t gen_length(const list l)
list gen_common_prefix(const list l1, const list l2)
return the common list prefix of lists l1 and l2.
#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.
void * gen_find(const void *item, const list seq, gen_filter2_func_t test, gen_extract_func_t extract)
bool gen_eq(const void *obj1, const void *obj2)
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.
loop statement_loop(statement)
Get the loop of a statement.
bool statement_loop_p(statement)
bool statement_sequence_p(statement)
Statement classes induced from instruction type.
statement make_assign_statement(expression, expression)
int count_references_to_variable(statement, entity)
statement add_declaration_statement_at_beginning(statement, entity)
int count_references_to_variable_element(statement, entity)
reference find_reference_to_variable(statement, entity)
void insert_statement(statement, statement, bool)
This is the normal entry point.
bool declaration_statement_p(statement)
Had to be optimized according to Beatrice Creusillet.
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_table_free(hash_table htp)
this function deletes a hash table that is no longer useful.
#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 pips_internal_error
string bool_to_string(bool)
string concatenate(const char *,...)
Return the concatenation of the given strings.
#define HASH_UNDEFINED_VALUE
value returned by hash_get() when the key is not found; could also be called HASH_KEY_NOT_FOUND,...
#define HASH_FOREACH(key_type, k, value_type, v, ht)
#define HASH_DEFAULT_SIZE
#define same_string_p(s1, s2)
set set_del_element(set, const set, const void *)
list set_to_list(const set)
create a list from a set the set is not freed
list set_to_sorted_list(const set, gen_cmp_func_t)
#define SET_FOREACH(type_name, the_item, the_set)
enumerate set elements in their internal order.
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 *)
hash_table set_ordering_to_statement(statement s)
To be used instead of initialize_ordering_to_statement() to make sure that the hash table ots is in s...
statement ordering_to_statement(int o)
Get the statement associated to a given ordering.
void reset_ordering_to_statement(void)
Reset the mapping from ordering to statement.
Psysteme sc_cute_convex_hull(Psysteme, Psysteme)
returns s1 v s2.
void print_statement(statement)
Print a statement on stderr.
static bool constant_p(entity e)
This function return a bool indicating if related entity e represents a constant.
static const char * prefix
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
#define ENTITY_ADDRESS_OF_P(e)
bool dynamic_area_p(entity aire)
bool stack_area_p(entity aire)
bool static_area_p(entity aire)
const char * entity_user_name(entity e)
Since entity_local_name may contain PIPS special characters such as prefixes (label,...
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_in_list_p(entity ent, list ent_l)
look for ent in ent_l
int compare_entities(const entity *pe1, const entity *pe2)
Comparison function for qsort.
bool entity_array_p(entity e)
Is e a variable with an array type?
bool same_entity_p(entity e1, entity e2)
predicates on entities
bool local_entity_of_module_p(entity e, entity module)
This test shows that "e" has been declared in "module".
bool c_module_p(entity m)
Test if a module "m" is written in C.
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
string storage_to_string(storage s)
bool effects_package_entity_p(entity e)
checks if an entity is an IO_EFFECTS_PACKAGE_NAME, a MALLOC_EFFECTS_NAME or a RAND_EFFECTS_PACKAGE_NA...
const char * module_local_name(entity e)
Returns the module local user name.
void print_entities(list l)
set get_declared_entities(void *elem)
retrieves the set of entities declared in elem
bool top_level_entity_p(entity e)
Check if the scope of entity e is global.
bool parameter_passing_by_value_p(entity f)
const char * entity_module_name(entity e)
See comments about module_name().
bool entity_pointer_p(entity e)
void set_register_qualifier(entity v)
Assuming that v is of type variable, add a qualifier register.
set get_referenced_entities(void *elem)
retrieves the set of entities used in elem beware that this entities may be formal parameters,...
bool expression_integer_value(expression e, intptr_t *pval)
expression reference_to_expression(reference r)
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
bool expression_equal_p(expression e1, expression e2)
Syntactic equality e1==e2.
bool unbounded_expression_p(expression e)
expression reference_offset(reference ref)
computes the offset of a C reference with its origin
bool extended_expression_constant_p(expression exp)
Returns true if the value of the expression does not depend syntactically on the current store.
bool c_language_module_p(entity m)
bool fortran_language_module_p(entity m)
list load_statement_enclosing_loops(statement)
bool entity_static_variable_p(entity)
return true if the entity is declared with the keyword static
void AddLocalEntityToDeclarationsOnly(entity, entity, statement)
Add the variable entity e to the list of variables of the function module.
void AddLocalEntityToDeclarations(entity, entity, statement)
Add the variable entity e to the list of variables of the function module.
bool entity_volatile_variable_p(entity)
bool entity_scalar_p(entity)
The concrete type of e is a scalar type.
void AddEntityToCurrentModule(entity)
Add a variable entity to the current module declarations.
type entity_basic_concrete_type(entity)
retrieves or computes and then returns the basic concrete type of an entity
size_t type_depth(type)
Number of steps to access the lowest leave of type t without dereferencing.
bool formal_parameter_p(entity)
entity make_new_scalar_variable_with_prefix(const char *, entity, basic)
Create a new scalar variable of type b in the given module.
void set_enclosing_loops_map(statement_mapping)
basic basic_of_reference(reference)
Retrieves the basic of a reference in a newly allocated basic object.
#define type_functional_p(x)
#define value_undefined_p(x)
#define expression_domain
newgen_execution_domain_defined
struct _newgen_struct_value_ * value
#define storage_formal_p(x)
#define reference_undefined
#define cast_domain
newgen_call_domain_defined
#define instruction_loop_p(x)
#define reference_variable(x)
#define loop_domain
newgen_language_domain_defined
#define reference_undefined_p(x)
#define statement_ordering(x)
#define value_unknown_p(x)
#define entity_storage(x)
#define statement_domain
newgen_sizeofexpression_domain_defined
#define call_domain
newgen_callees_domain_defined
#define EXPRESSION(x)
EXPRESSION.
#define cast_expression(x)
#define entity_undefined_p(x)
#define reference_domain
newgen_range_domain_defined
#define transformer_relation(x)
#define transformer_arguments(x)
#define reference_indices(x)
#define variable_dimensions(x)
#define statement_declarations(x)
#define statement_instruction(x)
#define call_arguments(x)
#define statement_undefined_p(x)
#define statement_number(x)
#define type_variable_p(x)
#define predicate_system(x)
#define variable_basic(x)
#define STATEMENT(x)
STATEMENT.
#define entity_initial(x)
int enclosing
This is an horrendous hack.
void sc_rm(Psysteme ps)
void sc_rm(Psysteme ps): liberation de l'espace memoire occupe par le systeme de contraintes ps;
Pbase sc_to_minimal_basis(Psysteme ps)
creation d'une base contenant toutes les variables apparaissant avec des coefficients non-nuls dans l...
bool sc_empty_p(Psysteme sc)
bool sc_empty_p(Psysteme sc): check if the set associated to sc is the constant sc_empty or not.
Psysteme sc_dup(Psysteme ps)
Psysteme sc_dup(Psysteme ps): should becomes a link.
Psysteme sc_copy(Psysteme ps)
Psysteme sc_copy(Psysteme ps): duplication d'un systeme (allocation et copie complete des champs sans...
bool sc_minmax_of_variable(Psysteme ps, Variable var, Value *pmin, Value *pmax)
void sc_minmax_of_variable(Psysteme ps, Variable var, Value *pmin, *pmax): examine un systeme pour tr...
Psysteme sc_append(Psysteme s1, Psysteme s2)
Psysteme sc_append(Psysteme s1, Psysteme s2): calcul de l'intersection des polyedres definis par s1 e...
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
void module_to_value_mappings(entity m)
void module_to_value_mappings(entity m): build hash tables between variables and values (old,...
transformer load_statement_precondition(statement)
void set_transformer_map(statement_mapping)
transformer load_statement_transformer(statement)
void reset_precondition_map(void)
void set_precondition_map(statement_mapping)
void reset_transformer_map(void)
char * current_module_name
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
FI: I do not understand why the type is duplicated at the set level.
The structure used to build lists in NewGen.
string words_to_string(cons *lw)
static int depth
la sequence de nids
#define sc_inclusion_p_ofl_ctrl(ps1, ps2, ofl)
@ keep
bj > b1 -> h1/hj = h1
A gen_chunk is used to store every object.
#define exp
Avoid some warnings from "gcc -Wshadow".
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.
#define BASE_UNDEFINED_P(b)
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
#define base_dimension(b)
#define BASE_NULLE
MACROS SUR LES BASES.
#define OFL_CTRL
I do thing that overflows are managed in a very poor manner.
void vect_rm(Pvecteur v)
void vect_rm(Pvecteur v): desallocation des couples de v;
void vect_add_elem(Pvecteur *pvect, Variable var, Value val)
void vect_add_elem(Pvecteur * pvect, Variable var, Value val): addition d'un vecteur colineaire au ve...
Value vect_coeff(Variable var, Pvecteur vect)
Variable vect_coeff(Variable var, Pvecteur vect): coefficient de coordonnee var du vecteur vect —> So...