PIPS
ss.c File Reference
#include "all.h"
+ Include dependency graph for ss.c:

Go to the source code of this file.

Macros

#define LINE   0
 

Functions

Pvecteur my_vect_var_subst (Pvecteur vect, Variable var, Pvecteur new_vect)
 {{ my vect var subst function More...
 
Pvecteur my_vect_substract (Pvecteur pvec1, Pvecteur pvec2)
 
void PrintCompRegions (list CompList)
 }} More...
 
void PrintLinExpr (LinExpr Lin)
 }} More...
 
void PrintSimp (comp_desc Dad)
 }} More...
 
void DisplayDad (comp_desc TheDad)
 
void DisplayRefTemp (simple_section Dad)
 }} More...
 
void DisplaySimpleSection (simple_section Dad)
 }} More...
 
tag GetRefTemp (simple_section Dad, _int DimNo)
 }} More...
 
void PutRefTemp (simple_section Dad, int DimNo, tag Val)
 }} More...
 
LinExpr GetBoundary (simple_section Dad, int DimNo, unsigned Low)
 }} More...
 
void PutBoundPair (simple_section Dad, _int DimNo, LinExpr Low, LinExpr Up)
 }} More...
 
LinExpr MinBoundary (LinExpr Lin1, LinExpr Lin2)
 }} More...
 
LinExpr MaxBoundary (LinExpr Lin1, LinExpr Lin2)
 }} More...
 
LinExpr MergeLinExprs (LinExpr Expr1, LinExpr Expr2, OpFlag Op)
 }} More...
 
unsigned int ComputeIndex (unsigned int I, unsigned int J, unsigned int Rank)
 }} More...
 
LinExpr CopyAccVec (LinExpr Expr)
 }} More...
 
bool IsExprConst (LinExpr Expr)
 }} More...
 
bool DivExists (loop Loop, LinExpr Lin)
 check whether loop index variable var is contained in LinExpr More...
 
expression GetAccVec (unsigned No, const reference ref)
 return the n'th subscript expression More...
 
unsigned int CardinalityOf (list gl)
 
dad_struct AllocateDadStruct (int Rank)
 }} More...
 
simple_section AllocateSimpleSection (reference ref)
 
void ScanAllDims (loop Loop, comp_desc Desc)
 }} More...
 
void ComputeRTandSS (expression Sub, unsigned DimNo, simple_section Dad, loop Loop)
 initialise reference template and shapes for inner most references More...
 
void TranslateRefsToLoop (loop ThisLoop, list ListOfComps)
 }} More...
 
void TranslateToLoop (loop ThisLoop, comp_desc Desc)
 }} More...
 
tVariants TransRefTemp (loop ThisLoop, comp_desc Desc)
 }} More...
 
void UpdateUnresolved (simple_section Dad, loop Loop)
 }} More...
 
void ComputeBoundaries (simple_section Dad, loop Loop, LinExpr lbExpr, LinExpr ubExpr, unsigned Offset)
 compute both boundary expression and store in the tSS array More...
 
void TransSimpSec (comp_desc Desc, loop Loop, tVariants *Vars)
 
LinExpr Lbound (loop Loop, LinExpr Lin)
 }} More...
 
LinExpr Ubound (loop Loop, LinExpr Lin)
 
simple_section SimpUnion (simple_section S1, simple_section S2)
 }} More...
 

Macro Definition Documentation

◆ LINE

#define LINE   0

Function Documentation

◆ AllocateDadStruct()

dad_struct AllocateDadStruct ( int  Rank)

}}

{{ allocate simple section allocate a structure to hold Dad

initialize the reference template

initialize the shape

Parameters
Rankank

Definition at line 440 of file ss.c.

441 {
442  dad_struct Dad;
443  bound_pair Bounds;
444  int cnt;
445  list RefTempList = NIL;
446  list BoundList = NIL;
448 
449  /* initialize the reference template */
450  for (cnt = 0; cnt < Rank; cnt++) {
451  RefTempList = gen_nconc(RefTempList,
452  CONS(REF_TEMP,make_ref_temp(cnt, Ref), NIL));
453  }
454 
455  /* initialize the shape */
456  for (cnt = 0; cnt < Rank * Rank; cnt++) {
457  Bounds = make_bound_pair(cnt, NULL, NULL);
458  BoundList = gen_nconc(BoundList, CONS(BOUND_PAIR, Bounds, NIL));
459  }
460 
461  Dad = make_dad_struct(RefTempList, BoundList);
462 
463  return (Dad);
464 }
ref_temp make_ref_temp(intptr_t a1, rtype a2)
Definition: compsec.c:306
rtype make_rtype(enum rtype_utype tag, void *val)
Definition: compsec.c:356
bound_pair make_bound_pair(intptr_t a1, Pvecteur a2, Pvecteur a3)
Definition: compsec.c:54
dad_struct make_dad_struct(list a1, list a2)
Definition: compsec.c:264
static hash_table Ref
Refs maps each statement to the effects it references.
Definition: chains.c:96
#define BOUND_PAIR(x)
newgen_simple_section_domain_defined
Definition: compsec.h:107
#define REF_TEMP(x)
REF_TEMP.
Definition: compsec.h:328
@ is_rtype_nonlinear
Definition: compsec.h:385
#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
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
#define UU
Definition: newgen_types.h:98
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References BOUND_PAIR, CONS, gen_nconc(), is_rtype_nonlinear, make_bound_pair(), make_dad_struct(), make_ref_temp(), make_rtype(), NIL, Ref, REF_TEMP, and UU.

Referenced by AllocateSimpleSection().

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

◆ AllocateSimpleSection()

simple_section AllocateSimpleSection ( reference  ref)

{{ intialize the data structure

}}

Parameters
refef

Definition at line 467 of file ss.c.

468 {
469 #define LINE 0
470  unsigned int Rank;
471  context_info Context;
472  dad_struct DadStruct;
473  simple_section Dad;
474  variable TmpVar;
475 
477 
478  /*{{{ intialize the data structure */
479  Rank = CardinalityOf(variable_dimensions(TmpVar));
480  Context = make_context_info(LINE, Rank, ZERO);
481  DadStruct = AllocateDadStruct(Rank);
482  Dad = make_simple_section(Context, DadStruct);
483  /*}}}*/
484  return (Dad);
485 }
simple_section make_simple_section(context_info a1, dad_struct a2)
Definition: compsec.c:407
context_info make_context_info(intptr_t a1, intptr_t a2, intptr_t a3)
Definition: compsec.c:222
static reference ref
Current stmt (an integer)
Definition: adg_read_paf.c:163
#define reference_variable(x)
Definition: ri.h:2326
#define type_variable(x)
Definition: ri.h:2949
#define variable_dimensions(x)
Definition: ri.h:3122
#define entity_type(x)
Definition: ri.h:2792
dad_struct AllocateDadStruct(int Rank)
}}
Definition: ss.c:440
unsigned int CardinalityOf(list gl)
Definition: ss.c:428
#define LINE

References AllocateDadStruct(), CardinalityOf(), entity_type, LINE, make_context_info(), make_simple_section(), ref, reference_variable, type_variable, variable_dimensions, and ZERO.

Referenced by InitCompDesc().

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

◆ CardinalityOf()

unsigned int CardinalityOf ( list  gl)

re-used Pips functional programs !!!

Parameters
gll

Definition at line 428 of file ss.c.

429 {
430  /* re-used Pips functional programs !!! */
431  return gen_length(gl);
432 }
size_t gen_length(const list l)
Definition: list.c:150

References gen_length().

Referenced by AllocateSimpleSection(), and TransSimpSec().

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

