PIPS
overlap.c File Reference
#include "defines-local.h"
+ Include dependency graph for overlap.c:

Go to the source code of this file.

Functions

bool expression_constant_p (expression)
 Overlap Management Module for HPFC Fabien Coelho, August 1993. More...
 
static void create_overlaps (entity e)
 in static_controlize More...
 
void set_overlap (entity ent, int dim, int side, int width)
 set_overlap(ent, dim, side, width) More...
 
int get_overlap (entity ent, int dim, int side)
 int get_overlap(ent, dim, side) More...
 
static void overlap_redefine_expression (expression *pexpr, int ov)
 static void overlap_redefine_expression(pexpr, ov) More...
 
static void declaration_with_overlaps (list l)
 
static void deal_with_similars (list le)
 updates overlaps for similar arrays that are going to be merged More...
 
void declaration_with_overlaps_for_module (entity module)
 

Function Documentation

◆ create_overlaps()

static void create_overlaps ( entity  e)
static

in static_controlize

Definition at line 36 of file overlap.c.

38 {
39  type t = entity_type(e);
40  list o=NIL;
41  int n;
42 
44 
46  for(; n>=1; n--) o = CONS(OVERLAP, make_overlap(0, 0), o);
47 
49 
51 }
overlap make_overlap(intptr_t a1, intptr_t a2)
Definition: hpf_private.c:740
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
size_t gen_length(const list l)
Definition: list.c:150
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
#define OVERLAP(x)
OVERLAP.
Definition: hpf_private.h:826
void store_overlap_status(entity, list)
bool bound_overlap_status_p(entity)
#define assert(ex)
Definition: newgen_assert.h:41
#define type_variable(x)
Definition: ri.h:2949
#define variable_dimensions(x)
Definition: ri.h:3122
#define entity_type(x)
Definition: ri.h:2792
#define type_variable_p(x)
Definition: ri.h:2947
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References assert, bound_overlap_status_p(), CONS, entity_type, gen_length(), make_overlap(), NIL, OVERLAP, store_overlap_status(), type_variable, type_variable_p, and variable_dimensions.

Referenced by get_overlap(), and set_overlap().

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

◆ deal_with_similars()

static void deal_with_similars ( list  le)
static

updates overlaps for similar arrays that are going to be merged

Definition at line 164 of file overlap.c.

165 {
166  FOREACH(ENTITY, array, le)
167  {
168  //if (entity_dynamic_p(array) && load_similar_mapping(array)!=array)
170  {
172  int dim;
173 
174  pips_debug(8, "translating overlaps from %s to %s\n",
175  entity_name(array), entity_name(sim));
176 
177  for (dim=variable_entity_dimension(array); dim>0; dim--)
178  {
179  int o;
180 
181  o = get_overlap(array, dim, 0);
182  set_overlap(sim, dim, 0, o);
183  o = get_overlap(array, dim, 1);
184  set_overlap(sim, dim, 1, o);
185  }
186  }
187  }
188 }
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
Definition: newgen_list.h:179
entity load_similar_mapping(entity)
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
int get_overlap(entity ent, int dim, int side)
int get_overlap(ent, dim, side)
Definition: overlap.c:88
void set_overlap(entity ent, int dim, int side, int width)
set_overlap(ent, dim, side, width)
Definition: overlap.c:59
bool variable_dynamic_p(entity)
Definition: variable.c:1586
int variable_entity_dimension(entity)
variable_entity_dimension(entity v): returns the dimension of variable v; scalar have dimension 0.
Definition: variable.c:1293
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define entity_name(x)
Definition: ri.h:2790
static entity array

References array, ENTITY, entity_name, FOREACH, get_overlap(), load_similar_mapping(), pips_debug, set_overlap(), variable_dynamic_p(), and variable_entity_dimension().

Referenced by declaration_with_overlaps_for_module().

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

◆ declaration_with_overlaps()

static void declaration_with_overlaps ( list  l)
static

Definition at line 126 of file overlap.c.

128 {
129  entity ent;
130  int ndim, i, lower_overlap, upper_overlap;
131  dimension the_dim;
132 
133  MAP(ENTITY, oldent,
134  {
135  ent = load_new_node(oldent);
136  ndim = variable_entity_dimension(ent);
137 
139 
140  for (i=1 ; i<=ndim ; i++)
141  {
142  the_dim = entity_ith_dimension(ent, i);
143  lower_overlap = get_overlap(oldent, i, 0);
144  upper_overlap = get_overlap(oldent, i, 1);
145 
146  debug(8, "declaration_with_overlaps",
147  "%s(DIM=%d): -%d, +%d\n",
148  entity_name(ent), i, lower_overlap, upper_overlap);
149 
150  if (lower_overlap!=0)
152  -lower_overlap);
153 
154  if (upper_overlap!=0)
156  upper_overlap);
157  }
158  },
159  l);
160 }
#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
entity load_new_node(entity)
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189
static void overlap_redefine_expression(expression *pexpr, int ov)
static void overlap_redefine_expression(pexpr, ov)
Definition: overlap.c:107
dimension entity_ith_dimension(entity, int)
Another semantics would be: is this reference r to e a kill for e? In general, this cannot be answere...
Definition: variable.c:1228
#define dimension_lower(x)
Definition: ri.h:980
#define dimension_upper(x)
Definition: ri.h:982

References assert, debug(), dimension_lower, dimension_upper, ENTITY, entity_ith_dimension(), entity_name, entity_type, get_overlap(), load_new_node(), MAP, overlap_redefine_expression(), type_variable_p, and variable_entity_dimension().

Referenced by declaration_with_overlaps_for_module().

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

◆ declaration_with_overlaps_for_module()

