25 #include "pips_config.h"
46 #include "resources.h"
217 (
char *) summary_comp_dup);
240 trace_on(
"statement %s, ordering (%d %d)",
257 fprintf(stderr,
"complexity for statement (%td,%td) at %p\n",
303 &callbasic, precond, effects_list);
308 precond, effects_list);
314 precond, effects_list);
361 for ( i = block_length; i > 0 ; i-- ) {
390 if ( mustbewritten ) {
404 fprintf(stderr,
"block comp is at %p and comp value is ", comp);
427 &testbasic, precond, effects_list);
431 fprintf(stderr,
"YYY test true complexity: ");
433 fprintf(stderr,
"YYY test false complexity: ");
435 fprintf(stderr,
"YYY test cond. complexity: ");
449 fprintf(stderr,
"YYY test total complexity: ");
470 complexity comp, cbody, crange, clower, cupper, cincr, cioh, cboh;
513 user_warning(
"loop_to_complexity",
"DOALL not implemented yet\n");
517 precond, effects_list,
530 precond, effects_list,
543 precond, effects_list,
549 user_error(
"loop_to_complexity",
"null increment\n");
550 else if ( incr < 0 ) {
554 if ( incr != -1.0 ) {
563 else if ( incr != 1) {
616 fprintf(stderr,
"@@@ body complexity: ");
618 fprintf(stderr,
"@@@ range complexity: ");
620 fprintf(stderr,
"@@@ lower value : ");
622 fprintf(stderr,
"@@@ upper value : ");
624 fprintf(stderr,
"@@@ increment value : ");
626 fprintf(stderr,
"@@@ sigma complexity: ");
669 fprintf(stderr,
"@@@ loop total compl: ");
702 fprintf(stderr,
"YYY body complexity: ");
704 fprintf(stderr,
"YYY test complexity: ");
715 precond, effects_list,
726 fprintf(stderr,
"YYY while total complexity: ");
763 user_error(
"call_to_complexity",
"unknown complexity\n");
782 user_error(
"call_to_complexity",
"unknown value");
788 fprintf(stderr,
"call '%s': ", name);
790 fprintf(stderr,
"call comp is at %p\n", comp);
827 fprintf(stderr,
"argument comp is at %p and value is ", comp);
894 precond, effects_list);
919 pbasic, precond, effects_list);
978 "basic_tag %d, not in 1->9\n", (
int)
basic_tag(b));
1027 fprintf(stderr,
">>> ref. %s argus complexity: ", name);
1029 fprintf(stderr,
">>> ref. %s access complexity: ", name);
1031 fprintf(stderr,
">>> ref. %s indices complexity: ", name);
1041 fprintf(stderr,
">>> ref. %s total complexity: ", name);
1094 complexity compl = NULL, compu = NULL, compi = NULL;
1122 fprintf(stderr,
"--- range lower complexity: ");
1124 fprintf(stderr,
"--- range upper complexity: ");
1126 fprintf(stderr,
"--- range incr complexity: ");
1136 fprintf(stderr,
"--- range total complexity: ");
float a2sf[2] __attribute__((aligned(16)))
USER generates a user error (i.e., non fatal) by printing the given MSG according to the FMT.
void free_complexity(complexity p)
complexity copy_complexity(complexity p)
COMPLEXITY.
bool complexity_consistent_p(complexity p)
struct _newgen_struct_entity_ * entity
static reference ref
Current stmt (an integer)
complexity make_complexity_unknown(const char *name)
builds a new unknown complexity attached to a virtual package
complexity evaluate_var_to_complexity(entity var, transformer precond, list effects_list __attribute__((__unused__)), int maximize)
complexity evaluate_var_to_complexity(entity var, transformer precond, list effects_list,...
complexity expression_to_complexity_polynome(expression expr, transformer precond, list effects_list, bool keep_symbols, int maximize)
Entry point routine of this file:
void complexity_add(complexity *pcomp1, complexity comp2)
void complexity_add(complexity *pcomp1, comp2) performs *pcomp1 = *pcomp1 + comp2; !...
void complexity_scalar_mult(complexity *pcomp, float f)
multiply a complexity by a floating-point number.
void complexity_polynome_add(complexity *pcomp, Ppolynome pp)
Ppolynome complexity_polynome(complexity comp)
Because complexity is composed of two elements, we use this function to get the first element : polyn...
float complexity_TCST(complexity comp)
return the constant term of comp.
void complexity_div(complexity *pcomp1, complexity comp2)
void complexity_div(complexity *pcomp1, comp2) performs *pcomp1 = *pcomp1 / comp2; !...
void complexity_float_add(complexity *pcomp, float f)
Add a floating point digit to the complexity May 3, 91.
complexity replace_formal_parameters_by_real_ones(complexity comp, entity mod, list args, transformer precond, list effects_list)
transform formal params into real ones (args) in complexity comp
bool complexity_constant_p(complexity comp)
true if comp is constant.
complexity make_zero_complexity()
make a zero complexity "0.0000 * TCST" with null statistics
complexity complexity_var_subst(complexity comp, Variable var, complexity compsubst)
complexity complexity_var_subst(comp, var, compsubst) replaces every occurrence of variable var in co...
complexity make_constant_complexity(float f)
make a constant complexity "f * TCST" with null statistics
complexity complexity_sigma(complexity comp, Variable index, complexity clower, complexity cupper)
comp_math.c
void complexity_stats_add(complexity *pcomp1, complexity comp2)
Add comp2's statistics to *pcomp1's comp2 keeps unchanged.
void complexity_mult(complexity *pcomp1, complexity comp2)
void complexity_mult(complexity *pcomp1, comp2) performs *pcomp1 = *pcomp1 * comp2; !...
bool complexity_zero_p(complexity comp)
zero complexity check.
bool complexity_unknown_p(complexity comp)
true if comp is unknown.
complexity make_single_var_complexity(float f, Variable var)
make a complexity "f * var" with null statistics
hash_table hash_complexity_parameters
complexity range_to_complexity(range rng, transformer precond, list effects_list)
2nd element of syntax
complexity whileloop_to_complexity(whileloop while_instr, transformer precond, list effects_list)
5th element of instruction
complexity call_to_complexity(call call_instr, basic *pbasic, transformer precond, list effects_list)
3rd element of syntax
complexity loop_to_complexity(loop loop_instr, transformer precond, list effects_list)
3rd element of instruction
hash_table hash_callee_to_complexity
comp_expr_to_pnome.c
complexity test_to_complexity(test test_instr, transformer precond, list effects_list)
2nd element of instruction
bool any_complexities(const string module_name)
complexity reference_to_complexity(reference ref, basic *pbasic, transformer precond, list effects_list)
1st element of syntax
complexity instruction_to_complexity(instruction instr, transformer precond, list effects_list)
The only element available of the statement.
complexity expression_to_complexity(expression expr, basic *pbasic, transformer precond, list effects_list)
2nd element of call –arguments
bool fp_complexities(const string module_name)
bool uniform_complexities(const string module_name)
declares the static variable complexity_map and defines its access functions
complexity indices_to_complexity(list exprlist, basic *pbasic, transformer precond, list effects_list)
2nd element of reference
complexity arguments_to_complexity(list exprlist, basic *pbasic, transformer precond, list effects_list)
2nd element of call
complexity statement_to_complexity(statement stat, transformer precon __attribute__((__unused__)), list eff_list __attribute__((__unused__)))
starting point of Abstract Syntax Tree
complexity subscript_to_complexity(subscript sub, basic *pbasic, transformer precond, list effects_list)
bool summary_complexity(const string module_name)
complexity goto_to_complexity(statement st __attribute__((__unused__)), transformer precond __attribute__((__unused__)), list effects_list __attribute__((__unused__)))
4th element of instruction
complexity block_to_complexity(list block, transformer precond, list effects_list)
1st element of instruction
complexity syntax_to_complexity(syntax s, basic *pbasic, transformer precond, list effects_list)
the only available element of expression
complexity unstructured_to_complexity(unstructured unstr, transformer precond, list effects_list)
6th element of instruction
void complexity_rm(complexity *pcomp)
remove complexity comp
void remove_formal_parameters_from_hash_table(entity mod, hash_table hash_complexity_params)
void remove_common_variables_from_hash_table(entity module, hash_table hash_complexity_params)
void trace_on(char *fmt,...)
hash_table free_callees_complexities(hash_table h)
void complexity_fprint(FILE *fd, complexity comp, bool print_stats_p, bool print_local_names_p)
void add_common_variables_to_hash_table(entity module, hash_table hash_complexity_params)
void complexity_check_and_warn(char *s, complexity comp) const
int complexity_degree(complexity c)
hash_table fetch_complexity_parameters(char *module_name)
void trace_off()
"trace off"
void add_formal_parameters_to_hash_table(entity mod, hash_table hash_complexity_params)
void fprint_cost_table(FILE *fd)
hash_table fetch_callees_complexities(char *module_name)
int intrinsic_cost(char *s, basic *pargsbasic) const
Return the cost of the intrinsic named s, knowing that the "basic" type of its biggest argument is *p...
complexity complexity_dup(complexity comp)
duplicates complexity comp
void init_cost_table()
Completes the intrinsic cost table with the costs read from the files specified in the "COMPLEXITY_CO...
bool complexity_is_monomial_p(complexity c)
#define MAKE_ADDRESS_BASIC
#define LOOP_BRANCH_OVERHEAD
#define TYPE_CAST_COST
TYPE_CAST_COST added to handle cast case ; Molka Becher
#define MEMORY_READ_NAME
the above two lines are added for 6th cost file, overhead.
#define KEEP_SYMBOLS
defines for "expression_to_polynome" parameters
#define MAKE_STRING_BASIC
#define LOOP_INIT_OVERHEAD
#define UNKNOWN_RANGE_NAME
pseudo-variable for default iteration number of a loop
#define COMPLEXITY_NOT_FOUND
statement_mapping get_complexity_map(void)
void store_statement_complexity(statement, complexity)
complexity load_statement_complexity(statement)
void reset_complexity_map(void)
void set_complexity_map(statement_mapping)
#define complexity_ifcount(x)
#define complexity_rangecount(x)
struct _newgen_struct_complexity_ * complexity
#define rangecount_guessed(x)
#define ifcount_halfhalf(x)
void reset_proper_rw_effects(void)
void set_proper_rw_effects(statement_effects)
void set_cumulated_rw_effects(statement_effects)
list load_cumulated_rw_effects_list(statement)
void reset_cumulated_rw_effects(void)
bool effects_write_variable_p(list, entity)
bool empty_global_label_p(const char *gln)
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....
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.
#define NIL
The empty list (nil in Lisp)
size_t gen_length(const list l)
#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.
list gen_nthcdr(int n, const list lx)
caution: the first item is 0! was: return( (n<=0) ? l : gen_nthcdr( n-1, CDR( l ))) ; if n>gen_length...
#define MAPL(_map_list_cp, _code, _l)
Apply some code on the addresses of 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.
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_del(hash_table htp, const void *key)
this function removes from the hash table pointed to by htp the couple whose key is equal to key.
struct _newgen_struct_range_ * range
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
#define pips_internal_error
#define user_error(fn,...)
#define user_warning(fn,...)
#define DEFINE_CURRENT_MAPPING(name, type)
#define MAKE_STATEMENT_MAPPING()
#define hash_table_undefined
Value of an undefined hash_table.
int bool
we cannot use an enum or stdbool because we need to be compatible with newgen, thus boolean need to h...
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
int default_is_inferior_pvarval(Pvecteur *pvarval1, Pvecteur *pvarval2)
bool default_is_inferior_pvarval(Pvecteur * pvarval1, Pvecteur * pvarval2) return true if var1 is bef...
Pbase polynome_used_var(Ppolynome pp, int *is_inferior_var)
Pbase polynome_used_var(Ppolynome pp, bool *is_inferior_var()) PRIVATE Returns, in a Pbase,...
#define MINUS_OPERATOR_NAME
#define ORDERING_NUMBER(o)
#define ENTITY_LESS_THAN_P(e)
#define ORDERING_STATEMENT(o)
#define is_instruction_block
soft block->sequence transition
#define instruction_block(i)
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_register_p(entity e)
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...
const char * module_local_name(entity e)
Returns the module local user name.
expression make_op_exp(char *op_name, expression exp1, expression exp2)
================================================================
basic simple_basic_dup(basic)
basic MakeBasic(int)
END_EOLE.
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
entity make_new_scalar_variable_with_prefix(const char *, entity, basic)
Create a new scalar variable of type b in the given module.
bool is_inferior_basic(basic, basic)
bool is_inferior_basic(basic1, basic2) return true if basic1 is less complex than basic2 ex: int is l...
#define type_functional_p(x)
#define transformer_undefined
#define loop_execution(x)
#define basic_complex_p(x)
#define syntax_reference(x)
#define reference_variable(x)
#define instruction_loop(x)
#define statement_ordering(x)
#define sizeofexpression_expression(x)
#define instruction_goto(x)
#define basic_pointer_p(x)
#define basic_derived_p(x)
#define type_statement_p(x)
@ is_syntax_sizeofexpression
#define range_increment(x)
#define EXPRESSION(x)
EXPRESSION.
#define cast_expression(x)
#define subscript_indices(x)
#define instruction_undefined
#define statement_label(x)
@ is_instruction_unstructured
@ is_instruction_whileloop
@ is_instruction_expression
#define instruction_tag(x)
#define reference_indices(x)
#define syntax_sizeofexpression(x)
#define sizeofexpression_expression_p(x)
#define instruction_expression(x)
#define expression_undefined_p(x)
#define test_condition(x)
#define subscript_array(x)
#define instruction_whileloop(x)
#define whileloop_body(x)
#define statement_instruction(x)
#define instruction_call(x)
#define syntax_subscript(x)
#define call_arguments(x)
#define instruction_test(x)
#define whileloop_condition(x)
#define basic_string_p(x)
#define expression_syntax(x)
#define execution_parallel_p(x)
#define instruction_unstructured(x)
#define variable_basic(x)
#define basic_logical_p(x)
#define STATEMENT(x)
STATEMENT.
#define entity_initial(x)
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 reset_precondition_map(void)
void set_precondition_map(statement_mapping)
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".
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
Pvecteur vect_dup(Pvecteur v_in)
Pvecteur vect_dup(Pvecteur v_in): duplication du vecteur v_in; allocation de et copie dans v_out;.