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

Go to the source code of this file.

Macros

#define IS_EG   TRUE
 {{{ banner More...
 
#define NOT_EG   FALSE
 
#define PHI_FIRST   TRUE
 
#define NOT_PHI_FIRST   FALSE
 

Functions

void CheckStride (loop __attribute__((unused)) Loop)
 global static variable local_regions_map, and its access functions More...
 
list CompRegionsExactUnion (list l1, list l2, bool __attribute__((unused))(*union_combinable_p)(effect, effect))
 just concatentate list for now : change later More...
 
list CompRegionsMayUnion (list l1, list l2, bool __attribute__((unused))(*union_combinable_p)(effect, effect))
 just concatentate list for now : change later More...
 
bool comp_regions (const char *module_name)
 }}} More...
 
list comp_regions_of_statement (statement s)
 }}} More...
 
list comp_regions_of_instruction (instruction i, transformer t_inst, transformer context, list *plpropreg)
 }}} More...
 
list comp_regions_of_block (list linst)
 }}} More...
 
list comp_regions_of_test (test t, transformer context, list __attribute__((unused)) *plpropreg)
 }}} More...
 
list comp_regions_of_loop (loop l, transformer __attribute__((unused)) loop_trans, transformer context, list __attribute__((unused)) *plpropreg)
 }}} More...
 
list comp_regions_of_call (call c, transformer context, list *plpropreg)
 }}} More...
 
list comp_regions_of_unstructured (unstructured u, transformer t_unst)
 }}} More...
 
list comp_regions_of_range (range r, transformer context)
 }}} More...
 
list comp_regions_of_syntax (syntax s, transformer context)
 }}} More...
 
list comp_regions_of_expressions (list exprs, transformer context)
 }}} More...
 
list comp_regions_of_expression (expression e, transformer context)
 {{{ comp_regions_of_expression More...
 
list comp_regions_of_read (reference ref, transformer context)
 }}} More...
 
list comp_regions_of_write (reference ref, transformer context)
 }}} More...
 

Macro Definition Documentation

◆ IS_EG

#define IS_EG   TRUE

{{{ banner

package complementary sections : Manjunathaiah M , 18-4-96

This File contains the functions computing the regions of a module : proper, local and global. }}}

Definition at line 40 of file propagate.c.

◆ NOT_EG

#define NOT_EG   FALSE

Definition at line 41 of file propagate.c.

◆ NOT_PHI_FIRST

#define NOT_PHI_FIRST   FALSE

Definition at line 44 of file propagate.c.

◆ PHI_FIRST

#define PHI_FIRST   TRUE

Definition at line 43 of file propagate.c.

Function Documentation

◆ CheckStride()

void CheckStride ( loop __attribute__((unused))  Loop)

global static variable local_regions_map, and its access functions

{{{ auxilliary functions

expression Stride = range_increment(loop_range(Loop));

Definition at line 50 of file propagate.c.

51 {
52  /* expression Stride = range_increment(loop_range(Loop)); */
53 
54 }

◆ comp_regions()

bool comp_regions ( const char *  module_name)

}}}

