PIPS
value.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "genC.h"
#include "linear.h"
#include "misc.h"
#include "properties.h"
#include "ri.h"
#include "ri-util.h"
#include "workspace-util.h"
#include "prettyprint.h"
#include "effects.h"
#include "effects-util.h"
#include "transformer.h"
+ Include dependency graph for value.c:

Go to the source code of this file.

Functions

bool hash_entity_to_values_undefined_p ()
 value.c More...
 
void reset_value_counters ()
 
void reset_temporary_value_counter ()
 
int number_of_temporary_values ()
 
void set_analyzed_types ()
 
void reset_analyzed_types ()
 
bool integer_analyzed_p ()
 
bool boolean_analyzed_p ()
 
bool string_analyzed_p ()
 
bool float_analyzed_p ()
 
bool complex_analyzed_p ()
 
bool pointer_analyzed_p ()
 
bool constant_path_analyzed_p ()
 
bool analyzed_basic_p (basic b)
 The basic corresponds to one of the analyzed types. More...
 
bool analyzed_type_p (type t)
 The type t is one of the analyzed types. More...
 
bool analyzed_struct_p (entity s)
 Does struct s contain directly or indirectly a field that may be analyzable? More...
 
bool analyzed_struct_type_p (type st)
 
bool analyzed_array_p (entity a)
 Does array a contain directly or indirectly a field that may be analyzable? More...
 
bool analyzed_array_type_p (type at)
 
bool analyzed_entity_p (entity e)
 
bool analyzable_scalar_entity_p (entity e)
 The entity type is one of the analyzed types. More...
 
bool analyzed_constant_p (entity f)
 The constant may appear as a variable in the linear systems. More...
 
bool analyzed_reference_p (reference r)
 FI: Nelson explains the motivation for can_be_constant_path_p() but I do not understand them. More...
 
static entity make_local_value_entity (int n, int nature, type t)
 LOCAL VALUE ENTITY. More...
 
static entity make_local_old_value_entity (type t)
 
static entity make_local_intermediate_value_entity (type t)
 
entity make_local_temporary_value_entity (type t)
 
entity make_local_temporary_value_entity_with_basic (basic b)
 
entity make_local_temporary_integer_value_entity ()
 
bool local_old_value_entity_p (entity e)
 Return true if an entity is a local old value (such as "o#0" for a global value "i#init"...). More...
 
bool local_intermediate_value_entity_p (entity e)
 
bool local_temporary_value_entity_p (entity e)
 
static bool non_local_temporary_value_entity_p (entity e)
 
bool global_new_value_p (entity e)
 GLOBAL VALUES. More...
 
bool global_old_value_p (entity e)
 Return true if an entity is a global old value (such as "i#init"...). More...
 
bool global_intermediate_value_p (entity e)
 
entity global_new_value_to_global_old_value (entity v_new)
 
const char * global_value_name_to_user_name (const char *gn)
 HASH TABLE USE. More...
 
const char * external_value_name (entity e)
 
const char * pips_user_value_name (entity e)
 This function is called many times when the constraints and the system of constraints are sorted using lexicographic information based on this particular value name. More...
 
entity entity_to_new_value (entity e)
 
entity entity_to_old_value (entity e)
 
entity entity_to_intermediate_value (entity e)
 
entity reference_to_address_of_value (reference r)
 
entity type_to_sizeof_value (type t)
 
bool entity_has_values_p (entity e)
 This function could be made more robust by checking the storage of e. More...
 
bool new_value_entity_p (entity e)
 the following three functions are directly or indirectly relative to the current module and its value hash tables. More...
 
bool old_value_entity_p (entity e)
 
bool intermediate_value_entity_p (entity e)
 
bool address_of_value_entity_p (entity e)
 
bool sizeof_value_entity_p (entity e)
 
bool value_entity_p (entity e)
 
static string string_identity (string s)
 used with hash_table_fprintf More...
 
void print_value_mappings ()
 
static int mapping_to_value_number (hash_table h)
 
static list mapping_to_domain_list (hash_table h)
 Returns the list of entities in the mapping domain. More...
 
list modified_variables_with_values ()
 Return the list of all analyzed variables which are modified in the current module. More...
 
void test_mapping_entry_consistency ()
 
int number_of_analyzed_values ()
 
int aproximate_number_of_analyzed_variables ()
 
int number_of_analyzed_variables ()
 FI: looks more like the number of values used. More...
 
void allocate_value_mappings (int n, int o, int i)
 
static void reset_value_mappings (void)
 
bool hash_value_to_name_undefined_p ()
 
void error_reset_value_mappings (void)
 To be called by error handler only. More...
 
void free_value_mappings (void)
 Normal call to free the mappings. More...
 
void error_free_value_mappings (void)
 To be called by an error handler. More...
 
static void add_new_value_name (entity e)
 HASH TABLE INITIALIZATION. More...
 
entity reference_to_address_entity (reference r)
 The address is the address of a variable or of a reference such as &a[5], not a of a value. More...
 
void add_address_of_value (reference r, type t)
 
void add_sizeof_value (type t)
 For a given architecture, sizeof(t) is a constant. More...
 
void add_new_value (entity e)
 
void add_new_alias_value (entity e, entity a)
 
entity external_entity_to_new_value (entity e)
 
entity external_entity_to_old_value (entity e)
 
void add_old_value (entity e)
 
void add_old_alias_value (entity e, entity a)
 
void add_intermediate_value (entity e)
 
void add_intermediate_alias_value (entity e, entity a)
 
void add_local_old_value (entity e)
 
void add_local_intermediate_value (entity e)
 
void remove_entity_values (entity e, bool readonly)
 
void add_synonym_values (entity e, entity eq, bool readonly)
 
entity value_to_variable (entity val)
 Get the primitive variable associated to any value involved in a transformer. More...
 
entity old_value_to_new_value (entity o_val)
 
entity new_value_to_old_value (entity n_val)
 
entity value_alias (entity e)
 Static aliasing. More...
 
Pvecteur vect_variables_to_values (Pvecteur v)
 FI: not used, not debugged. More...
 
string value_full_name (entity v)
 for debugging purposes More...
 
const char * readable_value_name (entity v)
 For debugging purposes, we might have to print system with temporary values. More...
 

Variables

static hash_table hash_entity_to_new_value = hash_table_undefined
 VARIABLE VALUE MANAGEMENT PACKAGE FOR TRANSFORMERS. More...
 
static hash_table hash_entity_to_old_value = hash_table_undefined
 
static hash_table hash_entity_to_intermediate_value = hash_table_undefined
 
static hash_table hash_value_to_name = hash_table_undefined
 
static hash_table hash_entity_to_user_value_name = hash_table_undefined
 
static hash_table hash_reference_to_address_of_value = hash_table_undefined
 
static hash_table hash_type_to_sizeof_value = hash_table_undefined
 
static int local_intermediate_value_counter = 0
 Two counters used to assign meaningless value entities to local variables. More...
 
static int local_old_value_counter = 0
 
static int local_temporary_value_counter = 0
 
static bool analyze_integer_scalar_entities = true
 TYPING. More...
 
static bool analyze_boolean_scalar_entities = false
 
static bool analyze_string_scalar_entities = false
 
static bool analyze_float_scalar_entities = false
 
static bool analyze_complex_scalar_entities = false
 
static bool analyze_pointer_scalar_entities = false
 
static bool analyze_constant_path = false
 

Function Documentation

◆ add_address_of_value()

void add_address_of_value ( reference  r,
type  t 
)

add the couple (e, address_of_value)

add its name

Definition at line 1309 of file value.c.

1310 {
1311  pips_internal_error("Obsolete function.\n");
1312  entity e = reference_variable(r);
1313  entity address_of_value;
1314  string address_of_value_name;
1315  string indice = strstr(reference_to_string(r), "[");
1316 
1317  if (indice != NULL)
1318  address_of_value_name = concatenate(
1319  entity_name(e), indice, ADDRESS_OF_SUFFIX, (char *) NULL);
1320  else
1321  address_of_value_name = concatenate(
1322  entity_name(e), ADDRESS_OF_SUFFIX, (char *) NULL);
1323 
1324 
1325  //address_of_value = gen_find_entity(address_of_value_name);
1326  address_of_value = gen_find_tabulated(address_of_value_name, entity_domain);
1327  //if (entity_undefined_p(address_of_value))
1328  if(address_of_value == entity_undefined)
1329  address_of_value = make_entity(strdup(address_of_value_name),
1330  copy_type(t),
1332  value_undefined);
1333 
1334  /* add the couple (e, address_of_value) */
1336  hash_put(hash_reference_to_address_of_value, (char *) r, (char *) address_of_value);
1337  /* add its name */
1338  hash_put(hash_value_to_name, (char *) address_of_value,
1339  strdup(entity_name(address_of_value)));
1340  // The next table be reset after the analysis, can't be reuse for the prettyprint, so useless to add in the table?
1341  entity v = value_to_variable(address_of_value);
1342  hash_put(hash_entity_to_user_value_name, (char *) address_of_value,
1343  strdup(concatenate("&", entity_user_name(v), indice, (char *) NULL)));
1344  }
1345 }
type copy_type(type p)
TYPE.
Definition: ri.c:2655
storage make_storage(enum storage_utype tag, void *val)
Definition: ri.c:2273
void * hash_get(const hash_table htp, const void *key)
this function retrieves in the hash table pointed to by htp the couple whose key is equal to key.
Definition: hash.c:449
void hash_put(hash_table htp, const void *key, const void *val)
This functions stores a couple (key,val) in the hash table pointed to by htp.
Definition: hash.c:364
#define pips_internal_error
Definition: misc-local.h:149
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
#define HASH_UNDEFINED_VALUE
value returned by hash_get() when the key is not found; could also be called HASH_KEY_NOT_FOUND,...
Definition: newgen_hash.h:56
void * gen_find_tabulated(const char *, int)
Definition: tabulated.c:218
#define UU
Definition: newgen_types.h:98
entity value_to_variable(entity val)
Get the primitive variable associated to any value involved in a transformer.
Definition: value.c:1624
static hash_table hash_reference_to_address_of_value
Definition: value.c:225
static hash_table hash_entity_to_user_value_name
Definition: value.c:223
static hash_table hash_value_to_name
Definition: value.c:222
string reference_to_string(reference r)
Definition: expression.c:87
#define make_entity(n, t, s, i)
const char * entity_user_name(entity e)
Since entity_local_name may contain PIPS special characters such as prefixes (label,...
Definition: entity.c:487
#define value_undefined
Definition: ri.h:3016
#define reference_variable(x)
Definition: ri.h:2326
@ is_storage_rom
Definition: ri.h:2494
#define entity_undefined
Definition: ri.h:2761
#define entity_name(x)
Definition: ri.h:2790
#define entity_domain
newgen_syntax_domain_defined
Definition: ri.h:410
char * strdup()
#define ADDRESS_OF_SUFFIX

References ADDRESS_OF_SUFFIX, concatenate(), copy_type(), entity_domain, entity_name, entity_undefined, entity_user_name(), gen_find_tabulated(), hash_entity_to_user_value_name, hash_get(), hash_put(), hash_reference_to_address_of_value, HASH_UNDEFINED_VALUE, hash_value_to_name, is_storage_rom, make_entity, make_storage(), pips_internal_error, reference_to_string(), reference_variable, strdup(), UU, value_to_variable(), and value_undefined.

+ Here is the call graph for this function:

◆ add_intermediate_alias_value()

void add_intermediate_alias_value ( entity  e,
entity  a 
)

add_new_value_name(e);

Definition at line 1495 of file value.c.

1496 {
1498 
1499  pips_assert("add_intermediate_alias_valued",
1501  == HASH_UNDEFINED_VALUE));
1502 
1504 
1505  hash_put(hash_entity_to_intermediate_value, (char *) e, (char *) v);
1506  /* add_new_value_name(e); */
1507 }
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
entity entity_to_intermediate_value(entity e)
Definition: value.c:879
static hash_table hash_entity_to_intermediate_value
Definition: value.c:221

References entity_to_intermediate_value(), entity_undefined, hash_entity_to_intermediate_value, hash_get(), hash_put(), HASH_UNDEFINED_VALUE, and pips_assert.

Referenced by add_interprocedural_value_entities().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_intermediate_value()

void add_intermediate_value ( entity  e)

get a new intermediate value, if necessary

add its (external) name

Definition at line 1476 of file value.c.

1477 {
1478  entity intermediate_value;
1479 
1480  /* get a new intermediate value, if necessary */
1481  if((intermediate_value =
1484  intermediate_value = make_local_intermediate_value_entity(entity_type(e));
1486  (char *) intermediate_value);
1487  /* add its (external) name */
1488  hash_put(hash_value_to_name, (char *) intermediate_value,
1491  (char *) NULL)));
1492  }
1493 }
static entity make_local_intermediate_value_entity(type t)
Definition: value.c:600
#define entity_type(x)
Definition: ri.h:2792
#define INTERMEDIATE_VALUE_SUFFIX

References concatenate(), entity_name, entity_type, hash_entity_to_intermediate_value, hash_get(), hash_put(), HASH_UNDEFINED_VALUE, hash_value_to_name, INTERMEDIATE_VALUE_SUFFIX, make_local_intermediate_value_entity(), and strdup().

Referenced by add_interprocedural_value_entities(), add_or_kill_equivalenced_variables(), convex_in_effect_loop_range_fix(), and interlaced_basic_workchunk_regions_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_local_intermediate_value()

void add_local_intermediate_value ( entity  e)

get a new intermediate value, if necessary

add its (external) name

Definition at line 1526 of file value.c.

1527 {
1528  entity intermediate_value;
1529 
1530  /* get a new intermediate value, if necessary */
1531  if((intermediate_value =
1534  intermediate_value = make_local_intermediate_value_entity(entity_type(e));
1536  (char *) intermediate_value);
1537  /* add its (external) name */
1538  hash_put(hash_value_to_name, (char *) intermediate_value,
1541  (char *) NULL)));
1542  }
1543 }

References concatenate(), entity_name, entity_type, hash_entity_to_intermediate_value, hash_get(), hash_put(), HASH_UNDEFINED_VALUE, hash_value_to_name, INTERMEDIATE_VALUE_SUFFIX, make_local_intermediate_value_entity(), and strdup().

