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

Go to the source code of this file.

Functions

entity undefined_pointer_value_entity ()
 pointer_values.c More...
 
cell make_undefined_pointer_value_cell ()
 
bool undefined_pointer_value_entity_p (entity e)
 
bool undefined_pointer_value_cell_p (cell c)
 
entity null_pointer_value_entity ()
 
cell make_null_pointer_value_cell ()
 
bool null_pointer_value_entity_p (entity e)
 
bool null_pointer_value_cell_p (cell c)
 
bool abstract_pointer_value_entity_p (entity e)
 
bool abstract_pointer_value_cell_p (cell c)
 
cell_relation make_value_of_pointer_value (cell c1, cell c2, tag app_tag, descriptor d)
 
cell_relation make_address_of_pointer_value (cell c1, cell c2, tag app_tag, descriptor d)
 
bool pv_cells_syntactically_equal_p (cell_relation pv1, cell_relation pv2)
 
bool pv_cells_mergeable_p (cell_relation pv1, cell_relation pv2)
 

Function Documentation

◆ abstract_pointer_value_cell_p()

bool abstract_pointer_value_cell_p ( cell  c)

Definition at line 121 of file pointer_values.c.

122 {
124 }
entity cell_entity(cell)
Definition: effects.c:57
bool abstract_pointer_value_entity_p(entity e)

References abstract_pointer_value_entity_p(), and cell_entity().

Referenced by kill_pointer_value().

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

◆ abstract_pointer_value_entity_p()

bool abstract_pointer_value_entity_p ( entity  e)

Definition at line 115 of file pointer_values.c.

116 {
119 }
bool null_pointer_value_entity_p(entity e)
bool undefined_pointer_value_entity_p(entity e)

References null_pointer_value_entity_p(), and undefined_pointer_value_entity_p().

Referenced by abstract_pointer_value_cell_p().

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

◆ make_address_of_pointer_value()

cell_relation make_address_of_pointer_value ( cell  c1,
cell  c2,
tag  app_tag,
descriptor  d 
)
Parameters
c11
c22
app_tagpp_tag

Definition at line 142 of file pointer_values.c.

143 {
146  cell_relation pv = make_cell_relation(ic1, ic2, make_approximation(app_tag, UU), d);
147  return(pv);
148 }
cell_relation make_cell_relation(interpreted_cell a1, interpreted_cell a2, approximation a3, descriptor a4)
Definition: effects.c:341
interpreted_cell make_interpreted_cell(cell a1, cell_interpretation a2)
Definition: effects.c:709
cell_interpretation make_cell_interpretation_value_of(void)
Definition: effects.c:237
cell_interpretation make_cell_interpretation_address_of(void)
Definition: effects.c:240
approximation make_approximation(enum approximation_utype tag, void *val)
Definition: effects.c:176
#define UU
Definition: newgen_types.h:98

References make_approximation(), make_cell_interpretation_address_of(), make_cell_interpretation_value_of(), make_cell_relation(), make_interpreted_cell(), and UU.

Referenced by make_anywhere_anywhere_pvs(), make_simple_pv_from_simple_effects(), module_initial_parameter_pv(), simple_pv_may_union(), simple_pv_must_union(), and simple_pv_translate().

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

◆ make_null_pointer_value_cell()

cell make_null_pointer_value_cell ( void  )

Definition at line 93 of file pointer_values.c.

94 {
97 }
cell make_cell_reference(reference _field_)
Definition: effects.c:293
reference make_reference(entity a1, list a2)
Definition: ri.c:2083
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
entity null_pointer_value_entity()

References make_cell_reference(), make_reference(), NIL, and null_pointer_value_entity().

Referenced by call_to_post_pv(), expression_to_post_pv(), null_to_sinks(), pointer_formal_parameter_to_stub_points_to(), and reference_condition_to_points_to().

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

◆ make_undefined_pointer_value_cell()

cell make_undefined_pointer_value_cell ( void  )

Definition at line 62 of file pointer_values.c.

63 {
66 }
entity undefined_pointer_value_entity()
pointer_values.c

References make_cell_reference(), make_reference(), NIL, and undefined_pointer_value_entity().

Referenced by expression_to_post_pv(), free_to_post_pv(), make_simple_pv_from_simple_effects(), and pointer_values_remove_var().

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

◆ make_value_of_pointer_value()

cell_relation make_value_of_pointer_value ( cell  c1,
cell  c2,
tag  app_tag,
descriptor  d 
)
Parameters
c11
c22
app_tagpp_tag

Definition at line 129 of file pointer_values.c.

130 {
134 
136  pv = make_cell_relation(ic2, ic1, make_approximation(app_tag, UU), d);
137  else
138  pv = make_cell_relation(ic1, ic2, make_approximation(app_tag, UU), d);
139  return(pv);
140 }
#define cell_relation_undefined
Definition: effects.h:485
bool null_pointer_value_cell_p(cell c)
bool undefined_pointer_value_cell_p(cell c)