{{{ process the body of a procedure ===============================================================================

INTRAPROCEDURAL ARRAY REGIONS ANALYSIS


{{{ intra procedural entry point "complementary_sections" calls comp_regions {{{ comments bool regions(const char* module_name) input : the name of the current module output : nothing. modifies : computes the local regions of a module. comment : local regions can contain local variables. }}}

{{{ code

{{{ initialize

regions_init();

get the current properties concerning regions

Get the code of the module.

}}}

{{{ transformers and preconditions

Get the transformers and preconditions of the module.

}}}

{{{ predicates for purpose of debugging

predicates defining summary regions from callees have to be translated into variables local to module

}}}

}}}

Compute the regions of the module.

{{{ for dependence analysis : currently masked

set_proper_regions_map( MAKE_STATEMENT_MAPPING() );

}}}

{{{ code

{{{ debug stmts

if (op_statistics_p()) print_regions_op_statistics(module_name, R_RW);

}}}

{{{ store in database : modify later

DB_PUT_MEMORY_RESOURCE(DBR_PROPER_REGIONS, strdup(module_name), (char*) listmap_to_effectsmap(get_proper_regions_map()));

}}}

{{{ finalise

}}}

}}}

Parameters
module_nameodule_name

Definition at line 87 of file propagate.c.

88 {
89  /* {{{ code*/
90  /* {{{ initialize*/
91  /* regions_init(); */
92 
93  /* get the current properties concerning regions */
95 
96  /* Get the code of the module. */
98  db_get_memory_resource(DBR_CODE, module_name, true) );
99  /* }}} */
100  /* {{{ transformers and preconditions*/
101  /* Get the transformers and preconditions of the module. */
103  db_get_memory_resource(DBR_TRANSFORMERS, module_name, true) );
105  db_get_memory_resource(DBR_PRECONDITIONS, module_name, true) );
106  /* }}} */
107  /* {{{ predicates for purpose of debugging*/
108  /* predicates defining summary regions from callees have to be
109  translated into variables local to module */
111 
112 
114  db_get_memory_resource(DBR_CUMULATED_EFFECTS, module_name, true));
116  db_get_memory_resource(DBR_PROPER_EFFECTS, module_name, true));
118 
119  debug_on("COMP_REGIONS_DEBUG_LEVEL");
120  pips_debug(3, "begin\n");
121 
122  /* }}} */
123  /* }}} */
124  /* Compute the regions of the module. */
126  /* {{{ for dependence analysis : currently masked */
127  /* set_proper_regions_map( MAKE_STATEMENT_MAPPING() ); */
128  /* }}} */
130  /* {{{ code*/
131  /* {{{ debug stmts*/
132  /* if (op_statistics_p()) print_regions_op_statistics(module_name, R_RW); */
133 
134  pips_debug(3, "end\n");
135 
136  debug_off();
137  /* }}} */
138  /* {{{ store in database : modify later*/
139  DB_PUT_MEMORY_RESOURCE(DBR_COMPSEC,
142 
143 
144  /* DB_PUT_MEMORY_RESOURCE(DBR_PROPER_REGIONS,
145  strdup(module_name),
146  (char*) listmap_to_effectsmap(get_proper_regions_map()));
147  */
148  /* }}} */
149  /* {{{ finalise*/
157  /* }}} */
158  /* }}} */
159 
160  return(true);
161 }
statement_mapping get_local_comp_regions_map(void)
statement_mapping listmap_to_compsecs_map(statement_mapping)
Definition: dbase.c:47
void free_local_comp_regions_map(void)
void set_local_comp_regions_map(statement_mapping)
void get_regions_properties(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)
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
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
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
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
#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 pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define debug_off()
Definition: misc-local.h:160
#define MAKE_STATEMENT_MAPPING()
Definition: newgen-local.h:43
list comp_regions_of_statement(statement s)
}}}
Definition: propagate.c:173
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
char * strdup()
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 set_transformer_map(statement_mapping)
void reset_precondition_map(void)
void set_precondition_map(statement_mapping)
void reset_transformer_map(void)

References comp_regions_of_statement(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, free_local_comp_regions_map(), get_current_module_entity(), get_current_module_statement(), get_local_comp_regions_map(), get_regions_properties(), listmap_to_compsecs_map(), local_name_to_top_level_entity(), MAKE_STATEMENT_MAPPING, module_name(), module_to_value_mappings(), pips_debug, reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), reset_precondition_map(), reset_proper_rw_effects(), reset_transformer_map(), set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), set_local_comp_regions_map(), set_precondition_map(), set_proper_rw_effects(), set_transformer_map(), and strdup().

Referenced by complementary_sections().

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

◆ comp_regions_of_block()

list comp_regions_of_block ( list  linst)

}}}

{{{ comp_region_of_block {{{ comment list comp_regions_of_block(list linst) input : a list of instructions, representing a sequential block of instructions, and the context before the block. output : a list of regions modifies : linst. comment : calls itself recursively to calculate the list of regions.
}}}

{{{ init

}}}

{{{ Is it end of list ?

}}}

{{{ else process list

{{{ regions of CAR(linst)

}}}

{{{ any more statements in CDR(linst)

{{{ load transformer

}}}

{{{ perform union

{{{ don't know that this means ???

blocked : check later list current_transformer = load_statement_transformer(first_statement);
debug_regions_consistency(r_block_regions); project_regions_with_transformer_inverse(r_block_regions, current_transformer, NIL);

debug_regions_consistency(r_block_regions);

}}}

}}}

}}}

{{{ if not lres = first_s_regions

}}}

}}}

Parameters
linstinst

Definition at line 301 of file propagate.c.

302 {
303  /* {{{ init*/
304  statement first_statement;
305  list remaining_block, first_s_regions, lres = NIL;
306 
307  pips_debug(3, "begin\n");
308  /* }}} */
309 
310  /* {{{ Is it end of list ? */
311  if (ENDP(linst))
312  {
313  user_warning("regions_of_block", "empty block\n");
314  lres = NIL;
315  }
316  /* }}} */
317  /* {{{ else process list*/
318  else
319  {
320  /* {{{ regions of CAR(linst)*/
321  first_statement = STATEMENT(CAR(linst));
322  remaining_block = CDR(linst);
323 
324  first_s_regions = comp_regions_of_statement(first_statement);
325  /* }}} */
326  /* {{{ any more statements in CDR(linst)*/
327  if (!ENDP(remaining_block))
328  {
329  /* {{{ load transformer*/
330  list r_block_regions = NIL;
331 
332  /* }}} */
333  r_block_regions = comp_regions_of_block(remaining_block);
334  /* {{{ perform union*/
335  /* {{{ don't know that this means ???*/
336  /* blocked : check later
337  list current_transformer = load_statement_transformer(first_statement);
338  debug_regions_consistency(r_block_regions);
339  project_regions_with_transformer_inverse(r_block_regions,
340  current_transformer,
341  NIL);
342 
343  debug_regions_consistency(r_block_regions);
344  */
345  /* }}} */
346  lres = CompRegionsExactUnion(first_s_regions, r_block_regions, effects_same_action_p);
347  /*
348  debug_regions_consistency(lres);
349  */
350  /* }}} */
351 
352  }
353  /* }}} */
354  /* {{{ if not lres = first_s_regions*/
355  else
356  lres = first_s_regions;
357  /* }}} */
358 
359  }
360  /* }}} */
361 
362  pips_debug(3, "end\n");
363  return lres;
364 }
bool effects_same_action_p(effect, effect)
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
#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 user_warning(fn,...)
Definition: misc-local.h:262
list comp_regions_of_block(list linst)
}}}
Definition: propagate.c:301
list CompRegionsExactUnion(list l1, list l2, bool __attribute__((unused))(*union_combinable_p)(effect, effect))
just concatentate list for now : change later
Definition: propagate.c:57
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References CAR, CDR, comp_regions_of_block(), comp_regions_of_statement(), CompRegionsExactUnion(), effects_same_action_p(), ENDP, NIL, pips_debug, STATEMENT, and user_warning.