◆ ComputeBoundaries()

void ComputeBoundaries ( simple_section  Dad,
loop  Loop,
LinExpr  lbExpr,
LinExpr  ubExpr,
unsigned  Offset 
)

compute both boundary expression and store in the tSS array

{{ about

}}

Parameters
Dadad
Loopoop
lbExprbExpr
ubExprbExpr
Offsetffset

Definition at line 765 of file ss.c.

766 {
767  LinExpr Low, Up;
768 
769  Low = lbExpr;
770  Up = ubExpr;
771 
772  /*{{{ about */
773  if (DivExists(Loop, lbExpr))
774  Low = Lbound(Loop, lbExpr);
775  if (DivExists(Loop, ubExpr))
776  Up = Ubound(Loop, ubExpr);
777  PutBoundPair(Dad, Offset, Low, Up);
778  /*}}}*/
779 }
LinExpr Ubound(loop Loop, LinExpr Lin)
Definition: ss.c:961
LinExpr Lbound(loop Loop, LinExpr Lin)
}}
Definition: ss.c:910
void PutBoundPair(simple_section Dad, _int DimNo, LinExpr Low, LinExpr Up)
}}
Definition: ss.c:290
bool DivExists(loop Loop, LinExpr Lin)
check whether loop index variable var is contained in LinExpr
Definition: ss.c:396
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89

References DivExists(), Lbound(), PutBoundPair(), and Ubound().

Referenced by TransSimpSec().

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

◆ ComputeIndex()

unsigned int ComputeIndex ( unsigned int  I,
unsigned int  J,
unsigned int  Rank 
)

}}

{{ ComputeIndex compute index of tSS array for a boundary

Parameters
Rankank

Definition at line 362 of file ss.c.

363 {
364  unsigned int LoIndex, HiIndex, Index, i;
365 
366  LoIndex = (I < J) ? I : J;
367  HiIndex = (I < J) ? J : I;
368  Index = 0;
369  for (i = 1; i < (LoIndex + 1); i++)
370  Index = Index + (Rank - i);
371  Index = Index + (HiIndex - LoIndex) - 1;
372  return (Index);
373 }
#define Index(p, i, j)
Definition: pip__tab.h:45

References Index.

Referenced by TransSimpSec(), and UpdateUnresolved().

+ Here is the caller graph for this function:

◆ ComputeRTandSS()

void ComputeRTandSS ( expression  Sub,
unsigned  DimNo,
simple_section  Dad,
loop  Loop 
)

initialise reference template and shapes for inner most references

for an access vector

{{ non-linear

}}

{{ linear

copy the subscript expression into the shape descriptor

linear subscripts : update if DIV exists

}}

Parameters
Subub
DimNoimNo
Dadad
Loopoop

Definition at line 524 of file ss.c.

525 {
526  normalized Nexpr;
527 
528  Nexpr = NORMALIZE_EXPRESSION(Sub);
529 
530  if (!normalized_linear_p(Nexpr)) {
531  /*{{{ non-linear */
532  /*
533  * non linear subscripts if it is non-linear we don't bother to
534  * distinguish between invariant and variant ; they are just non-linear
535  */
536  PutRefTemp(Dad, DimNo, is_rtype_nonlinear);
537  /*}}}*/
538  }
539  else {
540  LinExpr Low, Up;
541 
542  /*{{{ linear */
543  /* copy the subscript expression into the shape descriptor */
544  Low = CopyAccVec(normalized_linear(Nexpr));
545  Up = CopyAccVec(normalized_linear(Nexpr));
546 
547  PutBoundPair(Dad, DimNo, Low, Up);
548 
549  if(IsExprConst(normalized_linear(Nexpr)) == true ) {
550  PutRefTemp(Dad, DimNo, is_rtype_linvariant);
551  }
552  else {
553  /* linear subscripts : update if DIV exists */
554  if (DivExists(Loop, normalized_linear(Nexpr))) {
555  Low = Lbound(Loop, LSEC(Dad, DimNo));
556  Up = Ubound(Loop, USEC(Dad, DimNo));
557  PutBoundPair(Dad, DimNo, Low, Up);
558  PutRefTemp(Dad, DimNo, is_rtype_linvariant);
559  }
560  else {
561  PutRefTemp(Dad, DimNo, is_rtype_lininvariant);
562  }
563  }
564  /*}}}*/
565  }
566 }
#define USEC(x, i)
#define LSEC(x, i)
accessing DAD components
@ is_rtype_lininvariant
Definition: compsec.h:387
@ is_rtype_linvariant
Definition: compsec.h:386
#define NORMALIZE_EXPRESSION(e)
#define normalized_linear_p(x)
Definition: ri.h:1779
#define normalized_linear(x)
Definition: ri.h:1781
bool IsExprConst(LinExpr Expr)
}}
Definition: ss.c:388
LinExpr CopyAccVec(LinExpr Expr)
}}
Definition: ss.c:378
void PutRefTemp(simple_section Dad, int DimNo, tag Val)
}}
Definition: ss.c:248

References CopyAccVec(), DivExists(), is_rtype_lininvariant, is_rtype_linvariant, is_rtype_nonlinear, IsExprConst(), Lbound(), LSEC, NORMALIZE_EXPRESSION, normalized_linear, normalized_linear_p, PutBoundPair(), PutRefTemp(), Ubound(), and USEC.

Referenced by ScanAllDims().

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

◆ CopyAccVec()

LinExpr CopyAccVec ( LinExpr  Expr)

}}

{{ CopyAccVec

re-used function from alloc.c

Parameters
Exprxpr

Definition at line 378 of file ss.c.

379 {
380  /* re-used function from alloc.c */
381  return (vect_dup(Expr));
382 }
Pvecteur vect_dup(Pvecteur v_in)
Pvecteur vect_dup(Pvecteur v_in): duplication du vecteur v_in; allocation de et copie dans v_out;.
Definition: alloc.c:51

References vect_dup().

Referenced by ComputeRTandSS(), Lbound(), TransSimpSec(), and Ubound().

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

◆ DisplayDad()

void DisplayDad ( comp_desc  TheDad)
Parameters
TheDadheDad

Definition at line 107 of file ss.c.

108 {
111 
112  fprintf(stderr, "\nData Access Descriptor for %s \n", entity_minimal_name(Var));
113 
114  DisplayRefTemp(Dad);
116  fprintf(stderr, "\n");
117 
118 }
#define comp_desc_reference(x)
Definition: compsec.h:177
#define comp_desc_section(x)
Definition: compsec.h:181
#define comp_sec_hull(x)
Definition: compsec.h:247
const char * entity_minimal_name(entity e)
Do preserve scope informations.
Definition: naming.c:214
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
void DisplaySimpleSection(simple_section Dad)
}}
Definition: ss.c:161
void DisplayRefTemp(simple_section Dad)
}}
Definition: ss.c:123

References comp_desc_reference, comp_desc_section, comp_sec_hull, DisplayRefTemp(), DisplaySimpleSection(), entity_minimal_name(), fprintf(), and reference_variable.

Referenced by PrintSimp().

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

◆ DisplayRefTemp()

void DisplayRefTemp ( simple_section  Dad)

}}

