27 #ifdef BUILDER_RECOVER_FOR_LOOP
30 #include "pips_config.h"
73 find_simple_for_like_variable(
statement s,
87 pips_debug(5,
"! Found matching variable in the statement !\n");
104 equality = equality->
succ) {
106 bool found_value_for_current_variable =
false;
107 bool found_old_value_for_current_variable =
false;
108 bool found_value_for_another_variable_in_transformer =
false;
120 pips_debug(5,
"for vector variable : %s %s %s\n",
125 pips_debug(5,
"We have found a reference to the variable"
126 " in the transformer\n");
127 found_value_for_current_variable =
true;
132 pips_debug(5,
"We have found a reference to the initial value"
133 " of the variable in the transformer"
134 " with a factor +/- 1\n");
135 found_old_value_for_current_variable =
true;
139 pips_debug(5,
"We have found a reference to another variable"
140 " marked as modified by the transformer\n");
144 found_value_for_another_variable_in_transformer =
true;
152 if (found_value_for_current_variable
153 && found_old_value_for_current_variable
154 && !found_value_for_another_variable_in_transformer) {
155 pips_debug(4,
"We have found a relation of the form:\n"
156 "+/- i + k*i#init + invariant_loop_variables == constant\n"
220 try_to_recover_for_loop_in_a_while(
whileloop wl) {
226 pips_debug(9,
"While-loop %p, parent (instruction): %p, "
227 "whileloop of the instruction: %p\n", wl, i,
254 bool found = find_simple_for_like_variable(
whileloop_body(wl), rv,
259 pips_debug(3,
"Variable %s (%p) is a nice loop-like index"
319 recover_for_loop_in_statement(
statement s) {
394 debug_on(
"RECOVER_FOR_LOOP_DEBUG_LEVEL");
void free_whileloop(whileloop p)
forloop make_forloop(expression a1, expression a2, expression a3, statement a4)
static statement module_statement
struct _newgen_struct_statement_ * statement
void system_text_format(string line, string prefix, text txt, Psysteme ps, string(*variable_name)(Variable), bool a_la_fortran)
appends ps to line/txt with prefix continuations.
void sc_syst_debug(Psysteme s)
constraint_to_text.c
#define contrainte_vecteur(c)
passage au champ vecteur d'une contrainte "a la Newgen"
list load_proper_rw_effects_list(statement)
void reset_proper_rw_effects(void)
void set_proper_rw_effects(statement_effects)
void set_cumulated_rw_effects(statement_effects)
void reset_cumulated_rw_effects(void)
#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))
list effect_words_reference(reference)
prettyprint.c
const char * module_name(const char *s)
Return the module part of an entity name.
#define gen_recurse(start, domain_number, flt, rwt)
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.
entity set_current_module_entity(entity)
static.c
entity get_current_module_entity(void)
Get the entity of the current module.
gen_chunk * gen_get_recurse_ancestor(const void *)
Get the first ancestor object encountered during the recursion for the given object.
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
#define NIL
The empty list (nil in Lisp)
bool gen_in_list_p(const void *vo, const list lx)
tell whether vo belongs to lx
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
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.
statement make_assign_statement(expression, expression)
void insert_statement(statement, statement, bool)
This is the normal entry point.
void vect_dump(Pvecteur v)
void vect_dump(Pvecteur v): print sparse vector v on stderr.
void vect_print(Pvecteur v, get_variable_name_t variable_name)
void vect_print(Pvecteur v, char * (*variable_name)()): impression d'un vecteur creux v sur stdout; l...
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
#define pips_internal_error
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
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...
void reset_ordering_to_statement(void)
Reset the mapping from ordering to statement.
void print_statement(statement)
Print a statement on stderr.
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
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...
string entity_global_name(entity e)
Used instead of the macro to pass as formal argument.
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
basic entity_basic(entity e)
return the basic associated to entity e if it's a function/variable/constant basic_undefined otherwis...
static int init
Maximal value set for Fortran 77.
expression make_constraint_expression(Pvecteur v, Variable index)
Make an expression from a constraint v for a given index.
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
expression substitute_entity_in_expression(entity old, entity new, expression e)
This function replaces all the occurences of an old entity in the expression exp by the new entity.
expression make_assign_expression(expression lhs, expression rhs)
Make an assign expression, since in C the assignment is a side effect operator.
void AddEntityToCurrentModule(entity)
Add a variable entity to the current module declarations.
entity make_new_scalar_variable_with_prefix(const char *, entity, basic)
Create a new scalar variable of type b in the given module.
#define reference_variable(x)
#define whileloop_evaluation(x)
#define expression_undefined
#define instruction_tag(x)
#define transformer_relation(x)
#define transformer_arguments(x)
struct _newgen_struct_instruction_ * instruction
#define instruction_forloop(x)
#define instruction_whileloop(x)
#define whileloop_body(x)
#define whileloop_domain
newgen_variable_domain_defined
#define statement_instruction(x)
struct _newgen_struct_transformer_ * transformer
#define whileloop_condition(x)
#define evaluation_after_p(x)
#define predicate_system(x)
#define whileloop_undefined
#define statement_undefined
void translate_global_values(entity m, transformer tf)
void module_to_value_mappings(entity m)
void module_to_value_mappings(entity m): build hash tables between variables and values (old,...
text text_for_a_transformer(transformer tran, bool is_a_transformer)
call this one from outside.
transformer load_statement_semantic(statement)
void set_semantic_map(statement_mapping)
void reset_semantic_map(void)
struct Scontrainte * succ
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
The structure used to build lists in NewGen.
#define MAX_LINE_LENGTH
maximum length of a line when prettyprinting...
string text_to_string(text t)
SG: moved here from ricedg.
string words_to_string(cons *lw)
void dump_text(text t)
FI: print_text() should be fprint_text() and dump_text(), print_text()
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
char *(* get_variable_name_t)(Variable)
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....