Referenced by comp_regions_of_block(), and comp_regions_of_instruction().

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

◆ comp_regions_of_call()

list comp_regions_of_call ( call  c,
transformer  context,
list plpropreg 
)

}}}

{{{ comp_regions of call list comp_regions_of_call(call c, transformer context, list *plpropreg) input : a call, which can be a call to a subroutine, but also to an function, or to an intrinsic, or even an assignement. And a pointer that will be the proper regions of the call; NIL, except for an intrinsic (assignment or real FORTRAN intrinsic). output : the corresponding list of regions. modifies : nothing. comment :

{{{ code

masked now : change later

masked now : *plpropreg = regions_dup(le);

}}}

Parameters
contextontext
plpropreglpropreg

Definition at line 510 of file propagate.c.

511 {
512  list le = NIL;
513  entity e = call_function(c);
514  tag t = value_tag(entity_initial(e));
515  const char* n = module_local_name(e);
516  list pc = call_arguments(c);
517 
518  *plpropreg = NIL;
519 
520  pips_debug(3, "begin\n");
521 
522  switch (t)
523  {
524  /* {{{ code*/
525  case is_value_code:
526  pips_debug(3, "external function %s\n", n);
527  /* masked now : change later */
528  /*
529  le = comp_regions_of_external(e, pc, context);
530  */
531  break;
532 
533  case is_value_intrinsic:
534  pips_debug(3, "intrinsic function %s\n", n);
535  le = comp_regions_of_intrinsic(e, pc, context);
536  /* masked now : *plpropreg = regions_dup(le); */
537  break;
538 
539  case is_value_symbolic:
540  pips_debug(3, "symbolic\n");
541  break;
542 
543  case is_value_constant:
544  pips_debug(3, "constant\n");
545  break;
546 
547  case is_value_unknown:
548  pips_internal_error("unknown function %s", n);
549  break;
550 
551  default:
552  pips_internal_error("unknown tag %d", t);
553  /* }}} */
554  }
555 
556  pips_debug(3, "end\n");
557 
558  return(le);
559 }
list comp_regions_of_intrinsic(entity, list, transformer)
myintrinsics.c
Definition: myintrinsics.c:270
#define pips_internal_error
Definition: misc-local.h:149
int tag
TAG.
Definition: newgen_types.h:92
const char * module_local_name(entity e)
Returns the module local user name.
Definition: entity.c:582
#define value_tag(x)
Definition: ri.h:3064
#define call_function(x)
Definition: ri.h:709
@ is_value_intrinsic
Definition: ri.h:3034
@ is_value_unknown
Definition: ri.h:3035
@ is_value_constant
Definition: ri.h:3033
@ is_value_code
Definition: ri.h:3031
@ is_value_symbolic
Definition: ri.h:3032
#define call_arguments(x)
Definition: ri.h:711
#define entity_initial(x)
Definition: ri.h:2796
Definition: delay.c:253

References call_arguments, call_function, comp_regions_of_intrinsic(), entity_initial, is_value_code, is_value_constant, is_value_intrinsic, is_value_symbolic, is_value_unknown, module_local_name(), NIL, pips_debug, pips_internal_error, and value_tag.

Referenced by comp_regions_of_instruction(), and comp_regions_of_syntax().

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

◆ comp_regions_of_expression()

list comp_regions_of_expression ( expression  e,
transformer  context 
)

{{{ comp_regions_of_expression

list comp_regions_of_expression(expression e, transformer context) input : an expression and the current context output : the correpsonding list of regions. modifies : nothing. comment :

Parameters
contextontext

Definition at line 701 of file propagate.c.

702 {
704 }
list comp_regions_of_syntax(syntax s, transformer context)
}}}
Definition: propagate.c:636
#define expression_syntax(x)
Definition: ri.h:1247

References comp_regions_of_syntax(), and expression_syntax.

Referenced by affect_comp_regions(), comp_regions_of_expressions(), comp_regions_of_implied_do(), comp_regions_of_ioelem(), comp_regions_of_iolist(), comp_regions_of_range(), and comp_regions_of_test().

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

◆ comp_regions_of_expressions()

list comp_regions_of_expressions ( list  exprs,
transformer  context 
)

}}}

