25 #include "pips_config.h"
49 #define NB_SIMPLIFY_PASSES 1
52 #define FLOW_DEPENDANCE 1
53 #define ANTI_DEPENDANCE 2
54 #define OUTPUT_DEPENDANCE 4
55 #define INPUT_DEPENDANCE 8
56 #define ALL_DEPENDANCES (FLOW_DEPENDANCE|ANTI_DEPENDANCE|OUTPUT_DEPENDANCE)
80 "%02td (%p) -> (%td) : ",
123 "link with %02td :\n",
215 store_has_level(s,
depth);
285 debug(9,
"dependance_vertices_p",
"");
293 "between %02td and %02td ? ",
353 if ((
level < level_min) || (
level > level_max)) {
377 fprintf(stderr,
"Old conflicts :\n");
394 if (new_levels !=
NIL) {
414 fprintf(stderr,
"New conflicts :\n");
420 return new_conflicts;
438 fprintf(stderr,
"Old successors :\n");
474 fprintf(stderr,
"New successors :\n");
480 return new_successors;
505 "dep. at level >= %d and level <= %d ",
510 "between %02td and %02td.\n",
686 "statement %02td is partially invariant "
687 "(known array access).\n",
694 "statement %02td is not partially invariant "
695 "(known array access).\n",
705 "statement %02td is not partially invariant "
706 "(UNKNOWN array access).\n",
714 "statement %02td is partially invariant "
715 "(scalar access).\n",
725 "statement %02td is not partially invariant.\n",
746 load_statement_has_indices(st),
749 "statement %02td is not invariant (depend of indices).\n",
758 "statement %02td is not invariant (self flow dep).\n",
774 "statement %02td is not invariant "
775 "(dep. of %02td).\n",
785 "statement %02td is invariant.\n",
835 level, load_has_level(st));
836 }, matching_vertices);
852 set partially_invariant)
888 partially_invariant =
939 set partially_invariant,
967 "statement %02td is not redundant (variable address).\n",
984 "statement %td is not redundant "
995 "statement %td is redundant.\n",
1032 0, load_has_level(st));
1033 }, matching_vertices);
1049 set partially_invariant)
1067 partially_invariant,
1101 pips_debug(5,
"set of statement number studied: ");
1105 pips_debug(8,
"set of statement studied:\n");
1153 pips_debug(5,
"set of statement number studied: ");
1157 pips_debug(8,
"set of statement studied:\n");
1299 fprintf(stderr,
"TEST : loop on %s (statement %td):\n",
1327 pips_debug(5,
"-> loop on %s removed (statement %td)\n",
1334 pips_debug(5,
"-> loop on %s NOT removed (statement %td)\n",
1386 bool task_parallelize_p)
1408 make_has_indices_map();
1449 free_has_indices_map();
1464 task_parallelize_p);
1518 "\nTesting NewGen consistency for initial code %s:\n",
1521 fprintf(stderr,
" NewGen consistent statement\n");
1525 pips_debug(1,
"original sequential code:\n\n");
1542 fprintf(stderr,
" gen consistent ");
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 void stmt_rewrite(statement s)
graph copy_graph(graph p)
GRAPH.
expression copy_expression(expression p)
EXPRESSION.
bool statement_consistent_p(statement p)
void free_expression(expression p)
static reference ref
Current stmt (an integer)
static bool stmt_filter(statement s)
modifies global var current_caller_stmt
static graph dg
dg is the dependency graph ; FIXME : should not be static global ?
bool clean_up_sequences(statement s)
Recursively clean up the statement sequences by fusing them if possible and by removing useless one.
static list successors(list l)
#define CONFLICT(x)
CONFLICT.
#define dg_arc_label_conflicts(x)
#define conflict_source(x)
#define region
simulation of the type region
void proper_effects_of_module_statement(statement)
list load_proper_rw_effects_list(statement)
void reset_proper_rw_effects(void)
void init_proper_rw_effects(void)
void set_proper_rw_effects(statement_effects)
void generic_effects_reset_all_methods(void)
void set_methods_for_proper_simple_effects(void)
list words_effect(effect)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
#define effect_write_p(eff)
#define action_write_p(x)
#define STATEMENT_EFFECTS_MAP(k, v, c, f)
#define effects_effects(x)
const char * module_name(const char *s)
Return the module part of an entity name.
#define gen_recurse(start, domain_number, flt, rwt)
#define successor_vertex(x)
#define successor_arc_label(x)
struct _newgen_struct_graph_ * graph
#define vertex_successors(x)
#define graph_undefined_p(x)
#define SUCCESSOR(x)
SUCCESSOR.
#define graph_vertices(x)
void reset_current_module_entity(void)
Reset the current module entity.
void reset_current_module_statement(void)
Reset the current module statement.
const char * get_current_module_name(void)
Get the name of the current module.
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
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_null(__attribute__((unused)) void *unused)
Ignore the argument.
instruction make_instruction_block(list statements)
Build an instruction block from a list of statements.
list gen_nreverse(list cp)
reverse a list in place
#define NIL
The empty list (nil in Lisp)
list gen_copy_seq(list l)
Copy a list structure.
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.
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.
#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.
#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
statement make_assign_statement(expression, expression)
statement update_statement_instruction(statement, instruction)
Replace the instruction in statement s by instruction i.
bool declaration_statement_p(statement)
Had to be optimized according to Beatrice Creusillet.
bool expression_constant_p(expression)
HPFC module by Fabien COELHO.
static expression compute_final_index_value(expression m1, expression m2, expression m3)
static bool loop_level_in(loop l)
static bool common_ignore_this_vertex(set region, vertex v)
bool invariant_code_motion(const char *module_name)
Phase that hoists loop invariant code out of loops.
static bool inv_entity_filter(entity e)
statement vertex_to_statement(vertex v)
Vertex_to_statement looks for the statement that is pointed to by vertex v.
static list depending_indices
of entity
static bool does_it_depend(statement s)
Set whether s depends from enclosing indices.
static graph DoRedundantsStatements(list lsccs, graph g, set region, int level, set partially_invariant)
static bool invariant_ignore_this_successor(vertex v, set region, successor su, int level)
static void drop_dummy_loops(statement s)
static bool push_depending_index(loop l)
static bool statement_depend_of_indices_p(statement st, list indices, int level)
static bool vertex_invariant_p(vertex v, graph g, int level, set region, set invariant)
static bool action_dependance_p(conflict c, int dependance_type)
static list remove_dependances_from_successors(list successors, vertex v2, int dependance_type, int level_min, int level_max)
of successor
#define NB_SIMPLIFY_PASSES
Set to 2 if we want to simplify in two passes.
static bool icm_loop_rwt(loop l)
static set vertices_to_statements(list vl, set ss)
of statement
static bool exist_non_self_dependance_from_vertex_p(vertex v, int dependance_type, int level)
static bool expression_invariant
static void remove_dependance(vertex v1, vertex v2, int dependance_type, int level_min, int level_max)
static void prettyprint_vertex(FILE *fd, vertex v)
static statement icm_codegen(statement stat, graph g, set region, int level, bool task_parallelize_p)
static int reference_level
static graph SupressDependances(graph g, set region, int level, unsigned int count)
void dump_sef(statement_effects se)
icm.c
static void prettyprint_conflict(FILE *fd, conflict c)
static set invariant_vertex_to_invariant_entities(vertex v, set rs)
of entity
static graph DoInvariantsStatements(list lsccs, graph g, set region, int level, set partially_invariant)
#define OUTPUT_DEPENDANCE
static bool vertex_redundant_p(vertex v, __attribute__((unused)) graph g, int level, set region, set partially_invariant, set redundant)
static void pop_depending_index(loop l)
static bool drop_it(loop l)
static set invariant_entities
of entity
static void SimplifyInvariantVertex(vertex v, set region, int level)
static bool expressions_invariant_p(list le)
static graph SimplifyGraph(graph g, set region, int level, unsigned int count)
static list remove_dependance_from_conflicts(list conflicts, int dependance_type, int level_min, int level_max)
of conflict
static list remove_dependance_from_levels(list levels, int level_min, int level_max)
of level
static bool statement_mark(statement s)
static void loop_level_out(__attribute__((unused)) loop l)
static bool ref_flt(reference r)
void print_list_entities(list l)
static bool vertex_partially_invariant_p(vertex v, __attribute__((unused)) graph g, __attribute__((unused)) int level, __attribute__((unused)) set invariant)
static void prettyprint_successor(FILE *fd, successor su)
static void SimplifyRedundantVertex(vertex v, set region, int level)
static bool icm_ignore_this_successor(vertex v, set region, successor su, int level)
static bool dependance_vertices_p(vertex v1, vertex v2, int dependance_type, int level)
Test the existence of a given dependence between two vertices v1, v2.
static statement mod_stat
We want to keep track of the current statement inside the recurse.
static int redundant(Pproblem XX, int i1, int i2)
#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
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
#define GENERIC_LOCAL_MAPPING(name, result, type)
to allow mappings local to a file.
#define DEFINE_LOCAL_STACK(name, type)
bool set_empty_p(const set)
tell whether set s is empty.
#define SET_MAP(element, code, the_set)
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 *)
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.
void set_bool_property(const char *, bool)
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
#define MAX_OPERATOR_NAME
#define INT_GENERIC_CONVERSION_NAME
generic conversion names.
#define make_statement_list(stats...)
easy list constructor
entity local_name_to_top_level_entity(const char *n)
This function try to find a top-level entity from a local name.
entity entity_intrinsic(const char *name)
FI: I do not understand this function name (see next one!).
int expression_to_int(expression exp)
================================================================
expression make_factor_expression(int coeff, entity vari)
Some functions to generate expressions from vectors and constraint systems.
expression MakeBinaryCall(entity f, expression eg, expression ed)
Creates a call expression to a function with 2 arguments.
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 entity_scalar_p(entity)
The concrete type of e is a scalar type.
int variable_entity_dimension(entity)
variable_entity_dimension(entity v): returns the dimension of variable v; scalar have dimension 0.
#define loop_execution(x)
#define reference_variable(x)
#define loop_domain
newgen_language_domain_defined
#define statement_domain
newgen_sizeofexpression_domain_defined
#define range_increment(x)
#define EXPRESSION(x)
EXPRESSION.
#define instruction_undefined
#define reference_domain
newgen_range_domain_defined
#define reference_indices(x)
#define statement_instruction(x)
#define statement_number(x)
#define execution_parallel_p(x)
#define statement_undefined
bool strongly_connected_p(scc s, int l)
this function returns true if scc s is stronly connected at level l, i.e.
statement CodeGenerate(statement __attribute__((unused)) stat, graph g, set region, int l, bool task_parallelize_p)
This function implements Allen & Kennedy's algorithm.
int enclosing
This is an horrendous hack.
statement rice_statement(statement stat, int l, statement(*codegen_fun)(statement, graph, set, int, bool))
void set_sccs_drivers(bool(*)(set, vertex), bool(*)(vertex, set, successor, int))
scc.c
void reset_sccs_drivers(void)
list FindAndTopSortSccs(graph, set, int)
void prettyprint_dependence_graph(FILE *, statement, graph)
Print all edges and arcs.
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
GENERIC_LOCAL_FUNCTION(directives, step_directives)
Copyright 2007, 2008, 2009 Alain Muller, Frederique Silber-Chaussumier.
FI: I do not understand why the type is duplicated at the set level.
The structure used to build lists in NewGen.
void print_words(FILE *fd, cons *lw)
#define exp
Avoid some warnings from "gcc -Wshadow".