PIPS
alias_pairs.c File Reference
#include <stdio.h>
#include <string.h>
#include <setjmp.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "database.h"
#include "ri-util.h"
#include "effects-util.h"
#include "misc.h"
#include "text.h"
#include "effects-generic.h"
#include "effects-convex.h"
#include "semantics.h"
#include "transformer.h"
#include "pipsdbm.h"
#include "dg.h"
#include "graph.h"
+ Include dependency graph for alias_pairs.c:

Go to the source code of this file.

Macros

#define BACKWARD   true
 
#define FORWARD   false
 

Typedefs

typedef dg_arc_label arc_label
 Instantiation of the dependence graph: More...
 
typedef dg_vertex_label vertex_label
 

Functions

static Pbase make_base_phi_variables (region reg)
 creation of a Pbase containing just the PHI variables of the region More...
 
static region restrict_to_phi_constraints (region reg)
 strips from the region all the constraints which do not affect (even transitively) the PHI variables i.e. More...
 
static region convert_exact_to_exact_may (region reg)
 "convert" EXACT regions to exact representations of MAY-in-the-usual-dataflow-sense regions More...
 
static region approx_convert_may_to_approx_may (region reg)
 all MAY regions are "converted" to over-approximate representations of MAY-in-the-usual-dataflow-sense regions (some regions may in fact be precise representations of MAY-in-the-usual-dataflow-sense regions after this operation, but we cannot detect which) More...
 
