PIPS
|
#include "matrice.h"
Go to the source code of this file.
bool bounds_equal_p | ( | Variable | var, |
Pcontrainte | lower, | ||
Pcontrainte | upper | ||
) |
this function checks whether the lower and upper constraints are going to generate the same bound on variable var.
oeff for var in the constraint
??? the arithmetic ppcm version is on int instead of values
var | ar |
lower | ower |
upper | pper |
Definition at line 534 of file system_to_code.c.
References nb_elems_list(), ppcm(), sum(), TCST, val_of, value_div, value_minus, VALUE_ONE, value_uminus, var_of, vect_add(), vect_add_elem(), vect_coeff(), vect_dup(), vect_multiply(), vect_normalize(), vect_rm(), Scontrainte::vecteur, and VECTEUR_NUL_P.
Referenced by region_to_minimal_dimensions(), and systeme_to_loop_nest().
void change_of_base_index(Pbase base_oldindex, Pbase *base_newindex) change of variable index from base_oldindex to base_newindex
base_oldindex | ase_oldindex |
base_newindex | ase_newindex |
Definition at line 65 of file change_of_Pbase.c.
References derive_new_basis(), and make_index_prime_entity().
Referenced by hyperplane(), and unimodular().
expression constraints_to_loop_bound | ( | Pcontrainte | c, |
Variable | var, | ||
bool | is_lower, | ||
entity | divide | ||
) |
expression constraints_to_loop_bound(c, var, is_lower)
the is_lower (lower/upper) loop bound for variable var relative to Pcontrainte c is generated. All the constraints in c are used, and they must be ok.
see also make_bound_expression in ri-util/bound_generation.c maybe move this function in ri-util/bound_generation.c? integer division to be called
the constraints are sorted first, to ensure a deterministic result ??? the sorting criterion is rather strange:-)
each constraint is considered in turn to generate a bound
ax+b <= 0 and a<0 => x >= (b+(-a-1))/(-a)
extract coefficients that are dividable by val... x = (ay+bz)/a -> x = y + bz/a
assert. no a.i=0 should have reached this point...
I perform some other optimizations here, by looking at the extent of the numerator, that may result in a constant after division by the denominator. For instance, x = y/a and 0 <= y < a would lead to x = 0, which is quite simpler... I need a hook from the callers of this function to retrieve the constant lower and upper bounds of each variable in order to perform this. ??? this optimizations should/could be perform earlier on the original system... but the implementation in a general context does not seems obvious to me...
use / instead of the provided idiv if operand >=0
final operation: MAX or MIN if more than one bound
and memory leak... (cons lost)
var | the constraints of the bound |
is_lower | the index variable |
divide | lower or upper bound |
Definition at line 374 of file system_to_code.c.
References c_language_module_p(), CAR, compare_Pvecteur(), CONS, CONTRAINTE_UNDEFINED_P, contraintes_dup(), divide, DIVIDE_OPERATOR_NAME, entity_intrinsic(), entity_local_name(), evaluate_divide_if_possible(), exp, EXPRESSION, expression_constant_p(), expression_undefined, FOREACH, fprintf(), gen_free_list(), gen_length(), get_bool_property(), get_current_module_entity(), ifdebug, inegalites_fprint(), int_to_expression(), make_call_expression(), make_vecteur_expression(), MakeBinaryCall(), MAX_OPERATOR_NAME, message_assert, MIN_OPERATOR_NAME, NIL, pips_assert, PIPS_C_MAX_OPERATOR_NAME, PIPS_C_MIN_OPERATOR_NAME, pips_debug, PLUS_OPERATOR_NAME, sc_make(), sc_rm(), sc_sort_constraints(), Scontrainte::succ, Svecteur::succ, TCST, val_of, value_div, value_minus, value_mod, VALUE_ONE, value_one_p, value_oppose, value_pos_p, value_posz_p, value_sign, Value_to_expression(), value_zero_p, var_of, vect_add_elem(), vect_chg_sgn(), vect_coeff(), vect_del_var(), vect_erase_var(), vect_rm(), vect_sort(), Scontrainte::vecteur, vecteur_lower_bound(), and VECTEUR_NUL.
Referenced by do_array_expansion(), do_check_isolate_statement_preconditions_on_call(), do_isolate_statement_preconditions_satisified_p(), do_solve_hardware_constraints_on_nb_proc(), make_rectangular_area(), region_to_minimal_dimensions(), statement_insertion_fix_access(), systeme_to_loop_nest(), and variable_to_dimensions().
Warning! Do not modify this file that is automatically generated!
Modify src/Libs/conversion/conversion-local.h instead, to add your own modifications. header file built by cproto conversion-local.h cproto-generated files change_of_Pbase.c
Warning! Do not modify this file that is automatically generated!
base_oldindex | ase_oldindex |
base_newindex | ase_newindex |
Definition at line 48 of file change_of_Pbase.c.
References base_add_dimension, base_reversal(), Svecteur::succ, and Svecteur::var.
Referenced by change_of_base_index(), parallel_tiling(), and tiling_transformation().
expression expression_to_expression_newbase | ( | expression | , |
Pvecteur | [], | ||
Pbase | |||
) |
statement generate_optional_if(sc, stat)
if sc is Z^n then no if is required, if sc is empty, then statement is nop, else an if is required
sc | c |
stat | tat |
Definition at line 667 of file system_to_code.c.
References CONS, make_empty_statement, NIL, Psysteme_to_expression(), sc_empty_p(), sc_rn_p(), st_make_nice_test(), and STATEMENT.
Referenced by build_third_comb(), generate_io_statements_for_shared_arrays(), GENERATION(), processor_loop(), and verify_array_variable().
statement look_for_inner_loops | ( | loop | l, |
list | sl, | ||
statement(*)(list, bool(*)(statement)) | loop_transformation, | ||
bool(*)(statement) | loop_predicate | ||
) |
FI: I do not understand how debug levels are managed...
They should be factored out.
check that i is a block
SG: added to cope with empty statements
i is an inner loop, append it to the list of loops
here are no more nested loops
FI: I do not understand this piece of code. I expect a look_for_nested_loop_statements().
sl | l |
Definition at line 166 of file look_for_nested_loops.c.
References b1, CAR, CDR, CONS, control_statement, debug_off, debug_on, empty_statement_or_continue_p(), ENDP, forloop_body, instruction_block, instruction_block_p, instruction_forloop, instruction_loop, instruction_loop_p, instruction_tag, instruction_test, instruction_unstructured, instruction_whileloop, is_instruction_block, is_instruction_call, is_instruction_forloop, is_instruction_goto, is_instruction_loop, is_instruction_test, is_instruction_unstructured, is_instruction_whileloop, look_for_inner_loops(), look_for_nested_loop_statements(), loop_body, pips_internal_error, POP, STATEMENT, statement_instruction, statement_undefined, test_false, test_true, unstructured_control, and whileloop_body.
Referenced by look_for_inner_loops(), and look_for_nested_loop_statements().
void look_for_nested_loop_statements | ( | statement | s, |
statement(*)(list, bool(*)(statement)) | loop_transformation, | ||
bool(*)(statement) | loop_predicate | ||
) |
void look_for_nested_loop_statements(statement s) search the nested loops in the statement s
pips_debug(9, "Before transformation:\n");
debug_on("ZERO_DEBUG_LEVEL");
print_statement(s);
}
debug_on("ZERO_DEBUG_LEVEL");
print_statement(new_s);
SG: added to cope with empty statements
Definition at line 56 of file look_for_nested_loops.c.
References b1, CAR, CDR, CONS, empty_statement_or_continue_p(), ENDP, forloop_body, ifdebug, instruction_block, instruction_forloop, instruction_loop, instruction_tag, instruction_test, instruction_unstructured, instruction_whileloop, is_instruction_block, is_instruction_call, is_instruction_forloop, is_instruction_goto, is_instruction_loop, is_instruction_test, is_instruction_unstructured, is_instruction_whileloop, look_for_inner_loops(), look_for_nested_loop_statements(), look_for_nested_loops_unstructured(), loop_body, NIL, pips_assert, pips_debug, pips_internal_error, POP, STATEMENT, statement_consistent_p(), statement_instruction, statement_undefined, test_false, test_true, and whileloop_body.
Referenced by global_parallelization(), interactive_loop_transformation(), look_for_inner_loops(), look_for_nested_loop_statements(), look_for_nested_loops_unstructured(), and strip_mine().
void look_for_nested_loops_unstructured | ( | unstructured | u, |
statement(*)(list, bool(*)(statement)) | loop_transformation, | ||
bool(*)(statement) | loop_predicate | ||
) |
oid look_for_nested_loops_unstructured(unstructured u) search the nested loops contained in the unstructured u
Definition at line 298 of file look_for_nested_loops.c.
References CONTROL_MAP, control_statement, debug_off, debug_on, gen_free_list(), look_for_nested_loop_statements(), NIL, and unstructured_control.
Referenced by look_for_nested_loop_statements().
ake two constraints for the current index: I-vup<=0, -I+vlow<=0
build - new_var <= 0
build incr * new_var - vup + vlow <= 0
build ind == vlow + incr * new_var
ind | nd |
sc | c |
Definition at line 86 of file loop_iteration_domaine_to_sc.c.
References Ssysteme::base, contrainte_make(), creat_new_var(), debug(), debug_off, debug_on, Ssysteme::dimension, NORMALIZE_EXPRESSION, normalized_linear, normalized_linear_p, range_increment, range_lower, range_upper, user_error, VALUE_MONE, VALUE_ONE, value_one_p, value_uminus, vect_add(), vect_add_elem(), vect_add_variable(), vect_chg_sgn(), vect_constant_p(), vect_dup(), vect_new(), VECTEUR_NUL, and vecteur_val.
Referenced by loop_iteration_domaine_to_sc().
loop_iteration_domaine_to_sc.c
loop_iteration_domaine_to_sc.c
Psysteme loop_iteration_domaine_to_sc(cons *lls , Pbase *baseindex) transform the iteration domain of the nested loops (contained lls) in a system of constraints (sc)
New loop indices are added at the head of the list baseindex. The field base of sc contains all the system variables. Variables are not in a specific order.
CA: Ajout du cas ou l'increment de boucle est different de 1 le 1/9/91
add the current index "ind" to the index basis
dd the constraints to sc
lls | ls |
baseindex | aseindex |
Definition at line 52 of file loop_iteration_domaine_to_sc.c.
References base_add_dimension, CAR, CDR, debug(), debug_off, debug_on, entity_local_name(), ifdebug, Ssysteme::inegalites, instruction_loop, loop_index, loop_index_domaine_to_contrainte(), loop_range, nb_elems_list(), Ssysteme::nb_ineq, NIL, pips_debug, sc_creer_base(), sc_new(), STATEMENT, statement_instruction, and vect_fprint().
Referenced by compute_iteration_domain(), Hierarchical_tiling(), hyperplane(), parallel_tiling(), Tiling2_buffer(), Tiling_buffer_allocation(), tiling_transformation(), and unimodular().
old_index | ld_index |
Definition at line 77 of file change_of_Pbase.c.
References make_index_prime_entity().
old_index | ld_index |
Definition at line 72 of file change_of_Pbase.c.
References make_new_index_entity().
Referenced by change_of_base_index(), and make_index_entity().
list Pcontrainte_to_expression_list | ( | Pcontrainte | constraint, |
entity | operator | ||
) |
a simple expression is generated.
a binary operator should be given, as eg, ne, lt, le, gt, ge.
constraint | onstraint |
operator | perator |
Definition at line 90 of file system_to_code.c.
References CONS, contrainte_vecteur, entity_undefined_p, EXPRESSION, make_vecteur_expression(), MakeBinaryCall(), NIL, Pvecteur_separate_on_sign(), Scontrainte::succ, vect_rm(), and VECTEUR_NUL.
Referenced by Psysteme_to_expression().
expression Psysteme_to_expression | ( | Psysteme | systeme | ) |
Psystems stuff Newgen stuff PIPS stuff expression Psysteme_to_expression(Psysteme systeme)
From a Psysteme, a logical expression that checks for the constraints is generated.
systeme | ysteme |
Definition at line 69 of file system_to_code.c.
References entity_intrinsic(), EQUAL_OPERATOR_NAME, expression_list_to_conjonction(), gen_free_list(), gen_nconc(), LESS_OR_EQUAL_OPERATOR_NAME, and Pcontrainte_to_expression_list().
Referenced by build_third_comb(), expression_less_than_in_context(), generate_optional_if(), and top_down_abc_dimension().
void reset_information_for_code_optimizations | ( | void | ) |
Definition at line 254 of file system_to_code.c.
Referenced by generate_io_collect_or_update(), and hpf_remapping().
Psysteme sc_change_baseindex(Psysteme sc, Pbase base_old, Pbase base_new) le changement de base d'indice pour sc.
sc | c |
base_old | ase_old |
base_new | ase_new |
Definition at line 85 of file change_of_Pbase.c.
References sc_variable_rename(), Svecteur::succ, and Svecteur::var.
Referenced by hyperplane(), and unimodular().
void set_information_for_code_optimizations | ( | Psysteme | s | ) |
I could keep the system for further optimizations...
Here, only direct lower and upper bounds are extracted and kept.
first look thru equalities
then thru inequalities
UPPER
LOWER
Definition at line 208 of file system_to_code.c.
References contrainte_vecteur, store_a_lower(), store_an_upper(), Scontrainte::succ, value_div, value_minus, VALUE_ONE, value_pdiv, value_plus, value_pos_p, VALUE_TO_INT, value_uminus, and vect_simple_definition_p().
Referenced by generate_io_collect_or_update(), and hpf_remapping().
sc is used to generate the loop nest bounds for variables vars.
vars may be empty. the loop statement is returned.
sc is not touched... I have to give the divide entity to be called
duplicate sc
??? could do a better job with =
reverse the list of vars
VAR = LOWER body
DO VAR = LOWER, UPPER, 1 body ENDDO
sc | c |
vars | of entity |
body | ody |
divide | ivide |
Definition at line 578 of file system_to_code.c.
References bounds_equal_p(), CONS, constraints_for_bounds(), constraints_to_loop_bound(), CONTRAINTE_UNDEFINED_P, contraintes_free(), current, divide, ENDP, ENTITY, entity_empty_label(), entity_name, entity_to_expression(), FOREACH, gen_copy_seq(), gen_free_list(), gen_nreverse(), instruction_to_statement(), int_to_expression(), is_execution_sequential, is_instruction_loop, make_assign_statement(), make_block_statement(), make_execution(), make_instruction(), make_loop(), make_range(), message_assert, NIL, pips_debug, sc_dup(), sc_rm(), sc_transform_eg_in_ineg(), STATEMENT, and UU.
Referenced by broadcast(), copy_write_statement_with_cumulated_regions(), elements_loop(), generate_io_statements_for_shared_arrays(), GENERATION(), initialize_array_variable(), make_array_communication_statement(), processor_loop(), Psysteme_to_loop_nest(), and verify_array_variable().