{{ DisplayRefTemp

Parameters
Dadad

Definition at line 123 of file ss.c.

124 {
125  unsigned Rank;
126  unsigned int i;
128 
130 
131  fprintf(stderr, "\nReference Template :: \n[ ");
132  for (i = 0; i < Rank; i++) {
133  RefType = GetRefTemp(Dad, i);
134  switch (RefType) {
136  fprintf(stderr, "INV");
137  break;
138  case is_rtype_linvariant:
139  fprintf(stderr, "VAR");
140  break;
141  case is_rtype_nonlinear:
142  fprintf(stderr, "NON");
143  break;
144  default:
145  fprintf(stderr, "NUL");
146  break;
147  }
148 
149  if (i < (Rank - 1))
150  fprintf(stderr, ", ");
151  else
152  fprintf(stderr, " ]\n");
153  }
154  fprintf(stderr, "\n");
155 }
#define simple_section_context(x)
Definition: compsec.h:449
#define context_info_rank(x)
Definition: compsec.h:286
int tag
TAG.
Definition: newgen_types.h:92
#define tag_undefined
Definition: newgen_types.h:93
tag GetRefTemp(simple_section Dad, _int DimNo)
}}
Definition: ss.c:229

References context_info_rank, fprintf(), GetRefTemp(), is_rtype_lininvariant, is_rtype_linvariant, is_rtype_nonlinear, simple_section_context, and tag_undefined.

Referenced by DisplayDad().

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

◆ DisplaySimpleSection()

void DisplaySimpleSection ( simple_section  Dad)

}}

{{ DisplaySimpSec

{{ xi = c

}}

{{ Xi+Xj = c

{{ print

}}

{{ index

}}

}}

{{ Xi-Xj

}}

Parameters
Dadad

Definition at line 161 of file ss.c.

162 {
163  unsigned int i, I, J, K;
164  unsigned Rank = context_info_rank(simple_section_context(Dad));
165 
166  fprintf(stderr, "\nBoundary Pairs ::\n");
167  /*{{{ xi = c */
168 
169  for (i = 0; i < Rank; i++) {
170  PrintLinExpr(LSEC(Dad, i));
171  fprintf(stderr, " <= X%d <= ", i);
172  PrintLinExpr(USEC(Dad, i));
173  fprintf(stderr, "\n");
174  }
175  /*}}}*/
176 
177  /*{{{ Xi+Xj = c */
178  I = 0;
179  K = Rank - I - 2;
180  J = I + 1;
181  for (; i < ((Rank * (Rank + 1)) / 2); i++) {
182  /*{{{ print */
183  PrintLinExpr(LSEC(Dad, i));
184  fprintf(stderr, " <= X%d + X%d <= ", I, J);
185  PrintLinExpr(USEC(Dad, i));
186  fprintf(stderr, "\n");
187  /*}}}*/
188  /*{{{ index */
189  if (K < 1) {
190  I += 1;
191  J = I + 1;
192  K = Rank - I - 2;
193  } else {
194  K -= 1;
195  J += 1;
196  }
197  /*}}}*/
198  }
199  /*}}}*/
200  /*{{{ Xi-Xj */
201  I = 0;
202  K = Rank - I - 2;
203  J = I + 1;
204  for (; i < (Rank * Rank); i++) {
205  PrintLinExpr(LSEC(Dad, i));
206  fprintf(stderr, " <= X%d - X%d <= ", I, J);
207  PrintLinExpr(USEC(Dad, i));
208  fprintf(stderr, "\n");
209  if (K < 1) {
210  I += 1;
211  J = I + 1;
212  K = Rank - I - 2;
213  } else {
214  K -= 1;
215  J += 1;
216  }
217  }
218  /*}}}*/
219 
220  fprintf(stderr, "\n");
221 
222 }
void PrintLinExpr(LinExpr Lin)
}}
Definition: ss.c:87

References context_info_rank, fprintf(), LSEC, PrintLinExpr(), simple_section_context, and USEC.

Referenced by DisplayDad().

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

◆ DivExists()

bool DivExists ( loop  Loop,
LinExpr  Lin 
)

check whether loop index variable var is contained in LinExpr

Parameters
Loopoop
Linin

Definition at line 396 of file ss.c.

397 {
398  entity ent;
399  Pvecteur Vec;
400  bool Val;
401 
402  ent = loop_index(Loop);
403  Vec = (Pvecteur) Lin;
404  Val = vect_contains_variable_p(Vec, (Variable) ent);
405  return (Val);
406 
407 }
#define Val
#define loop_index(x)
Definition: ri.h:1640
struct Svecteur * Pvecteur
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
bool vect_contains_variable_p(Pvecteur v, Variable var)
bool vect_contains_variable_p(Pvecteur v, Variable var) BA 19/05/94 input : a vector and a variable o...
Definition: unaires.c:415

References loop_index, Val, and vect_contains_variable_p().

Referenced by ComputeBoundaries(), ComputeRTandSS(), TransRefTemp(), and UpdateUnresolved().

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

◆ GetAccVec()

expression GetAccVec ( unsigned  No,
const reference  ref 
)

return the n'th subscript expression

Parameters
Noo
refef

Definition at line 411 of file ss.c.

412 {
413  unsigned Cur = 0;
414  list inds = reference_indices(ref);
415 
416  MAP(EXPRESSION, index,
417  {
418  if (Cur == No)
419  return (index);
420  Cur++;
421  }, inds);
422 
423  return (NULL);
424 
425 }
#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
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define reference_indices(x)
Definition: ri.h:2328

References EXPRESSION, MAP, ref, and reference_indices.

Referenced by TransRefTemp().

+ Here is the caller graph for this function:

◆ GetBoundary()

LinExpr GetBoundary ( simple_section  Dad,
int  DimNo,
unsigned  Low 
)

}}

