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

Go to the source code of this file.

Functions

entity entity_all_locations ()
 eturn ANY_MODULE:ANYWHERE (the top of the lattice) More...
 
entity entity_anywhere_locations ()
 
bool entity_all_locations_p (entity e)
 test if an entity is the top of the lattice More...
 
entity entity_typed_anywhere_locations (type t)
 
entity generic_entity_typed_anywhere_locations (type t)
 
bool entity_anywhere_locations_p (entity e)
 test if an entity is the bottom of the lattice More...
 
bool cell_typed_anywhere_locations_p (cell c)
 test if a cell is the bottom of the lattice More...
 
bool reference_typed_anywhere_locations_p (reference r)
 test if a reference is the bottom of the lattice More...
 
bool entity_typed_anywhere_locations_p (entity e)
 Test if an entity is the bottom of the lattice. More...
 
entity entity_nowhere_locations ()
 return ANY_MODULE:NOWHERE More...
 
entity entity_typed_nowhere_locations (type t)
 
bool entity_nowhere_locations_p (entity e)
 test if an entity is the bottom of the lattice More...
 
bool entity_typed_nowhere_locations_p (entity e)
 test if an entity is the bottom of the lattice More...
 
entity entity_null_locations ()
 return TOP-LEVEL:NULL_POINTER The NULL pointer should be a global variable, unique for all modules FI: why isn't it called entity_null_location()? More...
 
bool entity_null_locations_p (entity e)
 test if an entity is the NULL POINTER More...
 
entity entity_all_module_locations (entity m)
 return m:ANYWHERE Set of all memory locations related to one module. More...
 
bool entity_all_module_locations_p (entity e)
 test if an entity is the set of locations defined in a module More...
 
entity entity_all_module_xxx_locations (entity m, const char *xxx)
 return m:xxx*ANYWHERE* Generic set of functions for all kinds of areas More...
 
entity entity_all_module_xxx_locations_typed (const char *mn, const char *xxx, type t)
 
bool entity_all_module_xxx_locations_p (entity e, string xxx)
 test if an entity is the set of all memory locations in the xxx area of a module. More...
 
entity entity_all_xxx_locations (string xxx)
 return ANY_MODULE:xxx More...
 
entity entity_all_xxx_locations_typed (string xxx, type t)
 FI->AM: the predicate entity_all_xxx_locations_typed_p() is missing... More...
 
bool entity_all_xxx_locations_p (entity e, string xxx)
 test if an entity is the set of all memory locations in the xxx area of any module. More...
 
entity entity_all_module_heap_locations (entity m)
 return m:*HEAP**ANYWHERE More...
 
entity entity_all_module_heap_locations_typed (entity m, type t)
 
bool entity_all_module_heap_locations_p (entity e)
 test if an entity is the a heap area More...
 
entity entity_all_heap_locations ()
 return ANY_MODULE:HEAP More...
 
bool entity_all_heap_locations_p (entity e)
 test if an entity is the set of all heap locations More...
 
entity entity_all_heap_locations_typed (type t)
 
entity entity_all_module_stack_locations (entity m)
 return m:*STACK**ANYWHERE More...
 
bool entity_all_module_stack_locations_p (entity e)
 test if an entity is the a stack area More...
 
entity entity_all_stack_locations ()
 return ANY_MODULE:STACK More...
 
bool entity_all_stack_locations_p (entity e)
 test if an entity is the set of all stack locations More...
 
entity entity_all_module_static_locations (entity m)
 return m:*DYNAMIC**ANYWHERE More...
 
bool entity_all_module_static_locations_p (entity e)
 test if an entity is the a static area More...
 
entity entity_all_static_locations ()
 return ANY_MODULE:STATIC More...
 
bool entity_all_static_locations_p (entity e)
 test if an entity is the set of all static locations More...
 
entity entity_all_module_dynamic_locations (entity m)
 return m:*DYNAMIC**ANYWHERE More...
 
bool entity_all_module_dynamic_locations_p (entity e)
 test if an entity is the a dynamic area More...
 
entity entity_all_dynamic_locations ()
 return ANY_MODULE:DYNAMIC More...
 
bool entity_all_dynamic_locations_p (entity e)
 test if an entity is the set of all dynamic locations More...
 
bool entity_stub_sink_p (entity e)
 test if an entity is a stub sink for a formal parameter e.g. More...
 
bool stub_entity_of_module_p (entity s, entity m)
 
bool entity_abstract_location_p (entity al)
 
entity variable_to_abstract_location (entity v)
 returns the smallest abstract locations containing the location of variable v. More...
 
entity abstract_locations_max (entity al1, entity al2)
 eturns the smallest abstract location set greater than or equalt to al1 and al2. More...
 
entity entity_locations_max (entity al1, entity al2)
 Here, entity al1 and entity al2 can be program variables. More...
 
entity entity_locations_dereference (entity al __attribute__((__unused__)))
 in case we need to evaluate sigma(al), i.e. More...
 
void check_abstract_locations ()
 For debugging the API. More...
 
bool abstract_locations_may_conflict_p (entity al1, entity al2)
 Do these two abstract locations MAY share some real memory locations ? More...
 
bool abstract_locations_must_conflict_p (entity al1 __attribute__((__unused__)), entity al2 __attribute__((__unused__)))
 Do these two abstract locations MUST share some real memory locations ? Never ! DO NOT USE THIS FUNCTION UNLESS... More...
 
reference make_anywhere_reference (type t)
 This function should be located somewhere in effect-util in or near abstract locations. More...
 
cell make_anywhere_cell (type t)
 

Function Documentation

◆ abstract_locations_max()

entity abstract_locations_max ( entity  al1,
entity  al2 
)

eturns the smallest abstract location set greater than or equalt to al1 and al2.

If al1 or al2 is nowhere, then return al2 or al1.

If al1 and al2 are related to the same module, the module can be preserved. Else the anywhere module must be used.

If al1 and al2 are related to the same area, then the area is preserved. Else, the anywhere area is used.

FI: The type part of the abstract location lattice is not implemented... Since the abstract locations are somewhere defined as area, they cannot carry a type. Types are taken care of for heap modelization but not more the abstract locations.

FI: we are in trouble with the NULL pointer... here al1 and al2 must be abstract locations

avoid costly string operations in trivial case

Parameters
al1l1
al2l2

Definition at line 766 of file anywhere_abstract_locations.c.

767 {
769 
770  if (same_entity_p(al1, al2)) /* avoid costly string operations in trivial case */
771  e = al1;
772  else if(!get_bool_property("ALIASING_ACROSS_TYPES")) {
775  if(!type_equal_p(t1, t2))
777  }
778 
779  if(entity_undefined_p(e)) {
780  // FI: the string based tests are not reliable as there is no link
781  // between suffixes and types, even within one module
782  const char* ln1 = entity_local_name(al1);
783  const char* ln2 = entity_local_name(al2);
784  char* mn1 = strdup(entity_module_name(al1));
785  char* mn2 = strdup(entity_module_name(al2));
786  const char* ln;
787  const char* mn;
788  static int mc = 0; // Message count: to avoid multiple repetitions
789 
790  if(mc==0 && !get_bool_property("ALIASING_ACROSS_TYPES")) {
791  //pips_internal_error("Option not implemented yet.");
792  pips_user_warning("property \"ALIASING_ACROSS_TYPES\" is assumed true"
793  " for abstract locations.\n");
794  mc++;
795  }
796 
797  if(strcmp(ln1, ln2)==0)
798  ln = ln1;
799  else
800  ln = ANYWHERE_LOCATION;
801 
802  if(strcmp(mn1, mn2)==0)
803  mn = mn1;
804  else
805  mn = ANY_MODULE_NAME;
806  e = FindEntity(mn, ln);
807 
808  if(true || entity_undefined_p(e)) {
809  if(get_bool_property("ALIASING_ACROSS_TYPES")) {
811  }
812  else {
813  type t1 = entity_type(al1);
814  type t2 = entity_type(al2);
815  if(type_equal_p(t1, t2))
817  else
819  }
820  }
821 
822  free(mn1);free(mn2);
823  }
824  return e;
825 }
entity entity_typed_anywhere_locations(type t)
entity entity_anywhere_locations()
#define ANYWHERE_LOCATION
#define ANY_MODULE_NAME
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
void free(void *)
#define pips_user_warning
Definition: misc-local.h:146
entity FindEntity(const char *package, const char *name)
Retrieve an entity from its package/module name and its local name.
Definition: entity.c:1503
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
bool same_entity_p(entity e1, entity e2)
predicates on entities
Definition: entity.c:1321
const char * entity_module_name(entity e)
See comments about module_name().
Definition: entity.c:1092
bool type_equal_p(type, type)
Definition: type.c:547
type entity_basic_concrete_type(entity)
retrieves or computes and then returns the basic concrete type of an entity
Definition: type.c:3677
#define entity_undefined_p(x)
Definition: ri.h:2762
#define entity_undefined
Definition: ri.h:2761
#define entity_type(x)
Definition: ri.h:2792
char * strdup()