References cell_relation_undefined, make_approximation(), make_cell_interpretation_value_of(), make_cell_relation(), make_interpreted_cell(), null_pointer_value_cell_p(), undefined_pointer_value_cell_p(), and UU.

Referenced by kill_pointer_value(), make_simple_pv_from_simple_effects(), and simple_pv_translate().

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

◆ null_pointer_value_cell_p()

bool null_pointer_value_cell_p ( cell  c)

Definition at line 104 of file pointer_values.c.

105 {
106  reference r;
107  if (cell_gap_p(c)) return false;
108  else if (cell_reference_p(c))
109  r = cell_reference(c);
110  else
113 }
#define cell_reference(x)
Definition: effects.h:469
#define cell_preference(x)
Definition: effects.h:472
#define cell_reference_p(x)
Definition: effects.h:467
#define cell_gap_p(x)
Definition: effects.h:473
#define reference_variable(x)
Definition: ri.h:2326
#define preference_reference(x)
Definition: ri.h:2102

References cell_gap_p, cell_preference, cell_reference, cell_reference_p, null_pointer_value_entity_p(), preference_reference, and reference_variable.

Referenced by generic_effect_find_aliases_with_simple_pointer_values(), generic_effect_find_equivalent_simple_pointer_values(), make_value_of_pointer_value(), multiple_pointer_assignment_to_post_pv(), single_pointer_assignment_to_post_pv(), and source_to_sinks().

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

◆ null_pointer_value_entity()

entity null_pointer_value_entity ( void  )

Definition at line 87 of file pointer_values.c.

88 {
89  return entity_null_locations();
90 }
entity entity_null_locations()
return TOP-LEVEL:NULL_POINTER The NULL pointer should be a global variable, unique for all modules FI...

References entity_null_locations().

Referenced by declaration_to_post_pv(), make_null_pointer_value_cell(), and pointer_expression_to_transformer().

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

◆ null_pointer_value_entity_p()

bool null_pointer_value_entity_p ( entity  e)

Definition at line 99 of file pointer_values.c.

100 {
101  return entity_null_locations_p(e);
102 }
bool entity_null_locations_p(entity e)
test if an entity is the NULL POINTER

References entity_null_locations_p().

Referenced by abstract_pointer_value_entity_p(), convex_effect_to_constant_path_effects_with_pointer_values(), external_value_name(), have_null_value_in_pointer_expression_p(), null_pointer_value_cell_p(), pips_user_value_name(), and simple_effect_to_constant_path_effects_with_pointer_values().

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

◆ pv_cells_mergeable_p()

bool pv_cells_mergeable_p ( cell_relation  pv1,
cell_relation  pv2 
)

value_of pvs, try to see if their cells are inverted

Parameters
pv1v1
pv2v2

Definition at line 230 of file pointer_values.c.