{{ GetBoundaryPair return the lower or upper boundary

Parameters
Dadad
DimNoimNo
Lowow

Definition at line 266 of file ss.c.

267 {
268  list BoundPair = dad_struct_shape(simple_section_dad(Dad));
269  LinExpr Lin = NULL;
270 
271  MAP(BOUND_PAIR, bp,
272  {
273  if (bound_pair_index(bp) == DimNo) {
274  if (Low == 1) {
275  Lin = bound_pair_lb(bp);
276  } else {
277  Lin = bound_pair_ub(bp);
278  }
279  break;
280  }
281  }, BoundPair);
282 
283  return(Lin);
284 }
#define bound_pair_ub(x)
Definition: compsec.h:142
#define dad_struct_shape(x)
Definition: compsec.h:324
#define bound_pair_index(x)
Definition: compsec.h:138
#define simple_section_dad(x)
Definition: compsec.h:451
#define bound_pair_lb(x)
Definition: compsec.h:140

References BOUND_PAIR, bound_pair_index, bound_pair_lb, bound_pair_ub, dad_struct_shape, MAP, and simple_section_dad.

◆ GetRefTemp()

tag GetRefTemp ( simple_section  Dad,
_int  DimNo 
)

}}

}} {{ auxilliary functions {{ GetRefTemp

Parameters
Dadad
DimNoimNo

Definition at line 229 of file ss.c.

230 {
232  tag ret_tag = tag_undefined;
233 
234  FOREACH(REF_TEMP, Ref, Rtemp)
235  {
236  if (ref_temp_index(Ref) == DimNo) {
237  ret_tag = rtype_tag(ref_temp_rtype(Ref));
238  break;
239  }
240  }
241 
242  return(ret_tag);
243 }
#define ref_temp_index(x)
Definition: compsec.h:358
#define dad_struct_rtemps(x)
Definition: compsec.h:322
#define rtype_tag(x)
Definition: compsec.h:406
#define ref_temp_rtype(x)
Definition: compsec.h:360
#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

References dad_struct_rtemps, FOREACH, Ref, REF_TEMP, ref_temp_index, ref_temp_rtype, rtype_tag, simple_section_dad, and tag_undefined.

Referenced by DisplayRefTemp(), SimpUnion(), TransRefTemp(), and UpdateUnresolved().

+ Here is the caller graph for this function:

◆ IsExprConst()

bool IsExprConst ( LinExpr  Expr)

}}

check whether a given expresion is a constant

Parameters
Exprxpr

Definition at line 388 of file ss.c.

389 {
390  return (vect_constant_p(Expr));
391 }
bool vect_constant_p(Pvecteur)
bool vect_constant_p(Pvecteur v): v contains only a constant term, may be zero
Definition: predicats.c:211

References vect_constant_p().

Referenced by ComputeRTandSS(), and UpdateUnresolved().

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

◆ Lbound()

LinExpr Lbound ( loop  Loop,
LinExpr  Lin 
)

}}

}} {{ lbound and ubound

only one step in pips ! it provides direct substitution functions

{{ substitution step

substitute with lower bound

substitute with upper bound

make a copy because vect_var_subst modifies NewVect

}}

Parameters
Loopoop
Linin

Definition at line 910 of file ss.c.

911 {
912  /*
913  * preconditions : lbound is invoked only if DivExists and if only on
914  * LinExprs
915  */
916 
917  expression TmpExpr;
918  normalized Nexpr;
919  LinExpr NewLin, NewVect;
920  entity Var = loop_index(Loop);
921 
922  /* only one step in pips ! it provides direct substitution functions */
923  /*{{{ substitution step */
924  /*
925  * use the lower/upper bound of the index variable depending on the sign of
926  * the coefficient
927  */
928  /*
929  * this needs to be changed if the representation for linear expression is
930  * changed to accommodate symbolic coefficients
931  */
932 
933  int Val = vect_coeff((Variable) Var, Lin);
934  if ((Val > 0)) {
935  /* substitute with lower bound */
936  TmpExpr = range_lower(loop_range(Loop));
937  } else {
938  /* substitute with upper bound */
939  TmpExpr = range_upper(loop_range(Loop));
940  }
941 
942  Nexpr = NORMALIZE_EXPRESSION(TmpExpr);
943  if (normalized_linear_p(Nexpr)) {
944  /* make a copy because vect_var_subst modifies NewVect */
945  NewVect = CopyAccVec(normalized_linear(Nexpr));
946  NewLin = my_vect_var_subst(Lin, (Variable) Var, NewVect);
947  }
948  else {
949  NewLin = NULL;
950  }
951 
952  /*}}}*/
953  return (NewLin);
954 }
#define range_upper(x)
Definition: ri.h:2290
#define range_lower(x)
Definition: ri.h:2288
#define loop_range(x)
Definition: ri.h:1642
Pvecteur my_vect_var_subst(Pvecteur vect, Variable var, Pvecteur new_vect)
{{ my vect var subst function
Definition: ss.c:35
Value vect_coeff(Variable var, Pvecteur vect)
Variable vect_coeff(Variable var, Pvecteur vect): coefficient de coordonnee var du vecteur vect —> So...
Definition: unaires.c:228

References CopyAccVec(), loop_index, loop_range, my_vect_var_subst(), NORMALIZE_EXPRESSION, normalized_linear, normalized_linear_p, range_lower, range_upper, Val, and vect_coeff().

Referenced by ComputeBoundaries(), ComputeRTandSS(), and UpdateUnresolved().

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

◆ MaxBoundary()

LinExpr MaxBoundary ( LinExpr  Lin1,
LinExpr  Lin2 
)

}}

{{ MaxBoundary substitute with new boundary

Parameters
Lin1in1
Lin2in2

Definition at line 335 of file ss.c.

336 {
337  int Result;
338 
339  Result = vect_compare(&Lin1, &Lin2);
340  if (Result > 0)
341  return (vect_dup(Lin1));
342  else
343  return (vect_dup(Lin2));
344 }
int vect_compare(Pvecteur *pv1, Pvecteur *pv2)
for qsort, returns:
Definition: unaires.c:352

References vect_compare(), and vect_dup().

Referenced by SimpUnion().

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

◆ MergeLinExprs()

LinExpr MergeLinExprs ( LinExpr  Expr1,
LinExpr  Expr2,
OpFlag  Op 
)

}}

{{ MergeLinExprs

must free Expr1 because vect_add will return a copy : check later

Parameters
Expr1xpr1
Expr2xpr2
Opp

Definition at line 349 of file ss.c.

350 {
351  /* must free Expr1 because vect_add will return a copy : check later */
352  if (Op == PLUS)
353  return (vect_add(Expr1, Expr2));
354  else
355  return (my_vect_substract(Expr1, Expr2));
356 }
#define PLUS
Definition: sc_gram.c:200
Pvecteur my_vect_substract(Pvecteur pvec1, Pvecteur pvec2)
Definition: ss.c:50
Pvecteur vect_add(Pvecteur v1, Pvecteur v2)
package vecteur - operations binaires
Definition: binaires.c:53

References my_vect_substract(), PLUS, and vect_add().

Referenced by TransSimpSec(), and UpdateUnresolved().

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

◆ MinBoundary()

LinExpr MinBoundary ( LinExpr  Lin1,
LinExpr  Lin2 
)

}}

{{ MinBoundary substitute with new boundary

Parameters
Lin1in1
Lin2in2

Definition at line 320 of file ss.c.

321 {
322  int Result;
323 
324  Result = vect_compare(&Lin1, &Lin2);
325  if (Result < 0)
326  return (vect_dup(Lin1));
327  else
328  return (vect_dup(Lin2));
329 }

References vect_compare(), and vect_dup().

Referenced by SimpUnion().

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

◆ my_vect_substract()

Pvecteur my_vect_substract ( Pvecteur  pvec1,
Pvecteur  pvec2 
)

Pvecteur var_val; for (var_val = pvec2; var_val!= NIL; vect_add_elem (&dvec,var_of(var_val),-val_of(var_val)),var_val=var_val->succ);

Parameters
pvec1vec1
pvec2vec2

Definition at line 50 of file ss.c.

52 {
53  int coeff;
54  Pvecteur dvec = vect_dup (pvec1);
55 /* Pvecteur var_val;
56  for (var_val = pvec2; var_val!= NIL;
57  vect_add_elem (&dvec,var_of(var_val),-val_of(var_val)),var_val=var_val->succ);
58  */
59 
60  Pvecteur v2 = pvec2;
61  for ( ; v2!= NULL; v2=v2->succ) {
62  coeff = 0-(val_of(v2));
63  vect_add_elem (&dvec,var_of(v2), coeff);
64  }
65 
66  return (dvec);
67 }
struct Svecteur * succ
Definition: vecteur-local.h:92
#define val_of(varval)
#define var_of(varval)
void vect_add_elem(Pvecteur *pvect, Variable var, Value val)
void vect_add_elem(Pvecteur * pvect, Variable var, Value val): addition d'un vecteur colineaire au ve...
Definition: unaires.c:72

References Svecteur::succ, val_of, var_of, vect_add_elem(), and vect_dup().

Referenced by MergeLinExprs().

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

◆ my_vect_var_subst()

Pvecteur my_vect_var_subst ( Pvecteur  vect,
Variable  var,
Pvecteur  new_vect 
)

{{ my vect var subst function

ss.c

mimicked this function from paf-tuil/utils.c because it was misbehaving !!

Parameters
vectect
varar
new_vectew_vect

Definition at line 35 of file ss.c.

36 {
38  Value val;
39 
40  if ((val = vect_coeff(var,vect)) != 0)
41  {
42  vect_erase_var(&vect,var);
43  vect_aux = vect_multiply(new_vect,val);
44  vect = vect_add(vect, vect_aux);
45  }
46 
47  return(vect);
48 }
int Value
Pvecteur vect_multiply(Pvecteur v, Value x)
Pvecteur vect_multiply(Pvecteur v, Value x): multiplication du vecteur v par le scalaire x,...
Definition: scalaires.c:123
Pvecteur vect_aux
Definition: solpip.c:102
void vect_erase_var(Pvecteur *ppv, Variable v)
void vect_erase_var(Pvecteur * ppv, Variable v): projection du vecteur *ppv selon la direction v (i....
Definition: unaires.c:106

References vect_add(), vect_aux, vect_coeff(), vect_erase_var(), and vect_multiply().

Referenced by Lbound(), and Ubound().

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

◆ PrintCompRegions()

void PrintCompRegions ( list  CompList)

}}

{{ PrintSimpleSection {{ PrintCompRegions

Parameters
CompListompList

Definition at line 74 of file ss.c.

75 {
76  if (CompList != NIL) {
77  MAP(COMP_DESC, Cdesc,
78  {
79  PrintSimp(Cdesc);
80  }, CompList);
81  }
82 }
#define COMP_DESC(x)
COMP_DESC.
Definition: compsec.h:146
void PrintSimp(comp_desc Dad)
}}
Definition: ss.c:99

References COMP_DESC, MAP, NIL, and PrintSimp().

Referenced by comp_regions_of_loop().

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

◆ PrintLinExpr()

void PrintLinExpr ( LinExpr  Lin)

}}

{{ PrintLinExpr

call the approprite print routine : check later

Parameters
Linin

Definition at line 87 of file ss.c.

88 {
89  /* call the approprite print routine : check later */
90  if (Lin != NULL)
91  vect_debug(Lin);
92  else
93  fprintf(stderr, "NULL");
94 }
void vect_debug(Pvecteur v)
constraint.c
Definition: constraint.c:43

References fprintf(), and vect_debug().

Referenced by DisplaySimpleSection(), and PutBoundPair().

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

◆ PrintSimp()

void PrintSimp ( comp_desc  Dad)

}}

{{ PrintSimp

Parameters
Dadad

Definition at line 99 of file ss.c.

100 {
101  fprintf(stderr, "*********************************************************************\n");
102  DisplayDad(Dad);
103  fprintf(stderr, "---------------------------------------------------------------------\n");
104 }
void DisplayDad(comp_desc TheDad)
Definition: ss.c:107

References DisplayDad(), and fprintf().

Referenced by PrintCompRegions().

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

◆ PutBoundPair()

void PutBoundPair ( simple_section  Dad,
_int  DimNo,
LinExpr  Low,
LinExpr  Up 
)

}}

{{ PutBoundryPair substitute with new boundary

check later vect_rm(bound_pair_lb(bp));

check later vect_rm(bound_pair_ub(bp));

Parameters
Dadad
DimNoimNo
Lowow
Upp

Definition at line 290 of file ss.c.

291 {
292  list BoundPair = dad_struct_shape(simple_section_dad(Dad));
293 
294  ifdebug(5) {
295  pips_debug(5, "PutBoundPair : dump Low and Up vectors \n");
296  PrintLinExpr(Low);
297  PrintLinExpr(Up);
298  }
299 
300  MAP(BOUND_PAIR, bp,
301  {
302  if (bound_pair_index(bp) == DimNo) {
303  if (Low != NULL) {
304  /* check later vect_rm(bound_pair_lb(bp)); */
305  bound_pair_lb_(bp) = (Pvecteur) Low;
306  }
307  if (Up != NULL) {
308  /* check later vect_rm(bound_pair_ub(bp)); */
309  bound_pair_ub_(bp) = (Pvecteur) Up;
310  }
311  return;
312  }
313  }, BoundPair);
314 }
#define bound_pair_lb_(x)
Definition: compsec.h:139
#define bound_pair_ub_(x)
Definition: compsec.h:141
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define ifdebug(n)
Definition: sg.c:47

References BOUND_PAIR, bound_pair_index, bound_pair_lb_, bound_pair_ub_, dad_struct_shape, ifdebug, MAP, pips_debug, PrintLinExpr(), and simple_section_dad.

Referenced by ComputeBoundaries(), ComputeRTandSS(), SimpUnion(), and UpdateUnresolved().

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

◆ PutRefTemp()

void PutRefTemp ( simple_section  Dad,
int  DimNo,
tag  Val 
)

}}

{{ PutRefTemp

Parameters
Dadad
DimNoimNo
Valal

Definition at line 248 of file ss.c.

249 {
251 
252  MAP(REF_TEMP, rt,
253  {
254  if (ref_temp_index(rt) == DimNo) {
256  return;
257  }
258  }, Rtemp);
259 
260 }

References dad_struct_rtemps, MAP, REF_TEMP, ref_temp_index, ref_temp_rtype, rtype_tag, simple_section_dad, and Val.

Referenced by ComputeRTandSS(), SimpUnion(), and TransRefTemp().

+ Here is the caller graph for this function:

◆ ScanAllDims()

void ScanAllDims ( loop  Loop,
comp_desc  Desc 
)

}}

{{ translate inner most references

{{ init RT and SS

}}

Parameters
Loopoop
Descesc

Definition at line 490 of file ss.c.

491 {
492  /*
493  * unfortunately an access vector cannot tell to which dimension it
494  * corresponds hence this round about of explicitly tracking the dimension
495  * number
496  */
497  unsigned int DimNo;
498  expression exp_ind;
499  simple_section Dad;
500  reference ref;
501  list inds;
502 
503  pips_debug(3, "begin\n");
504 
505  Dad = comp_sec_hull(comp_desc_section(Desc));
506  ref = comp_desc_reference(Desc);
507 
508  inds = reference_indices(ref);
509 
510  for (DimNo = 0; inds != NIL; DimNo++, inds = CDR(inds)) {
511  /*{{{ init RT and SS */
512  exp_ind = EXPRESSION(CAR(inds));
513  ComputeRTandSS(exp_ind, DimNo, Dad, Loop);
514  /*}}}*/
515  }
516 
517  pips_debug(3, "end\n");
518 
519 }
#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
void ComputeRTandSS(expression Sub, unsigned DimNo, simple_section Dad, loop Loop)
initialise reference template and shapes for inner most references
Definition: ss.c:524

References CAR, CDR, comp_desc_reference, comp_desc_section, comp_sec_hull, ComputeRTandSS(), EXPRESSION, NIL, pips_debug, ref, and reference_indices.

Referenced by TranslateToLoop().

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

◆ SimpUnion()

simple_section SimpUnion ( simple_section  S1,
simple_section  S2 
)

}}

{{ SimpUnion

SG: i am unsure this is a valid init

allocate a simple_section

{{ update reference template

update reference template

if a subscript is invariant or boundary expression is not constant

then whole dimension is assumed to be used

}}

{{ update simple sections

scan all boundary pairs

later insert code for releasing the space of LSEC and USEC

compute new lower boundary in the union

compute new upper boundary in the union

}}

Parameters
S11
S22

Definition at line 1013 of file ss.c.

1014 {
1015 /* SG: i am unsure this is a valid init */
1017  tag Variant;
1018  size_t i;
1019  LinExpr Low = NULL, Up = NULL;
1020  size_t Rank = context_info_rank(simple_section_context(S1));
1021 
1022  /* allocate a simple_section */
1023 
1024  /*{{{ update reference template */
1025  /* update reference template */
1026  /* if a subscript is invariant or boundary expression is not constant */
1027  /* then whole dimension is assumed to be used */
1028  for (i = 0; i < Rank; i++) {
1029  Variant = ((GetRefTemp(S1, i) == is_rtype_linvariant) &&
1030  (GetRefTemp(S2, i) == is_rtype_linvariant)) ?
1032  PutRefTemp(UnionDad, i, Variant);
1033  }
1034  /*}}}*/
1035  /*{{{ update simple sections */
1036  /* scan all boundary pairs */
1037  for (i = 0; i < (Rank * Rank); i++) {
1038  /* later insert code for releasing the space of LSEC and USEC */
1039  if ((LSEC(S1, i) != NULL) && (LSEC(S2, i) != NULL)) {
1040  /* compute new lower boundary in the union */
1041  Low = MinBoundary(LSEC(S1, i), LSEC(S2, i));
1042  }
1043  if ((USEC(S1, i) != NULL) && (USEC(S2, i) != NULL)) {
1044  /* compute new upper boundary in the union */
1045  Up = MaxBoundary(USEC(S1, i), USEC(S2, i));
1046  }
1047  PutBoundPair(UnionDad, i, Low, Up);
1048  }
1049  /*}}}*/
1050 
1051  return (UnionDad);
1052 }
#define context_info_undefined
Definition: compsec.h:259
LinExpr MaxBoundary(LinExpr Lin1, LinExpr Lin2)
}}
Definition: ss.c:335
LinExpr MinBoundary(LinExpr Lin1, LinExpr Lin2)
}}
Definition: ss.c:320

References context_info_rank, context_info_undefined, GetRefTemp(), is_rtype_linvariant, is_rtype_nonlinear, LSEC, make_dad_struct(), make_simple_section(), MaxBoundary(), MinBoundary(), NIL, PutBoundPair(), PutRefTemp(), simple_section_context, and USEC.

+ Here is the call graph for this function:

◆ TranslateRefsToLoop()

void TranslateRefsToLoop ( loop  ThisLoop,
list  ListOfComps 
)

}}

{{ translate to outer loop comp list {{ translate the set to the outer loop

Parameters
ThisLoophisLoop
ListOfCompsistOfComps

Definition at line 577 of file ss.c.

578 {
579  MAP(COMP_DESC, Desc,
580  {
581  TranslateToLoop(ThisLoop, Desc);
582  }, ListOfComps);
583 
584 }
void TranslateToLoop(loop ThisLoop, comp_desc Desc)
}}
Definition: ss.c:589

References COMP_DESC, MAP, and TranslateToLoop().

Referenced by comp_regions_of_loop().

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

◆ TranslateToLoop()

void TranslateToLoop ( loop  ThisLoop,
comp_desc  Desc 
)

}}

{{ translate to loop

Parameters
ThisLoophisLoop
Descesc

Definition at line 589 of file ss.c.

590 {
591  tVariants Vars;
592  simple_section Dad;
593 
594  if (GET_NEST(Desc) == ZERO) {
595  ScanAllDims(ThisLoop, Desc);
596  PUT_NEST(Desc,SINGLE);
597  }
598  else {
599  Vars = TransRefTemp(ThisLoop, Desc);
600  TransSimpSec(Desc, ThisLoop, &Vars);
601  PUT_NEST(Desc,MULTI);
602  }
603 
604  Dad = comp_sec_hull(comp_desc_section(Desc));
605  UpdateUnresolved(Dad, ThisLoop);
606 
607 }
#define GET_NEST(d)
@ SINGLE
#define PUT_NEST(d, val)
void TransSimpSec(comp_desc Desc, loop Loop, tVariants *Vars)
Definition: ss.c:782
tVariants TransRefTemp(loop ThisLoop, comp_desc Desc)
}}
Definition: ss.c:612
void UpdateUnresolved(simple_section Dad, loop Loop)
}}
Definition: ss.c:667
void ScanAllDims(loop Loop, comp_desc Desc)
}}
Definition: ss.c:490