static region approx_convert (region reg)
 takes EXACT (i.e. More...
 
static bool stmt_filter (statement s)
 modifies global var current_caller_stmt More...
 
static void add_parameter_aliases_for_this_call_site (call call_site __attribute__((unused)), transformer context, list real_args)
 static void add_parameter_aliases_for_this_call_site(call call_site, transformer context, list real_args) constructs the alias pairs for the effective parameters (but not for COMMON regions) at this call site and adds them to the list input : parameters: a call site and the calling context global variables: callee,list_regions_callee,list_pairs output : void global vars IN: list_regions_callee and list_pairs modifies : global var list_pairs for each region in list_regions_callee which is a region of a formal parameter (of the callee) and for which the corresponding real parameter is an expression with only one entity, this function performs the backward translation: callee_region -> real_region and adds an alias pair <callee_region,real_region> to list_pairs comment :
More...
 
static bool add_alias_pairs_for_this_call_site (call call_site)
 constructs the alias pairs for this call site and adds them to the list global vars IN: callee, list_regions_callee, current_caller_stmt and list_pairs modifies global var: list_pairs More...
 
static void add_alias_pairs_for_this_caller (entity caller)
 constructs the alias pairs for this caller and adds them to the list global vars IN: callee, list_regions_callee and list_pairs modifies global vars: list_pairs and current_caller_stmt More...
 
static list alias_pairs (const char *module_name, list l_reg)
 generic function (i.e. More...
 
bool in_alias_pairs (const string module_name)
 top-level creation of pairs of aliases of IN regions of the module modifies global vars callee, list_regions_callee, list_pairs and current_caller_stmt More...
 
bool out_alias_pairs (const char *module_name)
 top-level creation of pairs of aliases of OUT regions of the module modifies global vars callee, list_regions_callee, list_pairs and current_caller_stmt More...
 

Variables

static entity callee
 
static list list_regions_callee = NIL
 
static statement current_caller_stmt = statement_undefined
 
static list list_pairs = NIL
 

Macro Definition Documentation

◆ BACKWARD

#define BACKWARD   true

Definition at line 58 of file alias_pairs.c.

◆ FORWARD

#define FORWARD   false

Definition at line 59 of file alias_pairs.c.

Typedef Documentation

◆ arc_label

Instantiation of the dependence graph:

Definition at line 53 of file alias_pairs.c.

◆ vertex_label

Definition at line 54 of file alias_pairs.c.

Function Documentation

◆ add_alias_pairs_for_this_call_site()

static bool add_alias_pairs_for_this_call_site ( call  call_site)
static

constructs the alias pairs for this call site and adds them to the list global vars IN: callee, list_regions_callee, current_caller_stmt and list_pairs modifies global var: list_pairs

pips_debug(9, "try load_statement_precondition for statement %03d\n", statement_number(current_caller_stmt));

transformer_to_string no longer implemented

pips_debug(9,"got context:\n\t%s\n",transformer_to_string(context));

pips_debug(9,"try call_arguments\n");

pips_debug(9,"try set_interprocedural_translation_context_sc\n"); pips_debug(9,"\tfor callee %s\n",entity_name(callee));

pips_debug(9,"try set_backward_arguments_to_eliminate\n");

add_common_aliases_for_this_call_site();

Definition at line 392 of file alias_pairs.c.

393 {
395  list real_args;
396 
397  if (call_function(call_site) != callee) return true;
398 
399  pips_debug(4,"begin\n");
400 
401 /* pips_debug(9,
402  "try load_statement_precondition for statement %03d\n",
403  statement_number(current_caller_stmt));
404  */
405 
407 
408 /* transformer_to_string no longer implemented */
409 /* pips_debug(9,"got context:\n\t%s\n",transformer_to_string(context)); */
410 
411 /* pips_debug(9,"try call_arguments\n"); */
412 
413  real_args = call_arguments(call_site);
414 
415 /* pips_debug(9,"try set_interprocedural_translation_context_sc\n");
416  pips_debug(9,"\tfor callee %s\n",entity_name(callee)); */
417 
419 
420 /* pips_debug(9,"try set_backward_arguments_to_eliminate\n"); */
421 
423 
425 /* add_common_aliases_for_this_call_site(); */
426 
429 
430  pips_debug(4,"end\n");
431 
432  return true;
433 }
static statement current_caller_stmt
Definition: alias_pairs.c:64
static void add_parameter_aliases_for_this_call_site(call call_site __attribute__((unused)), transformer context, list real_args)
static void add_parameter_aliases_for_this_call_site(call call_site, transformer context,...
Definition: alias_pairs.c:270
static entity callee
Definition: alias_pairs.c:62
void set_backward_arguments_to_eliminate(entity)
void set_interprocedural_translation_context_sc(entity, list)
void reset_arguments_to_eliminate(void)
void reset_translation_context_sc(void)
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define call_function(x)
Definition: ri.h:709
#define call_arguments(x)
Definition: ri.h:711
transformer load_statement_precondition(statement)
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
Definition: delay.c:253

References add_parameter_aliases_for_this_call_site(), call_arguments, call_function, callee, current_caller_stmt, load_statement_precondition(), pips_debug, reset_arguments_to_eliminate(), reset_translation_context_sc(), set_backward_arguments_to_eliminate(), and set_interprocedural_translation_context_sc().

Referenced by add_alias_pairs_for_this_caller().

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

◆ add_alias_pairs_for_this_caller()

static void add_alias_pairs_for_this_caller ( entity  caller)
static

constructs the alias pairs for this caller and adds them to the list global vars IN: callee, list_regions_callee and list_pairs modifies global vars: list_pairs and current_caller_stmt

ATTENTION: we must do ALL this before calling set_interprocedural_translation_context_sc (in add_alias_pairs_for_this_call_site called by the gen_multi_recurse below) !!!

the current module becomes the caller

that's it, but we musn't forget to reset it all again below !

gen_multi_recurse(obj, [domain, filter, rewrite,]* NULL);

recurse from object obj, applies filter_i on encountered domain_i objects, if true, recurses down from the domain_i object, and applies rewrite_i on exit from the object.

Definition at line 441 of file alias_pairs.c.

442 {
443  const char *caller_name;
444  statement caller_statement;
445 
448  caller_name = module_local_name(caller);
449  pips_debug(4,"begin for caller: %s\n", caller_name);
450 
451  /* ATTENTION: we must do ALL this before calling
452  * set_interprocedural_translation_context_sc
453  * (in add_alias_pairs_for_this_call_site
454  * called by the gen_multi_recurse below) !!!
455  */
456  /* the current module becomes the caller */
457  regions_init();
460  db_get_memory_resource(DBR_CODE, caller_name, true) );
462  db_get_memory_resource(DBR_CUMULATED_EFFECTS, caller_name, true));
464  db_get_memory_resource(DBR_PROPER_EFFECTS, caller_name, true));
465  module_to_value_mappings(caller);
467  db_get_memory_resource(DBR_PRECONDITIONS, caller_name, true));
468  /* that's it,
469  * but we musn't forget to reset it all again below !
470  */
471 
472  caller_statement = get_current_module_statement();
473 
474 
475 /* gen_multi_recurse(obj,
476  * [domain, filter, rewrite,]*
477  * NULL);
478  *
479  * recurse from object obj,
480  * applies filter_i on encountered domain_i objects,
481  * if true, recurses down from the domain_i object,
482  * and applies rewrite_i on exit from the object.
483  */
484 
485  gen_multi_recurse(caller_statement,
487  stmt_filter,
488  gen_null,
489  call_domain,
491  gen_null,
492  NULL);
493 
499  regions_end();
500 
503 
504  pips_debug(4,"end\n");
505 
506 }
static const char * caller_name
Definition: alias_check.c:122
static bool add_alias_pairs_for_this_call_site(call call_site)
constructs the alias pairs for this call site and adds them to the list global vars IN: callee,...
Definition: alias_pairs.c:392
static bool stmt_filter(statement s)
modifies global var current_caller_stmt
Definition: alias_pairs.c:222
void get_in_out_regions_properties(void)
void regions_end(void)
void regions_init(void)
void reset_proper_rw_effects(void)
void set_proper_rw_effects(statement_effects)
void set_cumulated_rw_effects(statement_effects)
void reset_cumulated_rw_effects(void)
void reset_current_module_entity(void)
Reset the current module entity.
Definition: static.c:97
void reset_current_module_statement(void)
Reset the current module statement.
Definition: static.c:221
statement set_current_module_statement(statement)
Set the current module statement.
Definition: static.c:165
statement get_current_module_statement(void)
Get the current module statement.
Definition: static.c:208
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
void gen_multi_recurse(void *o,...)
Multi recursion visitor function.
Definition: genClib.c:3428
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
Definition: genClib.c:2752
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
Definition: database.c:755
const char * module_local_name(entity e)
Returns the module local user name.
Definition: entity.c:582
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362
#define call_domain
newgen_callees_domain_defined
Definition: ri.h:58
void module_to_value_mappings(entity m)
void module_to_value_mappings(entity m): build hash tables between variables and values (old,...
Definition: mappings.c:624
void reset_precondition_map(void)
void set_precondition_map(statement_mapping)
void free_value_mappings(void)
Normal call to free the mappings.
Definition: value.c:1212

References add_alias_pairs_for_this_call_site(), call_domain, callee, caller_name, db_get_memory_resource(), free_value_mappings(), gen_multi_recurse(), gen_null(), get_current_module_statement(), get_in_out_regions_properties(), module_local_name(), module_to_value_mappings(), pips_debug, regions_end(), regions_init(), reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), reset_precondition_map(), reset_proper_rw_effects(), set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), set_precondition_map(), set_proper_rw_effects(), statement_domain, and stmt_filter().