{{{ comp_regions_of_expressions list comp_regions_of_expressions(list exprs, transformer context) input : a list of expressions and the current context. output : the correpsonding list of regions. modifies : nothing. comment :

Parameters
exprsxprs
contextontext

Definition at line 678 of file propagate.c.

679 {
680  list le = NIL;
681 
682  pips_debug(3, "begin\n");
683 
684  MAP(EXPRESSION, exp,
685  {
688  },
689  exprs);
690 
691  pips_debug(5, "end\n");
692  return(le);
693 }
#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
list comp_regions_of_expression(expression e, transformer context)
{{{ comp_regions_of_expression
Definition: propagate.c:701
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define exp
Avoid some warnings from "gcc -Wshadow".
Definition: vasnprintf.c:207

References comp_regions_of_expression(), CompRegionsExactUnion(), effects_same_action_p(), exp, EXPRESSION, MAP, NIL, and pips_debug.

Referenced by comp_regions_of_read(), comp_regions_of_write(), and no_write_comp_regions().

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

◆ comp_regions_of_instruction()

list comp_regions_of_instruction ( instruction  i,
transformer  t_inst,
transformer  context,
list plpropreg 
)

}}}

{{{ comp_regions_of_instruction {{{ comments list comp_regions_of_instruction(instruction i, transformer t_inst, context, list *plpropreg) input : the current instruction and the corresponding transformer and context (i.e. precondition), and a pointer that will contain the proper regions of the instruction. output : the corresponding list of regions. modifies : nothing. }}}

{{{ init

}}}

{{{ code

{{{ code

}}}

{{{ code

}}}

{{{ code

}}}

{{{ code

}}}

{{{ code

}}}

{{{ code

}}}

}}}

Parameters
t_inst_inst
contextontext
plpropreglpropreg

Definition at line 224 of file propagate.c.

226 {
227  /* {{{ init*/
228  list lreg = NIL;
229 
230  *plpropreg = NIL;
231 
232  /* }}} */
233  switch(instruction_tag(i))
234  {
235  /* {{{ code*/
236  case is_instruction_goto:
237  /* {{{ code*/
238  pips_debug(3, "goto\n");
239  break;
240  /* }}} */
241  case is_instruction_test:
242  /* {{{ code*/
243  ifdebug(3)
244  {
245  pips_debug(3, "test : %s\n",
247  }
248  lreg = comp_regions_of_test(instruction_test(i), context, plpropreg);
249  break;
250  /* }}} */
251  case is_instruction_loop:
252  /* {{{ code*/
253  ifdebug(3)
254  {
255  pips_debug(3, "loop : index %s\n",
257  }
258  lreg = comp_regions_of_loop(instruction_loop(i), t_inst, context, plpropreg);
259  break;
260  /* }}} */
261  case is_instruction_call:
262  /* {{{ code*/
263  ifdebug(3)
264  {
265  pips_debug(3, "call : %s\n",
267  }
268  lreg = comp_regions_of_call(instruction_call(i), context, plpropreg);
269  break;
270  /* }}} */
272  /* {{{ code*/
273  pips_debug(3, "unstructured\n");
275  break ;
276  /* }}} */
277  case is_instruction_block:
278  /* {{{ code*/
279  pips_debug(3, "inst block\n");
281  break;
282  /* }}} */
283  default:
284  pips_debug(3, "unexpected tag %d\n", instruction_tag(i));
285  /* }}} */
286  }
287 
288  return(lreg);
289 }
string expression_to_string(expression e)
Definition: expression.c:77
list comp_regions_of_unstructured(unstructured u, transformer t_unst)
}}}
Definition: propagate.c:571
list comp_regions_of_test(test t, transformer context, list __attribute__((unused)) *plpropreg)
}}}
Definition: propagate.c:375
list comp_regions_of_loop(loop l, transformer __attribute__((unused)) loop_trans, transformer context, list __attribute__((unused)) *plpropreg)
}}}
Definition: propagate.c:416
list comp_regions_of_call(call c, transformer context, list *plpropreg)
}}}
Definition: propagate.c:510
#define is_instruction_block
soft block->sequence transition
#define instruction_block(i)
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 instruction_loop(x)
Definition: ri.h:1520
@ is_instruction_goto
Definition: ri.h:1473
@ is_instruction_unstructured
Definition: ri.h:1475
@ is_instruction_test
Definition: ri.h:1470
@ is_instruction_call
Definition: ri.h:1474
@ is_instruction_loop
Definition: ri.h:1471
#define instruction_tag(x)
Definition: ri.h:1511
#define test_condition(x)
Definition: ri.h:2833
#define instruction_call(x)
Definition: ri.h:1529
#define instruction_test(x)
Definition: ri.h:1517
#define instruction_unstructured(x)
Definition: ri.h:1532
#define loop_index(x)
Definition: ri.h:1640
#define ifdebug(n)
Definition: sg.c:47