References comp_desc_section, comp_sec_hull, GET_NEST, MULTI, PUT_NEST, ScanAllDims(), SINGLE, TransRefTemp(), TransSimpSec(), UpdateUnresolved(), and ZERO.

Referenced by TranslateRefsToLoop().

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

◆ TransRefTemp()

tVariants TransRefTemp ( loop  ThisLoop,
comp_desc  Desc 
)

}}

{{ TransRefTemp

iterate through all entries of reference template

process only linear elements

Pass only normalized expression into Divexists

variant w.r.t this loop index

Parameters
ThisLoophisLoop
Descesc

Definition at line 612 of file ss.c.

613 {
614  tVariants Vars;
615  simple_section Dad;
616  _int DimNo, Rank;
617  normalized Nexpr;
618  expression TmpExpr;
619  list OldList, NewList, NewEle;
620 
621 
622  comp_sec Csec = comp_desc_section(Desc);
624 
625  Dad = comp_sec_hull(Csec);
627 
628  pips_debug(3, "begin\n");
629 
630  OldList = NIL;
631  NewList = NIL;
632 
633  /* iterate through all entries of reference template */
634  for (DimNo = 0; DimNo < Rank; DimNo++) {
635  /* process only linear elements */
636  if (!(GetRefTemp(Dad, DimNo) == is_rtype_nonlinear)) {
637  /* Pass only normalized expression into Divexists */
638  TmpExpr = GetAccVec(DimNo, Ref);
639  Nexpr = NORMALIZE_EXPRESSION(TmpExpr);
640 
641  if (DivExists(ThisLoop, normalized_linear(Nexpr))) {
642  /* variant w.r.t this loop index */
643  NewEle = CONS(INT, DimNo, NIL);
644  NewList = gen_nconc(NewList, NewEle);
645  PutRefTemp(Dad, DimNo, is_rtype_linvariant);
646  } else {
647  /*
648  * invariant w.r.t. this loop index; but variant w.r.t. previous loop
649  * constant subscripts will also get included in the old list
650  */
651  if (GetRefTemp(Dad, DimNo) == is_rtype_linvariant)
652  OldList = gen_nconc(OldList, CONS(INT, DimNo, NIL));
653  }
654  }
655  }
656 
657  Vars.Old = OldList;
658  Vars.New = NewList;
659 
660  pips_debug(3, "end\n");
661  return (Vars);
662 }
@ INT
Definition: atomic.c:48
intptr_t _int
_INT
Definition: newgen_types.h:53
expression GetAccVec(unsigned No, const reference ref)
return the n'th subscript expression
Definition: ss.c:411

References comp_desc_reference, comp_desc_section, comp_sec_hull, CONS, context_info_rank, DivExists(), gen_nconc(), GetAccVec(), GetRefTemp(), INT, is_rtype_linvariant, is_rtype_nonlinear, Variants::New, NIL, NORMALIZE_EXPRESSION, normalized_linear, Variants::Old, pips_debug, PutRefTemp(), Ref, and simple_section_context.

Referenced by TranslateToLoop().

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

◆ TransSimpSec()

void TransSimpSec ( comp_desc  Desc,
loop  Loop,
tVariants Vars 
)

{{ declarations

}}

{{ Diagonal Boundaries for old and new

{{ compute offset in the tSS array to store diagonal boundaries

}}

{{ compute diagonal boundaries Xi + Xj

compute index for tSS array

copying done inside MergeLinExprs lbExpr = CopyAccVec(LSEC(Dad, I)); TmpExpr1 = CopyAccVec(LSEC(Dad, J));

ubExpr = CopyAccVec(USEC(Dad, I)); TmpExpr2 = CopyAccVec(USEC(Dad, J));

}}

{{ compute diagonal boundaries Xi - Xj

compute index for tSS array

}}

}}

{{ Compute parallel boundaries only for new variants

{{ compute Xi = c

bug unsigned Offset = J;

}}

}}

{{ Compute diagonal boundaries for new variants

set size must be atleast 2

{{ compute diagonals

set an iterator for the newvar

{{ iterators 1 and 2

set this iterator to next element in the first list

}}

{{ compute index for storing in tSS array

}}

{{ compute diagonal boundary Xi + Xj

}}

{{ compute diagonal boundary Xi - Xj

}}

}}

}}

Parameters
Descesc
Loopoop
Varsars

Definition at line 782 of file ss.c.

783 {
784  /*{{{ declarations */
785  unsigned Index, Offset;
786  LinExpr lbExpr, ubExpr, TmpExpr1, TmpExpr2;
787 
789  unsigned Rank = context_info_rank(simple_section_context(Dad));
790  list Old = Vars->Old;
791  list New = Vars->New;
792  /*}}}*/
793 
794  pips_debug(3, "begin\n");
795 
796  /*{{{ Diagonal Boundaries for old and new */
797  MAP(INT, I,
798  {
799  MAP(INT, J,
800  {
801  /*{{{ compute offset in the tSS array to store diagonal boundaries */
802  Index = ComputeIndex(I, J, Rank);
803  /*}}}*/
804  /*{{{ compute diagonal boundaries Xi + Xj */
805  /* compute index for tSS array */
806  Offset = Rank + Index;
807  /* copying done inside MergeLinExprs
808  lbExpr = CopyAccVec(LSEC(Dad, I));
809  TmpExpr1 = CopyAccVec(LSEC(Dad, J));
810  */
811  lbExpr = LSEC(Dad, I);
812  TmpExpr1 = LSEC(Dad, J);
813  lbExpr = MergeLinExprs(lbExpr, TmpExpr1, PLUS);
814  /*
815  ubExpr = CopyAccVec(USEC(Dad, I));
816  TmpExpr2 = CopyAccVec(USEC(Dad, J));
817  */
818  ubExpr = USEC(Dad, I);
819  TmpExpr2 = USEC(Dad, J);
820  ubExpr = MergeLinExprs(ubExpr, TmpExpr2, PLUS);
821  ComputeBoundaries(Dad, Loop, lbExpr, ubExpr, Offset);
822  /*}}}*/
823  /*{{{ compute diagonal boundaries Xi - Xj */
824  /* compute index for tSS array */
825  Offset = (Rank * (Rank + 1)) / 2 + Index;
826  /*
827  lbExpr = CopyAccVec(LSEC(Dad, I));
828  TmpExpr1 = CopyAccVec(USEC(Dad, J));
829  */
830  lbExpr = LSEC(Dad, I);
831  TmpExpr1 = USEC(Dad, J);
832  lbExpr = MergeLinExprs(lbExpr, TmpExpr1, MINUS);
833  /*
834  ubExpr = CopyAccVec(USEC(Dad, I));
835  TmpExpr2 = CopyAccVec(LSEC(Dad, J));
836  */
837  ubExpr = USEC(Dad, I);
838  TmpExpr2 = LSEC(Dad, J);
839  ubExpr = MergeLinExprs(ubExpr, TmpExpr2, MINUS);
840  ComputeBoundaries(Dad, Loop, lbExpr, ubExpr, Offset);
841  /*}}}*/
842  }, New);
843  }, Old);
844  /*}}}*/
845  /*{{{ Compute parallel boundaries only for new variants */
846  MAP(INT, J,
847  {
848  /*{{{ compute Xi = c */
849  /* bug unsigned Offset = J; */
850  lbExpr = CopyAccVec(LSEC(Dad, J));
851  ubExpr = CopyAccVec(USEC(Dad, J));
852  ComputeBoundaries(Dad, Loop, lbExpr, ubExpr, J);
853  /*}}}*/
854  }, New);
855  /*}}}*/
856  /*{{{ Compute diagonal boundaries for new variants */
857  /* set size must be atleast 2 */
858  if (CardinalityOf(New) > 1) {
859  int I, J;
860 
861  /*{{{ compute diagonals */
862  /* set an iterator for the newvar */
863  list New_iter1;
864  list New_iter2;
865  New_iter1 = Vars->New;
866  for (; !ENDP(New_iter1); (New_iter1 = CDR(New_iter1))) {
867  /*{{{ iterators 1 and 2 */
868  I = INT(CAR(New_iter1));
869  /* set this iterator to next element in the first list */
870  New_iter2 = CDR(New_iter1);
871  /*}}}*/
872  for (; !ENDP(New_iter2); New_iter2 = CDR(New_iter2)) {
873  J = INT(CAR(New_iter2));
874  /*{{{ compute index for storing in tSS array */
875  Index = ComputeIndex(I, J, Rank);
876  /*}}}*/
877  /*{{{ compute diagonal boundary Xi + Xj */
878  Offset = Rank + Index;
879  TmpExpr1 = LSEC(Dad, J);
880  lbExpr = MergeLinExprs(LSEC(Dad, I), TmpExpr1, PLUS);
881  TmpExpr2 = USEC(Dad, J);
882  ubExpr = MergeLinExprs(USEC(Dad, I), TmpExpr2, PLUS);
883  ComputeBoundaries(Dad, Loop, lbExpr, ubExpr, Offset);
884  /*}}}*/
885  /*{{{ compute diagonal boundary Xi - Xj */
886  Offset = ((Rank * (Rank + 1)) / 2) + Index;
887  TmpExpr1 = USEC(Dad, J);
888  lbExpr = MergeLinExprs(LSEC(Dad, I), TmpExpr1, MINUS);
889  TmpExpr2 = LSEC(Dad, J);
890  ubExpr = MergeLinExprs(USEC(Dad, I), TmpExpr2, MINUS);
891  ComputeBoundaries(Dad, Loop, lbExpr, ubExpr, Offset);
892  /*}}}*/
893  }
894  }
895  /*}}}*/
896  }
897  /*}}}*/
898 
899  pips_debug(3, "end\n");
900 }
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
#define MINUS
Definition: operator.h:42
#define New
unsigned int ComputeIndex(unsigned int I, unsigned int J, unsigned int Rank)
}}
Definition: ss.c:362
void ComputeBoundaries(simple_section Dad, loop Loop, LinExpr lbExpr, LinExpr ubExpr, unsigned Offset)
compute both boundary expression and store in the tSS array
Definition: ss.c:765
LinExpr MergeLinExprs(LinExpr Expr1, LinExpr Expr2, OpFlag Op)
}}
Definition: ss.c:349