Referenced by alias_pairs().

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

◆ add_parameter_aliases_for_this_call_site()

static void add_parameter_aliases_for_this_call_site ( call call_site   __attribute__(unused),
transformer  context,
list  real_args 
)
static

static void add_parameter_aliases_for_this_call_site(call call_site, transformer context, list real_args) constructs the alias pairs for the effective parameters (but not for COMMON regions) at this call site and adds them to the list input : parameters: a call site and the calling context global variables: callee,list_regions_callee,list_pairs output : void global vars IN: list_regions_callee and list_pairs modifies : global var list_pairs for each region in list_regions_callee which is a region of a formal parameter (of the callee) and for which the corresponding real parameter is an expression with only one entity, this function performs the backward translation: callee_region -> real_region and adds an alias pair <callee_region,real_region> to list_pairs comment :

Algorithm :

let list_regions_callee be the list of the regions on variables of callee let list_pairs be the list of alias pairs for the callee

FOR each expression real_exp IN real_args arg_num = number in the list of the function real arguments FOR each callee_region IN list_regions_callee callee_ent = entity of the region callee_region IF callee_ent is the formal parameter numbered arg_num IF real_exp is an lhs (expression with one entity) real_region = translation of the region callee_region list_pairs = list_pairs + <callee_region,real_region> ENDIF ENDIF ENDFOR ENDFOR

