29 #include "pips_config.h"
45 #include "resources.h"
70 printf(
"found invalid construct of type %td\n",elem->
i);
71 return *can_terapixify=
false;
80 return *can_terapixify=
false;
97 printf(
"found invalid expression %s of basic %s\n",estring, bstring);
101 return *can_terapixify=
false;
128 #define TERAPIX_PTRARG_PREFIX "FIFO"
129 #define TERAPIX_LOOPARG_PREFIX "N"
130 #define TERAPIX_IMAGE_PREFIX "im"
131 #define TERAPIX_MASK_PREFIX "ma"
132 #define TERAPIX_REGISTER_PREFIX "re"
137 string found = strstr(s,
prefix);
140 for(found+=strlen(
prefix);*found;++found)
141 if(!isdigit(*found))
return false;
312 return o0 > o1 ? -1 : 1 ;
315 return o0 > o1 ? -1 : 1 ;
337 bool only_mask =
true,
338 at_least_one_mask =
false;
341 at_least_one_mask=
true;
347 ctxt->
res = only_mask && at_least_one_mask;
420 string tmp=
strdup(fa_name);
421 tmp[strlen(tmp)-1]=0;
463 #define TERAPIX_ACC "P"
628 bool can_terapixify =
true;
761 for(
list citer=callers,siter=callers_statement;!
ENDP(citer);
POP(citer),
POP(siter))
836 return true || can_terapixify;
914 bool can_terapixify =
924 return can_terapixify;
1042 pips_user_error(
"terapix cannot handle division by a non-constant variable\n");
int get_int_property(const string)
call make_call(entity a1, list a2)
syntax make_syntax_call(call _field_)
type make_type_variable(variable _field_)
type copy_type(type p)
TYPE.
void free_constant(constant p)
basic make_basic_int(intptr_t _field_)
basic make_basic_pointer(type _field_)
expression copy_expression(expression p)
EXPRESSION.
statement copy_statement(statement p)
STATEMENT.
variable make_variable(basic a1, list a2, list a3)
syntax copy_syntax(syntax p)
SYNTAX.
void free_expression(expression p)
void free_storage(storage p)
void free_statement(statement p)
bool db_touch_resource(const char *rname, const char *oname)
touch logical time for resource[owner], possibly behind the back of pipsdbm.
list callers_to_call_sites(list callers_statement, entity called_module)
given a list callers_statement of module statements returns a list of calls to module called_module
void sort_parameters(entity module, gen_cmp_func_t cmp)
change the parameter order for function module using comparison function cmp both compilation unit an...
list callers_to_statements(list callers)
given a list callers of module name calling module called module return a list of their body
bool clean_up_sequences(statement s)
Recursively clean up the statement sequences by fusing them if possible and by removing useless one.
void do_loop_to_while_loop(statement)
converts a doloop to a while loop, in place
string compilation_unit_of_module(const char *)
The output is undefined if the module is referenced but not defined in the workspace,...
int dummy
A dummy file, to prevent empty libraries from breaking builds.
void set_cumulated_rw_effects(statement_effects)
list load_cumulated_rw_effects_list(statement)
list effects_write_effects(list)
void reset_cumulated_rw_effects(void)
list proper_effects_of_expression(expression)
const char * module_name(const char *s)
Return the module part of an entity name.
void substitute_expression(void *in, expression pattern, expression into)
expression_substitution.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....
#define call_constant_p(C)
#define gen_context_recurse(start, ctxt, domain_number, flt, rwt)
#define gen_recurse(start, domain_number, flt, rwt)
union gen_chunk * gen_chunkp
void gen_full_free_list(list l)
void set_conflict_testing_properties()
conflicts.c
bool effects_may_conflict_p(effect eff1, effect eff2)
Check if two effect may conflict @description Two effects may conflict if their abstract two location...
statement make_block_statement(list)
Make a block statement from a list of statement.
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
entity get_current_module_entity(void)
Get the entity of the current module.
void replace_entity(void *s, entity old, entity new)
per variable version of replace_entities.
void replace_entity_by_expression(void *s, entity ent, expression exp)
replace all reference to entity ent by expression exp in s.
void gen_recurse_stop(void *obj)
Tells the recursion not to go in this object.
void gen_context_multi_recurse(void *o, void *context,...)
Multi-recursion with context function visitor.
void gen_null2(__attribute__((unused)) void *u1, __attribute__((unused)) void *u2)
idem with 2 args, to please overpeaky compiler checks
bool gen_true2(__attribute__((unused)) gen_chunk *u1, __attribute__((unused)) void *u2)
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
instruction make_continue_instruction()
Creates a CONTINUE instruction, that is the FORTRAN nop, the ";" in C or the "pass" in Python for exa...
#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.
#define REFCAR(pc)
Get the adress of the first element of a list.
#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)
#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.
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.
sequence statement_sequence(statement)
Get the sequence of a statement sequence.
list statement_block(statement)
Get the list of block statements of a statement sequence.
loop statement_loop(statement)
Get the loop of a statement.
call statement_call(statement)
Get the call of a statement.
bool statement_call_p(statement)
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 continue_statement_p(statement)
Test if a statement is a CONTINUE, that is the FORTRAN nop, the ";" in C or the "pass" in Python....
void insert_statement(statement, statement, bool)
This is the normal entry point.
bool assignment_statement_p(statement)
Test if a statement is an assignment.
bool declaration_statement_p(statement)
Had to be optimized according to Beatrice Creusillet.
void statement_remove_useless_label(statement, bool *)
remove the label of a statement if the statement is not unstructured.
hash_table hash_table_make(hash_key_type key_type, size_t size)
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.
bool expression_constant_p(expression)
HPFC module by Fabien COELHO.
void full_loop_unroll(statement loop_statement)
get rid of the loop by body replication;
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
#define pips_internal_error
entity expression_int_scalar(expression exp)
================================================================
#define MODULE_SEP_STRING
#define HASH_DEFAULT_SIZE
#define same_string_p(s1, s2)
#define SET_FOREACH(type_name, the_item, the_set)
enumerate set elements in their internal order.
bool set_belong_p(const set, const void *)
list Words_Expression(expression obj)
of string
string basic_to_string(basic)
static const char * prefix
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
#define make_expression_list(stats...)
#define ENTITY_DIVIDE_P(e)
#define GREATER_THAN_OPERATOR_NAME
#define binary_call_rhs(c)
#define ENTITY_ASSIGN_P(e)
#define MINUS_OPERATOR_NAME
#define ENTITY_DEREFERENCING_P(e)
#define PLUS_OPERATOR_NAME
#define ENTITY_LESS_THAN_P(e)
#define DEFAULT_INTEGER_TYPE_SIZE
#define NORMALIZE_EXPRESSION(e)
#define statement_block_p(stat)
#define DEREFERENCING_OPERATOR_NAME
#define ENTITY_CONDITIONAL_P(e)
#define LEFT_SHIFT_OPERATOR_NAME
#define entity_declarations(e)
MISC: newgen shorthands.
#define ENTITY_PLUS_C_P(e)
#define ENTITY_GREATER_THAN_P(e)
#define ADDRESS_OF_OPERATOR_NAME
#define entity_variable_p(e)
An entity_variable_p(e) may hide a typedef and hence a functional type.
#define PRE_DECREMENT_OPERATOR_NAME
#define ENTITY_MINUS_C_P(e)
#define DIVIDE_OPERATOR_NAME
#define binary_call_lhs(c)
#define PRE_INCREMENT_OPERATOR_NAME
#define MINUS_C_OPERATOR_NAME
#define module_functional_parameters(func)
#define MULTIPLY_OPERATOR_NAME
#define RIGHT_SHIFT_OPERATOR_NAME
#define PLUS_C_OPERATOR_NAME
bool entity_area_p(entity e)
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...
bool entity_array_p(entity e)
Is e a variable with an array type?
bool same_entity_p(entity e1, entity e2)
predicates on entities
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
entity FindEntityFromUserName(const char *package, const char *name)
basic entity_basic(entity e)
return the basic associated to entity e if it's a function/variable/constant basic_undefined otherwis...
entity find_ith_formal_parameter(entity the_fnct, int rank)
This function gives back the ith formal parameter, which is found in the declarations of a call or a ...
const char * entity_module_name(entity e)
See comments about module_name().
bool entity_pointer_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!).
entity make_entity_copy_with_new_name(entity e, string global_new_name, bool move_initialization_p)
Create a copy of an entity, with (almost) identical type, storage and initial value if move_initializ...
expression range_to_expression(range r, enum range_to_expression_mode mode)
computes the distance between the lower bound and the upper bound of the range
bool expression_integer_value(expression e, intptr_t *pval)
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.
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.
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)
================================================================
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 extended_expression_constant_p(expression exp)
Returns true if the value of the expression does not depend syntactically on the current store.
list module_formal_parameters(entity func)
list module_formal_parameters(entity func) input : an entity representing a function.
void add_pragma_str_to_statement(statement st, const char *s, bool copy_flag)
Add a string as a pragma to a statement.
void AddLocalEntityToDeclarations(entity, entity, statement)
Add the variable entity e to the list of variables of the function module.
entity make_scalar_entity(const char *, const char *, basic)
entity make_scalar_entity(name, module_name, base)
bool entity_scalar_p(entity)
The concrete type of e is a scalar type.
entity make_new_scalar_variable(entity, basic)
int dimension_size(dimension)
this function computes the size of a dimension.
void AddEntityToCurrentModule(entity)
Add a variable entity to the current module declarations.
entity make_scalar_integer_entity(const char *, const char *)
Create an integer variable of name "name" in module of name "module_name".
bool formal_parameter_p(entity)
expression SizeOfDimension(dimension)
basic expression_basic(expression)
#define forloop_domain
newgen_extensions_domain_defined
#define dummy_identifier(x)
struct _newgen_struct_pragma_ * pragma
#define expression_domain
newgen_execution_domain_defined
#define parameter_dummy(x)
#define parameter_type(x)
#define value_constant(x)
#define normalized_linear_p(x)
#define callees_callees(x)
#define reference_variable(x)
#define loop_domain
newgen_language_domain_defined
#define value_intrinsic_p(x)
#define basic_pointer_p(x)
#define entity_storage(x)
#define statement_domain
newgen_sizeofexpression_domain_defined
#define code_declarations(x)
#define range_increment(x)
#define call_domain
newgen_callees_domain_defined
#define basic_overloaded_p(x)
#define storage_formal(x)
#define EXPRESSION(x)
EXPRESSION.
#define entity_undefined_p(x)
#define reference_domain
newgen_range_domain_defined
#define expression_normalized(x)
#define PARAMETER(x)
PARAMETER.
#define sequence_statements(x)
#define reference_indices(x)
#define variable_dimensions(x)
#define whileloop_domain
newgen_variable_domain_defined
#define statement_declarations(x)
#define call_arguments(x)
#define normalized_linear(x)
#define expression_syntax(x)
#define dummy_identifier_p(x)
#define value_expression(x)
#define variable_basic(x)
#define STATEMENT(x)
STATEMENT.
#define storage_undefined
#define entity_initial(x)
Psysteme new_loop_bound(Psysteme scn, Pbase base_index)
Psysteme new_loop_bound(Psysteme scn, Pbase base_index) computation of the new iteration space (given...
static list * w_effects
PDSon: w_effect store all the variables modified in the sequence of statement.
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.
The structure used to build lists in NewGen.
#define TERAPIX_MASK_PREFIX
bool generate_two_addresses_code(const string module_name)
static bool terapix_renamed_p(const char *s)
static bool terapix_pointer_initialized_from_a_mask_p(entity e)
static bool can_terapixify_expression_p(expression e, bool *can_terapixify)
static entity tw_loop_index
static bool terapix_suitable_loop_bound_p(expression exp)
static bool terapix_renamed_local_p(const char *s, const char *prefix)
bool terapix_warmup(const char *module_name)
static bool terapix_suitable_loop_bound_walker(reference r, bool *suitable)
static void stmt_rm_useless_label_rwt(statement s)
static void do_terapix_argument_handler(entity e, string arg_prefix, size_t *arg_cnt, string ass_prefix, size_t *ass_cnt, bool force)
static void two_addresses_code_generator(statement s)
static bool terapix_renamed_entity_p(entity e, const char *prefix)
static void normalize_microcode_parameter_orders(entity module)
static void do_terapix_warmup_patching(reference r, entity e)
static bool two_addresses_code_generator_split_p(expression e)
static void entity_used_in_reference_walker(reference r, struct entity_bool *eb)
static void terapix_normalize_tests(call c)
a test is normalized when it is in the form a>0
void normalize_microcode_anotate()
terapixify.c
#define TERAPIX_IMAGE_PREFIX
static bool cannot_terapixify(gen_chunk *elem, bool *can_terapixify)
terapixify
static bool can_terapixify_call_p(call c, bool *can_terapixify)
static void terapixify_loops(statement s)
static bool terapix_mask_entity_p(entity e)
static void entity_used_in_loop_bound_walker(loop l, struct entity_bool *eb)
static bool do_terapix_loop_optimizer(call c, tlo_context_t *ctxt)
static void terapix_loop_handler(statement sl, terapix_loop_handler_param *p)
static void terapix_argument_handler(entity e, string arg_prefix, size_t *arg_cnt, string ass_prefix, size_t *ass_cnt)
static bool do_terapix_warmup(statement top)
make sure s is of the form decl loop nest
static void terapixify_loop_purge(statement s, entity e)
#define TERAPIX_PTRARG_PREFIX
static void terapix_optimize_accumulator(statement st)
if only one register is ever written by a sequence of assignment, take advantage of it
bool normalize_microcode(char *module_name)
#define TERAPIX_LOOPARG_PREFIX
static int compare_formal_parameters(const void *v0, const void *v1)
static void do_terapix_remove_divide(call c)
bool terapix_remove_divide(const string module_name)
static void force_terapix_argument_handler(entity e, string arg_prefix, size_t *arg_cnt, string ass_prefix, size_t *ass_cnt)
#define TERAPIX_REGISTER_PREFIX
static void do_terapix_pointer_initialized_from_a_mask_p(call c, context *ctxt)
void terapix_loop_optimizer(statement st)
static bool entity_used_in_loop_bound_p(entity e)
string words_to_string(cons *lw)
A gen_chunk is used to store every object.
#define exp
Avoid some warnings from "gcc -Wshadow".
Pvecteur vect_new(Variable var, Value coeff)
Pvecteur vect_new(Variable var,Value coeff): allocation d'un vecteur colineaire au vecteur de base va...
void vect_rm(Pvecteur v)
void vect_rm(Pvecteur v): desallocation des couples de v;