void declaration_with_overlaps_for_module ( entity  module)
Parameters
moduleodule

Definition at line 190 of file overlap.c.

192 {
194 
197  gen_free_list(l);
198 }
void gen_free_list(list l)
free the spine of the list
Definition: list.c:327
list list_of_distributed_arrays_for_module(entity module)
returns the list of entities that are 'local' to module
Definition: declarations.c:72
static void declaration_with_overlaps(list l)
Definition: overlap.c:126
static void deal_with_similars(list le)
updates overlaps for similar arrays that are going to be merged
Definition: overlap.c:164
static char * module
Definition: pips.c:74

References deal_with_similars(), declaration_with_overlaps(), gen_free_list(), list_of_distributed_arrays_for_module(), and module.

+ Here is the call graph for this function:

◆ expression_constant_p()

bool expression_constant_p ( expression  exp)

Overlap Management Module for HPFC Fabien Coelho, August 1993.

Overlap Management Module for HPFC Fabien Coelho, August 1993.

HPFC module by Fabien COELHO.

bool expression_constant_p(expression exp) Returns true if "exp" is an (integer) constant value.

Note : A negativePositive constant can be represented with a call to the unary minus/plus intrinsic function upon a positive value.

See below extended_expression_constant_p() for a more general function.

Definition at line 2453 of file expression.c.

2454 {
2456 }
constant expression_constant(expression exp)
This function returns a "constant" object if the expression is a constant such as 10,...
Definition: expression.c:2347
#define constant_undefined_p(x)
Definition: ri.h:803
#define exp
Avoid some warnings from "gcc -Wshadow".
Definition: vasnprintf.c:207

Referenced by overlap_redefine_expression().

+ Here is the caller graph for this function:

◆ get_overlap()

int get_overlap ( entity  ent,
int  dim,
int  side 
)

int get_overlap(ent, dim, side)

returns the overlap for a given entity, dimension and side, to be used in the declaration modifications

Parameters
entnt
dimim
sideide

Definition at line 88 of file overlap.c.

91 {
92  overlap o;
93 
94  assert(dim>0);
95 
98 
99  o = OVERLAP(gen_nth(dim-1, load_overlap_status(ent)));
100  return(side ? overlap_upper(o) : overlap_lower(o));
101 }
gen_chunk gen_nth(int n, const list l)
to be used as ENTITY(gen_nth(3, l))...
Definition: list.c:710
#define overlap_lower(x)
Definition: hpf_private.h:856
#define overlap_upper(x)
Definition: hpf_private.h:858
list load_overlap_status(entity)
static void create_overlaps(entity e)
in static_controlize
Definition: overlap.c:36

References assert, bound_overlap_status_p(), create_overlaps(), gen_nth(), load_overlap_status(), OVERLAP, overlap_lower, and overlap_upper.

Referenced by deal_with_similars(), and declaration_with_overlaps().

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

◆ overlap_redefine_expression()

static void overlap_redefine_expression ( expression pexpr,
int  ov 
)
static

static void overlap_redefine_expression(pexpr, ov)

redefine the bound given the overlap which is to be included

this avoid a memory leak

Definition at line 107 of file overlap.c.

110 {
111  expression
112  copy = *pexpr;
113 
114  if (expression_constant_p(*pexpr))
115  {
116  *pexpr = int_to_expression(HpfcExpressionToInt(*pexpr)+ov);
117  free_expression(copy); /* this avoid a memory leak */
118  }
119  else
122  *pexpr,
123  int_to_expression(ov));
124 }
void free_expression(expression p)
Definition: ri.c:853
int HpfcExpressionToInt(expression e)
HpfcExpressionToInt(e)
Definition: hpfc-util.c:569
#define TOP_LEVEL_MODULE_NAME
Module containing the global variables in Fortran and C.
Definition: naming-local.h:101
bool expression_constant_p(expression)
Overlap Management Module for HPFC Fabien Coelho, August 1993.
Definition: expression.c:2453
#define PLUS_OPERATOR_NAME
entity FindOrCreateEntity(const char *package, const char *local_name)
Problem: A functional global entity may be referenced without parenthesis or CALL keyword in a functi...
Definition: entity.c:1586
expression MakeBinaryCall(entity f, expression eg, expression ed)
Creates a call expression to a function with 2 arguments.
Definition: expression.c:354
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
Definition: expression.c:1188

References expression_constant_p(), FindOrCreateEntity(), free_expression(), HpfcExpressionToInt(), int_to_expression(), MakeBinaryCall(), PLUS_OPERATOR_NAME, and TOP_LEVEL_MODULE_NAME.

Referenced by declaration_with_overlaps().

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

◆ set_overlap()

void set_overlap ( entity  ent,
int  dim,
int  side,
int  width 
)

set_overlap(ent, dim, side, width)

set the overlap value for entity ent, on dimension dim, dans side side to width, which must be a positive integer.

set the overlap value for entity ent, on dimension dim, dans side side to width, which must be a positive integer. if necessary, the overlap is updates with the value width.

upper

lower

Parameters
entnt
dimim
sideide
widthidth

Definition at line 59 of file overlap.c.

62 {
63  overlap o;
64  int current;
65 
66  assert(dim>0);
67 
69  o = OVERLAP(gen_nth(dim-1, load_overlap_status(ent)));
70 
71  if (side) /* upper */
72  {
74  if (current<width) overlap_upper(o)=width;
75  }
76  else /* lower */
77  {
79  if (current<width) overlap_lower(o)=width;
80  }
81 }
static size_t current
Definition: string.c:115

References assert, bound_overlap_status_p(), create_overlaps(), current, gen_nth(), load_overlap_status(), OVERLAP, overlap_lower, and overlap_upper.

Referenced by deal_with_similars().

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