25 #include "pips_config.h"
83 #include "resources.h"
186 "Look for effects for statement at %p (ordering %td, number %td):\n",
237 "Look for preconditions for statement at %p (ordering %td, number %td):\n",
260 fprintf(
f,
"\nFor statement at %p (ordering %td, number %td):\n",
279 (void)
printf(
"eformat %s = %d x EXPR + %d, %ssimpler, with EXPR:\n",
455 debug(9,
"partial_eval_reference",
"Array elements not evaluated\n");
464 pips_debug(9,
"Reference to a non-scalar-integer variable %s cannot be evaluated\n",
469 if (SC_UNDEFINED_P(ps)) {
470 pips_debug(9,
"No precondition information\n");
477 debug(9,
"partial_eval_reference",
478 "Write Reference to variable %s cannot be evaluated\n",
500 " module contains some dead code.\n");
716 #define PERFORM_ADDITION 1
717 #define PERFORM_SUBTRACTION 2
718 #define PERFORM_MULTIPLICATION 3
719 #define PERFORM_DIVISION 4
720 #define PERFORM_C_DIVISION 14
721 #define PERFORM_POWER 5
722 #define PERFORM_MODULO 6
723 #define PERFORM_C_MODULO 16
724 #define PERFORM_MINIMUM 7
725 #define PERFORM_MAXIMUM 8
748 ep=ep2; ep2=ep1; ep1=ep;
770 ep=ep2; ep2=ep1; ep1=ep;
844 else if( (ef1.
icoef>1)
871 ef.
icoef= (c1>0 ? 1 : -1);
894 else if(ef2.
icoef==0) {
1005 user_error(
"partial_eval_div_or_mod_operator",
1006 "division by zero!\n");
1268 binary_partial_eval_operator =
1275 if (binary_partial_eval_operator!=0)
1276 ef = binary_partial_eval_operator (ep1, ep2, ps, fx);
1361 else if( (ef1.
icoef>1)
1387 ef.
icoef= (c1>0 ? 1 : -1);
1438 ep=ep2; ep2=ep1; ep1=ep;
1460 ep=ep2; ep2=ep1; ep1=ep;
1485 "division by zero!\n");
1544 if(efp->
icoef != 0) {
1549 if(efp->
icoef == 1) {
1550 tmp_expr= efp->
expr;
1552 else if(efp->
icoef == -1) {
1700 pips_assert(
"internal current_statement was reseted",
1863 debug_on(
"PARTIAL_EVAL_DEBUG_LEVEL");
float a2sf[2] __attribute__((aligned(16)))
USER generates a user error (i.e., non fatal) by printing the given MSG according to the FMT.
effects apply_statement_effects(statement_effects f, statement k)
call make_call(entity a1, list a2)
value make_value_expression(expression _field_)
syntax make_syntax_call(call _field_)
expression copy_expression(expression p)
EXPRESSION.
bool statement_consistent_p(statement p)
bool expression_consistent_p(expression p)
void free_expression(expression p)
static statement module_statement
void free_arguments(cons *args)
bool entity_is_argument_p(entity e, cons *args)
cons * arguments_rm_entity(cons *a, entity e)
void dump_arguments(cons *args)
entity_name is a macro, hence the code replication
#define VALUE_TO_INT(val)
#define MIN(x, y)
minimum and maximum if they are defined somewhere else, they are very likely to be defined the same w...
#define ABS(x)
was: #define value_mult(v,w) value_direct_multiply(v,w) #define value_product(v,w) value_direct_produ...
#define value_eq(v1, v2)
bool operators on values
bool base_contains_variable_p(Pbase b, Variable v)
bool base_contains_variable_p(Pbase b, Variable v): returns true if variable v is one of b's elements...
bool integer_constant_p(entity ent, int *int_p)
Returns the double value associated to a PIPS constant.
bool integer_symbolic_constant_p(entity ent, int *int_p)
(*int_p) gets integer constant if any
entity int_to_entity(_int c)
bool proper_rw_effects_undefined_p(void)
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)
statement_effects get_proper_rw_effects(void)
list expression_to_proper_effects(expression)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
action_kind effect_action_kind(effect)
bool effects_all_read_p(list)
Check that all effects in el are read effects.
#define effects_undefined
#define action_kind_store_p(x)
struct _newgen_struct_effects_ * effects
#define action_write_p(x)
#define effects_effects(x)
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....
#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.
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.
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
#define ENDP(l)
Test if a list is empty.
#define POP(l)
Modify a list pointer to point on the next element of the list.
#define REFCAR(pc)
Get the adress of the first element of a list.
#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)
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
#define CAR(pcons)
Get the value of the first element of a 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.
#define MAPL(_map_list_cp, _code, _l)
Apply some code on the addresses of all the elements of a list.
#define list_undefined
Undefined list definition :-)
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.
bool declaration_statement_p(statement)
Had to be optimized according to Beatrice Creusillet.
void hash_table_print_header(hash_table htp, FILE *fout)
this function prints the header of the hash_table pointed to by htp on the opened stream fout.
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
#define pips_user_warning
#define FORTRAN_DIV(n, d)
#define FORTRAN_MOD(n, m)
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
#define pips_internal_error
#define user_error(fn,...)
int get_debug_level(void)
GET_DEBUG_LEVEL returns the current debugging level.
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
#define HASH_MAP(k, v, code, ht)
#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_table_undefined
Value of an undefined hash_table.
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
eformat_t partial_eval_mod_operator(expression *ep1, expression *ep2, Psysteme ps, effects fx)
bool partial_eval(const char *module_name)
Top-level function.
eformat_t partial_eval_binary_operator_old(entity func, cons *la, Psysteme ps, effects fx)
effects stmt_to_fx(statement stmt, statement_effects fx_map)
returns proper effects associated to statement stmt
static statement partial_eval_current_statement
eformat_t partial_eval_expression(expression e, Psysteme ps, effects fx)
#define PERFORM_MULTIPLICATION
eformat_t partial_eval_expression_and_copy(expression expr, Psysteme ps, effects fx)
bool eformat_equivalent_p(eformat_t ef1, eformat_t ef2)
eformat_t partial_eval_div_or_mod_operator(int token, expression *ep1, expression *ep2, Psysteme ps, effects fx)
eformat_t partial_eval_max_operator(expression *ep1, expression *ep2, Psysteme ps, effects fx)
void partial_eval_declaration(entity v, Psysteme pre_sc, effects fx)
assumes conditions checked by partial_eval_declarations()
void init_use_preconditions(const char *module_name)
static bool live_loop_index_p(entity i)
void regenerate_call(eformat_t *efp, call ca)
We are likely to end up in trouble because the regenerated expression may not be a call; for instance...
eformat_t partial_eval_syntax(expression e, Psysteme ps, effects fx)
eformat_t partial_eval_unary_operator(entity func, cons *la, Psysteme ps, effects fx)
eformat_t partial_eval_plus_operator(expression *ep1, expression *ep2, Psysteme ps, effects fx)
eformat_t partial_eval_update_operators(expression *ep1 __attribute__((__unused__)), expression *ep2, Psysteme ps, effects fx)
FI: a better job could be done by distinguishing between the different kinds of operators.
void partial_eval_statement(statement stmt)
apply partial eval on each statement we cannot recurse on something other than a statement because we...
eformat_t partial_eval_c_mod_operator(expression *ep1, expression *ep2, Psysteme ps, effects fx)
void partial_eval_call_and_regenerate(call ca, Psysteme ps, effects fx)
eformat_t partial_eval_mult_operator(expression *ep1, expression *ep2, Psysteme ps, effects fx)
#define PERFORM_SUBTRACTION
static void rm_live_loop_index(entity i)
void partial_eval_declarations(list el, Psysteme pre_sc, effects fx)
static list live_loop_indices
when formating is useless (ie.
bool entity_written_p(entity ent, effects fx)
eformat_t partial_eval_binary_operator(entity func, cons *la, Psysteme ps, effects fx)
void init_use_proper_effects(const char *module_name)
eformat_t partial_eval_min_or_max_operator(int token, expression *ep1, expression *ep2, Psysteme ps, effects fx)
expression generate_monome(int coef, expression expr)
void reset_live_loop_indices()
eformat_t partial_eval_div_operator(expression *ep1, expression *ep2, Psysteme ps, effects fx)
eformat_t partial_eval_minus_c_operator(expression *ep1, expression *ep2, Psysteme ps, effects fx)
eformat_t partial_eval_call(call ec, Psysteme ps, effects fx)
eformat_t partial_eval_plus_or_minus_operator(int token, expression *ep1, expression *ep2, Psysteme ps, effects fx)
void dump_live_loop_indices()
eformat_t partial_eval_call_expression(expression exp, Psysteme ps, effects fx)
static struct perform_switch binary_operator_switch[]
static void add_live_loop_index(entity i)
void set_live_loop_indices()
cproto-generated files
Psysteme stmt_prec(statement stmt)
void transformer_map_print(void)
eformat_t partial_eval_plus_c_operator(expression *ep1, expression *ep2, Psysteme ps, effects fx)
eformat_t partial_eval_reference(expression e, Psysteme ps, effects fx)
void regenerate_expression(eformat_t *efp, expression *ep)
in order to regenerate expression from eformat.
eformat_t partial_eval_minus_operator(expression *ep1, expression *ep2, Psysteme ps, effects fx)
void partial_eval_expression_and_regenerate(expression *ep, Psysteme ps, effects fx)
void print_eformat(eformat_t ef, char *name)
static eformat_t eformat_undefined
Hypotheses pour l'implementation:
eformat_t partial_eval_power_operator(expression *ep1, expression *ep2, Psysteme ps, effects fx)
eformat_t partial_eval_min_operator(expression *ep1, expression *ep2, Psysteme ps, effects fx)
void unnormalize_expression(void *st)
void unnormalize_expression(expression exp): puts all the normalized field of expressions in "st" to ...
void print_expression(expression e)
no file descriptor is passed to make is easier to use in a debugging stage.
#define print_transformer(t)
void print_statement(statement)
Print a statement on stderr.
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
#define MAX_OPERATOR_NAME
#define POWER_OPERATOR_NAME
#define BITWISE_OR_UPDATE_OPERATOR_NAME
#define C_MODULO_OPERATOR_NAME
#define MINUS_OPERATOR_NAME
#define ENTITY_UNARY_MINUS_P(e)
#define DIVIDE_UPDATE_OPERATOR_NAME
#define PLUS_OPERATOR_NAME
#define NORMALIZE_EXPRESSION(e)
#define MAX0_OPERATOR_NAME
#define MIN0_OPERATOR_NAME
#define LEFT_SHIFT_UPDATE_OPERATOR_NAME
#define MULTIPLY_UPDATE_OPERATOR_NAME
#define MINUS_UPDATE_OPERATOR_NAME
#define is_instruction_block
soft block->sequence transition
#define CONTINUE_FUNCTION_NAME
#define entity_variable_p(e)
An entity_variable_p(e) may hide a typedef and hence a functional type.
#define DIVIDE_OPERATOR_NAME
#define UNARY_MINUS_OPERATOR_NAME
#define RIGHT_SHIFT_UPDATE_OPERATOR_NAME
#define PLUS_UPDATE_OPERATOR_NAME
#define ENTITY_ADDRESS_OF_P(e)
#define MINUS_C_OPERATOR_NAME
#define MULTIPLY_OPERATOR_NAME
#define ASSIGN_OPERATOR_NAME
#define MODULO_OPERATOR_NAME
#define PLUS_C_OPERATOR_NAME
#define MIN_OPERATOR_NAME
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 same_entity_p(entity e1, entity e2)
predicates on entities
entity local_name_to_top_level_entity(const char *n)
This function try to find a top-level entity from a local name.
entity operator_neutral_element(entity op)
entity entity_intrinsic(const char *name)
FI: I do not understand this function name (see next one!).
int ipow(int vg, int vd)
FI: such a function should exist in Linear/arithmetique.
expression make_vecteur_expression(Pvecteur pv)
make expression for vector (Pvecteur)
bool expression_call_p(expression e)
expression MakeBinaryCall(entity f, expression eg, expression ed)
Creates a call expression to a function with 2 arguments.
bool expression_equal_p(expression e1, expression e2)
Syntactic equality e1==e2.
void update_expression_syntax(expression e, syntax s)
frees expression syntax of e and replace it by the new syntax s
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
expression make_op_exp(char *op_name, expression exp1, expression exp2)
================================================================
expression MakeUnaryCall(entity f, expression a)
Creates a call expression to a function with one argument.
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.
entity expression_to_entity(expression e)
just returns the entity of an expression, or entity_undefined
bool reference_scalar_p(reference r)
This function returns true if Reference r is scalar.
bool c_language_module_p(entity m)
bool fortran_language_module_p(entity m)
basic basic_of_expression(expression)
basic basic_of_expression(expression exp): Makes a basic of the same basic as the expression "exp".
statement pop_statement_global_stack(void)
bool variable_entity_p(entity)
variable.c
int type_memory_size(type)
expression variable_initial_expression(entity)
Returns a copy of the initial (i.e.
void push_statement_on_statement_global_stack(statement)
void free_statement_global_stack(void)
void make_statement_global_stack(void)
#define syntax_reference_p(x)
#define transformer_undefined
#define syntax_reference(x)
#define normalized_linear_p(x)
#define forloop_initialization(x)
#define reference_variable(x)
#define sizeofexpression_type(x)
#define forloop_increment(x)
#define instruction_loop(x)
#define statement_ordering(x)
#define sizeofexpression_expression(x)
#define syntax_application(x)
#define dimension_lower(x)
#define basic_pointer_p(x)
#define statement_domain
newgen_sizeofexpression_domain_defined
@ is_syntax_sizeofexpression
#define range_increment(x)
#define EXPRESSION(x)
EXPRESSION.
#define cast_expression(x)
#define subscript_indices(x)
#define entity_undefined_p(x)
#define expression_undefined
@ is_instruction_unstructured
@ is_instruction_whileloop
@ is_instruction_expression
#define instruction_tag(x)
#define transformer_relation(x)
#define expression_normalized(x)
#define dimension_upper(x)
#define reference_indices(x)
#define syntax_sizeofexpression(x)
#define sizeofexpression_expression_p(x)
#define instruction_forloop(x)
#define instruction_expression(x)
#define expression_undefined_p(x)
#define test_condition(x)
#define subscript_array(x)
#define application_function(x)
#define variable_dimensions(x)
#define statement_declarations(x)
#define statement_instruction(x)
#define instruction_call(x)
#define syntax_subscript(x)
#define forloop_condition(x)
#define call_arguments(x)
#define instruction_test(x)
#define statement_undefined_p(x)
#define statement_number(x)
#define value_expression_p(x)
#define normalized_linear(x)
#define expression_syntax(x)
#define type_variable_p(x)
#define predicate_system(x)
#define value_expression(x)
#define variable_basic(x)
#define statement_undefined
#define entity_initial(x)
struct Ssysteme * Psysteme
Pbase sc_to_minimal_basis(Psysteme ps)
creation d'une base contenant toutes les variables apparaissant avec des coefficients non-nuls dans l...
Psysteme sc_dup(Psysteme ps)
Psysteme sc_dup(Psysteme ps): should becomes a link.
bool sc_minmax_of_variable2(volatile Psysteme ps, Variable var, Value *pmin, Value *pmax)
void sc_minmax_of_variable2(Psysteme ps, Variable var, Value *pmin, *pmax): examine un systeme pour t...
Value b1
booleen indiquant quel membre est en cours d'analyse
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
bool precondition_minmax_of_expression(expression exp, transformer tr, intptr_t *pmin, intptr_t *pmax)
compute integer bounds pmax, pmin of expression exp under preconditions tr require value mappings set...
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 reset_precondition_map(void)
void set_precondition_map(statement_mapping)
statement_mapping get_precondition_map(void)
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
The structure used to build lists in NewGen.
#define exp
Avoid some warnings from "gcc -Wshadow".
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....