References call_function, comp_regions_of_block(), comp_regions_of_call(), comp_regions_of_loop(), comp_regions_of_test(), comp_regions_of_unstructured(), entity_local_name(), expression_to_string(), ifdebug, instruction_block, instruction_call, instruction_loop, instruction_tag, instruction_test, instruction_unstructured, is_instruction_block, is_instruction_call, is_instruction_goto, is_instruction_loop, is_instruction_test, is_instruction_unstructured, loop_index, module_local_name(), NIL, pips_debug, and test_condition.

Referenced by comp_regions_of_statement().

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

◆ comp_regions_of_loop()

list comp_regions_of_loop ( loop  l,
transformer __attribute__((unused))  loop_trans,
transformer  context,
list __attribute__((unused)) *  plpropreg 
)

}}}

{{{ comp_regions of loop list comp_regions_of_loop(loop l, transfomer loop_trans, context, list *plpropreg) input : a loop, its transformer and its context, and a pointer toward a list, that will contain the proper regions of the loop, which are the regions of its range. output : the corresponding list of regions. modifies : nothing. comment :

{{{ init

}}}

CheckStride(l);

regions of loop index.

{{{ code

loop index is must-written but may-read because the loop might execute no iterations.

the loop index is must-written

FI, RK: the may-read effect on the index variable is masked by the intial unconditional write on it (see standard page 11-7, 11.10.3); if masking is not performed, the read may prevent privatization somewhere else in the module (12 March 1993)

}}}

{{{ regions of loop induction variable

regions of loop bound expressions.

}}}

regions of loop body statement.

insert code to eliminate private variables later

projection of regions along the variables modified by the loop; it includes the projection along the loop index

{{{ In simple sections it is called translation !!

}}}

Definition at line 416 of file propagate.c.

419  {
420  /* {{{ init*/
421  list index_reg, body_reg, le;
422  /*
423  list global_reg;
424  entity i = loop_index(l);
425  */
426 
427  pips_debug(3, "begin\n");
428  /* }}} */
429 
430  /* CheckStride(l); */
431  /* regions of loop index. */
433  {
434  /* {{{ code*/
435  /* loop index is must-written but may-read because the loop might
436  execute no iterations. */
438 
439  index_reg = comp_regions_of_write(ref, context); /* the loop index is must-written */
440 
441  /* FI, RK: the may-read effect on the index variable is masked by
442  * the intial unconditional write on it (see standard page 11-7, 11.10.3);
443  * if masking is not performed, the read may prevent privatization
444  * somewhere else in the module (12 March 1993)
445  */
446  /* }}} */
447  }
448  else
449  index_reg = NIL ;
450 
451  /* {{{ regions of loop induction variable*/
452  /* regions of loop bound expressions. */
454  index_reg,
457  /* }}} */
458 
459  /* *plpropreg = regions_dup(le); */
460 
461  /* regions of loop body statement. */
462  body_reg = comp_regions_of_statement(loop_body(l));
463 
464  /* insert code to eliminate private variables later */
465 
466  /* projection of regions along the variables modified by the loop; it includes
467  * the projection along the loop index */
468 
469 
470  pips_debug(7, "elimination of variables modified by the loop.\n");
471 
472  /* {{{ In simple sections it is called translation !!*/
473  /*
474  project_regions_with_transformer_inverse(global_reg,
475  loop_trans,
476  CONS(ENTITY,i,NIL));
477  project_regions_along_loop_index(global_reg, i, loop_range(l));
478  */
479 
480  pips_debug(3, "Before Translations surrounding the loop index %s :\n",
482 
483  (void) TranslateRefsToLoop(l, body_reg);
484 
485  le = CompRegionsExactUnion(le, body_reg, effects_same_action_p);
486 
487  ifdebug(3) {
488  pips_debug(3, "After Translations surrounding the loop index %s :\n",
490  PrintCompRegions(le);
491  }
492 
493  pips_debug(3, "end\n");
494  /* }}} */
495 
496  return(le);
497 }
reference make_reference(entity a1, list a2)
Definition: ri.c:2083
static reference ref
Current stmt (an integer)
Definition: adg_read_paf.c:163
void TranslateRefsToLoop(loop, list)
}}
Definition: ss.c:577
void PrintCompRegions(list)
}}
Definition: ss.c:74
list comp_regions_of_range(range r, transformer context)
}}}
Definition: propagate.c:610
list comp_regions_of_write(reference ref, transformer context)
}}}
Definition: propagate.c:753
#define loop_body(x)
Definition: ri.h:1644
#define loop_execution(x)
Definition: ri.h:1648
#define execution_sequential_p(x)
Definition: ri.h:1208
#define loop_range(x)
Definition: ri.h:1642