Referenced by add_intraprocedural_value_entities_unconditionally().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_local_old_value()

void add_local_old_value ( entity  e)

get a new old value, if necessary

add its (external) name

Definition at line 1509 of file value.c.

1510 {
1511  entity old_value;
1512 
1513  /* get a new old value, if necessary */
1514  if((old_value =
1515  (entity) hash_get(hash_entity_to_old_value, (char *) e))
1517  old_value = make_local_old_value_entity(entity_type(e));
1518  hash_put(hash_entity_to_old_value, (char *) e, (char *) old_value);
1519  /* add its (external) name */
1520  hash_put(hash_value_to_name, (char *) old_value,
1522  (char *) NULL)));
1523  }
1524 }
static hash_table hash_entity_to_old_value
Definition: value.c:220
static entity make_local_old_value_entity(type t)
Definition: value.c:595
#define OLD_VALUE_SUFFIX

References concatenate(), entity_name, entity_type, hash_entity_to_old_value, hash_get(), hash_put(), HASH_UNDEFINED_VALUE, hash_value_to_name, make_local_old_value_entity(), OLD_VALUE_SUFFIX, and strdup().

Referenced by add_intraprocedural_value_entities_unconditionally().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_new_alias_value()

void add_new_alias_value ( entity  e,
entity  a 
)

add_new_value_name(e);

Definition at line 1396 of file value.c.

1397 {
1399  pips_debug(8, "begin: for %s and %s\n",
1400  entity_name(e),entity_name(a));
1401  pips_assert("hash_entity_to_new_value is defined",
1402  (hash_get(hash_entity_to_new_value, (char *) e)
1403  == HASH_UNDEFINED_VALUE));
1404 
1405  v = entity_to_new_value(a);
1406 
1407  hash_put(hash_entity_to_new_value, (char *) e, (char *) v);
1408  /* add_new_value_name(e); */
1409 }
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
static hash_table hash_entity_to_new_value
VARIABLE VALUE MANAGEMENT PACKAGE FOR TRANSFORMERS.
Definition: value.c:219
entity entity_to_new_value(entity e)
Definition: value.c:859

References entity_name, entity_to_new_value(), entity_undefined, hash_entity_to_new_value, hash_get(), hash_put(), HASH_UNDEFINED_VALUE, pips_assert, and pips_debug.

Referenced by add_interprocedural_new_value_entity(), and add_interprocedural_value_entities().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_new_value()

void add_new_value ( entity  e)

Definition at line 1386 of file value.c.

1387 {
1388  pips_debug(8,"begin: for %s\n", entity_name(e));
1389  if(hash_get(hash_entity_to_new_value, (char *) e)
1390  == HASH_UNDEFINED_VALUE) {
1391  hash_put(hash_entity_to_new_value, (char *) e, (char *) e);
1392  add_new_value_name(e);
1393  }
1394 }
static void add_new_value_name(entity e)
HASH TABLE INITIALIZATION.
Definition: value.c:1254

References add_new_value_name(), entity_name, hash_entity_to_new_value, hash_get(), hash_put(), HASH_UNDEFINED_VALUE, and pips_debug.

Referenced by add_interprocedural_new_value_entity(), add_interprocedural_value_entities(), add_intraprocedural_value_entities_unconditionally(), and add_or_kill_equivalenced_variables().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_new_value_name()

static void add_new_value_name ( entity  e)
static

HASH TABLE INITIALIZATION.

void add_new_value_name(entity e): add a new value name for entity e

Definition at line 1254 of file value.c.

1255 {
1256  string new_value_name =
1258  (char *) NULL));
1259  pips_debug(8,"begin: for %s\n", entity_name(e));
1261  hash_put(hash_value_to_name, (char *) e, (char *) new_value_name);
1262  else
1263  free(new_value_name);
1264 }
void free(void *)
#define NEW_VALUE_SUFFIX
external suffixes (NEW_VALUE_SUFFIX is not used, new values are represented by the variable itself,...

References concatenate(), entity_name, free(), hash_get(), hash_put(), HASH_UNDEFINED_VALUE, hash_value_to_name, NEW_VALUE_SUFFIX, pips_debug, and strdup().

Referenced by add_new_value().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_old_alias_value()

void add_old_alias_value ( entity  e,
entity  a 
)

add_new_value_name(e);

Definition at line 1463 of file value.c.

1464 {
1466 
1467  pips_assert("add_old_alias_valued", (hash_get(hash_entity_to_old_value, (char *) e)
1468  == HASH_UNDEFINED_VALUE));
1469 
1470  v = entity_to_old_value(a);
1471 
1472  hash_put(hash_entity_to_old_value, (char *) e, (char *) v);
1473  /* add_new_value_name(e); */
1474 }
entity entity_to_old_value(entity e)
Definition: value.c:869

References entity_to_old_value(), entity_undefined, hash_entity_to_old_value, hash_get(), hash_put(), HASH_UNDEFINED_VALUE, and pips_assert.

Referenced by add_interprocedural_value_entities().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_old_value()

void add_old_value ( entity  e)

find the old value entity if possible, else, generate it

add the couple (e, old_value)

add its name

Definition at line 1440 of file value.c.

1441 {
1442  entity old_value;
1443  string old_value_name;
1444 
1445  /* find the old value entity if possible, else, generate it */
1446  old_value_name = concatenate(entity_name(e),OLD_VALUE_SUFFIX,
1447  (char *) NULL);
1448  old_value = gen_find_tabulated(old_value_name, entity_domain);
1449  if(old_value == entity_undefined)
1450  old_value = make_entity(strdup(old_value_name),
1451  copy_type(entity_type(e)),
1453  value_undefined);
1454  /* add the couple (e, old_value) */
1456  hash_put(hash_entity_to_old_value, (char *) e, (char *) old_value);
1457  /* add its name */
1458  hash_put(hash_value_to_name, (char *) old_value,
1459  strdup(entity_name(old_value)));
1460  }
1461 }

References concatenate(), copy_type(), entity_domain, entity_name, entity_type, entity_undefined, gen_find_tabulated(), hash_entity_to_old_value, hash_get(), hash_put(), HASH_UNDEFINED_VALUE, hash_value_to_name, is_storage_rom, make_entity, make_storage(), OLD_VALUE_SUFFIX, strdup(), UU, and value_undefined.

Referenced by add_interprocedural_value_entities(), add_or_kill_equivalenced_variables(), and add_synonym_values().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_sizeof_value()

void add_sizeof_value ( type  t)

For a given architecture, sizeof(t) is a constant.

It has no old value, no new value, it is a value.

Constants are encoded as 0-ary functions, not as values.

find the sizeof entity if possible, else, generate it

add the couple (e, old_value)

add its name

Definition at line 1352 of file value.c.

1353 {
1354  entity sizeof_value;
1355  string sizeof_value_name;
1356 
1357  // improvement create the entity with the name of type
1358  // issue because of value_to_variable
1359  /* find the sizeof entity if possible, else, generate it */
1360  sizeof_value_name =
1361  concatenate(
1363  type_to_full_string_definition(t), SIZEOF_SUFFIX, (char *) NULL);
1364  sizeof_value = gen_find_tabulated(sizeof_value_name, entity_domain);
1365  if(sizeof_value == entity_undefined)
1366  sizeof_value =
1367  make_entity(strdup(sizeof_value_name),
1368  //make_type(is_type_variable,
1369  // make_variable(make_basic(is_basic_int, (void*)sizeof(int)),NIL,NIL)),
1370  copy_type(t),
1372  value_undefined);
1373  /* add the couple (e, old_value) */
1375  hash_put(hash_type_to_sizeof_value, (char *) t, (char *) sizeof_value);
1376  /* add its name */
1377  hash_put(hash_value_to_name, (char *) sizeof_value,
1378  strdup(entity_name(sizeof_value)));
1379  hash_put(hash_entity_to_new_value, (char *) sizeof_value,
1380  (char *) sizeof_value);
1381  hash_put(hash_entity_to_user_value_name, (char *) sizeof_value,
1382  concatenate("sizeof(", type_to_full_string_definition(t), ")", (char *) NULL));
1383  }
1384 }
#define TOP_LEVEL_MODULE_NAME
Module containing the global variables in Fortran and C.
Definition: naming-local.h:101
#define MODULE_SEP_STRING
Definition: naming-local.h:30
static hash_table hash_type_to_sizeof_value
Definition: value.c:227
string type_to_full_string_definition(type)
type.c
Definition: type.c:45
#define SIZEOF_SUFFIX

References concatenate(), copy_type(), entity_domain, entity_name, entity_undefined, gen_find_tabulated(), hash_entity_to_new_value, hash_entity_to_user_value_name, hash_get(), hash_put(), hash_type_to_sizeof_value, HASH_UNDEFINED_VALUE, hash_value_to_name, is_storage_rom, make_entity, make_storage(), MODULE_SEP_STRING, SIZEOF_SUFFIX, strdup(), TOP_LEVEL_MODULE_NAME, type_to_full_string_definition(), UU, and value_undefined.

Referenced by expression_multiply_sizeof_to_transformer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_synonym_values()

void add_synonym_values ( entity  e,
entity  eq,
bool  readonly 
)

e and eq are entities whose values are always equal because they share the exact same memory location (i.e. they are alias). Values for e have already been declared. Values for eq have to be declared.

hash_put(hash_value_to_name, (char *) old_value_eq, entity_name(old_value_eq));

The name does not change. It is not used until the equivalence equations are added

Parameters
eqq
readonlyeadonly

Definition at line 1578 of file value.c.

1579 {
1580  /* e and eq are entities whose values are always equal because they
1581  * share the exact same memory location (i.e. they are alias). Values
1582  * for e have already been declared. Values for eq have to be
1583  * declared. */
1584  entity new_value = entity_to_new_value(e);
1585  entity intermediate_value;
1586 
1587  pips_debug(8, "Begin for registered variable %s"
1588  " equivalenced with new variable %s"
1589  " with status %s\n",
1591  readonly? "readonly" : "read/write");
1592 
1594  (char *) new_value);
1595  if(!readonly) {
1596  entity old_value = entity_to_old_value(e);
1597  intermediate_value = entity_to_intermediate_value(e);
1598  add_old_value(eq);
1600  (char *) intermediate_value);
1602  (char *) old_value);
1603  /* hash_put(hash_value_to_name, (char *) old_value_eq, entity_name(old_value_eq)); */
1604  }
1605  /* The name does not change. It is not used until the equivalence
1606  equations are added */
1607  hash_put(hash_value_to_name, (char *) eq,
1609  NEW_VALUE_SUFFIX, (char *) NULL)));
1610 
1611  pips_debug(8, "End\n");
1612 }
void hash_update(hash_table htp, const void *key, const void *val)
update key->val in htp, that MUST be pre-existent.
Definition: hash.c:491
void add_old_value(entity e)
Definition: value.c:1440
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
Definition: entity.c:453
Pcontrainte eq
element du vecteur colonne du systeme donne par l'analyse
Definition: sc_gram.c:108

References add_old_value(), concatenate(), entity_local_name(), entity_name, entity_to_intermediate_value(), entity_to_new_value(), entity_to_old_value(), eq, hash_entity_to_intermediate_value, hash_entity_to_new_value, hash_entity_to_old_value, hash_put(), hash_update(), hash_value_to_name, NEW_VALUE_SUFFIX, pips_debug, and strdup().

Referenced by add_equivalenced_values().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ address_of_value_entity_p()

bool address_of_value_entity_p ( entity  e)

Definition at line 962 of file value.c.

963 {
964  string s = strstr(entity_local_name(e), ADDRESS_OF_SUFFIX);
965 
966  return s!=NULL;
967 }

References ADDRESS_OF_SUFFIX, and entity_local_name().

Referenced by pips_user_value_name(), and value_to_variable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ allocate_value_mappings()

void allocate_value_mappings ( int  n,
int  o,
int  i 
)

hash_warn_on_redefinition();

Definition at line 1165 of file value.c.