References CAR, CardinalityOf(), CDR, comp_desc_section, comp_sec_hull, ComputeBoundaries(), ComputeIndex(), context_info_rank, CopyAccVec(), ENDP, Index, INT, LSEC, MAP, MergeLinExprs(), MINUS, Variants::New, New, Variants::Old, pips_debug, PLUS, simple_section_context, and USEC.

Referenced by TranslateToLoop().

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

◆ Ubound()

LinExpr Ubound ( loop  Loop,
LinExpr  Lin 
)

only one step in pips ! it provides direct substitution functions

{{ substitution step

substitute with lower bound

substitute with upper bound

make a copy because vect_var_subst modifies NewVect

}}

Parameters
Loopoop
Linin

Definition at line 961 of file ss.c.

962 {
963  /*
964  * preconditions : Ubound is invoked only if DivExists and only on LinExprs
965  */
966  expression TmpExpr;
967  LinExpr NewLin, NewVect;
968  normalized Nexpr;
969 
970  entity Var = loop_index(Loop);
971 
972  /* only one step in pips ! it provides direct substitution functions */
973  /*{{{ substitution step */
974  /*
975  * use the lower/upper bound of the index variable depending on the sign of
976  * the coefficient
977  */
978  /*
979  * this needs to be changed if the representation for linear expression is
980  * changed to accommodate symbolic coefficients
981  */
982 
983  int Val = vect_coeff((Variable) Var, Lin);
984  if ((Val < 0)) {
985  /* substitute with lower bound */
986  TmpExpr = range_lower(loop_range(Loop));
987  } else {
988  /* substitute with upper bound */
989  TmpExpr = range_upper(loop_range(Loop));
990  }
991 
992  Nexpr = NORMALIZE_EXPRESSION(TmpExpr);
993  if (normalized_linear_p(Nexpr) ) {
994  /* make a copy because vect_var_subst modifies NewVect */
995  NewVect = CopyAccVec(normalized_linear(Nexpr));
996  NewLin = my_vect_var_subst(Lin, (Variable) Var, NewVect);
997  }
998  else {
999  NewLin = NULL;
1000  }
1001 
1002  /*}}}*/
1003  return (NewLin);
1004 }