References comp_regions_of_range(), comp_regions_of_statement(), comp_regions_of_write(), CompRegionsExactUnion(), effects_same_action_p(), entity_local_name(), execution_sequential_p, ifdebug, loop_body, loop_execution, loop_index, loop_range, make_reference(), NIL, pips_debug, PrintCompRegions(), ref, and TranslateRefsToLoop().

Referenced by comp_regions_of_instruction().

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

◆ comp_regions_of_range()

list comp_regions_of_range ( range  r,
transformer  context 
)

}}}

{{{ comp_regions_of_range list comp_regions_of_range(range r, context) input : a loop range (bounds and stride) and the context. output : the corresponding list of regions. modifies : nothing. comment :

Parameters
contextontext

Definition at line 610 of file propagate.c.

611 {
612  list le;
613  expression el = range_lower(r);
614  expression eu = range_upper(r);
615  expression ei = range_increment(r);
616 
617  pips_debug(3, "begin\n");
618 
624 
625  pips_debug(3, "end\n");
626  return(le);
627 }
#define range_upper(x)
Definition: ri.h:2290
#define range_increment(x)
Definition: ri.h:2292
#define range_lower(x)
Definition: ri.h:2288

References comp_regions_of_expression(), CompRegionsExactUnion(), effects_same_action_p(), pips_debug, range_increment, range_lower, and range_upper.

Referenced by comp_regions_of_loop(), and comp_regions_of_syntax().

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

◆ comp_regions_of_read()

list comp_regions_of_read ( reference  ref,
transformer  context 
)

}}}

}}} {{{ comp_regions_of_read list comp_regions_of_read(reference ref, transformer context) input : a reference that is read, and the current context. output : the corresponding list of regions. modifies : nothing. comment :

{{{ init

}}}

{{{ code

{{{ this read reference

}}}

{{{ rest of the references in an expression

}}}

}}}

Parameters
refef
contextontext

Definition at line 715 of file propagate.c.

716 {
717  /* {{{ init*/
718  list inds = reference_indices(ref);
719  list le = NIL;
720  comp_desc Cdesc;
722 
723  pips_debug(3, "begin\n");
724  /* }}} */
725 
726  /* {{{ code*/
727  /* {{{ this read reference*/
728  if (! entity_scalar_p(e) )
729  {
730  Cdesc = InitCompDesc(ref, is_action_read);
731  le = CONS(COMP_DESC, Cdesc, le);
732  }
733  /* }}} */
734  /* {{{ rest of the references in an expression*/
735  if (! ENDP(inds))
737 
738  /* }}} */
739  /* }}} */
740 
741  pips_debug(3, "end\n");
742  return(le);
743 }
comp_desc InitCompDesc(reference, tag)
operators.c
Definition: operators.c:30
#define COMP_DESC(x)
COMP_DESC.
Definition: compsec.h:146
@ is_action_read
Definition: effects.h:292
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
list comp_regions_of_expressions(list exprs, transformer context)
}}}
Definition: propagate.c:678
bool entity_scalar_p(entity)
The concrete type of e is a scalar type.
Definition: variable.c:1113
#define reference_variable(x)
Definition: ri.h:2326
#define reference_indices(x)
Definition: ri.h:2328

References COMP_DESC, comp_regions_of_expressions(), CompRegionsExactUnion(), CONS, effects_same_action_p(), ENDP, entity_scalar_p(), InitCompDesc(), is_action_read, NIL, pips_debug, ref, reference_indices, and reference_variable.

Referenced by comp_regions_of_syntax(), and io_comp_regions().

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

◆ comp_regions_of_statement()

list comp_regions_of_statement ( statement  s)

}}}

{{{ comp_regions_of_statement {{{ comments list comp_regions_of_statement(statement s) input : the current statement. output : a list of regions. modifies : the local regions_map. comment : computes the local regions of a statement and stores it in the local_regions_map. }}}

{{{ code

{{{ inits

}}}

{{{ transformer and preconditions

compute the regions on the instruction of the statement

}}}

}}}

{{{ code

{{{ store the result : currently masked, modify later

FI: make a copy to safely store that intermediate state in the mapping

debug_regions_consistency(lreg); debug_regions_consistency(lpropreg); store_statement_proper_regions(s, lpropreg);

}}}

}}}

Definition at line 173 of file propagate.c.

174 {
175  /* {{{ code*/
176  /* {{{ inits*/
177  transformer t_stat, context;
178  list lreg, lpropreg = NIL;
179 
180  ifdebug(3)
181  {
182  pips_debug(3, "begin\n\tComputation of regions of statement %03td\n",
183  statement_number(s));
184  }
185  /* }}} */
186  /* {{{ transformer and preconditions*/
188 
189  /* compute the regions on the instruction of the statement */
190  t_stat = load_statement_transformer(s);
191 
192  /* }}} */
193  /* }}} */
194 
196  t_stat, context, &lpropreg);
197 
198  /* {{{ code*/
199  /* {{{ store the result : currently masked, modify later*/
200  /* FI: make a copy to safely store that intermediate state in the mapping */
201  /* debug_regions_consistency(lreg);
202  debug_regions_consistency(lpropreg);
203  store_statement_proper_regions(s, lpropreg);
204  */
206  /* }}} */
207  /* }}} */
208 
209  return(lreg);
210 }
void store_statement_local_comp_regions(statement, list)
list comp_regions_dup(list)
REGIONS AND LISTS OF REGIONS MANIPULATION
Definition: dbase.c:82
list comp_regions_of_instruction(instruction i, transformer t_inst, transformer context, list *plpropreg)
}}}
Definition: propagate.c:224
#define statement_instruction(x)
Definition: ri.h:2458
#define statement_number(x)
Definition: ri.h:2452
transformer load_statement_precondition(statement)
transformer load_statement_transformer(statement)