References ANY_MODULE_NAME, ANYWHERE_LOCATION, entity_anywhere_locations(), entity_basic_concrete_type(), entity_local_name(), entity_module_name(), entity_type, entity_typed_anywhere_locations(), entity_undefined, entity_undefined_p, FindEntity(), free(), get_bool_property(), pips_user_warning, same_entity_p(), strdup(), and type_equal_p().

Referenced by abstract_locations_may_conflict_p(), convex_cells_inclusion_p(), entity_locations_max(), and simple_cells_inclusion_p().

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

◆ abstract_locations_may_conflict_p()

bool abstract_locations_may_conflict_p ( entity  al1,
entity  al2 
)

Do these two abstract locations MAY share some real memory locations ?

Parameters
al1l1
al2l2

Definition at line 989 of file anywhere_abstract_locations.c.

990  {
991  entity mal = abstract_locations_max(al1, al2); // maximal abstraction location
992  bool conflict_p = (mal==al1) || (mal==al2);
993 
994  return conflict_p;
995  }
entity abstract_locations_max(entity al1, entity al2)
eturns the smallest abstract location set greater than or equalt to al1 and al2.

References abstract_locations_max().

Referenced by add_conflicts(), and entities_maymust_conflict_p().

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

◆ abstract_locations_must_conflict_p()

bool abstract_locations_must_conflict_p ( entity al1   __attribute__(__unused__),
entity al2   __attribute__(__unused__) 
)

Do these two abstract locations MUST share some real memory locations ? Never ! DO NOT USE THIS FUNCTION UNLESS...

The function is useful in functional drivers to avoid dealing with specific cases

Definition at line 1001 of file anywhere_abstract_locations.c.

1003  {
1004 
1005  /* The function is useful in functional drivers to avoid dealing
1006  with specific cases*/
1007 
1008  //pips_internal_error("abstract_locations_must_conflict_p is a non sense : "
1009  // "it's always false ! avoid use it.");
1010 
1011  return false;
1012  }

Referenced by entities_maymust_conflict_p().

+ Here is the caller graph for this function:

◆ cell_typed_anywhere_locations_p()

bool cell_typed_anywhere_locations_p ( cell  c)

test if a cell is the bottom of the lattice

Definition at line 133 of file anywhere_abstract_locations.c.

134 {
136  bool anywhere_p = reference_typed_anywhere_locations_p(r);
137  return anywhere_p;
138 }
bool reference_typed_anywhere_locations_p(reference r)
test if a reference is the bottom of the lattice
reference cell_any_reference(cell)
API for reference.
Definition: effects.c:77

References cell_any_reference(), and reference_typed_anywhere_locations_p().

Referenced by binary_intrinsic_call_to_points_to_sinks(), check_type_of_points_to_cells(), compute_points_to_binded_set(), compute_points_to_gen_set(), dereferencing_subscript_to_points_to(), freeable_points_to_cells(), freed_pointer_to_points_to(), null_equal_condition_to_points_to(), offset_cells(), offset_points_to_cell(), points_to_with_stripped_sink(), print_or_dump_points_to(), source_to_sinks(), and unique_location_cell_p().

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

◆ check_abstract_locations()

void check_abstract_locations ( void  )

For debugging the API.

top

bottom

null pointer

all locations for a given module

all heap locations for a given module

all stack locations for a given module

all static locations for a given module

all dynamic locations for a given module

all heap locations for an application

all stack locations for an application

all static locations for an application

all dynamic locations for an application

Should/could be extended to check the max computation...

Definition at line 906 of file anywhere_abstract_locations.c.

907  {
909  /* top */
910  al = entity_all_locations();
911  fprintf(stderr, "top: %s is %s\n", entity_name(al),
913  "the set of all application locations" : "bug!!!");
914 
915  /* bottom */
917  fprintf(stderr, "bottom: %s is %s\n", entity_name(al),
919  "the bottom of the abstract location lattice" : "bug!!!");
920 
921  /* null pointer */
922  al = entity_null_locations();
923  fprintf(stderr, "null: %s is %s\n", entity_name(al),
925  "the null pointer" : "bug!!!");
926 
927  /* all locations for a given module */
929  fprintf(stderr, "all module locations: %s is %s\n", entity_name(al),
931  "the set of all locations of a module" : "bug!!!");
932 
933  /* all heap locations for a given module */
935  fprintf(stderr, "all module heap locations: %s is %s\n", entity_name(al),
937  "the set of all heap locations of a module" : "bug!!!");
938 
939  /* all stack locations for a given module */
941  fprintf(stderr, "all module stack locations: %s is %s\n", entity_name(al),
943  "the set of all stack locations of a module" : "bug!!!");
944 
945  /* all static locations for a given module */
947  fprintf(stderr, "all module static locations: %s is %s\n", entity_name(al),
949  "the set of all static locations of a module" : "bug!!!");
950 
951  /* all dynamic locations for a given module */
953  fprintf(stderr, "all module dynamic locations: %s is %s\n", entity_name(al),
955  "the set of all dynamic locations of a module" : "bug!!!");
956 
957 
958  /* all heap locations for an application */
960  fprintf(stderr, "all application heap locations: %s is %s\n", entity_name(al),
962  "the set of all heap locations of an application" : "bug!!!");
963 
964  /* all stack locations for an application */
966  fprintf(stderr, "all application stack locations: %s is %s\n", entity_name(al),
968  "the set of all stack locations of an application" : "bug!!!");
969 
970  /* all static locations for an application */
972  fprintf(stderr, "all application static locations: %s is %s\n", entity_name(al),
974  "the set of all static locations of an applciation" : "bug!!!");
975 
976  /* all dynamic locations for an application */
978  fprintf(stderr, "all module dynamic locations: %s is %s\n", entity_name(al),
980  "the set of all dynamic locations of an application" : "bug!!!");
981 
982  /* Should/could be extended to check the max computation... */
983  }
bool entity_all_module_static_locations_p(entity e)
test if an entity is the a static area
bool entity_null_locations_p(entity e)
test if an entity is the NULL POINTER
entity entity_null_locations()
return TOP-LEVEL:NULL_POINTER The NULL pointer should be a global variable, unique for all modules FI...
entity entity_all_module_dynamic_locations(entity m)
return m:*DYNAMIC**ANYWHERE
entity entity_all_module_heap_locations(entity m)
return m:*HEAP**ANYWHERE
bool entity_all_dynamic_locations_p(entity e)
test if an entity is the set of all dynamic locations
entity entity_all_module_locations(entity m)
return m:ANYWHERE Set of all memory locations related to one module.
entity entity_all_stack_locations()
return ANY_MODULE:STACK
bool entity_all_locations_p(entity e)
test if an entity is the top of the lattice
entity entity_all_module_static_locations(entity m)
return m:*DYNAMIC**ANYWHERE
bool entity_all_static_locations_p(entity e)
test if an entity is the set of all static locations
entity entity_all_module_stack_locations(entity m)
return m:*STACK**ANYWHERE
entity entity_all_dynamic_locations()
return ANY_MODULE:DYNAMIC
bool entity_nowhere_locations_p(entity e)
test if an entity is the bottom of the lattice
bool entity_all_module_locations_p(entity e)
test if an entity is the set of locations defined in a module
entity entity_all_locations()
eturn ANY_MODULE:ANYWHERE (the top of the lattice)
bool entity_all_module_heap_locations_p(entity e)
test if an entity is the a heap area
entity entity_all_heap_locations()
return ANY_MODULE:HEAP
bool entity_all_module_dynamic_locations_p(entity e)
test if an entity is the a dynamic area
entity entity_nowhere_locations()
return ANY_MODULE:NOWHERE
bool entity_all_module_stack_locations_p(entity e)
test if an entity is the a stack area
bool entity_all_stack_locations_p(entity e)
test if an entity is the set of all stack locations
bool entity_all_heap_locations_p(entity e)
test if an entity is the set of all heap locations
entity entity_all_static_locations()
return ANY_MODULE:STATIC
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
#define entity_name(x)
Definition: ri.h:2790
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...

