25 #include "pips_config.h"
55 #include "resources.h"
270 return current_statement_head();
276 #if defined(PUSH_BODY)
386 if (!bound_inserted_p(s))
449 for (i=0; i<=nlevels; i++)
457 pips_assert(
"coherent level", elevel>=0 && elevel<=nlevels);
479 for (i=0; i<nlevels && first_alone; i++)
508 for(i=0; i<= nombre_grp; i++)
511 fprintf(stderr,
"\n\n***GROUP LEVEL %d:\n", i);
610 for (i=0; i<nlevels; i++)
616 bool satom_inserted =
false;
623 for (j=i+1; j<=nlevels && !satom_inserted; j++)
631 satom_inserted =
true;
703 statement sofl = current_statement_head();
715 statement sofl = current_statement_head();
746 sscanf((
const char*)
comment,
"%d", &number);
799 sscanf((
const char*)
comment,
"%d", &number_use);
801 number_use += up_down;
802 new=
int2a(number_use);
815 if (bound_inserted_p(container))
817 statement updated, sblock = load_inserted(container);
903 pips_debug(1,
"redundant statement purged:\n");
959 if (bound_inserted_p(s))
1007 inserted_undefined_p() &&
1030 make_current_statement_stack();
1032 #if defined(PUSH_BODY)
1063 #if defined(PUSH_BODY)
1069 (current_statement_size()==0));
1072 free_current_statement_stack();
1147 fprintf(stderr,
"DUMP ASPT\n ASPT = NULL !!!\n");
1154 "Scalar: %s \t Operator:[%s] len=%d, avail=%d\n",
1159 fprintf(stderr,
"\n===Container:\n");
1161 fprintf(stderr,
"\n===Contents:\n");
1163 fprintf(stderr,
"\n===Available_contents:\n");
1180 int bestcplx = INT_MAX;
1189 if(dcplx < cplx && dcplx < bestcplx) {
1190 bestexp = eavailable;
1316 #define NO_SIMILARITY (0)
1317 #define MAX_SIMILARITY (1000)
1383 return already_seen;
1476 for (; l; l =
CDR(l), la =
CDR(la))
1500 (*best_quality) = 0;
1508 (*best_quality) = quality;
1511 if (quality>0 && (*best_quality)<quality)
1514 (*best_quality) = quality;
1525 pips_debug(2,
"adding new scalar to pool:%s\nas a container for %s\n",
1668 list in_common, linit, lo1, lo2, old;
1995 list *top_of_w_effects;
float a2sf[2] __attribute__((aligned(16)))
USER generates a user error (i.e., non fatal) by printing the given MSG according to the FMT.
instruction copy_instruction(instruction p)
INSTRUCTION.
call make_call(entity a1, list a2)
syntax make_syntax_call(call _field_)
expression make_expression(syntax a1, normalized a2)
expression copy_expression(expression p)
EXPRESSION.
reference make_reference(entity a1, list a2)
void free_extensions(extensions p)
syntax copy_syntax(syntax p)
SYNTAX.
syntax make_syntax(enum syntax_utype tag, void *val)
void free_statement(statement p)
static reference ref
Current stmt (an integer)
bool entity_all_locations_p(entity e)
test if an entity is the top of the lattice
void free_arguments(cons *args)
gen_array_t gen_array_make(size_t size)
declarations...
void gen_array_addto(gen_array_t a, size_t i, void *what)
void * gen_array_item(const gen_array_t a, size_t i)
struct _newgen_struct_statement_ * statement
effects load_expr_prw_effects(expression)
void close_expr_prw_effects(void)
bool bound_expr_prw_effects_p(expression)
void set_cumulated_rw_effects(statement_effects)
list load_cumulated_rw_effects_list(statement)
void reset_cumulated_rw_effects(void)
void close_proper_rw_effects(void)
list proper_effects_of_expression(expression)
bool full_simple_proper_effects(const char *, statement)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
#define effect_write_p(eff)
bool effects_write_variable_p(list, entity)
entity effect_entity(effect)
cproto-generated files
#define effects_effects(x)
const char * local_name(const char *s)
Does not take care of block scopes and returns a pointer.
const char * module_name(const char *s)
Return the module part of an entity name.
void convert_to_c_operators(void *)
bool optimize_expressions(const char *)
pipsmake interface to apply expression optimization according to various strategy.
void cleanup_subscripts(void *)
statement atomize_this_expression(entity(*)(entity, basic), expression)
simple_atomize.c
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....
static void comment(string_buffer code, spoc_hardware_type hw, dagvtx v, int stage, int side, bool flip)
#define gen_context_recurse(start, ctxt, domain_number, flt, rwt)
#define gen_chunk_undefined
#define gen_recurse(start, domain_number, flt, rwt)
void gen_full_free_list(list l)
bool entities_may_conflict_p(entity e1, entity e2)
Check if two entities may conflict.
statement make_block_statement(list)
Make a block statement from a list of statement.
statement instruction_to_statement(instruction)
Build a statement from a give instruction.
void gen_recurse_stop(void *obj)
Tells the recursion not to go in this object.
void gen_multi_recurse(void *o,...)
Multi recursion visitor function.
void gen_context_multi_recurse(void *o, void *context,...)
Multi-recursion with context function visitor.
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_false(__attribute__((unused)) gen_chunk *unused)
Return false and ignore the argument.
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
#define ENDP(l)
Test if a list is empty.
list gen_nreverse(list cp)
reverse a list in place
void gen_remove(list *cpp, const void *o)
remove all occurences of item o from list *cpp, which is thus modified.
#define POP(l)
Modify a list pointer to point on the next element of the list.
void gen_remove_once(list *pl, const void *o)
Remove the first occurence of o in list pl:
#define NIL
The empty list (nil in Lisp)
list gen_once(const void *vo, list l)
Prepend an item to a list only if it is not already in the list.
list gen_copy_seq(list l)
Copy a list structure.
size_t gen_length(const list l)
list gen_cons(const void *item, const list next)
#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.
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_eq(const void *item, const list seq)
gen_chunk gen_nth(int n, const list l)
to be used as ENTITY(gen_nth(3, l))...
#define list_undefined
Undefined list definition :-)
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
bool statement_loop_p(statement)
statement make_assign_statement(expression, expression)
statement update_statement_instruction(statement, instruction)
Replace the instruction in statement s by instruction i.
bool assignment_statement_p(statement)
Test if a statement is an assignment.
bool empty_comments_p(const char *)
bool expression_constant_p(expression)
HPFC module by Fabien COELHO.
int vect_size(Pvecteur v)
package vecteur - reductions
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
#define pips_internal_error
#define DEFINE_LOCAL_STACK(name, type)
#define same_string_p(s1, s2)
#define SET_FOREACH(type_name, the_item, the_set)
enumerate set elements in their internal order.
#define string_undefined_p(s)
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
struct _newgen_struct_atom_ * atom
void normalize_all_expressions_of(void *obj)
void unnormalize_expression(void *st)
void unnormalize_expression(expression exp): puts all the normalized field of expressions in "st" to ...
void print_syntax(syntax s)
void print_expression(expression e)
no file descriptor is passed to make is easier to use in a debugging stage.
string expression_to_string(expression e)
void print_statement(statement)
Print a statement on stderr.
void set_string_property(const char *, const char *)
#define make_expression_list(stats...)
#define MAX_OPERATOR_NAME
#define binary_call_rhs(c)
#define ENTITY_ASSIGN_P(e)
#define MINUS_OPERATOR_NAME
#define ENTITY_UNARY_MINUS_P(e)
#define ENTITY_IMPLIEDDO_P(e)
#define PLUS_OPERATOR_NAME
#define NORMALIZE_EXPRESSION(e)
#define statement_block_p(stat)
#define expression_scalar_p(e)
#define binary_call_lhs(c)
#define EOLE_PROD_OPERATOR_NAME
#define EOLE_SUM_OPERATOR_NAME
#define instruction_block(i)
#define MINUS_C_OPERATOR_NAME
#define MULTIPLY_OPERATOR_NAME
#define entity_constant_p(e)
#define PLUS_C_OPERATOR_NAME
#define MIN_OPERATOR_NAME
const char * entity_user_name(entity e)
Since entity_local_name may contain PIPS special characters such as prefixes (label,...
bool io_intrinsic_p(entity e)
rue is a statement s is an io intrinsic
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 commutative_call_p(call c)
Test if we are allowed to commute operations.
entity entity_empty_label(void)
bool entity_empty_label_p(entity e)
set get_referenced_entities(void *elem)
retrieves the set of entities used in elem beware that this entities may be formal parameters,...
entity entity_intrinsic(const char *name)
FI: I do not understand this function name (see next one!).
expression Pvecteur_to_expression(Pvecteur vect)
AP, sep 25th 95 : some usefull functions moved from static_controlize/utils.c.
bool expression_call_p(expression e)
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.
call expression_call(expression e)
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...
bool expression_pointer_p(expression e)
we get the type of the expression by calling expression_to_type() which allocates a new one.
expression make_op_exp(char *op_name, expression exp1, expression exp2)
================================================================
bool reference_equal_p(reference r1, reference r2)
bool same_expression_p(expression e1, expression e2)
this is slightly different from expression_equal_p, as it will return true for a+b vs b+a
expression call_to_expression(call c)
Build an expression that call a function or procedure.
extensions empty_extensions(void)
extension.c
basic basic_of_expression(expression)
basic basic_of_expression(expression exp): Makes a basic of the same basic as the expression "exp".
entity make_new_scalar_variable(entity, basic)
#define test_domain
newgen_entity_domain_defined
#define normalized_undefined
#define syntax_reference_p(x)
#define expression_domain
newgen_execution_domain_defined
#define instruction_sequence_p(x)
#define unstructured_domain
newgen_type_domain_defined
#define syntax_reference(x)
#define normalized_linear_p(x)
#define reference_variable(x)
#define loop_domain
newgen_language_domain_defined
#define instruction_loop(x)
#define basic_pointer_p(x)
#define statement_domain
newgen_sizeofexpression_domain_defined
#define range_increment(x)
#define instruction_domain
newgen_functional_domain_defined
#define call_domain
newgen_callees_domain_defined
#define EXPRESSION(x)
EXPRESSION.
#define cast_expression(x)
#define statement_label(x)
#define entity_undefined_p(x)
#define reference_domain
newgen_range_domain_defined
#define expression_undefined
#define expression_normalized(x)
#define sequence_statements(x)
#define reference_indices(x)
#define statement_extensions(x)
#define instruction_sequence(x)
#define instruction_call_p(x)
#define expression_undefined_p(x)
#define test_condition(x)
#define whileloop_body(x)
#define whileloop_domain
newgen_variable_domain_defined
#define statement_instruction(x)
#define statement_comments(x)
#define instruction_call(x)
#define call_arguments(x)
#define whileloop_condition(x)
#define normalized_linear(x)
#define expression_syntax(x)
#define sequence_domain
newgen_reference_domain_defined
#define statement_undefined
#define STATEMENT(x)
STATEMENT.
#define syntax_subscript_p(x)
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
static bool cse_call_flt(call c, __attribute__((unused)) list *inserted)
Avoid visit the left side of assign statement.
static void add_ref_ent(reference r)
static bool moveable_to(list le, statement s)
Whether sg with effects le can be moved up to s.
static void insert_rwt(statement s)
Insert the new statements created.
static available_scalar_pt best_similar_expression(expression e, int *best_quality)
static list insertion_statement_in_correct_position(statement news, list l)
Insert statement s in the list of statement l.
static void push_nesting(statement s)
Keep track of statement nesting.
static void atomize_or_associate(expression e)
static void do_gather_all_expressions_perms(list sterns, list *perms)
static void remove_statement_redundant(statement s, list *inserted)
Remove statement redundant inserted before statement s.
static bool do_gather_all_expressions(expression e, list *gathered)
static list nesting
assumes:
static bool while_stop(whileloop wl, __attribute__((unused)) list *skip_list)
static bool call_unary_minus_p(expression e)
static list * w_effects
PDSon: w_effect store all the variables modified in the sequence of statement.
static int current_level(void)
The nesting depth of the current statement.
static bool cse_atom_call_flt(call c, list *skip_list)
static void set_comment_of_statement(statement s, char *new_comment)
Update the field 'comments' of a statement.
static bool atomizable_sub_expression_p(expression e)
Atomizable if some computation.
static void atomize_whileloop(whileloop w)
bool icm(const char *module_name)
Pipsmake phase: Invariant Code Motion.
static void do_atomize_if_different_level(expression e, int level)
Atomize sub expressions with.
static bool expression_eq_in_list_p(expression e, list l, expression *f)
Define forward.
static void prune_singleton(list *l)
static expression expr_left_side_of_assign_statement(statement stat)
Return the expression in the left side of an assign statement.
static bool call_flt(call c)
handle all calls not in a sequence
static void atomize_instruction(instruction i)
Atomize an instruction with call.
static void atom_cse_expression(expression e, list *skip_list)
Remove some inpropriate ones...
static bool prepare_icm(statement s)
static bool test_stop(test t, __attribute__((unused)) list *skip_list)
static bool loop_stop(loop l, __attribute__((unused)) list *skip_list)
static bool entity_as_arguments(entity ent, statement stat)
Verify if entity ent is an argument in the right expression of the assign statement stat.
static void atomize_call(call c, int level)
static list common_expressions(list args, list avails)
of expression
static bool expr_cse_flt(expression e, __attribute__((unused)) list *skip_list)
whether to get in here, whether to atomize...
static void prune_non_constant(list effects, list *perms)
static void loop_rwt(loop l)
static statement update_number_of_use(entity ent, list lst_stat, int up_down)
Update the number of use of statement defining 'ent' which is a member of list lst_stat with step up_...
static bool interference_on(entity var, list les)
Compute if an effect list Some effect in les interfere with var.
static void insert_before_statement(statement news, statement s, bool last)
Just for test static void dump_list_of_statement(list l) { fprintf(stderr, "\n===== Dump List: \n"); ...
static list current_available
statement stack to current statement.
static bool seq_flt(sequence s)
top down.
static void increase_number_of_use_by_1(entity ent, statement container)
Increase number of use of variable ent by one.
static bool loop_flt(loop l)
static expression right_side_of_assign_statement(statement stat)
bool common_subexpression_elimination(const char *module_name)
Pipsmake phase: Common Subexpression Elimination.
static void atomize_test(test t)
static void reorder_pointer_expression(expression e)
make sure expressions are ordered with pointer first
static void add_call_ent(call c)
static list list_diff(list l1, list l2)
of expression
static char * table_of_AC_operators[]
option:
static bool number_of_use_greater_1(statement s)
PDSon: I use the field 'comments' of statement for counting its number of use.
void try_reorder_expressions(void *s, bool icm)
static int similarity(expression e, available_scalar_pt aspt)
Find the commun sub-expression between e & aspt.
static bool side_effects_p(expression e)
There is a side effect if there is a W effect in the expression.
static list get_all_entities(expression e)
static bool Is_Associative_Commutative(entity e)
static gen_array_t group_expr_by_level(int nlevels, list le)
of list of expressions
static void pop_nesting(statement s)
Pop the current statement from nesting list.
static bool cse_expression_flt(expression e, list *inserted)
static int expr_level_of(expression e)
The level can be queried for a sub expression.
static void atomize_or_associate_for_level(expression e, int level)
static int level_of(list le)
Return the level of this expression, using the current nesting list.
static statement statement_of_level(int level)
or for a statement.
static bool currently_nested_p(void)
Test if the current statement is not the top one:
void perform_ac_cse(__attribute__((unused)) const char *name, statement s)
static statement current_statement
static bool try_reorder_expression_call(expression e, list availables)
static entity left_side_of_assign_statement(statement stat)
Return the entity in left side of an assign statement.
static available_scalar_pt make_available_scalar(entity scalar, statement container, expression contents)
static bool icm_atom_call_flt(call c)
Don't go into I/O calls...
static expression find_equal_expression_not_in_list(expression e, list avails, list seen)
static bool expression_in_list_p(expression e, list seen)
static list atomize_cse_this_statement_expressions(statement s, list availables)
side effects: use current_available and current_statement
struct available_scalar_t * available_scalar_pt
void perform_icm_association(const char *name, statement s)
Perform ICM and association on operators.
GENERIC_LOCAL_FUNCTION(directives, step_directives)
Copyright 2007, 2008, 2009 Alain Muller, Frederique Silber-Chaussumier.
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.
performs Associative-Commutative Common Subexpression Elimination on sequences.
list depends
NULL for references.
list * w_effects
part of which is available
expression contents
statement in which it appears (for atomization)
entity operator
the entity which holds the value? or partial?
statement container
W effects on these invalidates the scalar.
list available_contents
call or reference...
The structure used to build lists in NewGen.
A gen_chunk is used to store every object.
#define exp
Avoid some warnings from "gcc -Wshadow".
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
void vect_rm(Pvecteur v)
void vect_rm(Pvecteur v): desallocation des couples de v;
Pvecteur vect_add(Pvecteur v1, Pvecteur v2)
package vecteur - operations binaires
Pvecteur vect_substract(Pvecteur v1, Pvecteur v2)
Pvecteur vect_substract(Pvecteur v1, Pvecteur v2): allocation d'un vecteur v dont la valeur est la di...