real_args = call_arguments(call_site);

entity callee_ent = region_entity(callee_region);

If the formal parameter corresponds to the real argument then we perform the translation.

If the real argument is a reference to an entity, then we translate the regions of the corresponding formal parameter

the actual parameter must be expressed relative to the store at the point of entry of the caller, so that it can be compared to other regions

convert actual and formal regions to MAY-in-the-usual-dataflow-sense

gave Newgen error formal = approx_convert(callee_region);

Definition at line 270 of file alias_pairs.c.

273 {
274  list r_args;
275  int arg_num;
276 
277  pips_debug(4,"begin\n");
278 
279 /* real_args = call_arguments(call_site); */
280 
281  for (r_args = real_args, arg_num = 1; r_args != NIL;
282  r_args = CDR(r_args), arg_num++)
283  {
284  pips_debug(9,"compare formal parameter arg_num %03d\n",arg_num);
285 
286  MAP(EFFECT, callee_region,
287  {
288 /* entity callee_ent = region_entity(callee_region); */
289 
290  pips_debug(9,"\tand entity %s\n",
291  entity_name(region_entity(callee_region)));
292 
293  /* If the formal parameter corresponds to the real argument then
294  * we perform the translation.
295  */
296  if (ith_parameter_p(callee,region_entity(callee_region),arg_num))
297  {
298  expression real_exp = EXPRESSION(CAR(r_args));
299  syntax real_syn = expression_syntax(real_exp);
300 
301  pips_debug(9,"match\n");
302 
303  /* If the real argument is a reference to an entity, then we
304  * translate the regions of the corresponding formal parameter
305  */
306  if (syntax_reference_p(real_syn))
307  {
308  reference real_ref = syntax_reference(real_syn);
309  entity real_ent = reference_variable(real_ref);
310  region trans;
311  region formal;
312  region actual;
313  list pair;
314 
315  pips_debug(9,"arg refers to entity\n");
316  pips_debug(9,"\t%s\n",entity_name(real_ent));
317 
318  trans =
320  callee_region,
321  callee,
323  real_ent,
325  real_ref,
326  VALUE_ZERO,
327  BACKWARD);
328 
329  pair = CONS(EFFECT,trans,NIL);
330 
331  ifdebug(9)
332  {
333  pips_debug(9,"region translated to:\n\t");
334  print_inout_regions(pair);
335  }
336 
337  /* the actual parameter must be expressed relative to
338  the store at the point of entry of the caller, so
339  that it can be compared to other regions */
340 
341  pair =
343 
344  ifdebug(9)
345  {
346  pips_debug(9,"relative to initial store:\n\t");
347  print_inout_regions(pair);
348  }
349 
350  /* convert actual and formal regions to
351  MAY-in-the-usual-dataflow-sense */
352  actual = approx_convert(EFFECT(CAR(pair)));
353 
354  pair = CONS(EFFECT,actual,NIL);
355 
356  ifdebug(9)
357  {
358  pips_debug(9,"restricted to:\n\t");
359  print_inout_regions(pair);
360  }
361 
362 /* gave Newgen error
363  formal = approx_convert(callee_region); */
364 
365  formal = approx_convert(region_dup(callee_region));
366 
367  pair = CONS(EFFECT,formal,pair);
368 
369  ifdebug(9)
370  {
371  pips_debug(9,"alias pair:\n\t");
372  print_inout_regions(pair);
373  }
374 
376  }
377  }
379  }
380 
381  pips_debug(4,"end\n");
382 
383 }
effects make_effects(list a)
Definition: effects.c:568
static list list_pairs
Definition: alias_pairs.c:65
static list list_regions_callee
Definition: alias_pairs.c:63
#define BACKWARD
Definition: alias_pairs.c:58
static region approx_convert(region reg)
takes EXACT (i.e.
Definition: alias_pairs.c:191
#define VALUE_ZERO
#define region_entity(reg)
#define region
simulation of the type region
effect region_dup(effect)
effect region_translation(effect, entity, reference, entity, entity, reference, Value, bool)
void print_inout_regions(list)
list convex_regions_transformer_compose(list, transformer)
compose.c
#define EFFECTS(x)
EFFECTS.
Definition: effects.h:682
#define EFFECT(x)
EFFECT.
Definition: effects.h:608
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
Definition: newgen_list.h:226
bool ith_parameter_p(entity, entity, int)
returns true if v is the ith formal parameter of function f
Definition: util.c:125
#define syntax_reference_p(x)
Definition: ri.h:2728
#define syntax_reference(x)
Definition: ri.h:2730
#define reference_undefined
Definition: ri.h:2302
#define reference_variable(x)
Definition: ri.h:2326
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define entity_name(x)
Definition: ri.h:2790
struct _newgen_struct_formal_ * formal
Definition: ri.h:191
#define expression_syntax(x)
Definition: ri.h:1247
#define ifdebug(n)
Definition: sg.c:47

References approx_convert(), BACKWARD, callee, CAR, CDR, CONS, convex_regions_transformer_compose(), EFFECT, EFFECTS, entity_name, EXPRESSION, expression_syntax, get_current_module_entity(), ifdebug, ith_parameter_p(), list_pairs, list_regions_callee, make_effects(), MAP, NIL, pips_debug, print_inout_regions(), reference_undefined, reference_variable, region, region_dup(), region_entity, region_translation(), syntax_reference, syntax_reference_p, and VALUE_ZERO.

Referenced by add_alias_pairs_for_this_call_site().

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

◆ alias_pairs()

static list alias_pairs ( const char *  module_name,
list  l_reg 
)
static

generic function (i.e.

used for IN and OUT regions) for constructing the list of alias pairs for this module parameters: module name and list of regions global vars IN: none modifies global vars: callee, list_regions_callee, current_caller_stmt and list_pairs

ATTENTION: we have to do ALL this just to call print_inout_regions for debug !!

that's it, but we musn't forget to reset everything below

we need the callers of the current module

we scan the callers to find the call sites, and fill in the list of alias pairs (list_pairs)

Definition at line 517 of file alias_pairs.c.

518 {
519 
520  callees callers;
521 
522  pips_debug(4,"begin for module %s\n",module_name);
523 
526  list_regions_callee = l_reg;
527 
528  ifdebug(9)
529  {
530  /* ATTENTION: we have to do ALL this
531  * just to call print_inout_regions for debug !!
532  */
534  db_get_memory_resource(DBR_CODE,
535  module_name,
536  true) );
539  DBR_CUMULATED_EFFECTS,
540  module_name,
541  true));
544  DBR_PROPER_EFFECTS,
545  module_name,
546  true));
548  /* that's it, but we musn't forget to reset everything below */
549 
550  pips_debug(9,"list_regions_callee is: \n");
552 
557  }
558 
559  /* we need the callers of the current module */
560  callers = (callees) db_get_memory_resource(DBR_CALLERS,
561  module_name,
562  true);
563 
564  /* we scan the callers to find the call sites,
565  * and fill in the list of alias pairs (list_pairs)
566  */
567  list_pairs = NIL;
569  {
572  },
573  callees_callees(callers));
574 
576 
577  pips_debug(4,"end\n");
578 
579  return list_pairs;
580 }
static void add_alias_pairs_for_this_caller(entity caller)
constructs the alias pairs for this caller and adds them to the list global vars IN: callee,...
Definition: alias_pairs.c:441
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
#define STRING(x)
Definition: genC.h:87
entity local_name_to_top_level_entity(const char *n)
This function try to find a top-level entity from a local name.
Definition: entity.c:1450
struct _newgen_struct_callees_ * callees
Definition: ri.h:55
#define callees_callees(x)
Definition: ri.h:675

