PIPS
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "genC.h"
#include "boolean.h"
#include "arithmetique.h"
#include "vecteur.h"
#include "contrainte.h"
#include "ray_dte.h"
#include "sommet.h"
#include "sg.h"
#include "sc.h"
#include "polyedre.h"
#include "properties.h"
#include "matrix.h"
#include "ri.h"
#include "graph.h"
#include "paf_ri.h"
#include "database.h"
#include "ri-util.h"
#include "workspace-util.h"
#include "prettyprint.h"
#include "constants.h"
#include "misc.h"
#include "control.h"
#include "text-util.h"
#include "pipsdbm.h"
#include "resources.h"
#include "paf-util.h"
#include "static_controlize.h"
Go to the source code of this file.
Data Structures | |
struct | IOIntrinsicDescriptor |
the following data structure describes an io intrinsic function: its name More... | |
Typedefs | |
typedef void * | arc_label |
Name : static_controlize.c package : static_controlize Author : Arnauld LESERVOT Date : May 93 Modified : Documents : "Implementation du Data Flow Graph dans Pips" Comments : More... | |
typedef void * | vertex_label |
typedef struct IOIntrinsicDescriptor | IOIntrinsicDescriptor |
the following data structure describes an io intrinsic function: its name More... | |
Functions | |
static_control | static_controlize_call (call c) |
================================================================ More... | |
static_control | static_controlize_loop (loop l) |
================================================================= More... | |
static_control | static_controlize_forloop (forloop fl) |
================================================================= More... | |
static_control | static_controlize_whileloop (whileloop wl) |
================================================================= More... | |
static_control | static_controlize_statement (statement s) |
static_control | static_controlize_unstructured (unstructured u) |
================================================================= More... | |
static bool | io_filter (statement st) |
====================================================================== More... | |
bool | static_controlize (string mod_name) |
================================================================= More... | |
list | loop_normalize_of_loop (loop l, hash_table fst, list *ell, list *etl, list *swfl, int *Gcount_nlc) |
================================================================= More... | |
list | loop_normalize_of_statement (statement s, hash_table fst, list *ell, list *etl, list *swfl, int *Gcount_nlc) |
================================================================= More... | |
void | loop_normalize_of_unstructured (unstructured u, hash_table fst, list *ell, list *etl, list *swfl, int *Gcount_nlc) |
================================================================= More... | |
Variables | |
list | Gstructure_parameters |
Global Variables More... | |
static list | Genclosing_loops |
static list | Genclosing_tests |
static list | Gscalar_written_forward |
static hash_table | Gforward_substitute_table |
statement_mapping | Gstatic_control_map |
list | assigned_var = NIL |
================================================================= More... | |
static IOIntrinsicDescriptor | IOIntrinsicDescriptorTable [] |
typedef void* arc_label |
Name : static_controlize.c package : static_controlize Author : Arnauld LESERVOT Date : May 93 Modified : Documents : "Implementation du Data Flow Graph dans Pips" Comments :
Ansi includes
Newgen includes C3 includes
Pips includes
Types arc_label and vertex_label must be defined although they are not used
Definition at line 63 of file static_controlize.c.
typedef struct IOIntrinsicDescriptor IOIntrinsicDescriptor |
the following data structure describes an io intrinsic function: its name
typedef void* vertex_label |
Definition at line 64 of file static_controlize.c.
======================================================================
bool io_filter(st)
Tests if the statement is a call to an IO function. In such a case, we put the statement inside a comment.
AP, oct 9th 1995
There can be no statement inside a call, so gen_recurse() do not need to go further.
Do not forget to move forbidden information associated with block:
Definition at line 430 of file static_controlize.c.
References call_function, comment(), CONS, empty_extensions(), entity_empty_label(), entity_initial, entity_local_name(), fix_sequence_statement_attributes(), instruction_call, instruction_tag, IOIntrinsicDescriptorTable, is_instruction_call, is_value_intrinsic, make_instruction_block(), make_statement(), make_synchronization_none(), malloc(), IOIntrinsicDescriptor::name, NIL, pips_assert, STATEMENT, statement_instruction, STATEMENT_NUMBER_UNDEFINED, STATEMENT_ORDERING_UNDEFINED, value_tag, Words_Call(), and words_to_string().
Referenced by static_controlize().
list loop_normalize_of_loop | ( | loop | l, |
hash_table | fst, | ||
list * | ell, | ||
list * | etl, | ||
list * | swfl, | ||
int * | Gcount_nlc | ||
) |
=================================================================
================================================================= list loop_normalize_of_loop((loop) l, hash_table fst, list *ell, *etl, *swfl, int *Gcount_nlc) AL 04/93
FI/SG Question: why change the loop index when it is not necessary? To have a uniform behavior when it is necessary?
loop_body( l ) = make_block_with_stmt( loop_body( l ));
If it is not a constant step, we just normalize the loop body
new upper bound, or at least iteration count
Generate the new loop index and the new loop bounds
assume C
Generate the change of basis expression: the new index starts at 0 in C and 1 in Fortran:
old_index = rl + (new_index * ri) // C
old_index = rl + (new_index * ri) - ri // Fortran
Compute the value of the index when the loop is exited: exp_max
nub3 is not used any longer
FI: Why copy nub? it does not seem used anywhere else.
fst | st |
ell | ================================================================= list loop_normalize_of_loop((loop) l, hash_table fst, list *ell, *etl, *swfl, int *Gcount_nlc) AL 04/93 |
FI/SG Question: why change the loop index when it is not necessary? To have a uniform behavior when it is necessary? forward substitute table
etl | ================================================================= list loop_normalize_of_loop((loop) l, hash_table fst, list *ell, *etl, *swfl, int *Gcount_nlc) AL 04/93 |
FI/SG Question: why change the loop index when it is not necessary? To have a uniform behavior when it is necessary? enclosing loops list
swfl | ================================================================= list loop_normalize_of_loop((loop) l, hash_table fst, list *ell, *etl, *swfl, int *Gcount_nlc) AL 04/93 |
FI/SG Question: why change the loop index when it is not necessary? To have a uniform behavior when it is necessary? enclosing tests list
Gcount_nlc | ================================================================= list loop_normalize_of_loop((loop) l, hash_table fst, list *ell, *etl, *swfl, int *Gcount_nlc) AL 04/93 |
FI/SG Question: why change the loop index when it is not necessary? To have a uniform behavior when it is necessary? scalar written forward list
Definition at line 616 of file static_controlize.c.
References ADD_ELEMENT_TO_LIST, copy_expression(), DIVIDE_OPERATOR_NAME, ENTITY, entity_domain, entity_empty_label(), expression_constant_p(), expression_to_int(), expression_undefined, fortran_module_p(), Gcount_nlc, gen_find_tabulated(), get_current_module_entity(), hash_del(), hash_put(), int_to_expression(), loop_body, loop_index, loop_label, loop_normalize_of_statement(), loop_range, make_assign_statement(), make_block_with_stmt_if_not_already(), make_continue_statement(), make_entity_expression(), make_entity_fullname(), make_max_exp(), make_nlc_entity(), make_op_exp(), make_undefined_list(), MAX_OPERATOR_NAME, MINUS_OPERATOR_NAME, MULTIPLY_OPERATOR_NAME, NIL, normalizable_loop_p(), pips_debug, PLUS_OPERATOR_NAME, range_increment, range_lower, range_upper, STATEMENT, statement_undefined, stmt_list, and TOP_LEVEL_MODULE_NAME.
Referenced by loop_normalize_of_statement().
list loop_normalize_of_statement | ( | statement | s, |
hash_table | fst, | ||
list * | ell, | ||
list * | etl, | ||
list * | swfl, | ||
int * | Gcount_nlc | ||
) |
=================================================================
list loop_normalize_of_statement(statement s, hash_table fst, list *ell, *etl, *swfl, int *Gcount_nlc): Normalization of a statement.
Before walking down the statements, we forward-substitute the new-loop-counters on each type of statements. We then return a list of two statements to be put before and after statement 's'. These two new statements are generated by loops when they are treated. See document for more detail, section : "Normalisation des boucles".
est_true(t) = make_block_with_stmt( test_true(t) );
test_false(t) = make_block_with_stmt( test_false(t) );
fst | st |
ell | list loop_normalize_of_statement(statement s, hash_table fst, list *ell, *etl, *swfl, int *Gcount_nlc): Normalization of a statement. |
Before walking down the statements, we forward-substitute the new-loop-counters on each type of statements. We then return a list of two statements to be put before and after statement 's'. These two new statements are generated by loops when they are treated. See document for more detail, section : "Normalisation des boucles". forward substitute table
etl | list loop_normalize_of_statement(statement s, hash_table fst, list *ell, *etl, *swfl, int *Gcount_nlc): Normalization of a statement. |
Before walking down the statements, we forward-substitute the new-loop-counters on each type of statements. We then return a list of two statements to be put before and after statement 's'. These two new statements are generated by loops when they are treated. See document for more detail, section : "Normalisation des boucles". enclosing loops list
swfl | list loop_normalize_of_statement(statement s, hash_table fst, list *ell, *etl, *swfl, int *Gcount_nlc): Normalization of a statement. |
Before walking down the statements, we forward-substitute the new-loop-counters on each type of statements. We then return a list of two statements to be put before and after statement 's'. These two new statements are generated by loops when they are treated. See document for more detail, section : "Normalisation des boucles". enclosing tests list
Gcount_nlc | list loop_normalize_of_statement(statement s, hash_table fst, list *ell, *etl, *swfl, int *Gcount_nlc): Normalization of a statement. |
Before walking down the statements, we forward-substitute the new-loop-counters on each type of statements. We then return a list of two statements to be put before and after statement 's'. These two new statements are generated by loops when they are treated. See document for more detail, section : "Normalisation des boucles". scalar written forward list
Definition at line 750 of file static_controlize.c.
References ADD_ELEMENT_TO_LIST, CAR, CDR, EXPRESSION, forward_substitute_in_anyloop(), forward_substitute_in_call(), forward_substitute_in_exp(), Gcount_nlc, gen_remove(), instruction_block, instruction_call, instruction_loop, instruction_tag, instruction_test, instruction_unstructured, is_instruction_block, is_instruction_call, is_instruction_goto, is_instruction_loop, is_instruction_test, is_instruction_unstructured, LOOP, loop_normalize_of_loop(), loop_normalize_of_unstructured(), make_block_with_stmt_if_not_already(), make_undefined_list(), NIL, pips_assert, pips_debug, pips_internal_error, scalar_written_in_call(), STATEMENT, statement_consistent_p(), statement_instruction, statement_undefined, test_condition, test_false, and test_true.
Referenced by loop_normalize_of_loop(), and loop_normalize_of_unstructured().
void loop_normalize_of_unstructured | ( | unstructured | u, |
hash_table | fst, | ||
list * | ell, | ||
list * | etl, | ||
list * | swfl, | ||
int * | Gcount_nlc | ||
) |
=================================================================
void loop_normalize_of_unstructured(unstructured u, fst): Normalization of an unstructured instruction.
tmt = make_block_with_stmt( stmt );
fst | st |
ell | void loop_normalize_of_unstructured(unstructured u, fst): Normalization of an unstructured instruction. forward substitute table |
etl | void loop_normalize_of_unstructured(unstructured u, fst): Normalization of an unstructured instruction. enclosing loops list |
swfl | void loop_normalize_of_unstructured(unstructured u, fst): Normalization of an unstructured instruction. enclosing tests list |
Gcount_nlc | void loop_normalize_of_unstructured(unstructured u, fst): Normalization of an unstructured instruction. scalar written forward list |
Definition at line 845 of file static_controlize.c.
References ADD_ELEMENT_TO_LIST, CAR, CDR, CONTROL, control_map_get_blocs(), control_statement, Gcount_nlc, gen_free_list(), gen_nreverse(), instruction_block, loop_normalize_of_statement(), make_block_with_stmt_if_not_already(), NIL, pips_debug, STATEMENT, statement_instruction, statement_undefined, undefined_statement_list_p(), and unstructured_control.
Referenced by loop_normalize_of_statement().
=================================================================
void static_controlize((char*) mod_name) AL 05/93 Computes the static_control attached to module-name : mod_name.
HAS TO BE REMOVED AS SOON AS POSSIBLE: as the IOs are not treated as they would, all the instructions containing IOs are put inside comments. AP, oct 9th 1995
Normalization of all loops
Modification: loop_normalize_of_statement is used instead of
loop_normalize_of_unstructured since we cannot ensure that
mod_inst is an unstructured –11th Dec 1995, DB
oop_normalize_of_statement(mod_stat, Gforward_substitute_table, &Genclosing_loops, &Genclosing_tests, &Gscalar_written_forward, &Gcount_nlc);
The code has been modified, so the orderings are recomputed.
We compute the static control infos for each instruction.
Same remark as before –DB
mod_name | od_name |
Definition at line 495 of file static_controlize.c.
References assigned_var, code_language, db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, entity_initial, Gcount_nsp, Gcount_nub, gen_free_list(), gen_null(), gen_recurse, Genclosing_loops, Genclosing_tests, Gforward_substitute_table, Gscalar_written_forward, Gstatic_control_map, Gstructure_parameters, hash_pointer, hash_table_make(), hash_warn_on_redefinition(), ifdebug, io_filter(), language_tag, local_name_to_top_level_entity(), MAKE_STATEMENT_MAPPING, mod_stat, module, module_name_to_entity(), module_reorder(), NIL, pips_assert, pips_debug, print_structurals(), reset_current_module_entity(), sc_entity_to_formal_integer_parameters(), set_current_module_entity(), set_prettyprint_language_from_property(), SET_STATEMENT_MAPPING, statement_consistent_p(), statement_domain, statement_instruction, static_control_consistent_p(), static_controlize_statement(), stco_renumber_code(), strdup(), user_log(), value_code, value_code_p, and verify_structural_parameters().
static_control static_controlize_call | ( | call | c | ) |
================================================================
static_control static_controlize_call( (call) c ) AL 05/93 It computes now just a static-control assignement if it is an ASSIGN statement.
_list_of_loop_dup( Genclosing_loops ),
_list_of_loop_dup( Genclosing_loops ),
Definition at line 95 of file static_controlize.c.
References call_arguments, call_function, copy_loops(), entity_initial, entity_local_name(), Genclosing_loops, Genclosing_tests, Gstructure_parameters, make_static_control(), pips_debug, sc_list_of_entity_dup(), sc_list_of_exp_dup(), splc_linear_access_to_arrays_p(), static_control_yes, and value_intrinsic_p.
Referenced by static_controlize_statement().
static_control static_controlize_forloop | ( | forloop | fl | ) |
=================================================================
static_control static_controlize_forloop( (forloop) fl ) It computes the forloop's static_control.
fl | l |
Definition at line 165 of file static_controlize.c.
References forloop_body, Gstatic_control_map, pips_debug, SET_STATEMENT_MAPPING, static_control_yes, and static_controlize_statement().
Referenced by static_controlize_statement().
static_control static_controlize_loop | ( | loop | l | ) |
=================================================================
static_control static_controlize_loop( (loop) l ) It computes the loop's static_control.
Definition at line 135 of file static_controlize.c.
References ADD_ELEMENT_TO_LIST, constant_step_loop_p(), gen_remove(), Genclosing_loops, Gstatic_control_map, LOOP, loop_body, loop_range, pips_debug, range_lower, range_upper, SET_STATEMENT_MAPPING, splc_feautrier_expression_p(), static_control_yes, and static_controlize_statement().
Referenced by static_controlize_statement().
static_control static_controlize_statement | ( | statement | s | ) |
We put condition under a normal disjunctive form
ontinue_statement_p(s) ||
Definition at line 209 of file static_controlize.c.
References ADD_ELEMENT_TO_LIST, assigned_var, call_function, copy_expression(), declaration_statement_p(), ENTITY_NOT, exp, EXPRESSION, expression_undefined, FOREACH, forward_substitute_in_anyloop(), forward_substitute_in_call(), forward_substitute_in_exp(), gen_length(), gen_remove(), Genclosing_loops, Genclosing_tests, get_bool_property(), get_reference_assignments(), Gforward_substitute_table, Gstatic_control_map, Gstructure_parameters, instruction_block, instruction_call, instruction_forloop, instruction_loop, instruction_tag, instruction_test, instruction_unstructured, instruction_whileloop, io_intrinsic_p(), is_instruction_block, is_instruction_call, is_instruction_expression, is_instruction_forloop, is_instruction_goto, is_instruction_loop, is_instruction_test, is_instruction_unstructured, is_instruction_whileloop, make_static_control(), MakeUnaryCall(), pips_debug, pips_internal_error, print_structurals(), sc_conditional(), sc_list_of_entity_dup(), sc_list_of_exp_dup(), sc_list_of_loop_dup(), SET_STATEMENT_MAPPING, sp_feautrier_expression_p(), STATEMENT, statement_contains_user_call_p(), statement_instruction, statement_ordering, static_control_yes, static_controlize_call(), static_controlize_forloop(), static_controlize_loop(), static_controlize_unstructured(), static_controlize_whileloop(), test_condition, test_false, and test_true.
Referenced by static_controlize(), static_controlize_forloop(), static_controlize_loop(), static_controlize_unstructured(), and static_controlize_whileloop().
static_control static_controlize_unstructured | ( | unstructured | u | ) |
=================================================================
static_control static_controlize_unstructered((unstructured) u) AL 05/93 Computes an unstructured's static_control
Definition at line 358 of file static_controlize.c.
References CONTROL, control_map_get_blocs(), control_statement, FOREACH, gen_free_list(), gen_length(), gen_nreverse(), Genclosing_loops, Genclosing_tests, Gstatic_control_map, Gstructure_parameters, make_static_control(), NIL, pips_assert, pips_debug, print_structurals(), sc_list_of_entity_dup(), sc_list_of_exp_dup(), sc_list_of_loop_dup(), SET_STATEMENT_MAPPING, statement_consistent_p(), static_control_undefined, static_control_yes, static_controlize_statement(), and unstructured_control.
Referenced by static_controlize_statement().
static_control static_controlize_whileloop | ( | whileloop | wl | ) |
=================================================================
static_control static_controlize_whileloop( (whileloop) l ) It computes the whileloop's static_control.
wl | l |
Definition at line 185 of file static_controlize.c.
References Gstatic_control_map, pips_debug, SET_STATEMENT_MAPPING, static_control_yes, static_controlize_statement(), and whileloop_body.
Referenced by static_controlize_statement().
=================================================================
static_control static_controlize_statement((statement) s) AL 05/93 Computes s's static_control
Definition at line 207 of file static_controlize.c.
Referenced by static_controlize(), and static_controlize_statement().
|
static |
Definition at line 82 of file static_controlize.c.
Referenced by static_controlize(), static_controlize_call(), static_controlize_loop(), static_controlize_statement(), and static_controlize_unstructured().
|
static |
Definition at line 83 of file static_controlize.c.
Referenced by static_controlize(), static_controlize_call(), static_controlize_statement(), and static_controlize_unstructured().
|
static |
Definition at line 85 of file static_controlize.c.
Referenced by static_controlize(), and static_controlize_statement().
|
static |
Definition at line 84 of file static_controlize.c.
Referenced by static_controlize().
statement_mapping Gstatic_control_map |
Definition at line 87 of file static_controlize.c.
Referenced by static_controlize(), static_controlize_forloop(), static_controlize_loop(), static_controlize_statement(), static_controlize_unstructured(), and static_controlize_whileloop().
list Gstructure_parameters |
Global Variables
Global variables
Definition at line 81 of file static_controlize.c.
Referenced by get_sp_of_call_p(), static_controlize(), static_controlize_call(), static_controlize_statement(), static_controlize_unstructured(), and verify_structural_parameters().
|
static |
Definition at line 404 of file static_controlize.c.
Referenced by io_filter().