PIPS
|
Go to the source code of this file.
Macros | |
#define | NLC_PREFIX "NLC" |
– norm_exp.c More... | |
#define | ENTITY_NLC_P(e) (strncmp(entity_local_name(e), NLC_PREFIX, 3) == 0) |
Functions | |
void | normal_expression_of_expression (expression exp) |
=========================================================================== More... | |
void | normal_expression_of_statement (statement s) |
=========================================================================== More... | |
void | normal_expression_of_unstructured (unstructured u) |
=========================================================================== More... | |
int | get_nlc_number (entity nlc_ent) |
=========================================================================== More... | |
static Pvecteur | config_vecteur (Pvecteur Vvar) |
=========================================================================== More... | |
void | reconfig_expression (expression exp) |
=========================================================================== More... | |
#define ENTITY_NLC_P | ( | e | ) | (strncmp(entity_local_name(e), NLC_PREFIX, 3) == 0) |
Definition at line 49 of file norm_exp.c.
#define NLC_PREFIX "NLC" |
Functions for the normalization of expressions.
Before the atomization, all the expression of the Code are put in a normal form. This normal form gathers the NLCs variables in the innermost parenthesis with the constant term. The NLCs are sorted in order to have the innerloop counter in the inner parenthesis.
Thus, the following expression: (4*S + ( NLC1 + ((T + 7) + 3*NLC2))) + C) + 8*NLC3 is normalized in: 4*S + (T + (C + (8*NLC1 + (3*NLC2 + (NLC3 + 7)))))
For more information about NLCs, see loop_normalize package. include "loop_normalize.h"
Definition at line 48 of file norm_exp.c.
===========================================================================
static Pvecteur config_vecteur(Pvecteur Vvar): returns a Pvecteur resulting of the configuration of the Pvecteur "Vvar".
Firstly, we put into three different Pvecteurs the constant term, the NLCs variables and the others variables (not NLCs). The NLCs variables are ordered from the greater to the smaller number.
Secondly, we concatenate these three Pvecteurs in the order: constant_term, nlc, not_nlc.
For example, with Pvecteur: 2*I 3*NLC2 1*NLC1 4*T 7 we could obtain: 7 3*NLC2 1*NLC1 4*T 2*I
"Vc" is the constant term.
"Vc" is a NLC.
"Vc" is not a NLC.
Definition at line 225 of file norm_exp.c.
References ENTITY_NLC_P, get_nlc_number(), num, Svecteur::succ, term_cst, Svecteur::val, Svecteur::var, vect_new(), VECTEUR_NUL, and VECTEUR_NUL_P.
Referenced by reconfig_expression().
===========================================================================
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 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 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().