References add_alias_pairs_for_this_caller(), callee, callees_callees, caller_name, db_get_memory_resource(), free_value_mappings(), get_current_module_entity(), ifdebug, list_pairs, list_regions_callee, local_name_to_top_level_entity(), MAP, module_name(), module_to_value_mappings(), NIL, pips_debug, print_inout_regions(), reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), reset_proper_rw_effects(), set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), set_proper_rw_effects(), and STRING.

Referenced by in_alias_pairs(), and out_alias_pairs().

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

◆ approx_convert()

static region approx_convert ( region  reg)
static

takes EXACT (i.e.

precise representations of MUST in the usual dataflow sense) and MAY (i.e. over-approximate representations of MUST regions or either over-approximate or precise representations of MAY-in-the-usual-dataflow-sense) regions and "converts" them to exact or over-approximate representations of MAY-in-the-usual-dataflow-sense) regions by stripping all the constraints which do not affect (even transitively) the PHI variables

Definition at line 191 of file alias_pairs.c.

192 {
193  region new_reg;
194 
195  pips_debug(4,"begin\n");
196 
197  if (region_scalar_p(reg))
198  {
199  pips_debug(9,"scalar\n");
200 
201  new_reg = reg;
203  }
204  else
205  {
206  if ( effect_exact_p(reg) || effect_exact_p(reg) )
207  new_reg = convert_exact_to_exact_may(reg);
208  else
209  {
210  if (!effect_may_p(reg))
211  pips_debug(4,"unknown approximation tag\n");
212  new_reg = approx_convert_may_to_approx_may(reg);
213  }
214  }
215  pips_debug(4,"end\n");
216 
217  return new_reg;
218 }
static region convert_exact_to_exact_may(region reg)
"convert" EXACT regions to exact representations of MAY-in-the-usual-dataflow-sense regions
Definition: alias_pairs.c:145
static region approx_convert_may_to_approx_may(region reg)
all MAY regions are "converted" to over-approximate representations of MAY-in-the-usual-dataflow-sens...
Definition: alias_pairs.c:166
#define region_scalar_p(reg)
#define effect_may_p(eff)
#define effect_approximation_tag(eff)
#define effect_exact_p(eff)
@ is_approximation_exact
Definition: effects.h:343