References entity_all_dynamic_locations(), entity_all_dynamic_locations_p(), entity_all_heap_locations(), entity_all_heap_locations_p(), entity_all_locations(), entity_all_locations_p(), entity_all_module_dynamic_locations(), entity_all_module_dynamic_locations_p(), entity_all_module_heap_locations(), entity_all_module_heap_locations_p(), entity_all_module_locations(), entity_all_module_locations_p(), entity_all_module_stack_locations(), entity_all_module_stack_locations_p(), entity_all_module_static_locations(), entity_all_module_static_locations_p(), entity_all_stack_locations(), entity_all_stack_locations_p(), entity_all_static_locations(), entity_all_static_locations_p(), entity_name, entity_nowhere_locations(), entity_nowhere_locations_p(), entity_null_locations(), entity_null_locations_p(), entity_undefined, fprintf(), and get_current_module_entity().

+ Here is the call graph for this function:

◆ entity_abstract_location_p()

bool entity_abstract_location_p ( entity  al)
Parameters
all

Definition at line 641 of file anywhere_abstract_locations.c.

642 {
643 #ifndef NDEBUG
644  const char * en = entity_name(al);
645  const char * module_sep = strchr(en,MODULE_SEP_CHAR);
646  bool abstract_locations_p = ( 0 == strncmp(en,ANY_MODULE_NAME,module_sep++ - en) // << FI: this may change in the future and may not be a strong enough condition
647  || 0 == strncmp(module_sep, ANYWHERE_LOCATION, sizeof(ANYWHERE_LOCATION)-1)
648  || 0 == strncmp(module_sep, STATIC_AREA_LOCAL_NAME, sizeof(STATIC_AREA_LOCAL_NAME)-1)
649  || 0 == strncmp(module_sep, DYNAMIC_AREA_LOCAL_NAME, sizeof(DYNAMIC_AREA_LOCAL_NAME)-1)
650  || 0 == strncmp(module_sep, STACK_AREA_LOCAL_NAME, sizeof(STACK_AREA_LOCAL_NAME)-1)
651  || 0 == strncmp(module_sep, HEAP_AREA_LOCAL_NAME, sizeof(HEAP_AREA_LOCAL_NAME)-1)
652  || 0 == strncmp(module_sep, FORMAL_AREA_LOCAL_NAME, sizeof(HEAP_AREA_LOCAL_NAME)-1)
653  // || 0 == strncmp(module_sep, NULL_POINTER_NAME, sizeof(NULL_POINTER_NAME)-1)
654  )
655  ;
656  pips_assert("entity_kind is consistent",abstract_locations_p == ((entity_kind(al)&ABSTRACT_LOCATION)==ABSTRACT_LOCATION));
657 #endif
658  return (entity_kind(al) & ABSTRACT_LOCATION) ? true : false;
659 }
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
#define FORMAL_AREA_LOCAL_NAME
Definition: naming-local.h:76
#define DYNAMIC_AREA_LOCAL_NAME
Definition: naming-local.h:69
#define MODULE_SEP_CHAR
Definition: naming-local.h:28
#define STACK_AREA_LOCAL_NAME
Definition: naming-local.h:72
#define STATIC_AREA_LOCAL_NAME
Definition: naming-local.h:70
#define HEAP_AREA_LOCAL_NAME
Definition: naming-local.h:71
#define true
Definition: newgen_types.h:81
@ ABSTRACT_LOCATION
#define entity_kind(x)
Definition: ri.h:2798

References ABSTRACT_LOCATION, ANY_MODULE_NAME, ANYWHERE_LOCATION, DYNAMIC_AREA_LOCAL_NAME, entity_kind, entity_name, FORMAL_AREA_LOCAL_NAME, HEAP_AREA_LOCAL_NAME, MODULE_SEP_CHAR, pips_assert, STACK_AREA_LOCAL_NAME, STATIC_AREA_LOCAL_NAME, and true.

Referenced by add_conflicts(), add_implicit_interprocedural_write_effects(), atomic_constant_path_p(), cell_abstract_location_p(), convex_effect_to_constant_path_effects_with_pointer_values(), create_values_for_simple_effect(), effect_reference_dereferencing_p(), effects_to_dma(), entities_maymust_conflict_p(), entity_locations_max(), generic_apply_effect_to_transformer(), generic_apply_effects_to_transformer(), generic_effects_entities_which_may_conflict_with_scalar_entity(), generic_effects_maymust_read_or_write_scalar_entity_p(), generic_eval_cell_with_points_to(), generic_transform_sink_cells_from_matching_list(), memory_dereferencing_p(), module_to_value_mappings(), opgen_may_name(), opgen_must_name(), opkill_may_name(), opkill_must_name(), points_to_cell_to_upper_bound_points_to_cells(), points_to_compare_cells(), points_to_compare_ptr_cell(), references_may_conflict_p(), simple_effect_to_constant_path_effects_with_pointer_values(), strict_constant_path_p(), struct_assignment_to_points_to(), and variable_to_abstract_location().

+ Here is the caller graph for this function:

◆ entity_all_dynamic_locations()

entity entity_all_dynamic_locations ( void  )

return ANY_MODULE:DYNAMIC

Definition at line 585 of file anywhere_abstract_locations.c.

586 {
588 }
entity entity_all_xxx_locations(string xxx)
return ANY_MODULE:xxx

References DYNAMIC_AREA_LOCAL_NAME, and entity_all_xxx_locations().

Referenced by check_abstract_locations().

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

◆ entity_all_dynamic_locations_p()

bool entity_all_dynamic_locations_p ( entity  e)

test if an entity is the set of all dynamic locations

Definition at line 591 of file anywhere_abstract_locations.c.

592 {
594 }
bool entity_all_xxx_locations_p(entity e, string xxx)
test if an entity is the set of all memory locations in the xxx area of any module.

References DYNAMIC_AREA_LOCAL_NAME, and entity_all_xxx_locations_p().

Referenced by check_abstract_locations(), and strict_constant_path_p().

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

◆ entity_all_heap_locations()

entity entity_all_heap_locations ( void  )

return ANY_MODULE:HEAP

FI->AM: I move it to ANY_MODULE:HEAP**ANYWHERE

Not compatible with entity_all_locations_p()...

Definition at line 494 of file anywhere_abstract_locations.c.

References ANYWHERE_LOCATION, entity_all_xxx_locations(), and HEAP_AREA_LOCAL_NAME.

Referenced by check_abstract_locations(), and malloc_type_to_abstract_location().

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

◆ entity_all_heap_locations_p()

bool entity_all_heap_locations_p ( entity  e)

test if an entity is the set of all heap locations

We look for "*ANY_MODULE*:*HEAP**ANYWHERE*"... unless it is "foo:*HEAP**ANYWHERE*"

FI->AM: this is not compatible with the entity name ANY-MODULE:HEAP

Definition at line 505 of file anywhere_abstract_locations.c.

506 {
508 }

References entity_all_xxx_locations_p(), and HEAP_AREA_LOCAL_NAME.

Referenced by all_heap_locations_cell_p(), check_abstract_locations(), entity_heap_location_p(), heap_intrinsic_to_post_pv(), reference_add_field_dimension(), and strict_constant_path_p().

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

◆ entity_all_heap_locations_typed()

entity entity_all_heap_locations_typed ( type  t)

Definition at line 510 of file anywhere_abstract_locations.c.

511 {
513 }
entity entity_all_xxx_locations_typed(string xxx, type t)
FI->AM: the predicate entity_all_xxx_locations_typed_p() is missing...

References entity_all_xxx_locations_typed(), and HEAP_AREA_LOCAL_NAME.

Referenced by malloc_type_to_abstract_location(), and reference_add_field_dimension().

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

◆ entity_all_locations()

entity entity_all_locations ( void  )

eturn ANY_MODULE:ANYWHERE (the top of the lattice)

anywhere_abstract_locations.c

FI->aM: it was first decided to make this entity an area, but areas cannot be typed. So the internal representation must be changed to carry a type usable according to ALIAS_ACROSS_TYPES. The top of the location lattice should use overloaded as type, that is the top of the type lattice.

Size and layout are unknown

Definition at line 68 of file anywhere_abstract_locations.c.