1166 {
1167  pips_assert("undefined mappings for allocation",
1174 
1175  /* hash_warn_on_redefinition(); */
1181  hash_table_make(hash_pointer, n + o + i + n); // The last +n for the pointer
1183  hash_table_make(hash_pointer, n + o + i + n); // The last +n for the pointer
1186 }
hash_table hash_table_make(hash_key_type key_type, size_t size)
Definition: hash.c:294
@ hash_pointer
Definition: newgen_hash.h:32
#define hash_table_undefined_p(h)
Definition: newgen_hash.h:50

References hash_entity_to_intermediate_value, hash_entity_to_new_value, hash_entity_to_old_value, hash_entity_to_user_value_name, hash_pointer, hash_reference_to_address_of_value, hash_table_make(), hash_table_undefined_p, hash_type_to_sizeof_value, hash_value_to_name, and pips_assert.

Referenced by allocate_module_value_mappings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ analyzable_scalar_entity_p()

bool analyzable_scalar_entity_p ( entity  e)

The entity type is one of the analyzed types.

Definition at line 471 of file value.c.

472 {
473  bool result = false;
474 
475  if(!abstract_state_variable_p(e) // for packages such as IO or RAND
476  && !typedef_entity_p(e)
479  && !place_holder_variable_p(e)) { // Because enum are analyzed
481  result = analyzed_type_p(bct);
482  }
483  return result;
484 }
bool entity_heap_location_p(entity b)
package abstract location.
bool entity_typed_anywhere_locations_p(entity e)
Test if an entity is the bottom of the lattice.
bool analyzed_type_p(type t)
The type t is one of the analyzed types.
Definition: value.c:367
bool typedef_entity_p(entity e)
Definition: entity.c:1902
bool abstract_state_variable_p(entity v)
Definition: entity.c:2572
bool place_holder_variable_p(entity)
Definition: variable.c:2069
type entity_basic_concrete_type(entity)
retrieves or computes and then returns the basic concrete type of an entity
Definition: type.c:3677

References abstract_state_variable_p(), analyzed_type_p(), entity_basic_concrete_type(), entity_heap_location_p(), entity_typed_anywhere_locations_p(), place_holder_variable_p(), and typedef_entity_p().

Referenced by add_implicit_interprocedural_write_effects(), add_or_kill_equivalenced_variables(), any_user_call_site_to_transformer(), c_return_to_transformer(), external_entity_to_new_value(), generic_reference_to_transformer(), module_to_formal_analyzable_parameters(), module_to_value_mappings(), precondition_intra_to_inter(), and same_analyzable_type_scalar_entity_list_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ analyzed_array_p()

bool analyzed_array_p ( entity  a)

Does array a contain directly or indirectly a field that may be analyzable?

Definition at line 434 of file value.c.

435 {
436  bool analyzed_p = false;
439  if(analyzed_type_p(et))
440  analyzed_p = true;
441  else if(struct_type_p(et))
442  analyzed_p = analyzed_struct_type_p(et);
443  return analyzed_p;
444 }
bool analyzed_struct_type_p(type st)
Definition: value.c:406
bool struct_type_p(type)
Returns true if t is of type derived and if the derived type is a struct.
Definition: type.c:3121
type array_type_to_element_type(type)
returns the type of the elements of an array type, as a newly allocated type.
Definition: type.c:5700

References analyzed_struct_type_p(), analyzed_type_p(), array_type_to_element_type(), entity_basic_concrete_type(), and struct_type_p().

+ Here is the call graph for this function:

◆ analyzed_array_type_p()

bool analyzed_array_type_p ( type  at)
Parameters
att

Definition at line 446 of file value.c.

447 {
448  bool analyzed_p = false;
450  if(analyzed_type_p(et))
451  analyzed_p = true;
452  else if(struct_type_p(et))
453  analyzed_p = analyzed_struct_type_p(et);
454  return analyzed_p;
455 }

References analyzed_struct_type_p(), analyzed_type_p(), array_type_to_element_type(), and struct_type_p().

Referenced by analyzed_entity_p(), and analyzed_struct_type_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ analyzed_basic_p()

bool analyzed_basic_p ( basic  b)

The basic corresponds to one of the analyzed types.

Definition at line 337 of file value.c.

338 {
339  bool analyzed_p = false;
340 
342  analyzed_p = true;
344  analyzed_p = true;
346  analyzed_p = true;
348  analyzed_p = true;
350  pips_debug(9,"pointer type : %s\n", type_to_string(basic_pointer(b)));
351  analyzed_p = true;
352  }
354  analyzed_p = true;
356  entity de = basic_derived(b);
358  analyzed_p = type_enum_p(dt);
359  }
360  else
361  analyzed_p = false;
362 
363  return analyzed_p;
364 }
static bool analyze_string_scalar_entities
Definition: value.c:264
static bool analyze_integer_scalar_entities
TYPING.
Definition: value.c:262
static bool analyze_boolean_scalar_entities
Definition: value.c:263
static bool analyze_complex_scalar_entities
Definition: value.c:266
static bool analyze_float_scalar_entities
Definition: value.c:265
static bool analyze_pointer_scalar_entities
Definition: value.c:267
string type_to_string(const type)
type.c
Definition: type.c:51
#define type_enum_p(x)
Definition: ri.h:2968
#define basic_pointer(x)
Definition: ri.h:637
#define basic_complex_p(x)
Definition: ri.h:626
#define basic_int_p(x)
Definition: ri.h:614
#define basic_derived(x)
Definition: ri.h:640
#define basic_pointer_p(x)
Definition: ri.h:635
#define basic_derived_p(x)
Definition: ri.h:638
#define basic_string_p(x)
Definition: ri.h:629
#define basic_logical_p(x)
Definition: ri.h:620
#define basic_float_p(x)
Definition: ri.h:617

References analyze_boolean_scalar_entities, analyze_complex_scalar_entities, analyze_float_scalar_entities, analyze_integer_scalar_entities, analyze_pointer_scalar_entities, analyze_string_scalar_entities, basic_complex_p, basic_derived, basic_derived_p, basic_float_p, basic_int_p, basic_logical_p, basic_pointer, basic_pointer_p, basic_string_p, entity_basic_concrete_type(), pips_debug, type_enum_p, and type_to_string().

Referenced by analyzed_type_p(), and condition_to_transformer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ analyzed_constant_p()

bool analyzed_constant_p ( entity  f)

The constant may appear as a variable in the linear systems.

is f a 0-ary function, i.e. a constant of proper type?

integer and logical constants are handled explicitly

Definition at line 487 of file value.c.

488 {
489  /* is f a 0-ary function, i.e. a constant of proper type? */
490  if(entity_constant_p(f)) {
493 
494  /* integer and logical constants are handled explicitly */
495 
497  return true;
499  return true;
501  return true;
503  return true;
504  }
505  return false;
506 }
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
#define entity_constant_p(e)
#define functional_result(x)
Definition: ri.h:1444
#define type_functional(x)
Definition: ri.h:2952
#define type_variable(x)
Definition: ri.h:2949
#define variable_basic(x)
Definition: ri.h:3120

References analyze_complex_scalar_entities, analyze_float_scalar_entities, analyze_pointer_scalar_entities, analyze_string_scalar_entities, basic_complex_p, basic_float_p, basic_pointer_p, basic_string_p, entity_constant_p, entity_type, f(), functional_result, type_functional, type_variable, and variable_basic.

Referenced by value_mappings_compatible_vector_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ analyzed_entity_p()

bool analyzed_entity_p ( entity  e)

Definition at line 457 of file value.c.

458 {
459  bool analyzed_p = false;
461  if(analyzed_type_p(et))
462  analyzed_p = true;
463  else if(struct_type_p(et))
464  analyzed_p = analyzed_struct_type_p(et);
465  else if(array_type_p(et))
466  analyzed_p = analyzed_array_type_p(et);
467  return analyzed_p;
468 }
bool analyzed_array_type_p(type at)
Definition: value.c:446
bool array_type_p(type)
Definition: type.c:2942

References analyzed_array_type_p(), analyzed_struct_type_p(), analyzed_type_p(), array_type_p(), entity_basic_concrete_type(), and struct_type_p().

Referenced by generic_substitute_formal_array_elements_in_transformer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ analyzed_reference_p()

bool analyzed_reference_p ( reference  r)

FI: Nelson explains the motivation for can_be_constant_path_p() but I do not understand them.

He also explains the motivation for strict_constant_path_p() and I do not understand them either.

Stricly speaking, this funtion should be called analyzed_points_to_reference_p()

Definition at line 518 of file value.c.

519 {
520  pips_debug(7, "analyzed_reference_p, ref : %s\n", reference_to_string(r));
521  bool result = false;
522  entity v = reference_variable(r);
523 
525  //&& atomic_points_to_reference_p(r)) {
527  && !effects_package_entity_p(v)) {
529  result = analyzed_type_p(t);
530  }
531  else {
532  // e.g. a[i]
533  result = false;
534  }
535 
536  pips_debug(7, "analyzed_reference_p result : %i\n", result);
537  return result;
538 }
type points_to_reference_to_concrete_type(reference)
Definition: type.c:685
bool generic_atomic_points_to_reference_p(reference, bool)
Is it a unique concrete memory location?
Definition: points_to.c:489
bool store_independent_points_to_reference_p(reference)
Functions for points-to references, the kind of references used in points-to cells.
Definition: points_to.c:1247
bool effects_package_entity_p(entity e)
checks if an entity is an IO_EFFECTS_PACKAGE_NAME, a MALLOC_EFFECTS_NAME or a RAND_EFFECTS_PACKAGE_NA...
Definition: entity.c:1181

References analyzed_type_p(), effects_package_entity_p(), generic_atomic_points_to_reference_p(), pips_debug, points_to_reference_to_concrete_type(), reference_to_string(), reference_variable, and store_independent_points_to_reference_p().

Referenced by any_assign_to_transformer(), any_basic_update_to_transformer(), any_update_to_transformer(), assign_rhs_to_reflhs_to_transformer(), generic_apply_effect_to_transformer(), lhs_expression_to_transformer(), module_to_value_mappings(), points_to_unary_operation_to_transformer(), and substitute_stubs_in_transformer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ analyzed_struct_p()

bool analyzed_struct_p ( entity  s)

Does struct s contain directly or indirectly a field that may be analyzable?

Definition at line 387 of file value.c.

388 {
389  bool analyzed_p = false;
391  FOREACH(ENTITY, f, fl) {
393  if(analyzed_type_p(ft)) {
394  analyzed_p = true;
395  break;
396  }
397  else if(struct_type_p(ft)) {
398  analyzed_p = analyzed_struct_p(f);
399  if(analyzed_p)
400  break;
401  }
402  }
403  return analyzed_p;
404 }
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
Definition: newgen_list.h:179
bool analyzed_struct_p(entity s)
Does struct s contain directly or indirectly a field that may be analyzable?
Definition: value.c:387
list struct_variable_to_fields(entity)
Assume that v is declared as a struct.
Definition: variable.c:2045
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References analyzed_struct_p(), analyzed_type_p(), ENTITY, entity_basic_concrete_type(), f(), FOREACH, struct_type_p(), and struct_variable_to_fields().

Referenced by analyzed_struct_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ analyzed_struct_type_p()

bool analyzed_struct_type_p ( type  st)
Parameters
stt

Definition at line 406 of file value.c.

407 {
408  bool analyzed_p = false;
409  list fl = struct_type_to_fields(st);
410  FOREACH(ENTITY, f, fl) {
411  // FI: might be shorter an safer to call entity_analyzed_p(f)
413  if(analyzed_type_p(ft)) {
414  analyzed_p = true;
415  break;
416  }
417  else if(struct_type_p(ft)) {
418  analyzed_p = analyzed_struct_type_p(ft);
419  if(analyzed_p)
420  break;
421  }
422  else if(array_type_p(ft)) {
423  analyzed_p = analyzed_array_type_p(ft);
424  if(analyzed_p)
425  break;
426  }
427  }
428  return analyzed_p;
429 }
list struct_type_to_fields(type)
Definition: type.c:5798

References analyzed_array_type_p(), analyzed_struct_type_p(), analyzed_type_p(), array_type_p(), ENTITY, entity_basic_concrete_type(), f(), FOREACH, struct_type_p(), and struct_type_to_fields().

Referenced by analyzed_array_p(), analyzed_array_type_p(), analyzed_entity_p(), and analyzed_struct_type_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ analyzed_type_p()

bool analyzed_type_p ( type  t)

The type t is one of the analyzed types.

Definition at line 367 of file value.c.