References approx_convert_may_to_approx_may(), convert_exact_to_exact_may(), effect_approximation_tag, effect_exact_p, effect_may_p, is_approximation_exact, pips_debug, region, and region_scalar_p.

Referenced by add_parameter_aliases_for_this_call_site().

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

◆ approx_convert_may_to_approx_may()

static region approx_convert_may_to_approx_may ( region  reg)
static

all MAY regions are "converted" to over-approximate representations of MAY-in-the-usual-dataflow-sense regions (some regions may in fact be precise representations of MAY-in-the-usual-dataflow-sense regions after this operation, but we cannot detect which)

Definition at line 166 of file alias_pairs.c.

167 {
168  region new_reg;
169 
170  pips_debug(4,"begin\n");
171 
172  new_reg = restrict_to_phi_constraints(reg);
174 
175  pips_debug(4,"end\n");
176 
177  return(new_reg);
178 }
static region restrict_to_phi_constraints(region reg)
strips from the region all the constraints which do not affect (even transitively) the PHI variables ...
Definition: alias_pairs.c:106
@ is_approximation_may
Definition: effects.h:341

References effect_approximation_tag, is_approximation_may, pips_debug, region, and restrict_to_phi_constraints().

Referenced by approx_convert().

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

◆ convert_exact_to_exact_may()

static region convert_exact_to_exact_may ( region  reg)
static

"convert" EXACT regions to exact representations of MAY-in-the-usual-dataflow-sense regions

Definition at line 145 of file alias_pairs.c.

146 {
147  region new_reg;
148 
149  pips_debug(4,"begin\n");
150 
151  new_reg = restrict_to_phi_constraints(reg);
153 
154  pips_debug(4,"end\n");
155 
156  return(new_reg);
157 }

References effect_approximation_tag, is_approximation_exact, pips_debug, region, and restrict_to_phi_constraints().

Referenced by approx_convert().

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

◆ in_alias_pairs()

bool in_alias_pairs ( const string  module_name)