69 {
70  entity anywhere = entity_undefined;
71  static const char any_name[] =
73  anywhere = gen_find_tabulated(any_name, entity_domain);
74  if(entity_undefined_p(anywhere)) {
75  area a = make_area(0,NIL); /* Size and layout are unknown */
76  type t = make_type_area(a);
77  anywhere = make_entity(strdup(any_name),
78  t,
82  }
83 
84  return anywhere;
85 }
value make_value_unknown(void)
Definition: ri.c:2847
storage make_storage_rom(void)
Definition: ri.c:2285
type make_type_area(area _field_)
Definition: ri.c:2712
area make_area(intptr_t a1, list a2)
Definition: ri.c:98
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
#define MODULE_SEP_STRING
Definition: naming-local.h:30
void * gen_find_tabulated(const char *, int)
Definition: tabulated.c:218
#define make_entity(n, t, s, i)
#define entity_domain
newgen_syntax_domain_defined
Definition: ri.h:410

References ABSTRACT_LOCATION, ANY_MODULE_NAME, ANYWHERE_LOCATION, entity_domain, entity_kind, entity_undefined, entity_undefined_p, gen_find_tabulated(), make_area(), make_entity, make_storage_rom(), make_type_area(), make_value_unknown(), MODULE_SEP_STRING, NIL, and strdup().

Referenced by anywhere_effect(), check_abstract_locations(), entity_anywhere_locations(), entity_anywhere_locations_p(), entity_locations_dereference(), generic_entity_typed_anywhere_locations(), make_anywhere_anywhere_pvs(), make_anywhere_points_to_cell(), max_module(), module_initial_parameter_pv(), and points_to_anywhere_sinks().

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

◆ entity_all_locations_p()

bool entity_all_locations_p ( entity  e)

test if an entity is the top of the lattice

This test does not take typed anywhere into account. This is consistent with the function name, but may be not with its uses.

It is not consistent with hiding the impact of ALIASING_ACROSS_TYPES from callers.

Definition at line 100 of file anywhere_abstract_locations.c.

101 {
102 
103  bool anywhere_p;
105  anywhere_p = anywhere_p
107 
108  return anywhere_p;
109 }
#define same_string_p(s1, s2)

References ANY_MODULE_NAME, ANYWHERE_LOCATION, entity_local_name(), entity_module_name(), and same_string_p.

Referenced by anywhere_cell_p(), anywhere_reference_p(), c_convex_effects_on_formal_parameter_backward_translation(), check_abstract_locations(), effect_reference_dereferencing_p(), entities_maymust_conflict_p(), generic_anywhere_effect_p(), interference_on(), loop_variant_list(), opkill_may_name(), opkill_must_name(), pvs_union_combinable_p(), references_may_conflict_p(), simple_pv_may_union(), simple_pv_must_union(), simple_pv_translate(), strict_constant_path_p(), and TestCoupleOfReferences().

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

◆ entity_all_module_dynamic_locations()

entity entity_all_module_dynamic_locations ( entity  m)

return m:*DYNAMIC**ANYWHERE

Definition at line 573 of file anywhere_abstract_locations.c.

574 {
576 }
entity entity_all_module_xxx_locations(entity m, const char *xxx)
return m:xxx*ANYWHERE* Generic set of functions for all kinds of areas

References DYNAMIC_AREA_LOCAL_NAME, and entity_all_module_xxx_locations().

Referenced by check_abstract_locations().

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

◆ entity_all_module_dynamic_locations_p()

bool entity_all_module_dynamic_locations_p ( entity  e)

test if an entity is the a dynamic area

Definition at line 579 of file anywhere_abstract_locations.c.

580 {
582 }
bool entity_all_module_xxx_locations_p(entity e, string xxx)
test if an entity is the set of all memory locations in the xxx area of a module.

References DYNAMIC_AREA_LOCAL_NAME, and entity_all_module_xxx_locations_p().

Referenced by check_abstract_locations(), and strict_constant_path_p().

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

◆ entity_all_module_heap_locations()

entity entity_all_module_heap_locations ( entity  m)

return m:*HEAP**ANYWHERE

Definition at line 471 of file anywhere_abstract_locations.c.

472 {
474 }

References entity_all_module_xxx_locations(), and HEAP_AREA_LOCAL_NAME.

Referenced by check_abstract_locations(), and malloc_type_to_abstract_location().

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

◆ entity_all_module_heap_locations_p()

bool entity_all_module_heap_locations_p ( entity  e)

test if an entity is the a heap area

Definition at line 483 of file anywhere_abstract_locations.c.

References entity_all_module_xxx_locations_p(), and HEAP_AREA_LOCAL_NAME.

Referenced by check_abstract_locations(), entity_heap_location_p(), heap_intrinsic_to_post_pv(), reference_add_field_dimension(), and strict_constant_path_p().

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

◆ entity_all_module_heap_locations_typed()

entity entity_all_module_heap_locations_typed ( entity  m,
type  t 
)

Definition at line 476 of file anywhere_abstract_locations.c.

477 {
480 }
entity entity_all_module_xxx_locations_typed(const char *mn, const char *xxx, type t)

References entity_all_module_xxx_locations_typed(), entity_local_name(), and HEAP_AREA_LOCAL_NAME.

Referenced by malloc_type_to_abstract_location().

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

◆ entity_all_module_locations()

entity entity_all_module_locations ( entity  m)

return m:ANYWHERE Set of all memory locations related to one module.

FI: This may prove useless unless the compilation unit is taken into account.

Size and layout are unknown

FI: any_name?

Definition at line 265 of file anywhere_abstract_locations.c.

266 {
267  entity anywhere = entity_undefined;
268  const char* mn = entity_local_name(m);
269 
270  anywhere = FindEntity(mn,ANYWHERE_LOCATION);
271  if(entity_undefined_p(anywhere)) {
272  area a = make_area(0,NIL); /* Size and layout are unknown */
273  type t = make_type_area(a);
274  /* FI: any_name? */
275  anywhere = CreateEntity(mn,ANYWHERE_LOCATION);
276  entity_type(anywhere)=t;
277  entity_storage(anywhere)=make_storage_rom();
279  entity_kind(anywhere)=ABSTRACT_LOCATION;
280  }
281 
282  return anywhere;
283 }
entity CreateEntity(const char *package_name, const char *local_name)
BEGIN_EOLE.
Definition: entity.c:1572
#define entity_storage(x)
Definition: ri.h:2794
#define entity_initial(x)
Definition: ri.h:2796

References ABSTRACT_LOCATION, ANYWHERE_LOCATION, CreateEntity(), entity_initial, entity_kind, entity_local_name(), entity_storage, entity_type, entity_undefined, entity_undefined_p, FindEntity(), make_area(), make_storage_rom(), make_type_area(), make_value_unknown(), and NIL.

Referenced by check_abstract_locations().

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

◆ entity_all_module_locations_p()

bool entity_all_module_locations_p ( entity  e)

test if an entity is the set of locations defined in a module

Definition at line 286 of file anywhere_abstract_locations.c.

287 {
288 
289  bool all_module_p;
291 
292  return all_module_p;
293 }

References ANYWHERE_LOCATION, entity_local_name(), and same_string_p.

Referenced by apply_abstract_effect_to_transformer(), check_abstract_locations(), and strict_constant_path_p().

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

◆ entity_all_module_stack_locations()

entity entity_all_module_stack_locations ( entity  m)

return m:*STACK**ANYWHERE

Definition at line 523 of file anywhere_abstract_locations.c.

524 {
526 }

References entity_all_module_xxx_locations(), and STACK_AREA_LOCAL_NAME.

Referenced by check_abstract_locations().

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

◆ entity_all_module_stack_locations_p()

bool entity_all_module_stack_locations_p ( entity  e)

test if an entity is the a stack area

Definition at line 529 of file anywhere_abstract_locations.c.

References entity_all_module_xxx_locations_p(), and STACK_AREA_LOCAL_NAME.

Referenced by check_abstract_locations(), and strict_constant_path_p().

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

◆ entity_all_module_static_locations()

entity entity_all_module_static_locations ( entity  m)

return m:*DYNAMIC**ANYWHERE

Definition at line 548 of file anywhere_abstract_locations.c.

References entity_all_module_xxx_locations(), and STATIC_AREA_LOCAL_NAME.

Referenced by check_abstract_locations().

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

◆ entity_all_module_static_locations_p()

bool entity_all_module_static_locations_p ( entity  e)

test if an entity is the a static area

Definition at line 554 of file anywhere_abstract_locations.c.

References entity_all_module_xxx_locations_p(), and STATIC_AREA_LOCAL_NAME.

Referenced by check_abstract_locations(), and strict_constant_path_p().

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

◆ entity_all_module_xxx_locations()

entity entity_all_module_xxx_locations ( entity  m,
const char *  xxx 
)

return m:xxx*ANYWHERE* Generic set of functions for all kinds of areas

Size and layout are unknown

I: more work to be done here...

Parameters
xxxxx

Definition at line 299 of file anywhere_abstract_locations.c.

300 {
301  entity dynamic = entity_undefined;
302  string any_name;
303  asprintf(&any_name, "%s" ANYWHERE_LOCATION, xxx);
304 
305  //dynamic = gen_find_tabulated(any_name, entity_domain);
306  dynamic = FindOrCreateEntity(entity_local_name(m), any_name);
307  if(storage_undefined_p(entity_storage(dynamic))) {
308  area a = make_area(0,NIL); /* Size and layout are unknown */
309  type t = make_type_area(a);
310  /*FI: more work to be done here... */
311  entity_type(dynamic) = t;
312  entity_storage(dynamic) = make_storage_rom();
313  entity_initial(dynamic) = make_value_unknown();
315  }
316  free(any_name);
317 
318  return dynamic;
319 }
#define asprintf
Definition: misc-local.h:225
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
#define storage_undefined_p(x)
Definition: ri.h:2477

References ABSTRACT_LOCATION, ANYWHERE_LOCATION, asprintf, entity_initial, entity_kind, entity_local_name(), entity_storage, entity_type, entity_undefined, FindOrCreateEntity(), free(), make_area(), make_storage_rom(), make_type_area(), make_value_unknown(), NIL, and storage_undefined_p.

Referenced by entity_all_module_dynamic_locations(), entity_all_module_heap_locations(), entity_all_module_stack_locations(), entity_all_module_static_locations(), and variable_to_abstract_location().

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

◆ entity_all_module_xxx_locations_p()

bool entity_all_module_xxx_locations_p ( entity  e,
string  xxx 
)

test if an entity is the set of all memory locations in the xxx area of a module.

The module is not checked, so it can be the set of all modules...

Parameters
xxxxx

Definition at line 366 of file anywhere_abstract_locations.c.

367 {
368  bool dynamic_p;
369  string s = concatenate(xxx, ANYWHERE_LOCATION, NULL);
370 
371  pips_assert("e is defined", !entity_undefined_p(e));
372 
373  dynamic_p = same_string_p(entity_local_name(e), s);
374 
375  return dynamic_p;
376 }
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183

References ANYWHERE_LOCATION, concatenate(), entity_local_name(), entity_undefined_p, pips_assert, and same_string_p.

Referenced by entity_all_module_dynamic_locations_p(), entity_all_module_heap_locations_p(), entity_all_module_stack_locations_p(), and entity_all_module_static_locations_p().

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

◆ entity_all_module_xxx_locations_typed()

entity entity_all_module_xxx_locations_typed ( const char *  mn,
const char *  xxx,
type  t 
)

A new entity has been created

I: more work to be done here...

no aliasing

Parameters
mnn
xxxxx

Definition at line 321 of file anywhere_abstract_locations.c.

322 {
324  int count = 0;
325  bool found_p = false; // a break could be used instead
326 
327  pips_assert("Type t is defined", !type_undefined_p(t));
328 
329  for(count = 0; !found_p; count++) {
330 
331  type ot = type_undefined;
332  char * local_name;
333 
334  asprintf(&local_name, "%s_b%d", xxx,count);
336  free(local_name);
337  ot = entity_type(e);
338  if(type_undefined_p(ot)) {
339  /* A new entity has been created */
340  //area a = make_area(0,NIL); /* Size and layout are unknown */
341  //type t = make_type_area(a);
342  /*FI: more work to be done here... */
343  entity_type(e) = copy_type(t); /* no aliasing */
346  found_p = true;
347 
348  }
349  else if(type_equal_p(t, ot))
350  found_p = true;
351  }
352 
353  // FI: the debug message should be improved with full information
354  // about the type... See get_symbol_table() and isolate the code
355  // used to prettyprint the type. Too bad it uses the buffer type...
356  pips_debug(8, "New abstract location entity \"%s\" found or created"
357  " with type \"%s\"\n", entity_name(e), type_to_string(t));
358 
359  return e;
360 }
type copy_type(type p)
TYPE.
Definition: ri.c:2655
static int count
Definition: SDG.c:519
const char * local_name(const char *s)
Does not take care of block scopes and returns a pointer.
Definition: entity_names.c:221
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
string type_to_string(const type)
type.c
Definition: type.c:51
#define type_undefined_p(x)
Definition: ri.h:2884
#define type_undefined
Definition: ri.h:2883

References asprintf, copy_type(), count, entity_initial, entity_name, entity_storage, entity_type, entity_undefined, FindOrCreateEntity(), free(), local_name(), make_storage_rom(), make_value_unknown(), pips_assert, pips_debug, type_equal_p(), type_to_string(), type_undefined, and type_undefined_p.

Referenced by entity_all_module_heap_locations_typed(), and variable_to_abstract_location().

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

◆ entity_all_stack_locations()

entity entity_all_stack_locations ( void  )

return ANY_MODULE:STACK

Definition at line 535 of file anywhere_abstract_locations.c.

536 {
538 }

References entity_all_xxx_locations(), and STACK_AREA_LOCAL_NAME.

Referenced by check_abstract_locations().

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

◆ entity_all_stack_locations_p()

bool entity_all_stack_locations_p ( entity  e)

test if an entity is the set of all stack locations

Definition at line 541 of file anywhere_abstract_locations.c.

542 {
544 }

References entity_all_xxx_locations_p(), and STACK_AREA_LOCAL_NAME.

Referenced by check_abstract_locations(), and strict_constant_path_p().

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

◆ entity_all_static_locations()

entity entity_all_static_locations ( void  )

return ANY_MODULE:STATIC

Definition at line 560 of file anywhere_abstract_locations.c.

561 {
563 }

References entity_all_xxx_locations(), and STATIC_AREA_LOCAL_NAME.

Referenced by check_abstract_locations().

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

◆ entity_all_static_locations_p()

bool entity_all_static_locations_p ( entity  e)

test if an entity is the set of all static locations

Definition at line 566 of file anywhere_abstract_locations.c.

567 {
569 }

References entity_all_xxx_locations_p(), and STATIC_AREA_LOCAL_NAME.

Referenced by check_abstract_locations(), and strict_constant_path_p().

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

◆ entity_all_xxx_locations()

entity entity_all_xxx_locations ( string  xxx)

return ANY_MODULE:xxx

I: more work to be done here...

FI: I'd like to make the type variable, overloaded,...

Parameters
xxxxx

Definition at line 379 of file anywhere_abstract_locations.c.

380 {
381  entity dynamic = entity_undefined;
382  dynamic = FindOrCreateEntity(ANY_MODULE_NAME,xxx);
383 
384  if(type_undefined_p(entity_type(dynamic))) {
385  //area a = make_area(0,NIL); /* Size and layout are unknown */
386  //type t = make_type_area(a);
387  /*FI: more work to be done here... */
388  /* FI: I'd like to make the type variable, overloaded,... */
389  // entity_type(dynamic) = make_type_unknown();
391  variable v = make_variable(b, NIL, NIL);
392  entity_type(dynamic) = make_type_variable(v);
393  entity_storage(dynamic) = make_storage_rom();
394  entity_initial(dynamic) = make_value_unknown();
400  }
401 
402  return dynamic;
403 }
type make_type_variable(variable _field_)
Definition: ri.c:2715
basic make_basic_overloaded(void)
Definition: ri.c:167
variable make_variable(basic a1, list a2, list a3)
Definition: ri.c:2895
@ ENTITY_STATIC_AREA
@ ENTITY_DYNAMIC_AREA
@ ENTITY_STACK_AREA
@ ENTITY_HEAP_AREA

References ABSTRACT_LOCATION, ANY_MODULE_NAME, DYNAMIC_AREA_LOCAL_NAME, ENTITY_DYNAMIC_AREA, ENTITY_HEAP_AREA, entity_initial, entity_kind, ENTITY_STACK_AREA, ENTITY_STATIC_AREA, entity_storage, entity_type, entity_undefined, FindOrCreateEntity(), HEAP_AREA_LOCAL_NAME, make_basic_overloaded(), make_storage_rom(), make_type_variable(), make_value_unknown(), make_variable(), NIL, same_string_p, STACK_AREA_LOCAL_NAME, STATIC_AREA_LOCAL_NAME, and type_undefined_p.

Referenced by application_to_points_to_sinks(), entity_all_dynamic_locations(), entity_all_heap_locations(), entity_all_stack_locations(), entity_all_static_locations(), make_anywhere_reference(), make_nowhere_cell(), points_to_anywhere(), and user_call_to_points_to_sinks().

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

◆ entity_all_xxx_locations_p()

bool entity_all_xxx_locations_p ( entity  e,
string  xxx 
)

test if an entity is the set of all memory locations in the xxx area of any module.

FI->AM: how come w generate HEAP and we check HEAP**ANYWHERE?

Parameters
xxxxx

Definition at line 456 of file anywhere_abstract_locations.c.

457 {
458  bool dynamic_p;
459  string s = concatenate(xxx, ANYWHERE_LOCATION, NULL);
460 
461  dynamic_p = same_string_p(entity_local_name(e), s);
462  dynamic_p = dynamic_p
464 
465  return dynamic_p;
466 }

References ANY_MODULE_NAME, ANYWHERE_LOCATION, concatenate(), entity_local_name(), entity_module_name(), and same_string_p.

Referenced by entity_all_dynamic_locations_p(), entity_all_heap_locations_p(), entity_all_stack_locations_p(), and entity_all_static_locations_p().

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

◆ entity_all_xxx_locations_typed()

entity entity_all_xxx_locations_typed ( string  xxx,
type  t 
)

FI->AM: the predicate entity_all_xxx_locations_typed_p() is missing...

A new entity has been created

I: more work to be done here...

Parameters
xxxxx

Definition at line 406 of file anywhere_abstract_locations.c.

407 {
409  int count = 0;
410  bool found_p = false; // a break could be used instead
411 
412  pips_assert("Type t is defined", !type_undefined_p(t));
413  pips_assert("Type t is not functional", !type_functional_p(t));
414 
415  for(count = 0; !found_p; count++) {
416  string name = string_undefined;
417  type ot = type_undefined;
418 
419  asprintf(&name, "%s_b%d", xxx, count);
421  free(name);
422  ot = entity_type(e);
423  if(type_undefined_p(ot)) {
424  /* A new entity has been created */
425  //area a = make_area(0,NIL); /* Size and layout are unknown */
426  //type t = make_type_area(a);
427  /*FI: more work to be done here... */
428  entity_type(e) = copy_type(t);
432  found_p = true;
433  }
434  else if(type_equal_p(t, ot)) // FI: do we want to relax this test?
435  found_p = true;
436  }
437 
438  // FI: the debug message should be improved with full information
439  // about the type... See get_symbol_table() and isolate the code
440  // used to prettyprint the type. Too bad it uses the buffer type...
441  ifdebug(8) {
442  pips_debug(8, "New abstract location entity \"%s\" found or created"
443  " with type ", entity_name(e));
444  print_type(t);
445  fprintf(stderr, "\n");
446  }
447 
448  return e;
449 }
#define string_undefined
Definition: newgen_types.h:40
void print_type(type)
For debugging.
Definition: type.c:111
#define type_functional_p(x)
Definition: ri.h:2950
#define ifdebug(n)
Definition: sg.c:47

References ABSTRACT_LOCATION, ANY_MODULE_NAME, asprintf, copy_type(), count, entity_initial, entity_kind, entity_name, entity_storage, entity_type, entity_undefined, FindOrCreateEntity(), fprintf(), free(), ifdebug, make_storage_rom(), make_value_unknown(), pips_assert, pips_debug, print_type(), string_undefined, type_equal_p(), type_functional_p, type_undefined, and type_undefined_p.

Referenced by application_to_points_to_sinks(), entity_all_heap_locations_typed(), entity_typed_anywhere_locations(), entity_typed_nowhere_locations(), generic_entity_typed_anywhere_locations(), make_anywhere_points_to_cell(), make_anywhere_reference(), make_typed_nowhere_cell(), points_to_anywhere_typed(), and user_call_to_points_to_sinks().

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

◆ entity_anywhere_locations()

entity entity_anywhere_locations ( void  )

Definition at line 87 of file anywhere_abstract_locations.c.

88 {
89  return entity_all_locations();
90 }

References entity_all_locations().

Referenced by abstract_locations_max(), anywhere_source_to_sinks(), remove_arcs_from_pt_map(), and source_to_sinks().

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

◆ entity_anywhere_locations_p()

bool entity_anywhere_locations_p ( entity  e)

test if an entity is the bottom of the lattice

Definition at line 127 of file anywhere_abstract_locations.c.

128 {
129  return same_entity_p(e, entity_all_locations());
130 }

References entity_all_locations(), and same_entity_p().

Referenced by entities_maymust_conflict_p(), generic_atomic_points_to_reference_p(), module_to_value_mappings(), points_to_cell_translation(), reference_add_field_dimension(), semantics_usable_points_to_reference_p(), and strict_constant_path_p().

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

◆ entity_locations_dereference()

entity entity_locations_dereference ( entity al   __attribute__(__unused__))

in case we need to evaluate sigma(al), i.e.

the locations pointed by al, return the top of the lattice. Of course, this function should be avoided as much as possible.

Definition at line 898 of file anywhere_abstract_locations.c.

899 {
901  e = entity_all_locations();
902  return e;
903 }

References entity_all_locations(), and entity_undefined.

+ Here is the call graph for this function:

◆ entity_locations_max()

entity entity_locations_max ( entity  al1,
entity  al2 
)

Here, entity al1 and entity al2 can be program variables.

Both al1 and al2 are abstract locations and they are different

al1 and al2 are assumed to be variables

Parameters
al1l1
al2l2

Definition at line 829 of file anywhere_abstract_locations.c.

830 {
832  //string ln1 = entity_local_name(al1);
833  //string ln2 = entity_local_name(al2);
834 
835  if(al1==al2) {
836  e = al1;
837  }
838  else {
839  bool al1_abstract_location_p = entity_abstract_location_p(al1);
840  bool al2_abstract_location_p = entity_abstract_location_p(al2);
841  if(al1_abstract_location_p )
842  if(al2_abstract_location_p ) {
843  /* Both al1 and al2 are abstract locations and they are
844  different */
845  e = abstract_locations_max(al1, al2);
846  }
847  else {
849  e = abstract_locations_max(al1, al);
850  }
851  else
852  if(al2_abstract_location_p) {
854  e = abstract_locations_max(al, al2);
855  }
856  else {
857  /* al1 and al2 are assumed to be variables */
858  storage s1 = entity_storage(al1);
859  storage s2 = entity_storage(al2);
860 
861  if(storage_ram_p(s1) && storage_ram_p(s2)) {
862  ram r1 = storage_ram(s1);
863  ram r2 = storage_ram(s2);
864  entity f1 = ram_function(r1);
865  entity f2 = ram_function(r2);
866  entity a1 = ram_section(r1);
867  entity a2 = ram_section(r2);
868  const char* mn ;
869  const char* ln ;
870 
871  if(f1==f2)
872  mn = entity_local_name(f1);
873  else
874  mn = ANY_MODULE_NAME;
875 
876  if(static_area_p(a1) && static_area_p(a2))
878  else if(dynamic_area_p(a1) && dynamic_area_p(a2))
880  else if(stack_area_p(a1) && stack_area_p(a2))
882  else if(heap_area_p(a1) && heap_area_p(a2))
884  else
885  ln = ANYWHERE_LOCATION;
886  e = FindEntity(mn, ln);
887  }
888  else
889  pips_internal_error("not implemented");
890  }
891  }
892  return e;
893 }
bool entity_abstract_location_p(entity al)
entity variable_to_abstract_location(entity v)
returns the smallest abstract locations containing the location of variable v.
#define pips_internal_error
Definition: misc-local.h:149
int f2(int off1, int off2, int w, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:1
bool dynamic_area_p(entity aire)
Definition: area.c:68
bool stack_area_p(entity aire)
Definition: area.c:104
bool heap_area_p(entity aire)
Definition: area.c:86
bool static_area_p(entity aire)
Definition: area.c:77
#define storage_ram_p(x)
Definition: ri.h:2519
#define ram_section(x)
Definition: ri.h:2249
#define storage_ram(x)
Definition: ri.h:2521
#define ram_function(x)
Definition: ri.h:2247
s1
Definition: set.c:247

References abstract_locations_max(), ANY_MODULE_NAME, ANYWHERE_LOCATION, DYNAMIC_AREA_LOCAL_NAME, dynamic_area_p(), entity_abstract_location_p(), entity_local_name(), entity_storage, entity_undefined, f2(), FindEntity(), HEAP_AREA_LOCAL_NAME, heap_area_p(), pips_internal_error, ram_function, ram_section, s1, STACK_AREA_LOCAL_NAME, stack_area_p(), STATIC_AREA_LOCAL_NAME, static_area_p(), storage_ram, storage_ram_p, and variable_to_abstract_location().

Referenced by effect_may_union(), effect_must_union(), and region_union().

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

◆ entity_nowhere_locations()

entity entity_nowhere_locations ( void  )

return ANY_MODULE:NOWHERE

Size and layout are unknown

Definition at line 174 of file anywhere_abstract_locations.c.

175 {
176  static entity nowhere = entity_undefined;
177  static const char any_name [] = ANY_MODULE_NAME MODULE_SEP_STRING NOWHERE_LOCATION ;
178  nowhere = gen_find_tabulated(any_name, entity_domain);
179  if(entity_undefined_p(nowhere)) {
180  area a = make_area(0,NIL); /* Size and layout are unknown */
181  type t = make_type_area(a);
182  nowhere = make_entity(strdup(any_name),
185  register_static_entity(&nowhere);
186  }
187 
188  return nowhere;
189 }
#define NOWHERE_LOCATION
void register_static_entity(entity *e)
add given entity to the set of entities that must reset upon workspace deletion practically,...
Definition: entity.c:156

References ABSTRACT_LOCATION, ANY_MODULE_NAME, entity_domain, entity_kind, entity_undefined, entity_undefined_p, gen_find_tabulated(), make_area(), make_entity, make_storage_rom(), make_type_area(), make_value_unknown(), MODULE_SEP_STRING, NIL, NOWHERE_LOCATION, register_static_entity(), and strdup().

Referenced by check_abstract_locations(), and entity_nowhere_locations_p().

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

◆ entity_nowhere_locations_p()

bool entity_nowhere_locations_p ( entity  e)

test if an entity is the bottom of the lattice

Should we care for the typed nowhere too?

Definition at line 200 of file anywhere_abstract_locations.c.

201 {
203 }

References entity_nowhere_locations(), and same_entity_p().

Referenced by check_abstract_locations(), gen_may_set(), gen_must_set(), opkill_may_name(), opkill_must_name(), reference_add_field_dimension(), and strict_constant_path_p().

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

◆ entity_null_locations()

entity entity_null_locations ( void  )

return TOP-LEVEL:NULL_POINTER The NULL pointer should be a global variable, unique for all modules FI: why isn't it called entity_null_location()?

Since NULL is a constant, it should be declared as a function. But then it cold not be used in a reference for the points-to analysis. Too bad for the semantics analysis of pointers were a constant 0-ary function would make more sense.

Size and layout are unknown

Definition at line 223 of file anywhere_abstract_locations.c.

224 {
225  static entity null_pointer = entity_undefined;
226  if(entity_undefined_p(null_pointer)) {
227  if(true) {
229  area a = make_area(0,NIL); /* Size and layout are unknown */
230  type t = make_type_area(a);
231  null_pointer = make_entity(strdup(null_name),
233  // FI: I do not see why NULL should be an abstract location; it
234  // does not represent a set of locations, but a unique one
235  // entity_kind(null_pointer) = ABSTRACT_LOCATION;
236  entity_kind(null_pointer) = DEFAULT_ENTITY_KIND;
237  }
238  else {
243  entity_type(null_pointer) = ft;
244  entity_storage(null_pointer) = make_storage_rom();
246  }
247  register_static_entity(&null_pointer);
248  }
249 
250  return null_pointer;
251 }
functional make_functional(list a1, type a2)
Definition: ri.c:1109
value make_value_constant(constant _field_)
Definition: ri.c:2841
type make_type_functional(functional _field_)
Definition: ri.c:2718
type make_type_void(list _field_)
Definition: ri.c:2727
constant make_constant_int(intptr_t _field_)
Definition: ri.c:409
#define NULL_POINTER_NAME
#define TOP_LEVEL_MODULE_NAME
Module containing the global variables in Fortran and C.
Definition: naming-local.h:101
@ DEFAULT_ENTITY_KIND
type type_to_pointer_type(type)
allocate a new type "pt" which includes directly "t".
Definition: type.c:5253

References copy_type(), DEFAULT_ENTITY_KIND, entity_initial, entity_kind, entity_storage, entity_type, entity_undefined, entity_undefined_p, FindOrCreateEntity(), make_area(), make_constant_int(), make_entity, make_functional(), make_storage_rom(), make_type_area(), make_type_functional(), make_type_void(), make_value_constant(), make_value_unknown(), MODULE_SEP_STRING, NIL, NULL_POINTER_NAME, register_static_entity(), strdup(), TOP_LEVEL_MODULE_NAME, and type_to_pointer_type().

Referenced by check_abstract_locations(), entity_null_locations_p(), make_null_cell(), null_pointer_value_entity(), and points_to_null_sinks().

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

◆ entity_null_locations_p()

◆ entity_stub_sink_p()

bool entity_stub_sink_p ( entity  e)

test if an entity is a stub sink for a formal parameter e.g.

f->_f_1, EXACT

Definition at line 599 of file anywhere_abstract_locations.c.

600 {
601  bool stub_sink_p = false;
602  bool dummy_target_p = false;
603  const char * en = entity_local_name(e);
604  storage s = entity_storage(e);
605  if(storage_ram_p(s)) {
606  // dummy_target_p = pointer_dummy_targets_area_p(ram_section(storage_ram(s)));
607  dummy_target_p = formal_area_p(ram_section(storage_ram(s)));
608  }
609  char first = en[0];
610  //char penultimate = en[strlen(en) - 2];
611  int l = strlen(en);
612  if(dummy_target_p && first == '_') {
613  int i = 1;
614  while('0' <=en[l-i] && en[l-i]<='9') {
615  i++;
616  }
617  if(i>=2 && en[l-i]=='_')
618  stub_sink_p = true;
619  }
620 
621  return stub_sink_p;
622 }
bool formal_area_p(entity aire)
Definition: area.c:95

References entity_local_name(), entity_storage, formal_area_p(), ram_section, storage_ram, and storage_ram_p.

Referenced by cell_out_of_scope_p(), create_stub_entity(), expand_points_to_domain(), generic_atomic_points_to_reference_p(), generic_points_to_set_to_stub_cell_list(), generic_remove_unreachable_vertices_in_points_to_graph(), generic_transformer_to_analyzed_locations(), reference_to_points_to(), source_to_sinks(), strict_constant_path_p(), stub_entity_of_module_p(), stub_points_to_cell_p(), subscript_to_points_to_sinks(), and transformer_general_consistency_p().

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

◆ entity_typed_anywhere_locations()

entity entity_typed_anywhere_locations ( type  t)

Definition at line 111 of file anywhere_abstract_locations.c.

112 {
114 }

References ANYWHERE_LOCATION, and entity_all_xxx_locations_typed().

Referenced by abstract_locations_max(), binary_intrinsic_call_to_points_to_sinks(), cells_to_read_or_write_effects(), points_to_anywhere_sinks(), and reference_add_field_dimension().

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

◆ entity_typed_anywhere_locations_p()

bool entity_typed_anywhere_locations_p ( entity  e)

Test if an entity is the bottom of the lattice.

Not really since it is typed...

The typed anywhere locations have names like ANYWHERE_LOCATION_bxxx

Beware, because the string ANYWHERE_LOCATION is also used for the heap, HEAP**ANYWHERE.

Also, this does not check for the module: is it ANYMODULE or a specific module?

Definition at line 160 of file anywhere_abstract_locations.c.

161 {
162  bool typed_anywhere_p = false;
163  string ln = (string) entity_local_name(e);
164  string p = strstr(ln, ANYWHERE_LOCATION);
165  if(p==ln) {
166  // if the two strings are equal, we have the non-typed anywhere location
167  typed_anywhere_p = strcmp(ln, ANYWHERE_LOCATION);
168  }
169  return typed_anywhere_p;
170 }
char * string
STRING.
Definition: newgen_types.h:39

References ANYWHERE_LOCATION, and entity_local_name().

Referenced by analyzable_scalar_entity_p(), cells_to_read_or_write_effects(), effect_reference_dereferencing_p(), generic_anywhere_effect_p(), generic_atomic_points_to_reference_p(), module_to_value_mappings(), points_to_cell_translation(), reference_add_field_dimension(), reference_typed_anywhere_locations_p(), semantics_usable_points_to_reference_p(), source_to_sinks(), and strict_constant_path_p().

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

◆ entity_typed_nowhere_locations()

entity entity_typed_nowhere_locations ( type  t)

Definition at line 191 of file anywhere_abstract_locations.c.

192 {
194 }

References entity_all_xxx_locations_typed(), and NOWHERE_LOCATION.

+ Here is the call graph for this function:

◆ entity_typed_nowhere_locations_p()

bool entity_typed_nowhere_locations_p ( entity  e)

test if an entity is the bottom of the lattice

Definition at line 206 of file anywhere_abstract_locations.c.

207 {
208  string ln = (string) entity_local_name(e);
209  string p = strstr(ln, NOWHERE_LOCATION);
210  return p!=NULL;
211 }

References entity_local_name(), and NOWHERE_LOCATION.

Referenced by any_basic_update_to_transformer(), any_update_to_transformer(), gen_may_set(), gen_must_set(), generic_atomic_points_to_reference_p(), nowhere_cell_p(), points_to_unary_operation_to_transformer(), reference_add_field_dimension(), semantics_usable_points_to_reference_p(), strict_constant_path_p(), and text_points_to_relation().

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

◆ generic_entity_typed_anywhere_locations()

entity generic_entity_typed_anywhere_locations ( type  t)

Definition at line 116 of file anywhere_abstract_locations.c.

117 {
119  if(get_bool_property("ALIASING_ACROSS_TYPES"))
120  a = entity_all_locations();
121  else
123  return a;
124 }

References ANYWHERE_LOCATION, entity_all_locations(), entity_all_xxx_locations_typed(), entity_undefined, and get_bool_property().

+ Here is the call graph for this function:

◆ make_anywhere_cell()

cell make_anywhere_cell ( type  t)

Definition at line 1028 of file anywhere_abstract_locations.c.

1029 {
1031  cell sc = make_cell_reference(r);
1032  return sc;
1033 }
cell make_cell_reference(reference _field_)
Definition: effects.c:293
reference make_anywhere_reference(type t)
This function should be located somewhere in effect-util in or near abstract locations.

References make_anywhere_reference(), and make_cell_reference().

Referenced by binary_intrinsic_call_to_points_to_sinks(), generic_transform_sink_cells_from_matching_list(), k_limit_points_to(), sizeofexpression_to_points_to_sinks(), source_to_sinks(), struct_assignment_to_points_to(), struct_initialization_to_points_to(), unary_intrinsic_call_to_points_to_sinks(), and use_default_sink_cell().

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

◆ make_anywhere_reference()

reference make_anywhere_reference ( type  t)

This function should be located somewhere in effect-util in or near abstract locations.

Definition at line 1016 of file anywhere_abstract_locations.c.

1017 {
1018  bool type_sensitive_p = !get_bool_property("ALIASING_ACROSS_TYPES");
1019  entity anywhere = type_sensitive_p?
1021  :
1023 
1024  reference r = make_reference(anywhere,NIL);
1025  return r;
1026 }
reference make_reference(entity a1, list a2)
Definition: ri.c:2083

References ANYWHERE_LOCATION, entity_all_xxx_locations(), entity_all_xxx_locations_typed(), get_bool_property(), make_reference(), and NIL.

Referenced by binary_intrinsic_call_to_points_to_sinks(), generic_eval_cell_with_points_to(), and make_anywhere_cell().

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

◆ reference_typed_anywhere_locations_p()

bool reference_typed_anywhere_locations_p ( reference  r)

test if a reference is the bottom of the lattice

Definition at line 141 of file anywhere_abstract_locations.c.

142 {
143  entity e = reference_variable(r);
144  bool anywhere_p = entity_typed_anywhere_locations_p(e);
145  return anywhere_p;
146 }
bool entity_typed_anywhere_locations_p(entity e)
Test if an entity is the bottom of the lattice.
#define reference_variable(x)
Definition: ri.h:2326

References entity_typed_anywhere_locations_p(), and reference_variable.

Referenced by any_assign_to_transformer(), and cell_typed_anywhere_locations_p().

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

◆ stub_entity_of_module_p()

bool stub_entity_of_module_p ( entity  s,
entity  m 
)

There are several ways to decide if entity "s" is local to "m": its module name, its belonging to the declarations of m, its storage,... Let's avoir string comparisons and list scans...

Definition at line 624 of file anywhere_abstract_locations.c.

625 {
626  bool stub_p = entity_stub_sink_p(s);
627  if(stub_p) {
628  /* There are several ways to decide if entity "s" is local to "m":
629  its module name, its belonging to the declarations of m, its
630  storage,... Let's avoir string comparisons and list scans... */
631  storage ss = entity_storage(s);
632  if(storage_ram_p(ss)) {
633  ram rss = storage_ram(ss);
634  entity f = ram_function(rss);
635  stub_p = m==f;
636  }
637  }
638  return stub_p;
639 }
bool entity_stub_sink_p(entity e)
test if an entity is a stub sink for a formal parameter e.g.
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15

References entity_storage, entity_stub_sink_p(), f(), ram_function, storage_ram, and storage_ram_p.

Referenced by clean_up_points_to_stubs(), compute_points_to_binded_set(), and generic_points_to_set_to_stub_cell_list().

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

◆ variable_to_abstract_location()

entity variable_to_abstract_location ( entity  v)

returns the smallest abstract locations containing the location of variable v.

This does not work for formal parameters or, if it works, the caller module is not known and the resulting abstract location is very large. A large abstract location is returned.

No idea to model return values... even though they are located in the stack in real world.

If v cannot be converted into an abstract location, either the function aborts or an undefined entity is returned.

NULL is an abstract location

Definition at line 675 of file anywhere_abstract_locations.c.

676 {
678 
680  al = v;
681  /* NULL is an abstract location */
682  else if(entity_null_locations_p(v))
683  al = v;
684  else if(entity_variable_p(v)
686  && !variable_return_p(v)) {
687  bool typed_p = !get_bool_property("ALIASING_ACROSS_TYPES");
688 
689  // Too simplistic
690  //al = FindOrCreateEntity(mn, ln);
691 
692  if(formal_parameter_p(v)) {
693  const char * ln = FORMAL_AREA_LOCAL_NAME;
695  storage s = entity_storage(v);
696  formal fs = storage_formal(s);
697  entity f = formal_function(fs);
698  if(typed_p) {
699  const char* fn = entity_local_name(f);
700  al = entity_all_module_xxx_locations_typed(fn, ln, uvt);
701  }
702  else
704  entity_kind(al)=ABSTRACT_LOCATION; // should it be a static/dynamic/stack/heap area too ? not according to static_area_p
705  }
706  else { // must be a standard variable, or a stub
707  storage s = entity_storage(v);
708  ram r = storage_ram(s);
709  entity f = ram_function(r);
710  entity a = ram_section(r);
711  //string mn = entity_local_name(f);
712  const char *ln = string_undefined;
714 
715  if(static_area_p(a))
717  else if(dynamic_area_p(a))
719  else if(stack_area_p(a))
721  else if(heap_area_p(a))
723  else if(formal_area_p(a))
725  else
726  pips_internal_error("Unexpected area\n");
727 
728  if(typed_p) {
729  const char* fn = entity_local_name(f);
730  al = entity_all_module_xxx_locations_typed(fn, ln, uvt);
731  }
732  else
734  entity_kind(al)=ABSTRACT_LOCATION; // should it be a static/dynamic/stack/heap area too ? not according to static_area_p
735  }
736  }
737  else
738  pips_internal_error("arg. not in definition domain");
739 
740  pips_assert("al is an abstract location entity",
742 
743  return al;
744 }
#define entity_variable_p(e)
An entity_variable_p(e) may hide a typedef and hence a functional type.
bool dummy_parameter_entity_p(entity p)
is p a dummy parameter?
Definition: entity.c:1941
bool variable_return_p(entity)
True if a variable is the pseudo-variable used to store value returned by a function:
Definition: variable.c:1522
bool formal_parameter_p(entity)
Definition: variable.c:1489
#define storage_formal(x)
Definition: ri.h:2524
#define formal_function(x)
Definition: ri.h:1406

References ABSTRACT_LOCATION, dummy_parameter_entity_p(), DYNAMIC_AREA_LOCAL_NAME, dynamic_area_p(), entity_abstract_location_p(), entity_all_module_xxx_locations(), entity_all_module_xxx_locations_typed(), entity_basic_concrete_type(), entity_kind, entity_local_name(), entity_null_locations_p(), entity_storage, entity_undefined, entity_variable_p, f(), FORMAL_AREA_LOCAL_NAME, formal_area_p(), formal_function, formal_parameter_p(), get_bool_property(), HEAP_AREA_LOCAL_NAME, heap_area_p(), pips_assert, pips_internal_error, ram_function, ram_section, STACK_AREA_LOCAL_NAME, stack_area_p(), STATIC_AREA_LOCAL_NAME, static_area_p(), storage_formal, storage_ram, string_undefined, and variable_return_p().

Referenced by add_conflicts(), entities_maymust_conflict_p(), entity_locations_max(), opkill_may_name(), and opkill_must_name().

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