PIPS
|
#include <stdio.h>
#include <math.h>
#include "linear.h"
#include "genC.h"
#include "ri.h"
#include "effects.h"
#include "complexity_ri.h"
#include "ri-util.h"
#include "effects-util.h"
#include "properties.h"
#include "misc.h"
#include "matrice.h"
#include "complexity.h"
Go to the source code of this file.
Macros | |
#define | FA(i, j) fa[(i)*n_controls + (j)] |
comp_unstr.c More... | |
Functions | |
complexity | unstructured_to_complexity (unstructured unstr, transformer precond, list effects_list) |
6th element of instruction More... | |
void | controls_to_hash_table (control cont, int *pn_controls, control_array, hash_table hash_control_to_complexity, transformer precond, list effects_list) |
Returns the hash table hash_control_to_complexity filled in with the complexities of the successors of control cont. More... | |
int | control_element_position_in_control_array (control cont, control_array, int n_controls) |
return the number i, that is i'th element of the control array Note that i begins from 1 instead of 0 More... | |
matrice | average_probability_matrix (unstructured unstr, int n_controls, control_array) |
void | node_successors_to_matrix (control cont, matrice P, int n_controls, control_array, already_examined) |
On return, Pij = 1 <=> there's an edge from control #i to #j It means that every succeccor has the same possibility to be reached. More... | |
Variables | |
hash_table | hash_callee_to_complexity |
comp_expr_to_pnome.c More... | |
hash_table | hash_complexity_parameters |
#define FA | ( | i, | |
j | |||
) | fa[(i)*n_controls + (j)] |
evaluate the complexity of unstructured graphs of statements used by get_bool_property
Added by AP, March 15th 93: allows the simulation of a two-dimensional array with a mono-dimensional memory allocation.
Definition at line 50 of file comp_unstr.c.
matrice average_probability_matrix | ( | unstructured | unstr, |
int | n_controls, | ||
control_array | |||
) |
initilize the already_examined to false
make in P the matrix "is_successor_of"
we'll attribute equitable probabilities to the n succ. of a node
computes probabilities (0<=p<1) out of the matrix "is_successor_of"
Definition at line 270 of file comp_unstr.c.
References ACCESS, DENOMINATOR, factorielle(), fprintf(), get_bool_property(), get_debug_level(), int_to_value, matrice_fprint(), matrice_new, matrice_normalize(), matrice_nulle(), MAX_CONTROLS_IN_UNSTRUCTURED, node_successors_to_matrix(), pips_internal_error, unstructured_control, value_div, value_product, VALUE_TO_INT, and x.
Referenced by unstructured_to_complexity().
return the number i, that is i'th element of the control array Note that i begins from 1 instead of 0
In order to satisfy compiler. LZ 3 Feb. 93
Definition at line 253 of file comp_unstr.c.
References pips_internal_error.
Referenced by node_successors_to_matrix().
void controls_to_hash_table | ( | control | cont, |
int * | pn_controls, | ||
control_array | , | ||
hash_table | hash_control_to_complexity, | ||
transformer | precond, | ||
list | effects_list | ||
) |
Returns the hash table hash_control_to_complexity filled in with the complexities of the successors of control cont.
each control of the graph is also stored in the array control_array (beginning at 1). also returns the total number of controls in the unstructured
Definition at line 212 of file comp_unstr.c.
References CAR, complexity_check_and_warn(), complexity_fprint(), CONTROL, control_statement, control_successors, fprintf(), get_debug_level(), hash_get(), hash_put(), HASH_UNDEFINED_VALUE, MAPL, NIL, and statement_to_complexity().
Referenced by unstructured_to_complexity().
void node_successors_to_matrix | ( | control | cont, |
matrice | P, | ||
int | n_controls, | ||
control_array | , | ||
already_examined | |||
) |
On return, Pij = 1 <=> there's an edge from control #i to #j It means that every succeccor has the same possibility to be reached.
Modification:
Here, we give equal possibility , 1 for each one
Definition at line 351 of file comp_unstr.c.
References ACCESS, CAR, CONTROL, control_element_position_in_control_array(), control_successors, fprintf(), get_bool_property(), get_debug_level(), MAPL, and VALUE_ONE.
Referenced by average_probability_matrix().
complexity unstructured_to_complexity | ( | unstructured | unstr, |
transformer | precond, | ||
list | effects_list | ||
) |
6th element of instruction
complexity unstructured_to_complexity(unstructured unstr; transformer precond; list effects_list;
Return the complexity of the unstructured graph unstr whose nodes are controls.
First runs through the graph to compute nodes' complexities, the total number of nodes, and give a number to each node. This is done in "controls_to_hash_table()".
Then runs again through it to fill the probability matrix [Pij] ( Pij = probability to go to node j when you're in node i) This is done in "build_probability_matrix()"
Then computes A = I-P, then inv_A = 1/A with the matrix package.
MAX_CONTROLS_IN_UNSTRUCTURED = 100
A is identity matrix I
B = A - P = I - P
matrice_general_inversion(B, A, n_controls);
A = 1/(B)
This region will call C routines. LZ 20/10/92
the "global" complexity is: comp = a11 * C1 + a12 * C2 + ... + a1n * Cn where Ci = complexity of control #i
Modif by AP, March 15th 93: old version had non constant int in dim decl float fa[n_controls][n_controls]; int indx[n_controls]; int d;
unstr | nstr |
precond | recond |
effects_list | ffects_list |
Definition at line 75 of file comp_unstr.c.
References A, ACCESS, average_probability_matrix(), B, complexity_add(), complexity_check_and_warn(), complexity_fprint(), complexity_scalar_mult(), controls_to_hash_table(), DENOMINATOR, f(), f2(), FA, float_matrice_inversion(), fprintf(), get_debug_level(), hash_get(), hash_pointer, hash_table_free(), hash_table_make(), make_zero_complexity(), malloc(), matrice_fprint(), matrice_free, matrice_identite(), matrice_new, matrice_substract(), MAX_CONTROLS_IN_UNSTRUCTURED, pips_internal_error, trace_off(), trace_on(), unstructured_control, and VALUE_TO_FLOAT.
Referenced by instruction_to_complexity().
|
extern |
scan a ri expression and try to make a polynomial of it Modif: – entity_local_name is replaced by module_local_name. LZ 230993 – MAXINT replaced by INT_MAX, -MAXINT by INT_MIN FI 1/12/95 useful, pips_error is defined there
Definition at line 57 of file comp_scan.c.
|
extern |
Definition at line 58 of file comp_scan.c.