top-level creation of pairs of aliases of IN regions of the module modifies global vars callee, list_regions_callee, list_pairs and current_caller_stmt

cproto-generated files

we need the IN summary regions

was (but didn't work) l_reg = (list) db_get_memory_resource(DBR_IN_SUMMARY_REGIONS, module_name, true);

Parameters
module_nameodule_name

Definition at line 587 of file alias_pairs.c.

588 {
589  list l_reg, l_pairs;
590 
591  debug_on("ALIAS_PAIRS_DEBUG_LEVEL");
592  pips_debug(4,"begin for module %s\n",module_name);
593 
594  /* we need the IN summary regions*/
595  l_reg = effects_to_list((effects)
596  db_get_memory_resource(DBR_IN_SUMMARY_REGIONS,
597  module_name,
598  true));
599 
600 /* was (but didn't work)
601  l_reg = (list) db_get_memory_resource(DBR_IN_SUMMARY_REGIONS,
602  module_name,
603  true);
604  */
605 
606  l_pairs = alias_pairs(module_name, l_reg);
607 
608  DB_PUT_MEMORY_RESOURCE(DBR_IN_ALIAS_PAIRS,
610  (char*) make_effects_classes(l_pairs));
611 
612  pips_debug(4,"end\n");
613  debug_off();
614 
615  return(true);
616 
617 }
effects_classes make_effects_classes(list a)
Definition: effects.c:526
static list alias_pairs(const char *module_name, list l_reg)
generic function (i.e.
Definition: alias_pairs.c:517
list effects_to_list(effects)
Definition: effects.c:209
#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
Definition: pipsdbm-local.h:66
#define debug_on(env)
Definition: misc-local.h:157
#define debug_off()
Definition: misc-local.h:160
char * strdup()

References alias_pairs(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, effects_to_list(), make_effects_classes(), module_name(), pips_debug, and strdup().

Referenced by alias_lists().

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

◆ make_base_phi_variables()

static Pbase make_base_phi_variables ( region  reg)
static

creation of a Pbase containing just the PHI variables of the region

Definition at line 70 of file alias_pairs.c.

71 {
72  Pbase phi_variables;
73  list indices;
74 
75  pips_debug(4,"begin\n");
76  phi_variables = BASE_NULLE;
77 
79  MAP(EXPRESSION, index,
80  {
81  entity e;
82 
84  if (variable_phi_p(e))
85  {
86  pips_debug(9,"add: %s\n",entity_local_name(e));
87 
88  phi_variables = base_add_variable(phi_variables,(Variable) e);
89  }
90  },
91  indices);
92 
93  pips_debug(4,"end\n");
94 
95  return phi_variables;
96 }
Pbase base_add_variable(Pbase b, Variable var)
Pbase base_add_variable(Pbase b, Variable v): add variable v as a new dimension to basis b at the end...
Definition: base.c:88
#define region_any_reference(reg)
To be avoided.
#define variable_phi_p(e)
true if e is a phi variable PHI entities have a name like: REGIONS:PHI#, where # is a number.
static list indices
Definition: icm.c:204
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
#define reference_indices(x)
Definition: ri.h:2328
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
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
#define BASE_NULLE
MACROS SUR LES BASES.

References base_add_variable(), BASE_NULLE, entity_local_name(), EXPRESSION, expression_syntax, indices, MAP, pips_debug, reference_indices, reference_variable, region_any_reference, syntax_reference, and variable_phi_p.

Referenced by restrict_to_phi_constraints().

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

◆ out_alias_pairs()

bool out_alias_pairs ( const char *  module_name)

top-level creation of pairs of aliases of OUT regions of the module modifies global vars callee, list_regions_callee, list_pairs and current_caller_stmt

we need the OUT summary regions

was (but didn't work) l_reg = (list) db_get_memory_resource(DBR_OUT_SUMMARY_REGIONS, module_name, true);

Parameters
module_nameodule_name

Definition at line 623 of file alias_pairs.c.

624 {
625  list l_reg, l_pairs;
626 
627  debug_on("ALIAS_PAIRS_DEBUG_LEVEL");
628  pips_debug(4,"begin for module %s\n",module_name);
629 
630  /* we need the OUT summary regions*/
631  l_reg = effects_to_list((effects)
632  db_get_memory_resource(DBR_OUT_SUMMARY_REGIONS,
633  module_name,
634  true));
635 
636 /* was (but didn't work)
637  l_reg = (list) db_get_memory_resource(DBR_OUT_SUMMARY_REGIONS,
638  module_name,
639  true);
640  */
641 
642 
643  l_pairs = alias_pairs(module_name, l_reg);
644 
645  DB_PUT_MEMORY_RESOURCE(DBR_OUT_ALIAS_PAIRS,
647  (char*) make_effects_classes(l_pairs));
648 
649  pips_debug(4,"end\n");
650  debug_off();
651 
652  return(true);
653 
654 }

References alias_pairs(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, effects_to_list(), make_effects_classes(), module_name(), pips_debug, and strdup().

Referenced by alias_lists().

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

◆ restrict_to_phi_constraints()

static region restrict_to_phi_constraints ( region  reg)
static

strips from the region all the constraints which do not affect (even transitively) the PHI variables i.e.

the function representing the region no longer returns the empty region if a branch condition is not satisfied so the region becomes MAY-in-the-usual-dataflow-sense

Definition at line 106 of file alias_pairs.c.

107 {
108  Pbase phi_variables;
109  Psysteme sc;
110  region new_reg;
111 
112  pips_debug(4,"begin\n");
113 
114 
115  sc = region_system(reg);
116  phi_variables = make_base_phi_variables(reg);
117  new_reg = region_dup(reg);
118 
119  ifdebug(9)
120  {
122  pips_debug(9,"call sc_restricted_to_variables_transitive_closure for:\t\n");
123  print_region(reg);
124  }
125 
126  region_system(new_reg) =
128 
129  ifdebug(9)
130  {
131  pips_debug(9,"restricted region:\n\t");
132  print_region(new_reg);
134  }
135 
136  pips_debug(4,"end\n");
137 
138  return new_reg;
139 }
static Pbase make_base_phi_variables(region reg)
creation of a Pbase containing just the PHI variables of the region
Definition: alias_pairs.c:70
#define region_system(reg)
#define ACTION_IN
#define ACTION_OUT
void reset_action_interpretation(void)
void set_action_interpretation(string, string)
prettyprint.c
#define print_region(x)
Definition: print.c:343
Psysteme sc_restricted_to_variables_transitive_closure(Psysteme sc, Pbase variables)
for an improved dependence test (Beatrice Creusillet)
Definition: sc_misc.c:64

References ACTION_IN, ACTION_OUT, ifdebug, make_base_phi_variables(), pips_debug, print_region, region, region_dup(), region_system, reset_action_interpretation(), sc_restricted_to_variables_transitive_closure(), and set_action_interpretation().

Referenced by approx_convert_may_to_approx_may(), and convert_exact_to_exact_may().

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

◆ stmt_filter()

static bool stmt_filter ( statement  s)
static

modifies global var current_caller_stmt

Definition at line 222 of file alias_pairs.c.

224 {
225  pips_debug(9, "statement %td\n", statement_number(s));
226 
228  return(true);
229 }
#define statement_number(x)
Definition: ri.h:2452

References current_caller_stmt, pips_debug, and statement_number.

Referenced by add_alias_pairs_for_this_caller(), and drop_dummy_loops().

+ Here is the caller graph for this function:

Variable Documentation

◆ callee

◆ current_caller_stmt

statement current_caller_stmt = statement_undefined
static

Definition at line 64 of file alias_pairs.c.

Referenced by add_alias_pairs_for_this_call_site(), and stmt_filter().

◆ list_pairs

list list_pairs = NIL
static

Definition at line 65 of file alias_pairs.c.

Referenced by add_parameter_aliases_for_this_call_site(), and alias_pairs().

◆ list_regions_callee

list list_regions_callee = NIL
static

Definition at line 63 of file alias_pairs.c.

Referenced by add_parameter_aliases_for_this_call_site(), and alias_pairs().