PIPS
|
Go to the source code of this file.
Data Structures | |
struct | Block |
During the computation, the program has to deal with blocks of statements. More... | |
Macros | |
#define | TMP_ENT 1 |
Warning! Do not modify this file that is automatically generated! More... | |
#define | AUX_ENT 2 |
#define | DOUBLE_PRECISION_SIZE 8 |
Functions | |
bool | new_atomizer (char *) |
Mappings for the cumulated effects of statements. More... | |
void | normalize_wp65_code (statement) |
bool | atomizer (const string) |
=========================================================================== More... | |
void | atomizer_of_unstructured (unstructured) |
void | atomizer_of_statement (statement, Block *) |
=========================================================================== More... | |
void | atomizer_of_block (instruction) |
=========================================================================== More... | |
void | atomizer_of_test (test, Block *) |
=========================================================================== More... | |
void | atomizer_of_loop (loop, Block *) |
=========================================================================== More... | |
void | atomizer_of_call (call, Block *) |
=========================================================================== More... | |
void | atomizer_of_intrinsic (call, Block *) |
=========================================================================== More... | |
void | atomizer_of_external (call, Block *) |
=========================================================================== More... | |
list | atomizer_of_expressions (list, Block *) |
=========================================================================== More... | |
expression | atomizer_of_expression (expression, Block *, int) |
=========================================================================== More... | |
void | atomizer_of_array_indices (expression, Block *) |
=========================================================================== More... | |
bool | instruction_in_list_p (instruction, list) |
utils.c More... | |
bool | nlc_linear_expression_p (expression) |
=========================================================================== More... | |
void | put_stmt_in_Block (statement, Block *) |
codegen.c More... | |
expression | assign_tmp_to_exp (expression, Block *) |
=========================================================================== More... | |
void | insert_one_type_declaration (entity, list, string) |
=========================================================================== More... | |
void | insert_new_declarations (char *) |
=========================================================================== More... | |
void | store_expression (expression, Block *) |
=========================================================================== More... | |
void | modify_blocks (control) |
control.c More... | |
void | atom_get_blocs (control, cons **) |
control | find_control_block (control) |
=========================================================================== More... | |
void | normal_expression_of_expression (expression) |
norm_exp.c More... | |
void | normal_expression_of_statement (statement) |
=========================================================================== More... | |
void | normal_expression_of_unstructured (unstructured) |
=========================================================================== More... | |
int | get_nlc_number (entity) |
=========================================================================== More... | |
void | reconfig_expression (expression) |
=========================================================================== More... | |
bool | true_dependence_with_entity_p (conflict, entity) |
defs_elim.c More... | |
bool | defs_elim_of_assign_call (statement, graph) |
=========================================================================== More... | |
bool | defs_elim_of_statement (statement, graph) |
=========================================================================== More... | |
void | defs_elim_of_unstructured (unstructured, graph) |
=========================================================================== More... | |
Variables | |
list | l_inst |
The list "first" is a truncated list from the first to the current statement (not included). More... | |
hash_table | MemToTmp |
These lists memorize all the new created entities of each type. More... | |
#define AUX_ENT 2 |
Definition at line 36 of file atomizer.h.
#define DOUBLE_PRECISION_SIZE 8 |
Definition at line 37 of file atomizer.h.
#define TMP_ENT 1 |
Warning! Do not modify this file that is automatically generated!
Modify src/Libs/atomizer/atomizer-local.h instead, to add your own modifications. header file built by cproto atomizer-local.h
Definition at line 35 of file atomizer.h.
expression assign_tmp_to_exp | ( | expression | exp, |
Block * | cb | ||
) |
===========================================================================
expression assign_tmp_to_exp(expression exp, Block *cb): Produces an assign statement of "exp" in a temporary (this is a load), puts it in "cb" and returns the expression of the temporary.
There are two cases:
The variable "cb" memorises the information about the block of statements that contains the expressions.
Called functions : _ entity_scalar_p() : ri-util/entity.c _ make_entity_expression() : ri-util/util.c _ make_assign_statement() : ri-util/statement.c
If this expression is a scalar variable already loaded in a temporary, then it is unnecessary to loaded it again. The only thing to do is to find the temporary that was used and return it.
We compute the basic of "exp".
We create a new temporary with the basic "tmp_basic".
If "exp_ent" is a scalar variable, this temporary is placed in MemToTmp at the key "exp_ent".
We create a new expression with this temporary.
The new assign statement is created ...
... and put in the current Block.
The new temporary is returned.
exp | xp |
cb | b |
Definition at line 155 of file codegen.c.
References basic_of_expression(), entity_scalar_p(), entity_undefined, exp, expression_syntax, expression_undefined, find_tmp_of_exp(), hash_put(), is_syntax_reference, make_assign_statement(), make_entity_expression(), make_new_entity(), MemToTmp, NIL, put_stmt_in_Block(), reference_variable, syntax_reference, syntax_tag, and TMP_ENT.
Referenced by atomizer_of_expression().
===========================================================================
void atomizer(const char* module_name): computes the translation of Fortran instructions into Three Adresses Code instructions.
This translation is done after two pre-computations : _ The first one puts all the integer linear expressions into a normal pattern (see norm_exp.c). _ The second one removes all the defs with no def-use dependence.
Also, after the atomization, the module statement is reordered, and declarations are made for the new variables and temporaries.
The atomization uses the CODE, CUMULATED_EFFECTS and DG (dependence graph) resources.
Called functions: _ module_body_reorder() : control/control.c
COMPUTATION
All the expressions are put into a normal pattern : the NLCs in the innermost parenthesis.
All the defs with no def-use dependence are removed.
Module is atomized.
We reorder the module. It is necessary because new statements have been generated. The reordering will permit to reuse the generated code for further analysis.
We declare the new variables and the new temporaries.
insert_new_declarations(mod_name);
We save the new CODE.
mod_name | od_name |
Definition at line 226 of file atomizer.c.
References atomizer_of_statement(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, defs_elim_of_statement(), discard_module_declaration_text(), get_bool_property(), get_debug_level(), initialize_global_variables(), local_name_to_top_level_entity(), mod_dg, mod_stat, module, module_reorder(), normal_expression_of_statement(), normalize_wp65_code(), pips_user_warning, reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), reset_global_variables(), rm_block_block_statement(), set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), strdup(), and user_log().
void atomizer_of_array_indices | ( | expression | exp, |
Block * | cb | ||
) |
===========================================================================
void atomizer_of_array_indices(expression exp, Block *cb): Applies the translation on an array expression.
Only the indices of the array are translated, in order to have a list of temporary variables.
We translate all the indices expressions.
exp | xp |
cb | b |
Definition at line 932 of file atomizer.c.
References atomizer_of_expressions(), exp, expression_syntax, expression_to_string(), pips_debug, reference_indices, and syntax_reference.
Referenced by atomizer_of_expression().
void atomizer_of_block | ( | instruction | i | ) |
===========================================================================
void atomizer_of_block(instruction inst): Applies the translation on all the statements of the block of the instruction given in argument.
Note: the "instruction_tag" of "inst" must be a block, otherwise, it's a user error.
We enter a new block of statements, so we generate a new variable of type "Block". "last" representes the list of statements not translated yet. "first" representes the list of statements that are translated, plus the statements that were generated by them. The statement being translated (current statement) is the first of the "last" list. When the translation of a statement is done, it is put at the end of the "first" list.
Nothing to do!!
Initialization of the new "Block".
"cb->last" is the list of the statements not yet visited
Gets the current statement.
This current statement has not yet generated another statement.
Translation of the current statement.
The current statement is put at the end of the "first" list.
Since there could have been creations of statements in the list "cb->first" we have to update the block of the instruction.
Memory deallocation
Definition at line 473 of file atomizer.c.
References atomizer_of_statement(), CAR, CDR, CONS, debug(), Block::first, free(), gen_nconc(), instruction_block, instruction_tag, is_instruction_block, Block::last, malloc(), NIL, STATEMENT, Block::stmt_generated, and user_error.
Referenced by atomizer_of_statement().
===========================================================================
void atomizer_of_call(call c, Block *cb): Applies the translation on an instruction call.
The two main kinds of call are: _ external call, ie user_defined function or subroutine. _ intrinsic call.
The variable "cb" memorises the information about the block of statements that contains the call statement.
Evite d'atomiser un parame`tre inexistant ( :-) ) d'un intrinsic sans argument, du style * dans : write ... FMT=*... RK, 24/02/1994.
cb | b |
Definition at line 660 of file atomizer.c.
References atomizer_of_external(), atomizer_of_intrinsic(), call_arguments, call_function, entity_initial, entity_name, is_value_code, is_value_constant, is_value_intrinsic, is_value_symbolic, is_value_unknown, NIL, pips_internal_error, and value_tag.
Referenced by atomizer_of_expression(), and atomizer_of_statement().
expression atomizer_of_expression | ( | expression | exp, |
Block * | cb, | ||
int | mem_var | ||
) |
===========================================================================
expression atomizer_of_expression(expression exp, Block *cb, int mem_var): Applies the translation on an expression.
It consists in assigning a new temporary variable to the expression, while the sub-expressions that it may contain are recursively translated.
If "exp" is only composed of NLCs variables (eventually a constant term), then the expression is treated like a constant, ie unchanged. NLC means Normalized Loop Counter.
The translation of expressions that reference a variable is not done only if the flag "mem_var" has the value "MEM_VAR". Otherwise, the variable is assigned to a temporary variable. The function "atomizer_of_array_indices()" translates the list of indices (when not empty) of the variable given in argument. Note: a scalar variable is an array with an empty list of indices.
The variable "cb" memorises the information about the block of statements that contains the expression.
An expression that is integer linear and is exclusively composed of NLCs is considered like a constant, ie not translated.
Two cases : _ a "real" call, ie an intrinsic or external function _ a constant
Evite d'atomiser un parame`tre inexistant ( :-) ) d'un intrinsic sans argument, du style * dans : write ... FMT=*... RK, 24/02/1994.
Translates the arguments of the call.
Generates the assign statement, and put it into the current block.
Constant value.
exp | xp |
cb | b |
mem_var | em_var |
Definition at line 849 of file atomizer.c.
References assign_tmp_to_exp(), atomizer_of_array_indices(), atomizer_of_call(), call_arguments, call_constant_p, call_function, debug(), entity_initial, exp, expression_syntax, expression_to_string(), expression_undefined, is_syntax_call, is_syntax_range, is_syntax_reference, MEM_VAR, NIL, nlc_linear_expression_p(), pips_debug, pips_internal_error, syntax_call, syntax_tag, and value_intrinsic_p.
Referenced by atomizer_of_expressions(), atomizer_of_external(), atomizer_of_intrinsic(), atomizer_of_loop(), and atomizer_of_test().
===========================================================================
list atomizer_of_expressions(list expl, Block *cb): Applies the translation on a list of expressions.
The variable "cb" memorises the information about the block of statements that contains the expressions.
Returns a list of expressions containing the translated expressions.
expl | xpl |
cb | b |
Definition at line 811 of file atomizer.c.
References atomizer_of_expression(), CAR, CDR, CONS, exp, EXPRESSION, gen_nconc(), NIL, and NO_MEM_VAR.
Referenced by atomizer_of_array_indices(), atomizer_of_external(), atomizer_of_intrinsic(), and atomizer_of_test().
===========================================================================
void atomizer_of_external(call c, block *cb): Translates the arguments of the call to an external function.
In fact, these arguments are kept as memory variable. When, the argument is an expression containing a "call" (a real call to a function and not a call to a constant), this expression is assigned to a new auxiliary variable which takes its place in the list of arguments. It is a variable, not a temporary (see the introduction at the beginning of this file).
Called functions : _ make_entity_expression() : ri-util/util.c _ make_assign_statement() : ri-util/statement.c
All the argument expressions are scanned. If an expression is not a reference (then, it is a call), we create an auxiliary variable. The expression is assigned to this new variable which is given in argument to the function, instead of the expression. If it is a reference, the corresponfding key (if it exists) in the hash table MemToTmp is deleted.
cb | b |
Definition at line 753 of file atomizer.c.
References atomizer_of_expression(), atomizer_of_expressions(), aux, AUX_ENT, basic_of_expression(), call_arguments, call_constant_p, CAR, CDR, CONS, EXPRESSION, expression_syntax, gen_nconc(), hash_del(), is_syntax_reference, make_assign_statement(), make_entity_expression(), make_new_entity(), MEM_VAR, MemToTmp, NIL, put_stmt_in_Block(), reference_indices, reference_variable, syntax_call, syntax_reference, and syntax_tag.
Referenced by atomizer_of_call().
===========================================================================
void atomizer_of_intrinsic(call c, block *cb): translates the arguments of the intrinsic function. It treats two cases: assign call, and others.
Assign calls are treated differently because the first argument is the left-hand-side, so this argument is translated with the MEM_VAR option.
Assign expressions.
If the rhs expression is integer linear and exclusively composed of NLC variables, it is considered like a constant, ie not translated. Otherwise, it is translated normaly.
Translation of the lhs expression. We keep the memory variable.
The lhs variable is stored, so it is delete from MemToTmp.
The call is not an assignment, then each arguments is translated.
cb | b |
Definition at line 699 of file atomizer.c.
References atomizer_of_expression(), atomizer_of_expressions(), call_arguments, call_function, CAR, CDR, CONS, ENTITY_ASSIGN_P, EXPRESSION, expression_syntax, expression_to_string(), hash_del(), MEM_VAR, MemToTmp, NIL, nlc_linear_expression_p(), NO_MEM_VAR, pips_debug, reference_variable, and syntax_reference.
Referenced by atomizer_of_call().
===========================================================================
void atomizer_of_loop(loop l, Block *cb): Applies the translation on an instruction loop.
All written variables of the loop are removed from MemToTmp.
The variable "cb" memorizes the information about the block of statements that contains the loop statement.
Called functions: _ entity_scalar_p() : ri-util/entity.c _ make_block_with_stmt() : loop_normalize/utils.c
We have to remove from MemToTmp all the (scalars) variables that are written in this loop.
Translation of the three expressions of the loop range.
Afterwards, the body statement of the loop is translated. If this statement is not a block of statements, then it is put inside one (the resulting block contains only one statement !!).
cb | b |
Definition at line 603 of file atomizer.c.
References action_tag, atomizer_of_expression(), atomizer_of_statement(), CAR, CDR, debug(), EFFECT, effect_action, effect_any_reference, entity_local_name(), entity_scalar_p(), hash_del(), is_action_write, Block::last, load_rw_effects_list(), loop_body, loop_index, loop_range, make_block_with_stmt_if_not_already(), MemToTmp, NIL, NO_MEM_VAR, range_increment, range_lower, range_upper, reference_variable, and STATEMENT.
Referenced by atomizer_of_statement().
===========================================================================
void atomizer_of_statement(statement stmt, Block *cb): computes the translation from Fortran to Three Addresses Code (ATOMIZER) of a statement ("stmt").
This function can be called in two different cases: _ If "cb" is NULL, then "stmt" is taken from a control C of the control graph. In such case, we have to find out where is the block in which we'll put the statements created by the translation of "stmt". . if "stmt" is a block, then this is it. . else, it is the predecessor of C. This control is obtained by the function find_control_block(). _ Else, "stmt" is one of the statements of a block, its creations are put in this block.
The "cb" variable refers to the current block of statements where "stmt" is.
Initialisation of "cb", if it is a NULL pointer.
The control in which the created statements are put is not the same as the control of "stmt".
We get the control in which we'll put our new statements.
We create the structure that will keep the created statements during the computation, before putting them in the control "c".
Computation of "stmt".
Updates of the control graph, if the generated statements are not put in the same control as "stmt".
The created statements are put in the control just before the control of the statement that created them.
Memory deallocation
stmt | tmt |
cb | b |
Definition at line 381 of file atomizer.c.
References atomizer_of_block(), atomizer_of_call(), atomizer_of_loop(), atomizer_of_test(), atomizer_of_unstructured(), CONS, control_statement, control_undefined, debug(), find_control_block(), Block::first, free(), 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, Block::last, malloc(), NIL, pips_internal_error, STATEMENT, statement_instruction, Block::stmt_generated, and user_error.
Referenced by atomizer(), atomizer_of_block(), atomizer_of_loop(), atomizer_of_test(), and atomizer_of_unstructured().
===========================================================================
void atomizer_of_test(test t, Block *cb): Applies the translation on an instruction test.
It consists in translating the three arguments of the test instruction : the condition expression and the two conditional statements (true, false).
The condition argument is an expression which may contain a logical intrinsic operator : "x op y" or "op x", with "op" in (<, =, >=, etc). In such case, the tranlation does not assign a temporary for the call expression associated with the operator, it only translates the arguments of the logical operator.
The variable "cb" memorises the information about the block of statements that contains the test statement.
Called functions : _ make_block_with_stmt() : loop_normalize/utils.c
If the expression is a call to a intrinsic operation, only its arguments are translated. Note : it is not tested that the intrinsic is a logical operator. In fact, Fortran requires it.
Else, the conditional expression is translated, and the returned expression must be a temporary (NO_MEM_VAR).
Afterwards, the two conditional statements are translated. If one of these statements is not a block of statements, then it is put inside one (the resulting block contains only one statement !!).
cb | b |
Definition at line 543 of file atomizer.c.
References atomizer_of_expression(), atomizer_of_expressions(), atomizer_of_statement(), call_arguments, call_function, debug(), entity_local_name(), expression_intrinsic_operation_p(), expression_syntax, make_block_with_stmt_if_not_already(), NO_MEM_VAR, syntax_call, test_condition, test_false, and test_true.
Referenced by atomizer_of_statement().
void atomizer_of_unstructured | ( | unstructured | ) |
===========================================================================
bool defs_elim_of_assign_call(statement assign_stmt, graph dg): returns true if "assign_stmt" is to be eliminated. It is eliminated if the lhs of this assignment verifies two conditions :
Definitions upon non local (non dynamic) variables are always kept.
Gets the vertex of the dependence graph that gives all the edges of which the assign statement is the source.
We scan all the dependences of the assign statement. If at least one true dependence is found, the statement is not removed.
assign_stmt | ssign_stmt |
dg | g |
Definition at line 136 of file defs_elim.c.
References bool_to_string(), call_arguments, call_function, CAR, CDR, CONFLICT, debug(), dg, dg_arc_label_conflicts, ENTITY_ASSIGN_P, entity_dynamic_p(), EXPRESSION, expression_syntax, get_vertex_of_statement(), instruction_call, instruction_tag, is_instruction_call, is_syntax_reference, NIL, pips_debug, pips_internal_error, reference_variable, statement_instruction, SUCCESSOR, successor_arc_label, syntax_reference, syntax_tag, true_dependence_with_entity_p(), user_warning, vertex_successors, vertex_undefined, Words_Call(), and words_to_string().
Referenced by defs_elim_of_statement().
===========================================================================
bool defs_elim_of_statement(statement s, graph dg): returns true if "s" is to be eliminated. As we eliminate assign statements, only statement with call to the assign function may be eliminated.
Called_functions : _ make_empty_statement() : ri-util/statement.c
We scan all the statements of the block, and we build in the same time a new block where the statements to delete do not appear.
dg | g |
Definition at line 211 of file defs_elim.c.
References call_function, CAR, CDR, CONS, debug(), defs_elim_of_assign_call(), defs_elim_of_statement(), defs_elim_of_unstructured(), dg, ENTITY_ASSIGN_P, entity_local_name(), gen_nconc(), 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_body, make_empty_statement, NIL, pips_internal_error, STATEMENT, statement_instruction, test_false, and test_true.
Referenced by atomizer(), defs_elim_of_statement(), and defs_elim_of_unstructured().
void defs_elim_of_unstructured | ( | unstructured | u, |
graph | dg | ||
) |
===========================================================================
void defs_elim_of_unstructured(unstructured, graph dg): computes the elimination of all the definitions with no def-use dependence of an unstructured instruction.
If the statement of the control of a node of the control graph has to be eliminated, it is replaced by an empty block of statement.
Called_functions : _ make_empty_statement() : ri-util/statement.c
dg | g |
Definition at line 291 of file defs_elim.c.
References CONTROL_MAP, control_statement, debug(), defs_elim_of_statement(), dg, gen_free_list(), make_empty_statement, NIL, and unstructured_control.
Referenced by defs_elim_of_statement().
===========================================================================
control find_control_block(control c): Returns the current control found in the static variable "cont_block".
The use of this function is: _ first, in order to initialize the static "cont_block" this function is called with the control we want to memorize. _ then, when we need to get this control, this function is called with the argument "control_undefined".
This is used by atomizer_of_statement() when we generate new statements.
Definition at line 115 of file control.c.
References CAR, CONTROL, control_predecessors, control_statement, control_undefined, instruction_tag, is_instruction_block, and statement_instruction.
Referenced by atomizer_of_statement(), and atomizer_of_unstructured().
===========================================================================
int get_nlc_number(entity nlc_ent): returns the number ending "nlc_ent" name. The local name is "NLC#", so we have to get the "#".
nlc_ent | lc_ent |
Definition at line 198 of file norm_exp.c.
References entity_local_name(), and num.
Referenced by config_vecteur().
void insert_new_declarations | ( | char * | mod_name | ) |
===========================================================================
void insert_new_declarations(char *mod_name): puts in the declaration text of the module "mod_name" the declarations for the temporary, auxiliary and NLC variables.
Called functions : _ local_name_to_top_level_entity() : ri-util/entity.c
We declare only variables that are not INTEGER or REAL simple precision.
mod_name | od_name |
Definition at line 285 of file codegen.c.
References char_entities, CHARACTER_DECL, COMPLEX_DECL, complex_entities, DOUBLE_DECL, double_entities, gen_free_list(), gen_nreverse(), insert_one_type_declaration(), integer_entities, local_name_to_top_level_entity(), LOGICAL_DECL, logical_entities, and real_entities.
===========================================================================
void insert_one_type_declaration(entity mod_entity, list var_to_decl, string type_decl): Inserts in the module "mod_entity" the declarations of the entities in the list "var_to_decl" with the type "type_decl".
Type declaration.
Lenght of the declaration to insert.
If the line is to long ..., we begin a new line!!
We separate the variables between comas.
mod_entity | od_entity |
var_to_decl | ar_to_decl |
type_decl | ype_decl |
Definition at line 229 of file codegen.c.
References CAR, CDR, code_decls_text, COMA, concatenate(), ENDLINE, ENTITY, entity_code(), entity_local_name(), LINE_LENGHT, MARGIN_LENGHT, NEWLINE, NIL, SPACE, and strdup().
Referenced by insert_new_declarations().
bool instruction_in_list_p | ( | instruction | inst, |
list | l | ||
) |
utils.c
utils.c
bool instruction_in_list_p(instruction inst, list l): Returns true if "inst" is in "l".
Note: "l" must be a list of instructions.
inst | nst |
Definition at line 50 of file utils.c.
References CAR, CDR, INSTRUCTION, and NIL.
Referenced by modify_blocks().
void modify_blocks | ( | control | c | ) |
control.c
control.c
Functions for the manipulations and modifications of the control graph. =========================================================================== void modify_blocks(control c): Adds a node to the control graph when the statement of "c" is not an "instruction_block".
This node is added just before "c". "c" predecessor became the new node. The latter's predecessors are those of "c", its successor is "c".
"l_inst" keep the reference to the instructions for which a new node is added. It is a global variable that will be used when we will generate new statements (see atomizer_of_statement(), in atomizer.c).
Called functions : _ make_empty_statement() : ri-util/statement.c
Definition at line 51 of file control.c.
References CONS, CONTROL, control_predecessors, control_statement, control_successors, INSTRUCTION, instruction_in_list_p(), instruction_tag, is_instruction_block, l_inst, make_control(), make_empty_statement, NIL, and statement_instruction.
Referenced by atom_get_blocs().
bool new_atomizer | ( | char * | mod_name | ) |
Mappings for the cumulated effects of statements.
extern statement_mapping cumulated_effects_map; cproto-generated files new_atomizer.c
get the resources
Now do the job
Reorder the module, because new statements have been added
update/release resources
mod_name | od_name |
Definition at line 164 of file new_atomizer.c.
References atomize_statement(), clean_up_sequences(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, gen_recurse, gen_true(), get_current_module_statement(), module_name_to_entity(), module_reorder(), reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), and statement_domain.
bool nlc_linear_expression_p | ( | expression | exp | ) |
===========================================================================
bool nlc_linear_expression_p(expression exp): returns true if "exp" is an integer linear expression with only NLCs variables.
NLC means Normalized Loop Counter.
Called functions : _ unnormalize_expression() : loop_normalize/utils.c
We unnormalize the expression, otherwise, it causes an error when we normalize an expression with sub-expressions already normalized. (cf. NormalizedExpression() in normalize/normalize.c).
This unnormalization is done recursively upon all the sub-expressions of "exp".
exp | xp |
Definition at line 78 of file utils.c.
References debug(), ENTITY_NLC_P, exp, expression_normalized, expression_to_string(), is_normalized_complex, NORMALIZE_EXPRESSION, normalized_linear, normalized_tag, pips_debug, Svecteur::succ, term_cst, unnormalize_expression(), Svecteur::var, and VECTEUR_NUL_P.
Referenced by atomizer_of_expression(), and atomizer_of_intrinsic().
void normal_expression_of_expression | ( | expression | exp | ) |
void normal_expression_of_expression(expression exp): normalizes "exp".
There are three cases:
In the case (1), if "exp" is linear (ie normalized), we call reconfig_expression(); it computes the normalization of "exp" with its Pvecteur. If "exp" is not integer linear, this function is called recursively upon the arguments of the call.
In case (2), we call this function upon each of the indices of "exp".
In case (3), we do nothing. Such a case may occur with a range argument in a call to a write or read procedure.
exp | xp |
Definition at line 72 of file norm_exp.c.
References call_arguments, call_constant_p, CAR, CDR, exp, EXPRESSION, expression_normalized, expression_syntax, expression_to_string(), is_normalized_linear, is_syntax_call, is_syntax_range, is_syntax_reference, NIL, normal_expression_of_expression(), NORMALIZE_EXPRESSION, normalized_tag, normalized_undefined, pips_debug, pips_internal_error, reconfig_expression(), ref, reference_indices, syntax_call, syntax_reference, and syntax_tag.
Referenced by normal_expression_of_expression(), and normal_expression_of_statement().
void normal_expression_of_statement | ( | statement | s | ) |
===========================================================================
void normal_expression_of_statement(statement s): normalizes the expressions contained in "s".
Definition at line 123 of file norm_exp.c.
References call_arguments, call_function, CAR, CDR, debug(), entity_local_name(), EXPRESSION, 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_body, loop_range, NIL, normal_expression_of_expression(), normal_expression_of_statement(), normal_expression_of_unstructured(), pips_internal_error, range_increment, range_lower, range_upper, STATEMENT, statement_instruction, test_condition, test_false, and test_true.
Referenced by atomizer(), normal_expression_of_statement(), and normal_expression_of_unstructured().
void normal_expression_of_unstructured | ( | unstructured | u | ) |
===========================================================================
void normal_expression_of_unstructured(unstructured u): normalizes the expressions of an unstructured instruction "u".
Definition at line 176 of file norm_exp.c.
References CONTROL_MAP, control_statement, debug(), gen_free_list(), NIL, normal_expression_of_statement(), and unstructured_control.
Referenced by normal_expression_of_statement().
void normalize_wp65_code | ( | statement | stat | ) |
reference test
function call test
test condition test
range arguments test
whileloop condition test
new variable
stat | tat |
Definition at line 161 of file atomizer.c.
References atomize_as_required(), build_new_variable(), gen_false2(), indirection_test(), and normalize_all_expressions_of().
Referenced by atomizer().
codegen.c
codegen.c
void put_stmt_in_Block(statement new_stmt, Block *cb): Puts "new_stmt" at the end of the list "cb->first".
First, if "new_stmt" is the first statement generated by the statement being translated (the current statement), then the caracteritics of "new_stmt" are taken from those of the current statement.
Second, "new_stmt" is added to the list of statements of "cb".
The current statement is the first element of the list "cb->last".
"stmt_generated" is false if the current statement has not produced any statement yet, in which case the new statement gets the "label", "number", "ordering" and "comments" (cf. RI) of the current statement.
The new statement gets the caracteristic of the current statement, while the latter gets the caracteristics of the new statement.
The current statement has, now, generated at least one statement.
The new statement is put just before the current statement in the block. Thus, it is put in last position in the list "cb->first".
new_stmt | ew_stmt |
cb | b |
Definition at line 89 of file codegen.c.
References CAR, CONS, current_stmt, Block::first, gen_nconc(), Block::last, NIL, STATEMENT, statement_comments, statement_label, statement_number, STATEMENT_NUMBER_UNDEFINED, statement_ordering, STATEMENT_ORDERING_UNDEFINED, Block::stmt_generated, and string_undefined.
Referenced by assign_tmp_to_exp(), and atomizer_of_external().
void reconfig_expression | ( | expression | exp | ) |
===========================================================================
void reconfig_expression(expression exp): "exp" is reordered so as to gather all the NLCs in the innermost parenthesis. More, the NLC of the inner loop is in the innermost parenthesis with the TCST (constant term). For example, if we have: (4*S + ( NLC1 + ((T + 7) + 3*NLC2))) + C) + 8*NLC3 it is reordered in: 4*S + (T + (C + (8*NLC1 + (3*NLC2 + (NLC3 + 7)))))
Called functions: _ Pvecteur_to_expression() : loop_normalize/utils.c
We configurate the Pvecteur of "exp".
We build a new expression with the configurated Pvecteur.
We change the syntax of "exp".
exp | xp |
Definition at line 334 of file norm_exp.c.
References call_constant_p, config_vecteur(), exp, expression_syntax, expression_undefined, is_normalized_linear, is_syntax_reference, NORMALIZE_EXPRESSION, normalized_linear, normalized_tag, Pvecteur_to_expression(), syntax_call, and syntax_tag.
Referenced by normal_expression_of_expression().
void store_expression | ( | expression | exp, |
Block * | cb | ||
) |
===========================================================================
void store_expression(expression exp, Block *cb): Removes the key of the hash table MemToTmp corresponding to the variable contained in "exp". It means that the value of this variable is no longer equal to the value of the temporary stored in MemToTmp.
Note: "exp" must have a "syntax_tag" equal to "reference".
Called functions : _ entity_scalar_p() : ri-util/entity.c _ make_entity_expression() : ri-util/util.c _ make_assign_statement() : ri-util/statement.c
entity tmp_ent;
exp | xp |
cb | b |
Definition at line 335 of file codegen.c.
References entity_scalar_p(), exp, expression_syntax, hash_del(), is_syntax_reference, MemToTmp, pips_assert, pips_user_error, reference_variable, syntax_reference, and syntax_tag.
bool true_dependence_with_entity_p(conflict conf, entity e): returns TRUE if the conflict "conf" is a true dependence upon the entity "e".
A true dependence is a conflict with a Write at the "source" and a Read at the "sink".
called functions : _ effect_entity() : ri-util/util.c _ same_entity_p() : ri-util/util.c
conf | onf |
Definition at line 82 of file defs_elim.c.
References action_tag, conflict_sink, conflict_source, effect_action, effect_entity(), effect_to_string(), is_action_read, is_action_write, pips_debug, pips_internal_error, and same_entity_p().
Referenced by defs_elim_of_assign_call().
|
extern |
The list "first" is a truncated list from the first to the current statement (not included).
atomizer.c
The list "last" is a truncated list from the current statement (included) to the last. The union of "first" and "last" is equal to the entire block.
The bool "stmt_generated" says if the current statement has: _ true : already generated statements. _ false : not generated statements.
Thus, when the current statement generates a new statement it is put at the end of the list "first" (just before the current statement). The current statement gives its caracteristics to the new one if the bool "stmt_generated" is false; this allows to keep these caracteristics at the first statement of the list generated by the translation of the current statement. The caracteristics of a statement are its "label", "number", "ordering" and "comments" (cf. RI). This global variable is used for the modification of the control graph, see commentaries of atomizer_of_unstructured() in atomizer.c.
The list "first" is a truncated list from the first to the current statement (not included).
This global variable is used for the modification of the control graph, see commentaries of atomizer_of_unstructured() in this file.
Definition at line 87 of file atomizer.h.
Referenced by atomizer_of_unstructured().
|
extern |
These lists memorize all the new created entities of each type.
They are used for the declarations of the temporaries and the auxiliaries. A hash table to map temporary variables (entities) to memory variables (entities).
Definition at line 95 of file atomizer.c.