References comp_regions_dup(), comp_regions_of_instruction(), ifdebug, load_statement_precondition(), load_statement_transformer(), NIL, pips_debug, statement_instruction, statement_number, and store_statement_local_comp_regions().

Referenced by comp_regions(), comp_regions_of_block(), comp_regions_of_loop(), comp_regions_of_test(), and comp_regions_of_unstructured().

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

◆ comp_regions_of_syntax()

list comp_regions_of_syntax ( syntax  s,
transformer  context 
)

}}}

{{{ comp_regions_of_syntax list comp_regions_of_syntax(syntax s, transformer context) input : output : modifies : comment :

{{{ code

comp_desc_free(lpropreg);

}}}

Parameters
contextontext

Definition at line 636 of file propagate.c.

637 {
638  list le = NIL, lpropreg = NIL;
639 
640  pips_debug(3, "begin\n");
641 
642  switch(syntax_tag(s))
643  {
644  /* {{{ code*/
645  case is_syntax_reference:
647  break;
648  case is_syntax_range:
650  break;
651  case is_syntax_call:
652  le = comp_regions_of_call(syntax_call(s), context, &lpropreg);
653  /* comp_desc_free(lpropreg); */
654  break;
655  default:
656  pips_internal_error("unexpected tag %d", syntax_tag(s));
657  /* }}} */
658  }
659 
660  ifdebug(3)
661  {
662  pips_debug(3, "Regions of expression %s :\n",
664  print_regions(le);
665  }
666 
667  pips_debug(3, "end\n");
668  return(le);
669 }
void print_regions(list)
list Words_Syntax(syntax obj)
Definition: misc.c:2664
list comp_regions_of_read(reference ref, transformer context)
}}}
Definition: propagate.c:715
#define syntax_reference(x)
Definition: ri.h:2730
#define syntax_tag(x)
Definition: ri.h:2727
#define syntax_range(x)
Definition: ri.h:2733
@ is_syntax_range
Definition: ri.h:2692
@ is_syntax_call
Definition: ri.h:2693
@ is_syntax_reference
Definition: ri.h:2691
#define syntax_call(x)
Definition: ri.h:2736
string words_to_string(cons *lw)
Definition: print.c:211

References comp_regions_of_call(), comp_regions_of_range(), comp_regions_of_read(), ifdebug, is_syntax_call, is_syntax_range, is_syntax_reference, NIL, pips_debug, pips_internal_error, print_regions(), syntax_call, syntax_range, syntax_reference, syntax_tag, Words_Syntax(), and words_to_string().

Referenced by comp_regions_of_expression().

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

◆ comp_regions_of_test()

list comp_regions_of_test ( test  t,
transformer  context,
list __attribute__((unused)) *  plpropreg 
)

}}}

{{{ comp_regions of test list regions_of_test(test t, transformer context, list *plpropreg) input : a test instruction, the context of the test, and a pointer toward a list that will contain the proper regions of the test, which are the regions of its conditionnal part. output : the corresponding list of regions. modifies : nothing.

{{{ init

}}}

{{{ if-then-else including if-condition

regions of the true branch

regions of the false branch

regions of the combination of both

regions of the condition

check later plpropreg = comp_regions_dup(lc);

}}}

{{{ union the regions : currently just add to the list

}}}

Definition at line 375 of file propagate.c.

377  {
378  /* {{{ init*/
379  list le, lt, lf, lc, lr;
380 
381  pips_debug(3, "begin\n");
382  /* }}} */
383 
384  /* {{{ if-then-else including if-condition*/
385  /* regions of the true branch */
387  /* regions of the false branch */
389  /* regions of the combination of both */
391 
392  /* regions of the condition */
394  /* check later
395  *plpropreg = comp_regions_dup(lc);
396  */
397  /* }}} */
398  /* {{{ union the regions : currently just add to the list*/
400  pips_debug(3, "end\n");
401  /* }}} */
402 
403  return(lr);
404 }
list CompRegionsMayUnion(list l1, list l2, bool __attribute__((unused))(*union_combinable_p)(effect, effect))
just concatentate list for now : change later
Definition: propagate.c:63
#define test_false(x)
Definition: ri.h:2837
#define test_true(x)
Definition: ri.h:2835

References comp_regions_of_expression(), comp_regions_of_statement(), CompRegionsExactUnion(), CompRegionsMayUnion(), effects_same_action_p(), pips_debug, test_condition, test_false, and test_true.

Referenced by comp_regions_of_instruction().

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

◆ comp_regions_of_unstructured()

list comp_regions_of_unstructured ( unstructured  u,
transformer  t_unst 
)

}}}