368 {
369  bool result = false;
371 
372  if(type_variable_p(bct)) {
373  variable v = type_variable(bct);
374  if (!volatile_variable_p(v)
375  && ENDP(variable_dimensions(v)) //NL : for checking the dimension instead of entity_scalar_p which filter pointer type
376  ) {
377  result = analyzed_basic_p(variable_basic(v));
378  }
379  }
380 
381  return result;
382 }
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
bool analyzed_basic_p(basic b)
The basic corresponds to one of the analyzed types.
Definition: value.c:337
type compute_basic_concrete_type(type)
computes a new type which is the basic concrete type of the input type (this new type is not stored i...
Definition: type.c:3556
bool volatile_variable_p(variable)
Definition: variable.c:1649
#define variable_dimensions(x)
Definition: ri.h:3122
#define type_variable_p(x)
Definition: ri.h:2947

References analyzed_basic_p(), compute_basic_concrete_type(), ENDP, type_variable, type_variable_p, variable_basic, variable_dimensions, and volatile_variable_p().

Referenced by add_inter_or_intraprocedural_field_entities(), analyzable_scalar_entity_p(), analyzed_array_p(), analyzed_array_type_p(), analyzed_entity_p(), analyzed_reference_p(), analyzed_struct_p(), analyzed_struct_type_p(), assign_rhs_to_reflhs_to_transformer(), call_to_transformer(), create_values_for_simple_effect(), expression_to_transformer(), generic_reference_to_transformer(), generic_substitute_formal_array_elements_in_transformer(), make_local_temporary_value_entity(), module_to_value_mappings(), perform_array_element_substitutions_in_transformer(), semantics_usable_points_to_reference_p(), substitute_struct_stub_in_transformer(), and transformer_apply_field_assignments_or_equalities().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ aproximate_number_of_analyzed_variables()

int aproximate_number_of_analyzed_variables ( void  )

FI: I do not know if equivalenced variables are well taken into account

Definition at line 1153 of file value.c.

1154 {
1155  /* FI: I do not know if equivalenced variables are well taken into account*/
1157 }
int hash_table_entry_count(hash_table htp)
now we define observers in order to hide the hash_table type...
Definition: hash.c:818

References hash_entity_to_new_value, and hash_table_entry_count().

Referenced by module_to_value_mappings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ boolean_analyzed_p()

bool boolean_analyzed_p ( void  )

Definition at line 305 of file value.c.

306 {
308 }

References analyze_boolean_scalar_entities.

Referenced by any_expression_to_transformer(), and fortran_data_to_prec_for_variables().

+ Here is the caller graph for this function:

◆ complex_analyzed_p()

bool complex_analyzed_p ( void  )

Definition at line 320 of file value.c.

321 {
323 }

References analyze_complex_scalar_entities.

◆ constant_path_analyzed_p()

◆ entity_has_values_p()

bool entity_has_values_p ( entity  e)

This function could be made more robust by checking the storage of e.

Formal parameters of analyzed type always have values.

is e a variable whose value(s) (already) are analyzed?

Definition at line 911 of file value.c.

912 {
913  /* is e a variable whose value(s) (already) are analyzed?
914  */
915  pips_assert("value hash table is defined",
917  bool has_values_p = hash_defined_p(hash_entity_to_new_value, (char *) e);
918  return has_values_p;
919 }
bool hash_defined_p(const hash_table htp, const void *key)
true if key has e value in htp.
Definition: hash.c:484

References hash_defined_p(), hash_entity_to_new_value, hash_table_undefined_p, and pips_assert.

Referenced by add_index_range_conditions(), add_inter_or_intraprocedural_field_entities(), add_interprocedural_new_value_entity(), add_interprocedural_value_entities(), add_intraprocedural_value_entities(), add_loop_index_exit_value(), add_or_kill_equivalenced_variables(), any_assign_operation_to_transformer(), any_scalar_assign_to_transformer_list(), any_scalar_assign_to_transformer_without_effect(), apply_abstract_effect_to_transformer(), assign_operation_to_transformer(), assigned_expression_to_transformer(), assigned_expression_to_transformer_list(), c_data_to_prec_for_variables(), declaration_to_transformer(), declaration_to_transformer_list(), dynamic_variables_to_values(), effects_to_arguments(), filter_transformer(), fortran_data_to_prec_for_variables(), fortran_user_call_to_transformer(), generic_apply_effect_to_transformer(), generic_reference_to_transformer(), generic_unary_operation_to_transformer(), integer_assign_to_transformer(), integer_assign_to_transformer_list(), logical_reference_to_transformer(), loop_bound_evaluation_to_transformer(), module_to_value_mappings(), noms_var(), pips_user_value_name(), pointer_unary_operation_to_transformer(), safe_assigned_expression_to_transformer(), safe_assigned_expression_to_transformer_list(), string_expression_to_transformer(), substitute_scalar_stub_in_transformer(), substitute_stubs_in_transformer(), transformer_add_condition_information_updown(), transformer_add_loop_index_incrementation(), transformer_add_loop_index_initialization(), transformer_add_modified_variable_entity(), transformer_add_variable_type_information(), transformer_filter_subsumed_variables(), transformer_general_consistency_p(), transformer_projection_with_redundancy_elimination_and_check(), transformer_variables_filter(), value_mappings_compatible_vector_p(), variable_to_values(), and variables_to_values().

+ Here is the call graph for this function:

◆ entity_to_intermediate_value()

entity entity_to_intermediate_value ( entity  e)

◆ entity_to_new_value()

entity entity_to_new_value ( entity  e)

Definition at line 859 of file value.c.

860 {
861  entity n;
862  if((n = (entity) hash_get(hash_entity_to_new_value, (char *) e))
863  == entity_undefined)
864  pips_internal_error("unbounded entity %s",
865  entity_name(e));
866  return n;
867 }

References entity_name, entity_undefined, hash_entity_to_new_value, hash_get(), and pips_internal_error.

Referenced by add_affine_bound_conditions(), add_loop_index_exit_value(), add_new_alias_value(), add_synonym_values(), affine_to_transformer(), any_assign_operation_to_transformer(), any_scalar_assign_to_transformer_list(), any_scalar_assign_to_transformer_without_effect(), args_to_transformer(), assign_operation_to_transformer(), assigned_expression_to_transformer(), assigned_expression_to_transformer_list(), comp_regions_of_implied_do(), dynamic_variables_to_values(), external_value_name(), filter_transformer(), fortran_user_call_to_transformer(), generic_reference_to_transformer(), logical_reference_to_transformer(), loop_bound_evaluation_to_transformer(), old_value_to_new_value(), remove_entity_values(), string_expression_to_transformer(), substitute_scalar_stub_in_transformer(), substitute_stubs_in_transformer_with_translation_binding(), transformer_add_condition_information_updown(), transformer_add_identity(), transformer_add_loop_index_incrementation(), transformer_add_modified_variable_entity(), transformer_add_value_update(), transformer_add_variable_incrementation(), transformer_add_variable_type_information(), transformer_add_variable_update(), transformer_argument_general_consistency_p(), transformer_arguments_projection(), transformer_convex_hulls(), transformer_derivative_constraints(), transformer_derivative_fix_point(), transformer_domain_intersection(), transformer_internal_consistency_p(), transformer_list_generic_transitive_closure(), transformer_to_domain(), transformer_variables_filter(), update_cp_with_rhs_to_transformer(), value_mappings_compatible_vector_p(), value_passing_summary_transformer(), variable_to_values(), variables_to_new_values(), variables_to_values(), and vect_variables_to_values().

+ Here is the call graph for this function:

◆ entity_to_old_value()

entity entity_to_old_value ( entity  e)

Definition at line 869 of file value.c.

870 {
871  entity o;
872  if((o = (entity) hash_get(hash_entity_to_old_value, (char *) e))
873  == entity_undefined)
874  pips_internal_error("unbounded entity %s",
875  entity_name(e));
876  return o;
877 }

References entity_name, entity_undefined, hash_entity_to_old_value, hash_get(), and pips_internal_error.

Referenced by add_old_alias_value(), add_synonym_values(), add_type_information(), affine_to_transformer(), any_assign_operation_to_transformer(), any_basic_update_operation_to_transformer(), any_scalar_assign_to_transformer_list(), any_scalar_assign_to_transformer_without_effect(), assigned_expression_to_transformer(), assigned_expression_to_transformer_list(), dynamic_variables_to_values(), external_value_name(), fortran_user_call_to_transformer(), new_value_to_old_value(), perform_array_element_substitutions_in_transformer(), precondition_intra_to_inter(), remove_entity_values(), safe_transformer_projection(), statement_to_postcondition(), statement_to_total_precondition(), substitute_scalar_stub_in_transformer(), substitute_stubs_in_transformer_with_translation_binding(), transformer_add_identity(), transformer_add_loop_index_incrementation(), transformer_add_loop_index_initialization(), transformer_add_modified_variable_entity(), transformer_add_value_update(), transformer_add_variable_incrementation(), transformer_add_variable_update(), transformer_arguments_projection(), transformer_combine(), transformer_convex_hulls(), transformer_domain_intersection(), transformer_intersect_range_with_domain(), transformer_list_safe_variables_projection(), transformer_projection_with_redundancy_elimination_and_check(), transformer_range(), transformer_to_domain(), transformer_variables_filter(), update_cp_with_rhs_to_transformer(), value_passing_summary_transformer(), variable_to_values(), variables_to_old_values(), and variables_to_values().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ error_free_value_mappings()

void error_free_value_mappings ( void  )

To be called by an error handler.

free previous hash tables, desallocate names; this implies ALL value names were malloced and were not pointer to a ri part

the three tables are assumed to be allocated all together

free names in hash_value_to_name; the other two hash tables contain pointers to the entity tabulated domain and thus need no value freeing

k is discovered unused by lint; it is syntaxically necessary

free the three tables themselves

Definition at line 1222 of file value.c.

1223 {
1224  /* free previous hash tables, desallocate names; this implies ALL
1225  value names were malloced and were not pointer to a ri part */
1226 
1227  /* the three tables are assumed to be allocated all together */
1228 
1229  /* free names in hash_value_to_name; the other two hash tables
1230  contain pointers to the entity tabulated domain and thus need
1231  no value freeing */
1232  /* k is discovered unused by lint; it is syntaxically necessary */
1233  HASH_MAP(k, v, {free(v);}, hash_value_to_name);
1234  // Do not deallocate the names: they are pointers towards parts of
1235  // entity names
1236  //HASH_MAP(k, v, {free(v);}, hash_entity_to_user_value_name);
1237  /* free the three tables themselves */
1245 
1249 }
void hash_table_free(hash_table htp)
this function deletes a hash table that is no longer useful.
Definition: hash.c:327
#define HASH_MAP(k, v, code, ht)
Definition: newgen_hash.h:60
void reset_temporary_value_counter()
Definition: value.c:250
static void reset_value_mappings(void)
Definition: value.c:1188
void reset_analyzed_types()
Definition: value.c:289

References free(), hash_entity_to_intermediate_value, hash_entity_to_new_value, hash_entity_to_old_value, hash_entity_to_user_value_name, HASH_MAP, hash_reference_to_address_of_value, hash_table_free(), hash_type_to_sizeof_value, hash_value_to_name, reset_analyzed_types(), reset_temporary_value_counter(), and reset_value_mappings().

Referenced by free_value_mappings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ error_reset_value_mappings()

void error_reset_value_mappings ( void  )

To be called by error handler only.

Potential memory leak.

Definition at line 1205 of file value.c.

1206 {
1208 }

References reset_value_mappings().

Referenced by free_value_mappings(), and module_to_value_mappings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ external_entity_to_new_value()

entity external_entity_to_new_value ( entity  e)

there is no decisive test here; a necessary condition is used instead

Definition at line 1411 of file value.c.

1412 {
1413  /* there is no decisive test here; a necessary condition is used instead */
1414 
1415  entity e_new;
1416 
1417  pips_assert("e must be a type analyzable scalar variable", analyzable_scalar_entity_p(e));
1418  e_new = e;
1419  return e_new;
1420 }
bool analyzable_scalar_entity_p(entity e)
The entity type is one of the analyzed types.
Definition: value.c:471

References analyzable_scalar_entity_p(), and pips_assert.

Referenced by add_formal_to_actual_bindings(), formal_and_actual_parameters_association(), fortran_user_call_to_transformer(), generic_reference_to_transformer(), logical_reference_to_transformer(), and substitute_stubs_in_transformer_with_translation_binding().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ external_entity_to_old_value()

entity external_entity_to_old_value ( entity  e)

find the old value entity if possible or abort I should never have to call this function on an local entity (local entities include static local variables)

Definition at line 1422 of file value.c.

1423 {
1424  /* find the old value entity if possible or abort
1425  I should never have to call this function on an local entity
1426  (local entities include static local variables) */
1427 
1428  entity old_value;
1429  string old_value_name;
1430 
1431  old_value_name = concatenate(entity_name(e),OLD_VALUE_SUFFIX,
1432  (char *) NULL);
1433  old_value = gen_find_tabulated(old_value_name, entity_domain);
1434 
1435  pips_assert("external_entity_to_old_value", old_value!=entity_undefined);
1436 
1437  return old_value;
1438 }

References concatenate(), entity_domain, entity_name, entity_undefined, gen_find_tabulated(), OLD_VALUE_SUFFIX, and pips_assert.

Referenced by fortran_user_call_to_transformer(), perform_array_element_substitutions_in_transformer(), and substitute_stubs_in_transformer_with_translation_binding().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ external_value_name()

const char* external_value_name ( entity  e)

This should never occur. Please core dump!

Definition at line 753 of file value.c.

754 {
755  const char* s = string_undefined;
756  if(entity_constant_p(e)) {
757  // Used for floating point and string constants? Why entity name?
758  s = entity_local_name(e);
759  }
760  else if(entity_symbolic_p(e)) {
761  // Used for locations, i.e. constant memory access paths
762  s = entity_local_name(e);
763  }
764  else if(null_pointer_value_entity_p(e)) {
765  s = entity_name(e);
766  }
767  else {
768  // it must be one of the values attached to a user variable
770  s = hash_get(hash_value_to_name, (char *) e);
771  // type t = entity_type(e);
772 
774  //&& type_variable_p(t)
775  && !variable_in_module_p(e,m)) {
776  if(global_new_value_p(e)) {
778  s = hash_get(hash_value_to_name, (char *) a);
779  }
780  else if(global_old_value_p(e)) {
782  s = hash_get(hash_value_to_name, (char *) a);
783  }
784  else if(global_intermediate_value_p(e)) {
786  s = hash_get(hash_value_to_name, (char *) a);
787  }
788  else {
789  /* This should never occur. Please core dump! */
790  pips_internal_error("\nUnexpected value \"%s\""
791  " for current module \"%s\"",
792  entity_name(e),
794  }
795  }
796 
797  pips_assert("A value name must be defined",
798  s != HASH_UNDEFINED_VALUE);
799 
800  if(strcmp(module_local_name(m), module_name(s)) == 0
801  ||strcmp(TOP_LEVEL_MODULE_NAME, module_name(s)) == 0) {
802  //s = local_name(s);
804  }
805  }
806 
807  return s;
808 }
bool null_pointer_value_entity_p(entity)
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
#define string_undefined
Definition: newgen_types.h:40
bool global_intermediate_value_p(entity e)
Definition: value.c:703
bool global_old_value_p(entity e)
Return true if an entity is a global old value (such as "i#init"...).
Definition: value.c:690
const char * global_value_name_to_user_name(const char *gn)
HASH TABLE USE.
Definition: value.c:741
bool global_new_value_p(entity e)
GLOBAL VALUES.
Definition: value.c:667
#define entity_symbolic_p(e)
const char * module_local_name(entity e)
Returns the module local user name.
Definition: entity.c:582
bool variable_in_module_p(entity, entity)
This test can only be applied to variables, not to functions, subroutines or commons visible from a m...
Definition: variable.c:1610

References entity_constant_p, entity_local_name(), entity_name, entity_symbolic_p, entity_to_intermediate_value(), entity_to_new_value(), entity_to_old_value(), get_current_module_entity(), global_intermediate_value_p(), global_new_value_p(), global_old_value_p(), global_value_name_to_user_name(), hash_get(), HASH_UNDEFINED_VALUE, hash_value_to_name, module_local_name(), module_name(), null_pointer_value_entity_p(), pips_assert, pips_internal_error, string_undefined, TOP_LEVEL_MODULE_NAME, and variable_in_module_p().

Referenced by __attribute__(), add_loop_skip_condition(), build_transfer_equations(), complete_loop_transformer(), complete_loop_transformer_list(), intermediate_value_entity_p(), invariant_vector_p(), loop_to_transformer(), noms_var(), old_complete_whileloop_transformer(), pips_user_value_name(), print_transformer(), print_transformers(), print_value_mappings(), readable_value_name(), recompute_loop_transformer(), remove_entity_values(), standard_whileloop_to_transformer(), transformer_derivative_constraints(), transformer_derivative_fix_point(), transformer_equality_fix_point(), transformer_list_generic_transitive_closure(), transformer_normalize(), and transformer_pattern_fix_point().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ float_analyzed_p()

bool float_analyzed_p ( void  )

Definition at line 315 of file value.c.

316 {
318 }

References analyze_float_scalar_entities.

Referenced by any_expression_to_transformer(), fortran_data_to_prec_for_variables(), parametric_transformer_empty_p(), and transformer_normalize().

+ Here is the caller graph for this function:

◆ free_value_mappings()

void free_value_mappings ( void  )

Normal call to free the mappings.

Definition at line 1212 of file value.c.

1213 {
1215  pips_assert("no free of undefined mappings",
1218 }
void reset_hooks_unregister(reset_func_t)
remove registered cleanup hook.
Definition: reset_hooks.c:73
void error_free_value_mappings(void)
To be called by an error handler.
Definition: value.c:1222
void error_reset_value_mappings(void)
To be called by error handler only.
Definition: value.c:1205

References error_free_value_mappings(), error_reset_value_mappings(), hash_entity_to_old_value, hash_table_undefined_p, pips_assert, and reset_hooks_unregister().

Referenced by add_alias_pairs_for_this_caller(), alias_classes(), alias_lists(), alias_pairs(), aliases_text(), any_complexities(), array_expansion(), bdsc_code_instrumentation(), call_site_to_module_precondition_text(), continuation_conditions(), dsc_code_parallelization(), generic_module_name_to_transformers(), generic_print_xml_application(), get_continuation_condition_text(), get_semantic_text(), hbdsc_parallelization(), initial_precondition(), isolate_statement(), kernel_data_mapping(), kernel_load_store_engine(), module_name_to_preconditions(), module_name_to_total_preconditions(), out_regions_from_caller_to_callee(), partial_eval(), phrase_comEngine_distributor(), phrase_distributor(), phrase_distributor_control_code(), pragma_outliner(), print_initial_precondition(), print_program_precondition(), program_precondition(), reset_convex_in_out_regions(), reset_convex_rw_regions(), reset_convex_summary_in_out_regions(), reset_convex_summary_rw_regions(), safescale_distributor(), safescale_module_analysis(), sequence_dependence_graph(), solve_hardware_constraints(), spire_distributed_unstructured_to_structured(), summary_precondition(), summary_total_postcondition(), and update_precondition_with_call_site_preconditions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ global_intermediate_value_p()

bool global_intermediate_value_p ( entity  e)

this is not a general test; it will only work for GLOBAL values

Definition at line 703 of file value.c.

704 {
705  /* this is not a general test; it will only work for GLOBAL values */
706  string suf = strchr(entity_local_name(e), SEMANTICS_SEPARATOR);
707  bool intermediate = false;
708 
709  if(suf!=NULL)
710  intermediate = strcmp(entity_module_name(e), SEMANTICS_MODULE_NAME) != 0 &&
711  strcmp(suf, INTERMEDIATE_VALUE_SUFFIX) == 0;
712 
713  return intermediate;
714 }
const char * entity_module_name(entity e)
See comments about module_name().
Definition: entity.c:1092
#define SEMANTICS_SEPARATOR
Must be used in suffixes and prefixes below.
#define SEMANTICS_MODULE_NAME
include file for transformer library

References entity_local_name(), entity_module_name(), INTERMEDIATE_VALUE_SUFFIX, SEMANTICS_MODULE_NAME, and SEMANTICS_SEPARATOR.

Referenced by external_value_name().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ global_new_value_p()

bool global_new_value_p ( entity  e)

GLOBAL VALUES.

this is not a general test; it will only work for GLOBAL values

this function should always return false because new value = variable (FI)

=> suf == NULL string suf = strchr(entity_local_name(e), SEMANTICS_SEPARATOR);

pips_assert("global_new_value", suf != NULL);

new = strcmp(entity_module_name(e), SEMANTICS_MODULE_NAME) != 0 && strcmp(suf, NEW_VALUE_SUFFIX) == 0;

Definition at line 667 of file value.c.

668 {
669  bool new = false;
670  /* this is not a general test; it will only work for GLOBAL values */
671 
672  /* this function should always return false because new value = variable (FI) */
673 
674  /* => suf == NULL
675  string suf = strchr(entity_local_name(e), SEMANTICS_SEPARATOR);
676 
677  pips_assert("global_new_value", suf != NULL);
678 
679  new = strcmp(entity_module_name(e), SEMANTICS_MODULE_NAME) != 0 &&
680  strcmp(suf, NEW_VALUE_SUFFIX) == 0;
681  */
682 
683  pips_assert("global_new_value", new == false && e==e);
684 
685  return new;
686 }

References pips_assert.

Referenced by external_value_name().

+ Here is the caller graph for this function:

◆ global_new_value_to_global_old_value()

entity global_new_value_to_global_old_value ( entity  v_new)

There is no real test for global new values

Parameters
v_new_new

Definition at line 716 of file value.c.

717 {
718  entity v_old = entity_undefined;
719 
720  /* There is no real test for global new values */
721 
722  pips_assert("new value must be a real variable entity, denoting the new value",
723  strcmp(entity_module_name(v_new), SEMANTICS_MODULE_NAME) != 0);
724 
725  string v_old_name = concatenate(entity_name(v_new), OLD_VALUE_SUFFIX, NULL);
726  v_old = (entity) gen_find_tabulated(v_old_name, entity_domain);
727  if(v_old==NULL) v_old = entity_undefined;
728 
729  return v_old;
730 }
struct _newgen_struct_entity_ * entity
Definition: abc_private.h:14

References concatenate(), entity_domain, entity_module_name(), entity_name, entity_undefined, gen_find_tabulated(), OLD_VALUE_SUFFIX, pips_assert, and SEMANTICS_MODULE_NAME.

Referenced by c_user_function_call_to_transformer(), fortran_user_function_call_to_transformer(), substitute_scalar_stub_in_transformer(), transformer_projection_with_redundancy_elimination_and_check(), and translate_global_value().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ global_old_value_p()

bool global_old_value_p ( entity  e)

Return true if an entity is a global old value (such as "i#init"...).

this is not a general test; it will only work for GLOBAL values

Definition at line 690 of file value.c.

691 {
692  /* this is not a general test; it will only work for GLOBAL values */
693  string suf = strchr(entity_local_name(e), SEMANTICS_SEPARATOR);
694  bool old = false;
695 
696  if(suf!=NULL)
697  old = strcmp(entity_module_name(e), SEMANTICS_MODULE_NAME) != 0 &&
698  strcmp(suf, OLD_VALUE_SUFFIX) == 0;
699 
700  return old;
701 }

References entity_local_name(), entity_module_name(), OLD_VALUE_SUFFIX, SEMANTICS_MODULE_NAME, and SEMANTICS_SEPARATOR.

Referenced by external_value_name(), and translate_global_value().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ global_value_name_to_user_name()

const char* global_value_name_to_user_name ( const char *  gn)

HASH TABLE USE.

Return a variable value name or map a variable to its different variable values. the '#' character used in value naming conflicts with the reserved character for struct naming

Parameters
gnn

Definition at line 741 of file value.c.

742 {
743  const char* un = strrchr(gn, BLOCK_SEP_CHAR);
744 
745  if(un==NULL)
746  un = local_name(gn);
747  else
748  un++;
749 
750  return un;
751 }
const char * local_name(const char *s)
Does not take care of block scopes and returns a pointer.
Definition: entity_names.c:221
#define BLOCK_SEP_CHAR
Definition: naming-local.h:51

References BLOCK_SEP_CHAR, and local_name().

Referenced by external_value_name().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hash_entity_to_values_undefined_p()

bool hash_entity_to_values_undefined_p ( void  )

value.c

Definition at line 229 of file value.c.

230 {
232 }

References hash_entity_to_new_value, and hash_table_undefined_p.

◆ hash_value_to_name_undefined_p()

bool hash_value_to_name_undefined_p ( void  )

Definition at line 1199 of file value.c.

1200 {
1202 }

References hash_table_undefined_p, and hash_value_to_name.

Referenced by generic_value_name().

+ Here is the caller graph for this function:

◆ integer_analyzed_p()

bool integer_analyzed_p ( void  )

Definition at line 300 of file value.c.

301 {
303 }

References analyze_integer_scalar_entities.

Referenced by any_expression_to_transformer().

+ Here is the caller graph for this function:

◆ intermediate_value_entity_p()

bool intermediate_value_entity_p ( entity  e)

Definition at line 955 of file value.c.

956 {
957  string s = strstr(external_value_name(e), INTERMEDIATE_VALUE_SUFFIX);
958 
959  return s!=NULL;
960 }
const char * external_value_name(entity e)
Definition: value.c:753

References external_value_name(), and INTERMEDIATE_VALUE_SUFFIX.

Referenced by transformer_internal_consistency_p(), and value_to_variable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ local_intermediate_value_entity_p()

bool local_intermediate_value_entity_p ( entity  e)

this is not a general test; it will only work for LOCAL values

Definition at line 648 of file value.c.

649 {
650  /* this is not a general test; it will only work for LOCAL values */
651  return strncmp(entity_local_name(e), INTERMEDIATE_VALUE_PREFIX, 2) == 0;
652 }
#define INTERMEDIATE_VALUE_PREFIX

References entity_local_name(), and INTERMEDIATE_VALUE_PREFIX.

+ Here is the call graph for this function:

◆ local_old_value_entity_p()

bool local_old_value_entity_p ( entity  e)

Return true if an entity is a local old value (such as "o#0" for a global value "i#init"...).

This is not a general test; it will only work for LOCAL values

Definition at line 642 of file value.c.

643 {
644  /* This is not a general test; it will only work for LOCAL values */
645  return strncmp(entity_local_name(e), OLD_VALUE_PREFIX, 2) == 0;
646 }
#define OLD_VALUE_PREFIX
internal entity names (FI: I should have used suffixes to be consistent with external suffixes

References entity_local_name(), and OLD_VALUE_PREFIX.

Referenced by add_type_information(), and regions_transformer_apply().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ local_temporary_value_entity_p()

bool local_temporary_value_entity_p ( entity  e)

this is not a general test; it will only work for LOCAL values

Definition at line 654 of file value.c.

655 {
656  /* this is not a general test; it will only work for LOCAL values */
657  return strncmp(entity_local_name(e), TEMPORARY_VALUE_PREFIX, 2) == 0;
658 }
#define TEMPORARY_VALUE_PREFIX

References entity_local_name(), and TEMPORARY_VALUE_PREFIX.

Referenced by generic_transformer_to_analyzed_locations(), generic_value_name(), non_local_temporary_value_entity_p(), old_value_entity_p(), readable_value_name(), transformer_add_sign_information(), transformer_projection_with_redundancy_elimination_and_check(), transformer_temporary_value_projection(), transformer_to_potential_stub_translation(), transformer_with_temporary_values_p(), and value_mappings_compatible_vector_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ make_local_intermediate_value_entity()

static entity make_local_intermediate_value_entity ( type  t)
static

Definition at line 600 of file value.c.

601 {
603 }
static entity make_local_value_entity(int n, int nature, type t)
LOCAL VALUE ENTITY.
Definition: value.c:547
static int local_intermediate_value_counter
Two counters used to assign meaningless value entities to local variables.
Definition: value.c:240

References local_intermediate_value_counter, and make_local_value_entity().

Referenced by add_intermediate_value(), and add_local_intermediate_value().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ make_local_old_value_entity()

static entity make_local_old_value_entity ( type  t)
static

Definition at line 595 of file value.c.

596 {
598 }
static int local_old_value_counter
Definition: value.c:241

References local_old_value_counter, and make_local_value_entity().

Referenced by add_local_old_value().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ make_local_temporary_integer_value_entity()

entity make_local_temporary_integer_value_entity ( void  )

Definition at line 629 of file value.c.

630 {
631  basic b = make_basic(is_basic_int, (void *) 4);
634 
635  free_type(t);
636  return tmp;
637 }
basic make_basic(enum basic_utype tag, void *val)
Definition: ri.c:155
variable make_variable(basic a1, list a2, list a3)
Definition: ri.c:2895
void free_type(type p)
Definition: ri.c:2658
type make_type(enum type_utype tag, void *val)
Definition: ri.c:2706
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
static int local_temporary_value_counter
Definition: value.c:242
@ is_basic_int
Definition: ri.h:571
@ is_type_variable
Definition: ri.h:2900

References free_type(), is_basic_int, is_type_variable, local_temporary_value_counter, make_basic(), make_local_value_entity(), make_type(), make_variable(), and NIL.

Referenced by add_type_information(), bitwise_xor_to_transformer(), logical_not_to_transformer(), modulo_to_transformer(), transformer_add_condition_information_updown(), transformer_derivative_fix_point(), and transformer_list_generic_transitive_closure().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ make_local_temporary_value_entity()

entity make_local_temporary_value_entity ( type  t)

FI: is it easier to admit value of type void than to make a special case? Let see if it works... No, it's not a good idea because value are assumed of type variable in many places.

Definition at line 605 of file value.c.

606 {
608 
609  /* FI: is it easier to admit value of type void than to make a
610  special case? Let see if it works... No, it's not a good idea
611  because value are assumed of type variable in many places. */
612  if(analyzed_type_p(t))
614  else
615  pips_internal_error("Request for a temporary value with a non analyzed type.\n");
616 
617  return tv;
618 }

References analyzed_type_p(), entity_undefined, local_temporary_value_counter, make_local_value_entity(), and pips_internal_error.

Referenced by add_formal_to_actual_bindings(), add_index_bound_conditions(), add_type_information(), addition_operation_to_transformer(), any_assign_operation_to_transformer(), any_scalar_assign_to_transformer_list(), any_scalar_assign_to_transformer_without_effect(), assigned_expression_to_transformer(), assigned_expression_to_transformer_list(), call_to_transformer(), expression_multiply_sizeof_to_transformer(), expression_to_transformer(), generic_abs_to_transformer(), generic_minmax_to_transformer(), iabs_to_transformer(), integer_binary_operation_to_transformer(), integer_expression_and_precondition_to_integer_interval(), integer_left_shift_to_transformer(), integer_minmax_to_transformer(), integer_multiply_to_transformer(), logical_binary_operation_to_transformer(), logical_unary_operation_to_transformer(), loop_bound_evaluation_to_transformer(), loop_to_enter_transformer(), unary_minus_operation_to_transformer(), update_cp_with_rhs_to_transformer(), update_operation_to_transformer(), and value_passing_summary_transformer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ make_local_temporary_value_entity_with_basic()

entity make_local_temporary_value_entity_with_basic ( basic  b)

Definition at line 620 of file value.c.

621 {
624 
625  free_type(t);
626  return tmp;
627 }
basic copy_basic(basic p)
BASIC.
Definition: ri.c:104

References copy_basic(), free_type(), is_type_variable, local_temporary_value_counter, make_local_value_entity(), make_type(), make_variable(), and NIL.

Referenced by condition_to_transformer(), precondition_minmax_of_expression(), and transformer_add_any_relation_information().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ make_local_value_entity()

static entity make_local_value_entity ( int  n,
int  nature,
type  t 
)
static

LOCAL VALUE ENTITY.

static entity make_local_value_entity(int n, bool old): find or generate an entity representing an old or an intermediate value of number n

13 is a magic number that can accommodate 2 prefix characters, 10 digits and a null character

find entity or define it

Another option might be to undefine types when counters are reset?

It is likely to take longer to compare types than to free one and allocate one...

Well, type_equal_p() replaces typedefs types by the underlying type which leads to disasters; see suppress_dead_code04.c

The previous test always returns true for strings

Definition at line 547 of file value.c.

548 {
549  entity v;
550  /* 13 is a magic number that can accommodate 2 prefix characters,
551  10 digits and a null character */
552  char value_name[13];
553  char * s;
554 
555  if(nature==0)
556  (void) strcpy(value_name, OLD_VALUE_PREFIX);
557  else if(nature==1)
558  (void) strcpy(value_name, INTERMEDIATE_VALUE_PREFIX);
559  else
560  (void) strcpy(value_name, TEMPORARY_VALUE_PREFIX);
561  (void) sprintf(value_name+2,"%d",n);
562  pips_debug(8,"value name: %s\n",value_name);
564  MODULE_SEP_STRING, value_name, (char *) NULL));
565 
566  /* find entity or define it */
568  if(v==entity_undefined)
569  v = make_entity(s,
570  copy_type(t),
573  else {
574  free(s);
575  /* Another option might be to undefine types when counters are
576  reset? */
577  /* It is likely to take longer to compare types than to free one and
578  allocate one... */
579  /* Well, type_equal_p() replaces typedefs types by the underlying
580  type which leads to disasters; see suppress_dead_code04.c */
581  if(true || type_equal_p(entity_type(v), t)) {
583  entity_type(v) = copy_type(t);
584  }
586  /* The previous test always returns true for strings */
588  entity_type(v) = copy_type(t);
589  }
590  }
591 
592  return v;
593 }
bool type_equal_p(type, type)
Definition: type.c:547

References basic_string_p, concatenate(), copy_type(), entity_domain, entity_type, entity_undefined, free(), free_type(), gen_find_tabulated(), INTERMEDIATE_VALUE_PREFIX, is_storage_rom, make_entity, make_storage(), MODULE_SEP_STRING, OLD_VALUE_PREFIX, pips_debug, SEMANTICS_MODULE_NAME, strdup(), TEMPORARY_VALUE_PREFIX, type_equal_p(), type_variable, UU, value_undefined, and variable_basic.

Referenced by make_local_intermediate_value_entity(), make_local_old_value_entity(), make_local_temporary_integer_value_entity(), make_local_temporary_value_entity(), and make_local_temporary_value_entity_with_basic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mapping_to_domain_list()

static list mapping_to_domain_list ( hash_table  h)
static

Returns the list of entities in the mapping domain.

Could be more efficient to return a set.

Note: this is a copy of mapping_to_value_number()

Definition at line 1048 of file value.c.

1049 {
1050  size_t count = 0;
1051  list values = NIL;
1052 
1053  HASH_MAP(var, val, {
1054  if(!gen_in_list_p((entity) val, values)) {
1055  values = CONS(ENTITY,(entity) var, values);
1056  count++;
1057  }
1058  }, h);
1059 
1060  pips_assert("The number of insertions is equal to the list length",
1061  count == gen_length(values));
1062 
1063  return values;
1064 }
static int count
Definition: SDG.c:519
size_t gen_length(const list l)
Definition: list.c:150
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
bool gen_in_list_p(const void *vo, const list lx)
tell whether vo belongs to lx
Definition: list.c:734

References CONS, count, ENTITY, gen_in_list_p(), gen_length(), HASH_MAP, NIL, and pips_assert.

Referenced by modified_variables_with_values().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mapping_to_value_number()

static int mapping_to_value_number ( hash_table  h)
static

Definition at line 1024 of file value.c.

1025 {
1026  size_t count = 0;
1027  list values = NIL;
1028 
1029  HASH_MAP(var, val, {
1030  if(!gen_in_list_p((entity) val, values)) {
1031  values = CONS(ENTITY,(entity) val, values);
1032  count++;
1033  }
1034  }, h);
1035 
1036  pips_assert("The number of insertions is equal to the list length",
1037  count == gen_length(values));
1038  gen_free_list(values);
1039  return count;
1040 }
void gen_free_list(list l)
free the spine of the list
Definition: list.c:327

References CONS, count, ENTITY, gen_free_list(), gen_in_list_p(), gen_length(), HASH_MAP, NIL, and pips_assert.

Referenced by test_mapping_entry_consistency().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ modified_variables_with_values()

list modified_variables_with_values ( void  )

Return the list of all analyzed variables which are modified in the current module.

If they are modified, they must have old values.

The intermediate values could be used as well

Definition at line 1094 of file value.c.

1095 {
1096  /* The intermediate values could be used as well */
1097  /*
1098  list ivl = mapping_to_domain_list(hash_entity_to_old_value); // initial
1099  // value list
1100  list wvl = NIL; // written variable list
1101 
1102  FOREACH(ENTITY, e, ivl) {
1103  entity wv = new_value_to_variable(e);
1104  ivl = CONS(ENTITY, wv, ivl);
1105  }
1106 
1107  gen_reverse(wvl);
1108  */
1110  return wvl;
1111 }
static list mapping_to_domain_list(hash_table h)
Returns the list of entities in the mapping domain.
Definition: value.c:1048

References hash_entity_to_old_value, and mapping_to_domain_list().

Referenced by apply_abstract_effect_to_transformer(), generic_reference_to_transformer(), and transformer_combine().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ new_value_entity_p()

bool new_value_entity_p ( entity  e)

the following three functions are directly or indirectly relative to the current module and its value hash tables.

since new values are always variable entities, hash_entity_to_new_value can be used for this test

Definition at line 925 of file value.c.

926 {
927  /* since new values are always variable entities, hash_entity_to_new_value
928  can be used for this test */
929 
930  pips_assert("new_value_entity_p",e != entity_undefined);
931 
932  return (entity) hash_get(hash_entity_to_new_value, (char *) e)
933  == e;
934 }

References entity_undefined, hash_entity_to_new_value, hash_get(), and pips_assert.

Referenced by build_transfer_matrix(), equations_to_bases(), invariant_vector_p(), look_for_the_best_counter(), new_value_in_transfer_equation(), transfer_equation_p(), transformer_internal_consistency_p(), and value_to_variable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ new_value_to_old_value()

entity new_value_to_old_value ( entity  n_val)

FI: correct code entity var = entity_undefined;

var = value_to_variable(n_val); o_val = entity_to_old_value(var);

FI: faster code

Parameters
n_val_val

Definition at line 1710 of file value.c.

1711 {
1712  entity o_val = entity_undefined;
1713 
1714  /* FI: correct code
1715  entity var = entity_undefined;
1716 
1717  var = value_to_variable(n_val);
1718  o_val = entity_to_old_value(var);
1719  */
1720 
1721  /* FI: faster code */
1722  o_val = entity_to_old_value(n_val);
1723 
1724  return o_val;
1725 }

References entity_to_old_value(), and entity_undefined.

Referenced by transformer_equality_fix_point(), and upwards_vect_rename().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ non_local_temporary_value_entity_p()

static bool non_local_temporary_value_entity_p ( entity  e)
static

Definition at line 660 of file value.c.

661 {
663 }
bool local_temporary_value_entity_p(entity e)
Definition: value.c:654

References local_temporary_value_entity_p().

Referenced by vect_variables_to_values().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ number_of_analyzed_values()

int number_of_analyzed_values ( void  )

Definition at line 1148 of file value.c.

1149 {
1151 }

References hash_table_entry_count(), and hash_value_to_name.

Referenced by module_to_value_mappings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ number_of_analyzed_variables()

int number_of_analyzed_variables ( void  )

FI: looks more like the number of values used.

Definition at line 1160 of file value.c.

1161 {
1163 }

References hash_table_entry_count(), and hash_value_to_name.

+ Here is the call graph for this function:

◆ number_of_temporary_values()

int number_of_temporary_values ( void  )

Definition at line 255 of file value.c.

256 {
258 }

References local_temporary_value_counter.

Referenced by transformer_temporary_value_projection(), and transformer_with_temporary_values_p().

+ Here is the caller graph for this function:

◆ old_value_entity_p()

bool old_value_entity_p ( entity  e)

Temporary values do not have an external name.

OLD_VALUE_PREFIX is not used for global old values

string s = strstr(external_value_name(e), OLD_VALUE_SUFFIX);

string s = strstr(entity_local_name(e), OLD_VALUE_PREFIX);

Definition at line 936 of file value.c.

937 {
938  /* Temporary values do not have an external name. */
939  /* OLD_VALUE_PREFIX is not used for global old values */
940  /* string s = strstr(external_value_name(e), OLD_VALUE_SUFFIX); */
941  /* string s = strstr(entity_local_name(e), OLD_VALUE_PREFIX); */
942 
944  string s1 = strstr(entity_local_name(e), OLD_VALUE_SUFFIX);
945  // Need to remake the search for OLD_VALUE_PREFIX
946  // bug for toto#...
947  string s2 = strstr(entity_local_name(e), OLD_VALUE_PREFIX);
948  // s2==entity_local_name(e) : for the case toto#...
949  return s1!=NULL || (s2!=NULL && s2==entity_local_name(e));
950  }
951  else
952  return false;
953 }
s1
Definition: set.c:247

References entity_local_name(), local_temporary_value_entity_p(), OLD_VALUE_PREFIX, OLD_VALUE_SUFFIX, and s1.

Referenced by expression_less_than_in_context(), invariant_vector_p(), look_for_the_best_counter(), my_system_remove_variables(), precondition_filter_old_values(), print_call_precondition(), remove_temporal_variables_from_system(), transformer_derivative_constraints(), transformer_derivative_fix_point(), transformer_general_consistency_p(), transformer_internal_consistency_p(), transformer_list_generic_transitive_closure(), and value_to_variable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ old_value_to_new_value()

entity old_value_to_new_value ( entity  o_val)

o_val = variable_to_old_value(var);

Parameters
o_val_val

Definition at line 1698 of file value.c.

1699 {
1700  entity var = entity_undefined;
1701  entity n_val = entity_undefined;
1702 
1703  var = value_to_variable(o_val);
1704  /* o_val = variable_to_old_value(var); */
1705  n_val = entity_to_new_value(var);
1706 
1707  return n_val;
1708 }

References entity_to_new_value(), entity_undefined, and value_to_variable().

Referenced by build_transfer_matrix(), and equations_to_bases().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pips_user_value_name()

const char* pips_user_value_name ( entity  e)

This function is called many times when the constraints and the system of constraints are sorted using lexicographic information based on this particular value name.

See for instance Semantics-New/freia_52.c. Hence it is memorized.

Definition at line 815 of file value.c.

816 {
817  pips_debug(9, "start with entity : %s\n", entity_name(e));
818  const char* uvn = string_undefined;
819 
820  if(e == (entity) TCST) {
821  uvn = "";
822  }
823  else {
824  // To check the execution speed, uncomment the next line
825  // return entity_name(e);
826  uvn = hash_get(hash_entity_to_user_value_name, (char *) e);
827 
828  if(uvn==HASH_UNDEFINED_VALUE) {
829  // Need to discriminate the case of an address_of value
830  // because the hash table are reset between each pass
831  if (address_of_value_entity_p(e)) {
832  entity v = value_to_variable(e);
833  string temp = strdup(entity_name(e));
834  string indice = strstr(temp, "[");
835  if (indice != NULL)
836  *(indice+strlen(indice)-strlen(ADDRESS_OF_SUFFIX)) = '\0';
837  uvn = strdup(concatenate("&", entity_user_name(v), indice, (char *) NULL));
838  free(temp);
839  }
840  else if (null_pointer_value_entity_p(e)) {
841  uvn = strdup("NULL");
842  }
843  else if (sizeof_value_entity_p(e)) {
844  type t = entity_type(e);
845  uvn = strdup(concatenate("sizeof(", type_to_full_string_definition(t), ")", (char *) NULL));
846  }
847  else {
848  (void) gen_check((gen_chunk *) e, entity_domain);
851  }
852  hash_put(hash_entity_to_user_value_name, (char *) e, uvn);
853  }
854  }
855  pips_debug(9, "end with string : %s\n", uvn);
856  return uvn;
857 }
gen_chunk * gen_check(gen_chunk *obj, int t)
GEN_CHECK checks that the gen_chunk received OBJ is of the appropriate TYPE.
Definition: genClib.c:2356
const char * entity_minimal_name(entity e)
Do preserve scope informations.
Definition: naming.c:214
char * string
STRING.
Definition: newgen_types.h:39
bool entity_has_values_p(entity e)
This function could be made more robust by checking the storage of e.
Definition: value.c:911
bool address_of_value_entity_p(entity e)
Definition: value.c:962
bool sizeof_value_entity_p(entity e)
Definition: value.c:969
A gen_chunk is used to store every object.
Definition: genC.h:58
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.

References ADDRESS_OF_SUFFIX, address_of_value_entity_p(), concatenate(), entity_domain, entity_has_values_p(), entity_minimal_name(), entity_name, entity_type, entity_user_name(), external_value_name(), free(), gen_check(), hash_entity_to_user_value_name, hash_get(), hash_put(), HASH_UNDEFINED_VALUE, null_pointer_value_entity_p(), pips_debug, sizeof_value_entity_p(), strdup(), string_undefined, TCST, type_to_full_string_definition(), and value_to_variable().

Referenced by generic_value_name(), is_inferior_pvarval(), semantics_is_inferior_pvarval(), text_continuation(), and text_transformer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pointer_analyzed_p()

bool pointer_analyzed_p ( void  )

Definition at line 325 of file value.c.

326 {
328 }

References analyze_pointer_scalar_entities.

Referenced by any_expression_to_transformer().

+ Here is the caller graph for this function:

◆ print_value_mappings()

void print_value_mappings ( void  )

Definition at line 993 of file value.c.

994 {
995  (void) fprintf(stderr,"\nhash table value to name:\n");
998 
999  (void) fprintf(stderr,"\nhash table entity to new value:\n");
1000  /*
1001  hash_table_fprintf(stderr, entity_local_name, external_value_name,
1002  hash_entity_to_new_value);
1003  */
1006 
1007  (void) fprintf(stderr,"\nhash table entity to old value:\n");
1010 
1011  (void) fprintf(stderr, "\nhash table entity to intermediate value:\n");
1014 
1015  (void) fprintf(stderr, "\nhash table reference to address_of value:\n");
1018 
1019  (void) fprintf(stderr, "\nhash table entity to sizeof value:\n");
1022 }
void hash_table_fprintf(FILE *f, gen_string_func_t key_to_string, gen_string_func_t value_to_string, const hash_table htp)
This function prints the content of the hash_table pointed to by htp on file descriptor f,...
Definition: hash.c:548
string(* gen_string_func_t)(const void *)
Definition: newgen_types.h:111
char * dump_value_name(entity e)
char * dump_value_name(e): used as functional argument because entity_name is a macro
Definition: io.c:128
static string string_identity(string s)
used with hash_table_fprintf
Definition: value.c:990
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...

References dump_value_name(), entity_minimal_name(), external_value_name(), fprintf(), hash_entity_to_intermediate_value, hash_entity_to_new_value, hash_entity_to_old_value, hash_reference_to_address_of_value, hash_table_fprintf(), hash_type_to_sizeof_value, hash_value_to_name, reference_to_string(), string_identity(), and type_to_full_string_definition().

Referenced by module_to_value_mappings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readable_value_name()

const char* readable_value_name ( entity  v)

For debugging purposes, we might have to print system with temporary values.

Definition at line 1769 of file value.c.

1770 {
1771  const char* n ;
1772 
1774  n = entity_local_name(v);
1775  }
1776  else {
1777  n = external_value_name(v);
1778  }
1779 
1780  return n;
1781 }