References CopyAccVec(), loop_index, loop_range, my_vect_var_subst(), NORMALIZE_EXPRESSION, normalized_linear, normalized_linear_p, range_lower, range_upper, Val, and vect_coeff().

Referenced by ComputeBoundaries(), ComputeRTandSS(), and UpdateUnresolved().

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

◆ UpdateUnresolved()

void UpdateUnresolved ( simple_section  Dad,
loop  Loop 
)

}}

{{ TransSimpSec

{{ declarations

}}

{{ Update unresolved boundaries

{{ update parallel or diagonal boundaries with induction variable

{{ scan all dimensions

ComputeBoundaries(Dad, Loop, lbExpr, ubExpr, ZhiExprNo);

}}

}}

{{ update diagonal boundaries whose parallel components are constants

{{ process only linear subscripts

{{ compute index

}}

{{ update diagonals

{{ update Xi + Xj

lower boundary

bug fix : check boundary otherwise it will get overwritten

{{ update

copy done in MergeLinExpr lbExpr = CopyAccVec(LSEC(Dad, I));

LSEC(Dad,PlusOffset) = lbExpr;

}}

upper boundary

{{ update

USEC(PlusOffset) = ubExpr;

}}

}}

{{ update Xi - Xj

lower boundary

{{ upate

lbExpr = CopyAccVec(LSEC(J));

LSEC(MinusOffset) = lbExpr;

}}

upper boundary

{{ update

ubExpr = CopyAccVec(USEC(J));

USEC(MinusOffset) = ubExpr;

}}

}}

}}

}}

}}

}}

Parameters
Dadad
Loopoop

Definition at line 667 of file ss.c.

668 {
669  /*{{{ declarations */
670  unsigned Index, I, J;
671  LinExpr lbExpr, ubExpr;
672  unsigned ZhiExprNo;
673  unsigned Rank = context_info_rank(simple_section_context(Dad));
674  /*}}}*/
675  /*{{{ Update unresolved boundaries */
676  /*{{{ update parallel or diagonal boundaries with induction variable */
677  if (Loop != NULL) {
678  /*{{{ scan all dimensions */
679  for (ZhiExprNo = 0; ZhiExprNo < Rank; ZhiExprNo++) {
680  lbExpr = LSEC(Dad, ZhiExprNo);
681  ubExpr = USEC(Dad, ZhiExprNo);
682  if (DivExists(Loop, lbExpr))
683  lbExpr = Lbound(Loop, lbExpr);
684  if (DivExists(Loop, ubExpr))
685  ubExpr = Ubound(Loop, ubExpr);
686  PutBoundPair(Dad, ZhiExprNo, lbExpr, ubExpr);
687 
688  /* ComputeBoundaries(Dad, Loop, lbExpr, ubExpr, ZhiExprNo); */
689 
690  }
691  /*}}}*/
692  }
693  /*}}}*/
694  /*{{{ update diagonal boundaries whose parallel components are constants */
695  for (I = 0; I < Rank; I++) {
696  for (J = I + 1; J < Rank; J++) {
697  if ((GetRefTemp(Dad, I) != is_rtype_nonlinear) && (GetRefTemp(Dad, J) != is_rtype_nonlinear)) {
698  /*{{{ process only linear subscripts */
699  /*{{{ compute index */
700  int PlusOffset, MinusOffset;
701  Index = ComputeIndex(I, J, Rank);
702  PlusOffset = Rank + Index;
703  MinusOffset = ((Rank * (Rank + 1)) / 2) + Index;
704  /*}}}*/
705  /*{{{ update diagonals */
706  /*{{{ update Xi + Xj */
707  /* lower boundary */
708  /* bug fix : check boundary otherwise it will get overwritten */
709  if (LSEC(Dad, PlusOffset) == NULL) {
710  /*{{{ update */
711  if (IsExprConst(LSEC(Dad, I)) && IsExprConst(LSEC(Dad, J))) {
712  /* copy done in MergeLinExpr lbExpr = CopyAccVec(LSEC(Dad, I)); */
713  lbExpr = MergeLinExprs(LSEC(Dad, I), LSEC(Dad, J), PLUS);
714  /* LSEC(Dad,PlusOffset) = lbExpr; */
715  PutBoundPair(Dad, PlusOffset, lbExpr, NULL);
716  }
717  /*}}}*/
718  }
719  /* upper boundary */
720  if (USEC(Dad, PlusOffset) == NULL) {
721  /*{{{ update */
722  if (IsExprConst(USEC(Dad, I)) && IsExprConst(USEC(Dad, J))) {
723  ubExpr = MergeLinExprs(USEC(Dad, I), USEC(Dad, J), PLUS);
724  /* USEC(PlusOffset) = ubExpr; */
725  PutBoundPair(Dad, PlusOffset, NULL, ubExpr);
726  }
727  /*}}}*/
728  }
729  /*}}}*/
730  /*{{{ update Xi - Xj */
731  /* lower boundary */
732  if (LSEC(Dad, MinusOffset) == NULL) {
733  /*{{{ upate */
734  if (IsExprConst(LSEC(Dad, J)) && IsExprConst(USEC(Dad, I))) {
735  /* lbExpr = CopyAccVec(LSEC(J)); */
736  lbExpr = MergeLinExprs(LSEC(Dad, J), USEC(Dad, I), MINUS);
737  /* LSEC(MinusOffset) = lbExpr; */
738  PutBoundPair(Dad, MinusOffset, lbExpr, NULL);
739  }
740  /*}}}*/
741  }
742  /* upper boundary */
743  if (USEC(Dad, MinusOffset) == NULL) {
744  /*{{{ update */
745  if (IsExprConst(USEC(Dad, J)) && IsExprConst(LSEC(Dad, I))) {
746  /* ubExpr = CopyAccVec(USEC(J)); */
747  ubExpr = MergeLinExprs(USEC(Dad, J), LSEC(Dad, I), MINUS);
748  /* USEC(MinusOffset) = ubExpr; */
749  PutBoundPair(Dad, MinusOffset, NULL, ubExpr);
750  }
751  /*}}}*/
752  }
753  /*}}}*/
754  /*}}}*/
755  /*}}}*/
756  }
757  }
758  }
759  /*}}}*/
760  /*}}}*/
761 }

References ComputeIndex(), context_info_rank, DivExists(), GetRefTemp(), Index, is_rtype_nonlinear, IsExprConst(), Lbound(), LSEC, MergeLinExprs(), MINUS, PLUS, PutBoundPair(), simple_section_context, Ubound(), and USEC.

Referenced by TranslateToLoop().

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