{{{ comp_regions of unstructured Computes the effects of the control graph. list comp_regions_of_unstructured( u , t_unst) input : an unstructured control flow graph and the corresponding transformer. output : the corresponding list of regions. modifies : nothing. comment :

there is only one statement in u; no need for a fix-point

Parameters
t_unst_unst

Definition at line 571 of file propagate.c.

572 {
573  control ct;
574  list blocs = NIL ;
575  list le = NIL ;
576 
577  pips_debug(3, "begin\n");
578 
579  ct = unstructured_control( u );
580 
581  if(control_predecessors(ct) == NIL && control_successors(ct) == NIL)
582  {
583  /* there is only one statement in u; no need for a fix-point */
584  pips_debug(3, "unique node\n");
586  }
587  else
588  {
589  CONTROL_MAP(c,
590  {
592  le, effects_same_action_p) ;
593  },ct, blocs) ;
595  gen_free_list(blocs) ;
596  }
597 
598  pips_debug(3, "end\n");
599 
600  return( le ) ;
601 }
void project_regions_along_parameters(list, list)
void project_regions_along_parameters(list l_reg, list l_param) input : a list of regions to project,...
#define CONTROL_MAP(ctl, code, c, list)
Macro to walk through all the controls reachable from a given control node of an unstructured.
void gen_free_list(list l)
free the spine of the list
Definition: list.c:327
#define unstructured_control
After the modification in Newgen: unstructured = entry:control x exit:control we have create a macro ...
#define control_predecessors(x)
Definition: ri.h:943
#define transformer_arguments(x)
Definition: ri.h:2871
#define control_successors(x)
Definition: ri.h:945
#define control_statement(x)
Definition: ri.h:941

References comp_regions_of_statement(), CompRegionsMayUnion(), CONTROL_MAP, control_predecessors, control_statement, control_successors, effects_same_action_p(), gen_free_list(), NIL, pips_debug, project_regions_along_parameters(), transformer_arguments, and unstructured_control.

Referenced by comp_regions_of_instruction().

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

◆ comp_regions_of_write()

list comp_regions_of_write ( reference  ref,
transformer  context 
)

}}}

{{{ comp_regions_of_write regions of a reference that is written list comp_regions_of_write(reference ref, transformer context) input : a reference that is written, and the current context. output : the corresponding list of regions. modifies : nothing. comment :

{{{ init

}}}

{{{ this write

}}}

{{{ check for arrays in subscripts

}}}

Parameters
refef
contextontext

Definition at line 753 of file propagate.c.

754 {
755  /* {{{ init*/
756  comp_desc Cdesc;
757  list le = NIL;
759  list inds = reference_indices(ref);
760  /* }}} */
761 
762  pips_debug(3, "begin\n");
763 
764  /* {{{ this write */
765  if (! entity_scalar_p(e) )
766  {
767  Cdesc = InitCompDesc(ref, is_action_write);
768  le = CONS(COMP_DESC, Cdesc, le);
769  }
770  /* }}} */
771  /* {{{ check for arrays in subscripts*/
772  if (! ENDP(inds))
774 
775  /* }}} */
776 
777  pips_debug(3, "end\n");
778 
779  return(le);
780 }
@ is_action_write
Definition: effects.h:293

References COMP_DESC, comp_regions_of_expressions(), CompRegionsExactUnion(), CONS, effects_same_action_p(), ENDP, entity_scalar_p(), InitCompDesc(), is_action_write, NIL, pips_debug, ref, reference_indices, and reference_variable.

Referenced by affect_comp_regions(), comp_regions_of_implied_do(), comp_regions_of_ioelem(), comp_regions_of_iolist(), comp_regions_of_loop(), and io_comp_regions().

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

◆ CompRegionsExactUnion()

list CompRegionsExactUnion ( list  l1,
list  l2,
bool __attribute__((unused))(*)(effect, effect union_combinable_p 
)

just concatentate list for now : change later

Definition at line 57 of file propagate.c.

58 {
59  return(gen_nconc(l1,l2));
60 }
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344

References gen_nconc().

Referenced by comp_regions_of_block(), comp_regions_of_expressions(), comp_regions_of_loop(), comp_regions_of_range(), comp_regions_of_read(), comp_regions_of_test(), and comp_regions_of_write().

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

◆ CompRegionsMayUnion()

list CompRegionsMayUnion ( list  l1,
list  l2,
bool __attribute__((unused))(*)(effect, effect union_combinable_p 
)

just concatentate list for now : change later

Definition at line 63 of file propagate.c.

64 {
65  return(gen_nconc(l1,l2));
66 }

References gen_nconc().

Referenced by comp_regions_of_test(), and comp_regions_of_unstructured().

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