References entity_local_name(), external_value_name(), and local_temporary_value_entity_p().

Referenced by generic_module_name_to_transformers(), module_name_to_preconditions(), and module_name_to_total_preconditions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reference_to_address_entity()

entity reference_to_address_entity ( reference  r)

The address is the address of a variable or of a reference such as &a[5], not a of a value.

The reference must be a constant memory access path. It does not have to be atomic, as struct are not considered atomic, following Pierre Jouvelot's view point since partial updates are possible.

An address is a constant within a C user function.

As a constant, it must be encoded as a 0-ary function, just like 1.0 or true.

We use the user representation as entity name, namey &a[5].

We do not use array names as constant pointers because they alreay are entities with types and storage. So the address of array a is &a[0].

References can be points-to references, i.e. fields can be encoded as indices.

trict_constant_path_p(r)

Should this local constant be added to the module declarations ?

Definition at line 1285 of file value.c.

1286 {
1288  // if(can_be_constant_path_p(r) /*strict_constant_path_p(r)*/) {
1289  /*strict_constant_path_p(r)*/
1291  entity v = reference_variable(r);
1292  /* Should this local constant be added to the module declarations ? */
1293  string mn = (string) entity_module_name(v);
1294  string ln = strdup(concatenate("&", reference_to_string(r), NULL));
1297  a = FindOrCreateEntity(mn, ln);
1298  entity_type(a) = ft;
1305  }
1306  return a;
1307 }
functional make_functional(list a1, type a2)
Definition: ri.c:1109
storage make_storage_rom(void)
Definition: ri.c:2285
type make_type_functional(functional _field_)
Definition: ri.c:2718
symbolic make_symbolic(expression a1, constant a2)
Definition: ri.c:2369
reference copy_reference(reference p)
REFERENCE.
Definition: ri.c:2047
constant make_constant_unknown(void)
Definition: ri.c:424
value make_value_symbolic(symbolic _field_)
Definition: ri.c:2838
#define unary_intrinsic_expression(name, e)
Building quickly bool expressions, FC.
#define ADDRESS_OF_OPERATOR_NAME
@ DEFAULT_ENTITY_KIND
entity FindOrCreateEntity(const char *package, const char *local_name)
Problem: A functional global entity may be referenced without parenthesis or CALL keyword in a functi...
Definition: entity.c:1586
expression reference_to_expression(reference r)
Definition: expression.c:196
#define entity_storage(x)
Definition: ri.h:2794
#define entity_kind(x)
Definition: ri.h:2798
#define entity_initial(x)
Definition: ri.h:2796