231 {
232 
233 
234  bool value_of_1_p = cell_relation_second_value_of_p(pv1);
235  bool value_of_2_p = cell_relation_second_value_of_p(pv1);
236 
237  if ( (value_of_1_p && !value_of_2_p) || (value_of_2_p && !value_of_1_p))
238  return false;
239 
240  cell c_first_1 = cell_relation_first_cell(pv1);
241  cell c_second_1 = cell_relation_second_cell(pv1);
242 
243  cell c_first_2 = cell_relation_first_cell(pv2);
244  cell c_second_2 = cell_relation_second_cell(pv2);
245 
246  int n_first_first = cell_compare(&c_first_1, &c_first_2);
247 
248  if (n_first_first == 0)
249  {
250  int n_second_second = cell_compare(&c_second_1, &c_second_2);
251 
252  if (n_second_second != 0)
253  {
254  if (cell_entity(c_second_1) != cell_entity(c_second_2)
257  return false;
258  }
259  }
260  else
261  {
262  if (!value_of_1_p)
263  return false;
264  else /* value_of pvs, try to see if their cells are inverted */
265  {
266  int n_first_second = cell_compare(&c_first_1, &c_second_2);
267  if (n_first_second == 0)
268  {
269  int n_second_first = cell_compare(&c_second_1, &c_first_2);
270 
271  if (n_second_first != 0)
272  return false;
273  }
274  else
275  return false;
276 
277  }
278  }
279 
282 
283  if (descriptor_none_p(d1) && descriptor_none_p(d2))
284  {
285  return true;
286  }
287  else
288  pips_internal_error("Convex pointer_values not implemented yet");
289 
290  return false;
291 }
int cell_compare(cell *c1, cell *c2)
Definition: compare.c:168
#define cell_relation_second_cell(cr)
#define cell_relation_second_value_of_p(cr)
#define cell_relation_first_cell(cr)
reference cell_any_reference(cell)
API for reference.
Definition: effects.c:77
#define cell_relation_descriptor(x)
Definition: effects.h:517
#define descriptor_none_p(x)
Definition: effects.h:602
size_t gen_length(const list l)
Definition: list.c:150
#define pips_internal_error
Definition: misc-local.h:149
#define reference_indices(x)
Definition: ri.h:2328

References cell_any_reference(), cell_compare(), cell_entity(), cell_relation_descriptor, cell_relation_first_cell, cell_relation_second_cell, cell_relation_second_value_of_p, descriptor_none_p, gen_length(), pips_internal_error, and reference_indices.

Referenced by pvs_union_combinable_p().

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

◆ pv_cells_syntactically_equal_p()

bool pv_cells_syntactically_equal_p ( cell_relation  pv1,
cell_relation  pv2 
)

value_of pvs, try to see if their cells are inverted

Parameters
pv1v1
pv2v2

Definition at line 162 of file pointer_values.c.

163 {
164 
165 
166  bool value_of_1_p = cell_relation_second_value_of_p(pv1);
167  bool value_of_2_p = cell_relation_second_value_of_p(pv1);
168 
169  if ( (value_of_1_p && !value_of_2_p) || (value_of_2_p && !value_of_1_p))
170  return false;
171 
172  cell c_first_1 = cell_relation_first_cell(pv1);
173  cell c_second_1 = cell_relation_second_cell(pv1);
174 
175  cell c_first_2 = cell_relation_first_cell(pv2);
176  cell c_second_2 = cell_relation_second_cell(pv2);
177 
178  int n_first_first = cell_compare(&c_first_1, &c_first_2);
179 
180  if (n_first_first == 0)
181  {
182  int n_second_second = cell_compare(&c_second_1, &c_second_2);
183 
184  if (n_second_second != 0)
185  return false;
186  }
187  else
188  {
189  if (!value_of_1_p)
190  return false;
191  else /* value_of pvs, try to see if their cells are inverted */
192  {
193  int n_first_second = cell_compare(&c_first_1, &c_second_2);
194  if (n_first_second == 0)
195  {
196  int n_second_first = cell_compare(&c_second_1, &c_first_2);
197 
198  if (n_second_first != 0)
199  return false;
200  }
201  else
202  return false;
203 
204  }
205  }
206 
209 
210  if (descriptor_none_p(d1) && descriptor_none_p(d2))
211  {
212  return true;
213  }
214  else
215  pips_internal_error("Convex pointer_values not implemented yet");
216 
217  return false;
218 }

References cell_compare(), cell_relation_descriptor, cell_relation_first_cell, cell_relation_second_cell, cell_relation_second_value_of_p, descriptor_none_p, and pips_internal_error.

Referenced by simple_pvs_syntactically_equal_p().

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

◆ undefined_pointer_value_cell_p()

◆ undefined_pointer_value_entity()

entity undefined_pointer_value_entity ( void  )

pointer_values.c

Definition at line 42 of file pointer_values.c.

43 {
45  string u_name = strdup(concatenate(ANY_MODULE_NAME,
48  NULL));
49  u = gen_find_tabulated(u_name, entity_domain);
50  if(entity_undefined_p(u)) {
51  type tv = make_type_void(NIL);
53  type t = make_type_variable(v);
54  u = make_entity(u_name,
57  }
58  return u;
59 }
value make_value_unknown(void)
Definition: ri.c:2847
type make_type_variable(variable _field_)
Definition: ri.c:2715
storage make_storage_rom(void)
Definition: ri.c:2285
type make_type_void(list _field_)
Definition: ri.c:2727
basic make_basic_pointer(type _field_)
Definition: ri.c:179
variable make_variable(basic a1, list a2, list a3)
Definition: ri.c:2895
#define UNDEFINED_POINTER_VALUE_NAME
#define ANY_MODULE_NAME
#define MODULE_SEP_STRING
Definition: naming-local.h:30
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
void * gen_find_tabulated(const char *, int)
Definition: tabulated.c:218
#define make_entity(n, t, s, i)
@ ABSTRACT_LOCATION
#define entity_undefined_p(x)
Definition: ri.h:2762
#define entity_undefined
Definition: ri.h:2761
#define entity_kind(x)
Definition: ri.h:2798
#define entity_domain
newgen_syntax_domain_defined
Definition: ri.h:410
char * strdup()

References ABSTRACT_LOCATION, ANY_MODULE_NAME, concatenate(), entity_domain, entity_kind, entity_undefined, entity_undefined_p, gen_find_tabulated(), make_basic_pointer(), make_entity, make_storage_rom(), make_type_variable(), make_type_void(), make_value_unknown(), make_variable(), MODULE_SEP_STRING, NIL, strdup(), and UNDEFINED_POINTER_VALUE_NAME.

Referenced by declaration_to_post_pv(), make_undefined_pointer_value_cell(), and sequence_to_post_pv().

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

◆ undefined_pointer_value_entity_p()

bool undefined_pointer_value_entity_p ( entity  e)

Definition at line 68 of file pointer_values.c.

69 {
70  bool res;
73  return res;
74 }
#define same_string_p(s1, s2)
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
const char * entity_module_name(entity e)
See comments about module_name().
Definition: entity.c:1092

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

Referenced by abstract_pointer_value_entity_p(), convex_effect_to_constant_path_effects_with_pointer_values(), simple_effect_to_constant_path_effects_with_pointer_values(), and undefined_pointer_value_cell_p().

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