References ADDRESS_OF_OPERATOR_NAME, concatenate(), copy_reference(), copy_type(), DEFAULT_ENTITY_KIND, entity_initial, entity_kind, entity_module_name(), entity_storage, entity_type, entity_undefined, FindOrCreateEntity(), make_constant_unknown(), make_functional(), make_storage_rom(), make_symbolic(), make_type_functional(), make_value_symbolic(), NIL, points_to_reference_to_concrete_type(), reference_to_expression(), reference_to_string(), reference_variable, store_independent_points_to_reference_p(), strdup(), and unary_intrinsic_expression.

+ Here is the call graph for this function:

◆ reference_to_address_of_value()

entity reference_to_address_of_value ( reference  r)

Definition at line 889 of file value.c.

890 {
891  entity n;
892  if((n = (entity) hash_get(hash_reference_to_address_of_value, (char *) r))
893  == entity_undefined)
894  pips_internal_error("unbounded reference %s",
896  return n;
897 }

References entity_undefined, hash_get(), hash_reference_to_address_of_value, pips_internal_error, and reference_to_string().

+ Here is the call graph for this function:

◆ remove_entity_values()

void remove_entity_values ( entity  e,
bool  readonly 
)

pips_assert("remove_entity_values", e != entity_undefined);

Parameters
readonlyeadonly

Definition at line 1545 of file value.c.

1546 {
1547  entity new_value = entity_to_new_value(e);
1548  const char* s;
1549 
1550  /* pips_assert("remove_entity_values", e != entity_undefined); */
1551  pips_assert("remove_entity_values", new_value != entity_undefined);
1552 
1553  s = external_value_name(new_value);
1554  pips_assert("remove_entity_values", s != (char *) NULL);
1555  (void) hash_del(hash_value_to_name, (char *) new_value);
1556  (void) hash_del(hash_entity_to_new_value, (char *) e);
1557 
1558  if(!readonly) {
1559  entity old_value = entity_to_old_value(e);
1560  entity intermediate_value = entity_to_intermediate_value(e);
1561 
1562  pips_assert("remove_entity_values", old_value != entity_undefined);
1563  pips_assert("remove_entity_values",
1564  intermediate_value!=entity_undefined);
1565 
1566  s = external_value_name(old_value);
1567  pips_assert("remove_entity_values", s != (char *) NULL);
1568  (void) hash_del(hash_value_to_name, (char *) old_value);
1569  s = external_value_name(intermediate_value);
1570  pips_assert("remove_entity_values", s != (char *) NULL);
1571  (void) hash_del(hash_value_to_name, (char *) intermediate_value);
1572 
1573  (void) hash_del(hash_entity_to_old_value, (char *) e);
1574  (void) hash_del(hash_entity_to_intermediate_value, (char *) e);
1575  }
1576 }
void * hash_del(hash_table htp, const void *key)
this function removes from the hash table pointed to by htp the couple whose key is equal to key.
Definition: hash.c:439

References entity_to_intermediate_value(), entity_to_new_value(), entity_to_old_value(), entity_undefined, external_value_name(), hash_del(), hash_entity_to_intermediate_value, hash_entity_to_new_value, hash_entity_to_old_value, hash_value_to_name, and pips_assert.

Referenced by add_or_kill_equivalenced_variables().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reset_analyzed_types()

◆ reset_temporary_value_counter()

◆ reset_value_counters()

void reset_value_counters ( void  )

Definition at line 244 of file value.c.

245 {
248 }

References local_intermediate_value_counter, and local_old_value_counter.

Referenced by module_to_value_mappings().

+ Here is the caller graph for this function:

◆ reset_value_mappings()

◆ set_analyzed_types()

void set_analyzed_types ( void  )

Definition at line 271 of file value.c.

272 {
274  get_bool_property("SEMANTICS_ANALYZE_SCALAR_INTEGER_VARIABLES");
276  get_bool_property("SEMANTICS_ANALYZE_SCALAR_BOOLEAN_VARIABLES");
278  get_bool_property("SEMANTICS_ANALYZE_SCALAR_STRING_VARIABLES");
280  get_bool_property("SEMANTICS_ANALYZE_SCALAR_FLOAT_VARIABLES");
282  get_bool_property("SEMANTICS_ANALYZE_SCALAR_COMPLEX_VARIABLES");
284  get_bool_property("SEMANTICS_ANALYZE_SCALAR_POINTER_VARIABLES");
286  get_bool_property("SEMANTICS_ANALYZE_CONSTANT_PATH");
287 }
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....

References analyze_boolean_scalar_entities, analyze_complex_scalar_entities, analyze_constant_path, analyze_float_scalar_entities, analyze_integer_scalar_entities, analyze_pointer_scalar_entities, analyze_string_scalar_entities, and get_bool_property().

Referenced by eval_linear_expression(), and module_to_value_mappings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sizeof_value_entity_p()

bool sizeof_value_entity_p ( entity  e)

Definition at line 969 of file value.c.

970 {
971  string s = strstr(entity_local_name(e), SIZEOF_SUFFIX);
972 
973  return s!=NULL;
974 }

References entity_local_name(), and SIZEOF_SUFFIX.

Referenced by have_sizeof_value_in_multiply_pointer_expression_p(), pips_user_value_name(), and value_to_variable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ string_analyzed_p()

bool string_analyzed_p ( void  )

Definition at line 310 of file value.c.

311 {
313 }

References analyze_string_scalar_entities.

Referenced by any_expression_to_transformer(), fortran_data_to_prec_for_variables(), and parametric_transformer_empty_p().

+ Here is the caller graph for this function:

◆ string_identity()

static string string_identity ( string  s)
static

used with hash_table_fprintf

Definition at line 990 of file value.c.

991 { return s;}

Referenced by print_value_mappings().

+ Here is the caller graph for this function:

◆ test_mapping_entry_consistency()

void test_mapping_entry_consistency ( void  )

This second assert is too strong when some analyzable variables are equivalenced together. The number of values required is smaller since two (or more) different variables share the same value: the number of entries in the tables is greater than the number of values. We must compute the number of values in each table.

Why greater instead of equal? Because the equivalence variable appears in the equivalence equations although it should never appear in regular constraints, except under its canonical name.

Definition at line 1113 of file value.c.

1114 {
1115  int nbo = 0;
1116  int nbi = 0;
1117  int nbn = 0;
1118 
1119  pips_assert("The number of old values is equal to the number of intermediate values",
1122  /* This second assert is too strong when some analyzable variables are
1123  equivalenced together. The number of values required is smaller
1124  since two (or more) different variables share the same value: the
1125  number of entries in the tables is greater than the number of
1126  values. We must compute the number of values in each table.
1127  */
1128  /*
1129  pips_assert("The number of values is greater than the number"
1130  " of new, old and intermediate values",
1131  hash_table_entry_count(hash_value_to_name) >=
1132  hash_table_entry_count(hash_entity_to_new_value)
1133  + nbo + nbi);
1134  */
1138 
1139  /* Why greater instead of equal? Because the equivalence variable
1140  appears in the equivalence equations although it should never
1141  appear in regular constraints, except under its canonical name. */
1142  pips_assert("The number of values with a name is greater than the number"
1143  " of new, old and intermediate values",
1145  nbn + nbo + nbi);
1146 }
static int mapping_to_value_number(hash_table h)
Definition: value.c:1024

References hash_entity_to_intermediate_value, hash_entity_to_new_value, hash_entity_to_old_value, hash_table_entry_count(), hash_value_to_name, mapping_to_value_number(), and pips_assert.

Referenced by module_to_value_mappings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ type_to_sizeof_value()

entity type_to_sizeof_value ( type  t)

Definition at line 899 of file value.c.

900 {
901  entity i;
902  if((i = (entity) hash_get(hash_type_to_sizeof_value, (char *) t))
903  == entity_undefined)
904  pips_internal_error("unbounded type %s : %s",
906  return i;
907 }

References entity_undefined, hash_get(), hash_type_to_sizeof_value, pips_internal_error, type_to_full_string_definition(), and type_to_string().

Referenced by expression_multiply_sizeof_to_transformer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ value_alias()

entity value_alias ( entity  e)

Static aliasing.

useful for Fortran, useless for C. When no alias is found, an undefined entity must be returned.

lookup the current value name mapping and return an arbitrary "representant" of the interprocedural alias set of e; the equivalence relation is "has same location"

Definition at line 1729 of file value.c.

1730 {
1732 
1733  pips_debug(8,"begin: for %s\n", entity_name(e));
1734 
1735  /* lookup the current value name mapping and return an arbitrary "representant"
1736  of the interprocedural alias set of e; the equivalence relation is "has
1737  same location" */
1738  HASH_FOREACH(entity, var, string, val, hash_value_to_name) {
1739  if(variable_entity_p(var)
1740  && entities_may_conflict_p(var, e)) {
1741  a = var;
1742  break;
1743  }
1744  }
1745 
1746  if(a==entity_undefined)
1747  pips_debug(8, "return: %s\n", "entity_undefined");
1748  else
1749  pips_debug(8, "return: %s\n", entity_name(a));
1750 
1751  return a;
1752 }
bool entities_may_conflict_p(entity e1, entity e2)
Check if two entities may conflict.
Definition: conflicts.c:984
#define HASH_FOREACH(key_type, k, value_type, v, ht)
Definition: newgen_hash.h:71
bool variable_entity_p(entity)
variable.c
Definition: variable.c:70

References entities_may_conflict_p(), entity_name, entity_undefined, HASH_FOREACH, hash_value_to_name, pips_debug, and variable_entity_p().

Referenced by add_interprocedural_new_value_entity(), add_interprocedural_value_entities(), and translate_global_value().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ value_entity_p()

bool value_entity_p ( entity  e)

tells if e is seen as a variable value in the current module

Definition at line 976 of file value.c.

977 {
978  /* tells if e is seen as a variable value in the current module */
979  string s = hash_get(hash_value_to_name, (char *) e);
980 
981  if(s == (char*) HASH_UNDEFINED_VALUE) {
982  return false;
983  }
984  else {
985  return true;
986  }
987 }

References hash_get(), HASH_UNDEFINED_VALUE, and hash_value_to_name.

Referenced by generic_value_name(), transformer_add_sign_information(), transformer_filter_subsumed_variables(), and translate_global_value().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ value_full_name()

string value_full_name ( entity  v)

for debugging purposes

Definition at line 1762 of file value.c.

1763 {
1764  return entity_name(v);
1765 }

References entity_name.

Referenced by parametric_transformer_empty_p().

+ Here is the caller graph for this function:

◆ value_to_variable()

entity value_to_variable ( entity  val)

Get the primitive variable associated to any value involved in a transformer.

For example can associate values such as "o#0" to "i" (via "i#init").

This function used to be restricted to values seen by the current module. It was extended to values in general to cope with translation issues.

for gcc only!

pips_assert("value_to_variable", s != HASH_UNDEFINED_VALUE);

pips_assert("value_to_variable", strchr(entity_name(val), (int) SEMANTICS_SEPARATOR) != NULL);

this may be a value, but it is unknown in the current module

new values in fact have no suffixes...

It can be an equivalenced variable... Additional testing should be performed!

Parameters
valal

Definition at line 1624 of file value.c.

1625 {
1626  entity var = entity_undefined;
1627  int l_suffix = -1; /* for gcc only! */
1628  string s = hash_get(hash_value_to_name, (char *) val);
1629  string var_name;
1630 
1631  /* pips_assert("value_to_variable", s != HASH_UNDEFINED_VALUE); */
1632 
1633  /* pips_assert("value_to_variable",
1634  strchr(entity_name(val), (int) SEMANTICS_SEPARATOR) != NULL); */
1635 
1636  // TODO : Maybe redesign the search of suffix/prefix
1637  // Can bug if the variable name is/begin/end with
1638  // o, i, t, new, init, int, address_of see SUFFIX and PREFIX in transformer.h
1639  if(s == HASH_UNDEFINED_VALUE) {
1640  /* this may be a value, but it is unknown in the current module */
1641  string val_name = entity_name(val);
1642 
1643  if(strstr(val_name, NEW_VALUE_SUFFIX) != NULL)
1644  l_suffix = strlen(NEW_VALUE_SUFFIX);
1645  else if(strstr(val_name, OLD_VALUE_SUFFIX) != NULL)
1646  l_suffix = strlen(OLD_VALUE_SUFFIX);
1647  else if(strstr(val_name, INTERMEDIATE_VALUE_SUFFIX) != NULL)
1648  l_suffix = strlen(INTERMEDIATE_VALUE_SUFFIX);
1649  else if(strstr(val_name, ADDRESS_OF_SUFFIX) != NULL)
1650  l_suffix = strlen(ADDRESS_OF_SUFFIX);
1651  else if(strstr(val_name, SIZEOF_SUFFIX) != NULL)
1652  l_suffix = 0;
1653  else if(strchr(val_name, (int) SEMANTICS_SEPARATOR) == NULL) {
1654  /* new values in fact have no suffixes... */
1655  l_suffix = 0;
1656  }
1657  else
1658  pips_internal_error("%s is not a non-local value", entity_name(val));
1659 
1660  s = val_name;
1661  }
1662  else {
1663  if(sizeof_value_entity_p(val))
1664  l_suffix = 0;
1665  else if(new_value_entity_p(val))
1666  l_suffix = strlen(NEW_VALUE_SUFFIX);
1667  else if(old_value_entity_p(val))
1668  l_suffix = strlen(OLD_VALUE_SUFFIX);
1669  else if(intermediate_value_entity_p(val))
1670  l_suffix = strlen(INTERMEDIATE_VALUE_SUFFIX);
1671  else if(address_of_value_entity_p(val))
1672  l_suffix = strlen(ADDRESS_OF_SUFFIX);
1673  else
1674  /* It can be an equivalenced variable... Additional testing
1675  should be performed! */
1676  pips_internal_error("%s is not a locally visible value",
1677  entity_name(val));
1678  }
1679 
1680  var_name = strdup(s);
1681  *(var_name+strlen(var_name)-l_suffix) = '\0';
1682  if(address_of_value_entity_p(val)) {
1683  string temp = strstr(var_name, "[");
1684  if(temp != NULL)
1685  *temp = '\0';
1686  }
1687 
1688  var = gen_find_tabulated(var_name, entity_domain);
1689  free(var_name);
1690 
1691  if( var == entity_undefined )
1692  pips_internal_error("no related variable for val=%s",
1693  entity_name(val));
1694 
1695  return var;
1696 }
bool new_value_entity_p(entity e)
the following three functions are directly or indirectly relative to the current module and its value...
Definition: value.c:925
bool intermediate_value_entity_p(entity e)
Definition: value.c:955
bool old_value_entity_p(entity e)
Definition: value.c:936

References ADDRESS_OF_SUFFIX, address_of_value_entity_p(), entity_domain, entity_name, entity_undefined, free(), gen_find_tabulated(), hash_get(), HASH_UNDEFINED_VALUE, hash_value_to_name, intermediate_value_entity_p(), INTERMEDIATE_VALUE_SUFFIX, new_value_entity_p(), NEW_VALUE_SUFFIX, old_value_entity_p(), OLD_VALUE_SUFFIX, pips_internal_error, SEMANTICS_SEPARATOR, SIZEOF_SUFFIX, sizeof_value_entity_p(), and strdup().

Referenced by add_address_of_value(), add_loop_index_exit_value(), add_type_information(), any_assign_operation_to_transformer(), any_scalar_assign_to_transformer_list(), any_scalar_assign_to_transformer_without_effect(), fortran_user_call_to_transformer(), generic_transformer_intra_to_inter(), generic_transformer_to_analyzed_locations(), invariant_vector_p(), look_for_the_best_counter(), old_value_to_new_value(), pips_user_value_name(), print_call_precondition(), transformer_add_variable_incrementation(), transformer_add_variable_update(), transformer_derivative_constraints(), transformer_derivative_fix_point(), transformer_formal_parameter_projection(), transformer_general_consistency_p(), transformer_list_generic_transitive_closure(), transformer_projection_with_redundancy_elimination_and_check(), transformer_return_value_projection(), transformer_to_analyzed_arrays(), transformer_to_local_values(), transformer_to_potential_stub_translation(), and value_passing_summary_transformer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vect_variables_to_values()

Pvecteur vect_variables_to_values ( Pvecteur  v)

FI: not used, not debugged.

Definition at line 1755 of file value.c.

1756 {
1758  return v;
1759 }
Pvecteur vect_rename_variables(Pvecteur v, bool(*renamed_p)(Variable), Variable(*new_variable)(Variable))
Pvecteur vect_rename_variables(v, renamed_p, new_variable) Pvecteur v; bool (*renamed_p)(Variable); V...
Definition: base.c:281
static bool non_local_temporary_value_entity_p(entity e)
Definition: value.c:660
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
Definition: vecteur-local.h:60

References entity_to_new_value(), non_local_temporary_value_entity_p(), and vect_rename_variables().

+ Here is the call graph for this function:

Variable Documentation

◆ analyze_boolean_scalar_entities

bool analyze_boolean_scalar_entities = false
static

◆ analyze_complex_scalar_entities

bool analyze_complex_scalar_entities = false
static

◆ analyze_constant_path

bool analyze_constant_path = false
static

Definition at line 269 of file value.c.

Referenced by constant_path_analyzed_p(), reset_analyzed_types(), and set_analyzed_types().

◆ analyze_float_scalar_entities

bool analyze_float_scalar_entities = false
static

◆ analyze_integer_scalar_entities

bool analyze_integer_scalar_entities = true
static

TYPING.

Definition at line 262 of file value.c.

Referenced by analyzed_basic_p(), integer_analyzed_p(), reset_analyzed_types(), and set_analyzed_types().

◆ analyze_pointer_scalar_entities

bool analyze_pointer_scalar_entities = false
static

◆ analyze_string_scalar_entities

bool analyze_string_scalar_entities = false
static

◆ hash_entity_to_intermediate_value

◆ hash_entity_to_new_value

hash_table hash_entity_to_new_value = hash_table_undefined
static

VARIABLE VALUE MANAGEMENT PACKAGE FOR TRANSFORMERS.

Values of variables could be a new data structure or a special kind of entities. To avoid an increase in data structure declarations and an increased size for the implicit array of entities, values are often entities with special names. Their meaning is defined with respect to an environment defined at the module level and so, constant during the analysis of a module.

Constant values may be used as values. They are 0-ary functions. They are used to encode character strings. They are not dealt with by this package. It is possible to handle scalar floating point constants in the same way.

Temporary values may be used to denote expression values. These temporary values have no names. They are read only. They must be eliminated from long lasting data structures as their semantics is local to a single expression, usually a right hand side. Only the most basic entity printing routine can be used for such values.

Only scalar variables are analyzed.

Properties are used to select the variables types that are to be analyzed among integer, boolean, string, float and/or complex. Any combination of types is legal. Scalar variables of an analyzed type are said to be analyzable but they may be not analyzed because of some static aliasing (EQUIVALENCE).

Three different kind of variable values are used: new, old and intermediate. New values are used in post-condition predicates. Old values are used in pre-condition predicates. New and old values are also used in predicate transformers. Intermediate values are used to combine transformers.

New values are directly referenced by the corresponding scalar variable, a regular entity, with types integer, boolean, float, complex or string. However they are printed with a different name to avoid confusion between variables and values. The value name is the variable name, suffixed by "#new".

Old values and intermediate values are referenced via special entities, distinguished by their names made of a specific prefix followed by a number (see OLD_VALUE_PREFIX and INTERMEDIATE_VALUE_PREFIX in transformer.h).

The type of a value is the type of the associated entity. Equivalenced variables are handled only if they all have the same type.

Pre-values, a.k.a. old values, for local dynamic entities are named "o#XX", where "XX" is a number. A pre-value is associated to an entity via a hash table used by the function entity_to_old_value(). Static aliasing (i.e. EQUIVALENCEs) is dealed with by associating the same value entity to the two aliased variable entities.

Pre-values, a.k.a. old values, for analyzed scalar formal parameters and analyzed scalar global variables are represented by special entities named from the relevant variable entity, by suffixing its name by "#init". These values have to be represented by specific entities to let us consider parameter values at entry point and to let us perform interprocedural semantics analysis.

Intermediate values are referenced by special entities named "i#XX", which are reused from procedure to procedure. Within a procedure, each variable is linked to one intermediate value entity.

These conventions are used by value_to_name(e) to generate EXTERNAL names I::new, I::old and I::tmp and to print readable debug information.

To accelerate conversions between new, old and intermediate value entities, four hash tables must set up for each module before semantics analysis is started or used:

  • hash_entity_to_new_value associates an entity representing a new value to each scalar variable with an analyzed type; this value entity is most of the time the variable entity itself and thus this hash table almost represents an identity function; however, perfectly equivalenced variables are represented by one of them only and some eligible analyzable scalar variables are not mapped to anything because they are equivalenced to an array
  • hash_entity_to_old_value associates an entity representing an old value to each scalar analyzable variable
  • hash_entity_to_intermediate_value
  • hash_value_to_name: associates user-readable names to value entity; used for debugging and display purposes.

Francois Irigoin, December 1989 (updated June 2001,... August 2009)

Modifications:

  • only integer variables used to be analyzed; the analysis is extended to strings, bool and floating point scalar variables (Francois Irigoin, 14 June 2001).
  • temporary values are added to deal with subexpressions and to analyze non-linear expressions (Francois Irigoin, 14 June 2001).
  • the three mappings between variable entities and value entities were done differently for each transformer and based on the arguments field; efficiency was limited because the mappings were based on lists and because transformers had to be renamed before they could be combined; aliasis information had to be computed at each step instead of being factored out at hashing time (Francois Irigoin, April 90)

*** assigments to array or to non integer scalar can now affect transformer on integer scalar variables (Francois Irigoin, April 90)*** no longer true - such integer scalar variables are just ignored; however, it would be easy to do slightly better (21 April 1990)

  • old value suffix is now "#init" because it's nicer in prettyprinting predicates; it's also worse for transformer but they are less interesting for the users (Francois Irigoin, 18 April 1990)
  • fourth hash_table entity->new_value added to handle EQUIVALENCEs (Francois Irigoin, 18 April 1990)
  • only analyzable scalar variables that are not aliased or that are aliased to another scalar variable with same type are analyzed; dubious interest but April 24th is close (Francois Irigoin, 21 April 1990)

Bugs/Features:

  • once the hash tables are lost, intraprocedural transformers are useless while they were still interpretable when mappings were based on arguments; they could be translated into the previous representation when their computation is completed (Francois Irigoin, April 1990)

hash tables are static; recursion is not possible for interprocedural analysis; topographical order will have to be used for it (Francois Irigoin, April 1990)

Assumptions:

  • all variable values and only variable values used in a module have names in value_to_name(); however, constants, which also are values, do not appear in this mapping;
  • all variables whose values may be imported have entries in the three mappings entity_to_xxx_value() if they are defined within the current module, directly or indirectly thru calls; the information is derived interprocedurally from the memory effects which do not take aliasing into account; aliasing is handled using these three mappings; several exactly aliased variables are represented by the variable that appears first in the module effects, or by default, if none of these variables is in the scope of the current module, by any of them, probably the first one in the interprocedural effects; variables that are only read, i.e. used, are mapped only in entity_to_new_value();
  • a summary_transformer imported for a callee may be difficult to print before it is translated in the current module frame;
  • there is no absolute frame to express summary_preconditions for the time being (maybe, this has been fixed!)

Francois Irigoin, 13 January 1994 STATIC VARIABLES Four global hash tables used to map scalar analyzable variable entities onto the different kind of value entities and to map value entities onto their external names.

They prevent recursive calls.

Definition at line 219 of file value.c.

Referenced by add_new_alias_value(), add_new_value(), add_sizeof_value(), add_synonym_values(), allocate_value_mappings(), aproximate_number_of_analyzed_variables(), entity_has_values_p(), entity_to_new_value(), error_free_value_mappings(), hash_entity_to_values_undefined_p(), new_value_entity_p(), print_value_mappings(), remove_entity_values(), reset_value_mappings(), and test_mapping_entry_consistency().

◆ hash_entity_to_old_value

◆ hash_entity_to_user_value_name

◆ hash_reference_to_address_of_value

◆ hash_type_to_sizeof_value

◆ hash_value_to_name

◆ local_intermediate_value_counter

int local_intermediate_value_counter = 0
static

Two counters used to assign meaningless value entities to local variables.

A special global prefix, SEMANTICS_MODULE_NAME, and two special local prefixes, OLD_VALUE_PREFIX and INTERMEDIATE_VALUE_PREFIX, are also used

Definition at line 240 of file value.c.

Referenced by make_local_intermediate_value_entity(), and reset_value_counters().

◆ local_old_value_counter

int local_old_value_counter = 0
static

Definition at line 241 of file value.c.

Referenced by make_local_old_value_entity(), and reset_value_counters().

◆ local_temporary_value_counter