PIPS
deatomizer.c File Reference
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "resources.h"
#include "misc.h"
#include "ri-util.h"
#include "prettyprint.h"
#include "effects-util.h"
#include "pipsdbm.h"
#include "effects-generic.h"
#include "sac.h"
#include "ray_dte.h"
#include "sommet.h"
#include "sg.h"
#include "polyedre.h"
#include "ricedg.h"
#include "control.h"
#include "effects-simple.h"
#include "effects-convex.h"
+ Include dependency graph for deatomizer.c:

Go to the source code of this file.

Functions

static void daCheckCallReplace (call c, reference ref)
 
static void checkReplaceReference (expression e, reference ref)
 
static void daCallReplaceReference (call c, reference ref, expression next)
 
static void daExpressionReplaceReference (list e, reference ref, expression next)
 
static list addStatementToSequence (statement stat, list seq, list *start)
 
static bool expr_has_write_eff_ref_p (reference ref, expression expr)
 
static bool stat_has_write_eff_ref_p (reference ref, statement stat)
 
static bool add_const_expr_p (statement stat)
 
static bool stats_has_rw_conf_p (statement si, statement sj, reference refi, reference refj)
 
static list da_process_list (list seq, bool repOnlyInIndex, bool(*stat_to_process)(statement))
 
static void da_simple_statements_pass (statement s)
 
static void da_simple_statements (statement s)
 
static bool da_simple_sequence_filter (statement s)
 
bool deatomizer (char *mod_name)
 deatomizer.c More...
 

Variables

static int gInIndex = 0
 
static bool gRepOnlyInIndex = 0
 
static bool gReplaceAllowed = false
 
static bool gRepDone = false
 
static graph dep_graph
 

Function Documentation

◆ add_const_expr_p()

static bool add_const_expr_p ( statement  stat)
static

Definition at line 288 of file deatomizer.c.

289 {
290  pips_assert("stat is an assign call statement",
293 
295 
297 
298  switch(syntax_tag(syn))
299  {
300  // exp is a call expression
301  case is_syntax_call:
302  {
303  call ca = syntax_call(syn);
304 
305  if(call_constant_p(ca))
306  {
308  if(!constant_int_p(cn))
309  return false;
310  }
312  {
313  cons * arg = call_arguments(ca);
314 
315  // Strange error
316  if ((arg == NIL) || (CDR(arg) == NIL))
317  return false;
318 
319  expression e1 = EXPRESSION(CAR(arg));
320  expression e2 = EXPRESSION(CAR(CDR(arg)));
321 
323  return false;
324  }
325  else
326  return false;
327 
328  }
329 
330  case is_syntax_reference:
331  break;
332 
333  default:
334  return false;
335  }
336 
337  return true;
338 }
#define call_constant_p(C)
Definition: flint_check.c:51
#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
bool expression_constant_p(expression)
HPFC module by Fabien COELHO.
Definition: expression.c:2453
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
#define ENTITY_ASSIGN_P(e)
#define ENTITY_MINUS_P(e)
#define ENTITY_PLUS_P(e)
#define value_constant(x)
Definition: ri.h:3073
#define syntax_tag(x)
Definition: ri.h:2727
#define call_function(x)
Definition: ri.h:709
@ is_syntax_call
Definition: ri.h:2693
@ is_syntax_reference
Definition: ri.h:2691
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define constant_int_p(x)
Definition: ri.h:848
#define syntax_call(x)
Definition: ri.h:2736
#define instruction_call_p(x)
Definition: ri.h:1527
#define statement_instruction(x)
Definition: ri.h:2458
#define instruction_call(x)
Definition: ri.h:1529
#define call_arguments(x)
Definition: ri.h:711
#define expression_syntax(x)
Definition: ri.h:1247
#define entity_initial(x)
Definition: ri.h:2796
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
#define exp
Avoid some warnings from "gcc -Wshadow".
Definition: vasnprintf.c:207

References call_arguments, call_constant_p, call_function, CAR, CDR, constant_int_p, ENTITY_ASSIGN_P, entity_initial, ENTITY_MINUS_P, ENTITY_PLUS_P, exp, EXPRESSION, expression_constant_p(), expression_syntax, instruction_call, instruction_call_p, is_syntax_call, is_syntax_reference, NIL, pips_assert, statement_instruction, syntax_call, syntax_tag, and value_constant.

Referenced by da_simple_statements_pass().

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

◆ addStatementToSequence()

static list addStatementToSequence ( statement  stat,
list  seq,
list start 
)
static

Definition at line 226 of file deatomizer.c.

227 {
228  if(seq == NIL)
229  {
230  seq = CONS(STATEMENT, stat, seq);
231  *start = seq;
232  }
233  else
234  {
235  seq = CDR(seq) = CONS(STATEMENT, stat, NIL);
236  }
237 
238  return seq;
239 }
static char start[1024]
The name of the variable from which to start counting domain numbers.
Definition: genLisp.c:55
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413

References CDR, CONS, NIL, start, and STATEMENT.

Referenced by da_process_list().

+ Here is the caller graph for this function:

◆ checkReplaceReference()

static void checkReplaceReference ( expression  e,
reference  ref 
)
static

replace if equal to ref

Definition at line 67 of file deatomizer.c.

68 {
70 
71  switch(syntax_tag(s)) {
72  case is_syntax_reference : {
74  /* replace if equal to ref */
75  if ( reference_indices(r) == NIL ) {
77  ((gRepOnlyInIndex && (gInIndex != 0)) || !gRepOnlyInIndex)) {
78  gReplaceAllowed = true;
79  }
80  }
81  else {
82  gInIndex++;
83 
85  {
86  checkReplaceReference(indice, ref);
87  }
88 
89  gInIndex--;
90  }
91  }
92  break;
93  case is_syntax_range :
97  break;
98  case is_syntax_call :
100  break;
101  default :
102  pips_internal_error("unknown tag: %d",
103  (int) syntax_tag(expression_syntax(e)));
104  }
105 }
static reference ref
Current stmt (an integer)
Definition: adg_read_paf.c:163
static int gInIndex
Definition: deatomizer.c:59
static void daCheckCallReplace(call c, reference ref)
Definition: deatomizer.c:107
static bool gReplaceAllowed
Definition: deatomizer.c:61
static void checkReplaceReference(expression e, reference ref)
Definition: deatomizer.c:67
static bool gRepOnlyInIndex
Definition: deatomizer.c:60
#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
#define pips_internal_error
Definition: misc-local.h:149
bool reference_equal_p(reference r1, reference r2)
Definition: expression.c:1500
#define syntax_reference(x)
Definition: ri.h:2730
#define range_upper(x)
Definition: ri.h:2290
#define syntax_range(x)
Definition: ri.h:2733
@ is_syntax_range
Definition: ri.h:2692
#define range_increment(x)
Definition: ri.h:2292
#define reference_indices(x)
Definition: ri.h:2328
#define range_lower(x)
Definition: ri.h:2288

References daCheckCallReplace(), EXPRESSION, expression_syntax, FOREACH, gInIndex, gReplaceAllowed, gRepOnlyInIndex, is_syntax_call, is_syntax_range, is_syntax_reference, NIL, pips_internal_error, range_increment, range_lower, range_upper, ref, reference_equal_p(), reference_indices, syntax_call, syntax_range, syntax_reference, and syntax_tag.

Referenced by daCheckCallReplace().

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

◆ da_process_list()

static list da_process_list ( list  seq,
bool  repOnlyInIndex,
bool(*)(statement stat_to_process 
)
static

Definition at line 381 of file deatomizer.c.

382 {
383  cons * i;
384 
385  // At the end of thi function, newSeqStart contains
386  // the new statements sequence
387  list newSeq = NIL;
388  list newSeqStart = NIL;
389 
390  gRepOnlyInIndex = repOnlyInIndex;
391 
392  pips_debug(2, "begin da_process_list\n");
393 
394  // outStats associates a statement with a replaced reference
395  hash_table outStats = hash_table_make(hash_pointer, 0);
396 
397  // notSup associates a statement which is not supported
398  // with a reference
400 
401  // Go through the sequence of statements
402  for( i = seq;
403  i != NIL;
404  i = CDR(i) )
405  {
406  cons * j;
407  cons * last;
408  statement si = STATEMENT(CAR(i));
409 
410  // Go through the hash table notSup
411  HASH_MAP(ent, lStat,
412  {
413  // If the current statement si is in the hash table then it is not supported.
414  // So, let's insert before this statement the out statement that corresponds
415  // to the reference.
416  if(lStat == i)
417  {
418 
419  statement statToInsert = (statement)hash_get(outStats, ent);
420  newSeq = addStatementToSequence(statToInsert, newSeq, &newSeqStart);
421  hash_del(outStats, ent);
422  }
423  }, notSup);
424 
425  ifdebug(2)
426  {
427  fprintf(stderr,"si\n");
428  print_statement(si);
429  }
430 
431  // If si is not an assign statement, then just add it to the new sequence
434  {
435  newSeq = addStatementToSequence(si, newSeq, &newSeqStart);
436  continue;
437  }
438 
439  // ei is the expression of the left value of si
442 
443  pips_assert("ei is a reference",
445 
446  // ei is the expression of the right value of si
449 
450  // ei is the reference of the left value of si
452 
453  // If refi is modified by the right part of si, give up
454  if(expr_has_write_eff_ref_p(refi, rVal) ||
455  !(*stat_to_process)(si))
456  {
457  newSeq = addStatementToSequence(si, newSeq, &newSeqStart);
458  continue;
459  }
460 
461  // If the left value of si is not a scalar, then just add the statement
462  // to the new sequence without doing anything
463  if(gen_length(reference_indices(refi)) != 0)
464  {
465  newSeq = addStatementToSequence(si, newSeq, &newSeqStart);
466  continue;
467  }
468 
469  // gReplaceAllowed is a global variable and is initialized to FALSE.
470  // After the end of the next loop, if gReplaceAllowed is true, then
471  // means that refi was found in at least one reference index of a sj
472  // statement.
473  gReplaceAllowed = false;
474 
475  // true at the end of the newt loop, if one sj statement is not supported
476  bool statNotSupported = false;
477 
478  // Go through the remaining statements in the sequence
479  last = NIL;
480  for( j = CDR(i);
481  j != NIL;
482  j = CDR(j) )
483  {
484  statement sj = STATEMENT(CAR(j));
485 
486  // If true, sj is not supported. Let's stop the analysis.
489  {
490  last = j;
491  statNotSupported = true;
492  break;
493  }
494 
495  // At this point, sj has a write effect on refi and is an assign statement.
496  // ej is the expression of the sj left value.
499 
502 
503  pips_assert("ej is a reference",
505 
506  // refj is the reference of the sj left value.
508 
509  ifdebug(2)
510  {
511  printf("sj\n");
512  print_statement(sj);
513  }
514 
515  if(stats_has_rw_conf_p(si, sj, refi, refj))
516  {
517  ifdebug(2)
518  {
519  printf("read write conflict\n");
520  print_statement(si);
521  print_statement(sj);
522  }
523 
524  last = j;
525  statNotSupported = true;
526  break;
527  }
528 
529  // sj doesn't change refi value, then sj is supported.
530  // So, let's call daCheckCallReplace() to see if refi is
531  // used in a reference index in this statement.
532  if(!stat_has_write_eff_ref_p(refi, sj))
533  {
534  ifdebug(2)
535  {
536  printf("left write effect\n");
537  print_statement(sj);
538  }
539  gInIndex = 0;
541 
542  continue;
543  }
544 
545  // If refi and refj are equal and that refj is not modified by
546  // sj left part, ...
547  if(reference_equal_p(refi, refj) &&
548  !expr_has_write_eff_ref_p(refi, rValj))
549  {
550  last = j;
551  break;
552  }
553 
554  last = j;
555  statNotSupported = true;
556  break;
557  }
558 
559  // If refi has not been found in a reference index in at least one sj
560  // statement, ...
561  if(!gReplaceAllowed)
562  {
563  // Add si to the new sequence
564  newSeq = addStatementToSequence(si, newSeq, &newSeqStart);
565 
566  // Delete the out statement corresponding to refi because
567  // si is writing refi
568  HASH_MAP(ent, stat,
569  {
570  if(same_entity_p(ent, reference_variable(refi)))
571  {
572  hash_del(outStats, ent);
573  }
574  }, outStats);
575  continue;
576  }
577 
578  // If gReplaceAllowed is true, then do the replacement until last
579  for( j = CDR(i);
580  (j != last) && (j != NIL);
581  j = CDR(j) )
582  {
583 
584  statement sj = STATEMENT(CAR(j));
585 
586  // This function replaces refi by rVal in sj call
588  }
589 
590  // curStat holds the current out statement corresponding to the reference refi
591  statement curStat = (statement)hash_get(outStats, reference_variable(refi));
592 
593  if(curStat != HASH_UNDEFINED_VALUE)
594  free_statement(curStat);
595 
596  // Put the new out statement corresponding to the reference refi
597  hash_put(outStats, reference_variable(refi), si);
598 
599  // If the statement "last" is supported, ...
600  if(!statNotSupported && last != NIL)
601  {
602  ifdebug(2)
603  {
604  printf("replace last\n");
605  print_statement(STATEMENT(CAR(last)));
606  }
607 
608  statement sLast = STATEMENT(CAR(last));
609 
612 
613  pips_assert("eLast is a reference",
615 
616  reference refLast = expression_reference(eLast);
617 
618  list lastRVal = CDR(call_arguments(
620 
621  daExpressionReplaceReference(lastRVal, refi, rVal);
622 
623  if(same_entity_p(reference_variable(refLast),
624  reference_variable(refi)))
625  {
626  hash_del(outStats, reference_variable(refi));
627  }
628  }
629  else
630  {
631  // In notSup hash table, associate last to refi
632  hash_put(notSup, reference_variable(refi), last);
633  }
634 
635  }
636 
637  // At the end of the new sequence, add the out statement for each reference
638  HASH_MAP(ent, stat,
639  {
640  newSeq = addStatementToSequence(stat, newSeq, &newSeqStart);
641  }, outStats);
642 
643  hash_table_free(outStats);
644  hash_table_free(notSup);
645 
646  return newSeqStart;
647 }
void free_statement(statement p)
Definition: ri.c:2189
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
static bool stat_has_write_eff_ref_p(reference ref, statement stat)
Definition: deatomizer.c:270
static void daCallReplaceReference(call c, reference ref, expression next)
Definition: deatomizer.c:189
static list addStatementToSequence(statement stat, list seq, list *start)
Definition: deatomizer.c:226
static bool expr_has_write_eff_ref_p(reference ref, expression expr)
Definition: deatomizer.c:244
static void daExpressionReplaceReference(list e, reference ref, expression next)
Definition: deatomizer.c:145
static bool stats_has_rw_conf_p(statement si, statement sj, reference refi, reference refj)
Definition: deatomizer.c:344
size_t gen_length(const list l)
Definition: list.c:150
hash_table hash_table_make(hash_key_type key_type, size_t size)
Definition: hash.c:294
void * hash_get(const hash_table htp, const void *key)
this function retrieves in the hash table pointed to by htp the couple whose key is equal to key.
Definition: hash.c:449
void hash_put(hash_table htp, const void *key, const void *val)
This functions stores a couple (key,val) in the hash table pointed to by htp.
Definition: hash.c:364
void hash_table_free(hash_table htp)
this function deletes a hash table that is no longer useful.
Definition: hash.c:327
void * hash_del(hash_table htp, const void *key)
this function removes from the hash table pointed to by htp the couple whose key is equal to key.
Definition: hash.c:439
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define HASH_MAP(k, v, code, ht)
Definition: newgen_hash.h:60
@ hash_pointer
Definition: newgen_hash.h:32
#define HASH_UNDEFINED_VALUE
value returned by hash_get() when the key is not found; could also be called HASH_KEY_NOT_FOUND,...
Definition: newgen_hash.h:56
void print_statement(statement)
Print a statement on stderr.
Definition: statement.c:98
bool same_entity_p(entity e1, entity e2)
predicates on entities
Definition: entity.c:1321
reference expression_reference(expression e)
Short cut, meaningful only if expression_reference_p(e) holds.
Definition: expression.c:1832
#define reference_variable(x)
Definition: ri.h:2326
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
int printf()
#define ifdebug(n)
Definition: sg.c:47

References addStatementToSequence(), call_arguments, call_function, CAR, CDR, daCallReplaceReference(), daCheckCallReplace(), daExpressionReplaceReference(), ENTITY_ASSIGN_P, expr_has_write_eff_ref_p(), EXPRESSION, expression_reference(), expression_syntax, fprintf(), free_statement(), gen_length(), gInIndex, gReplaceAllowed, gRepOnlyInIndex, hash_del(), hash_get(), HASH_MAP, hash_pointer, hash_put(), hash_table_free(), hash_table_make(), HASH_UNDEFINED_VALUE, ifdebug, instruction_call, instruction_call_p, is_syntax_reference, NIL, pips_assert, pips_debug, print_statement(), printf(), reference_equal_p(), reference_indices, reference_variable, same_entity_p(), stat_has_write_eff_ref_p(), STATEMENT, statement_instruction, stats_has_rw_conf_p(), syntax_reference, and syntax_tag.

Referenced by da_simple_statements_pass().

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

◆ da_simple_sequence_filter()

static bool da_simple_sequence_filter ( statement  s)
static

Do not recurse through simple calls, for better performance

Definition at line 698 of file deatomizer.c.

699 {
700  instruction i;
701 
702  /* Do not recurse through simple calls, for better performance */
703  i = statement_instruction(s);
704  if (instruction_call_p(i))
705  return false;
706  else
707  return true;
708 }

References instruction_call_p, and statement_instruction.

Referenced by deatomizer().

+ Here is the caller graph for this function:

◆ da_simple_statements()

static void da_simple_statements ( statement  s)
static

Definition at line 676 of file deatomizer.c.

677 {
678  // It is a global variable
679  gRepDone = true;
680 
681  int debCount = 0;
682 
683  while(gRepDone && (debCount < 2))
684  {
685  gRepDone = false;
686 
687  debCount++;
688 
690 
691  if(debCount == 2)
692  {
693  pips_user_warning("too many iterations\n");
694  }
695  }
696 }
static bool gRepDone
Definition: deatomizer.c:63
static void da_simple_statements_pass(statement s)
Definition: deatomizer.c:653
#define pips_user_warning
Definition: misc-local.h:146

References da_simple_statements_pass(), gRepDone, and pips_user_warning.

Referenced by deatomizer().

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

◆ da_simple_statements_pass()

static void da_simple_statements_pass ( statement  s)
static

not much we can do with a single statement, or with "complex" statements (ie, with tests/loops/...)

Definition at line 653 of file deatomizer.c.

654 {
655  list seq;
656  list newseq;
657 
659  /* not much we can do with a single statement, or with
660  * "complex" statements (ie, with tests/loops/...)
661  */
662  return;
663 
665  newseq = da_process_list(seq, true, add_const_expr_p);
666 
668  gen_free_list(seq);
669 }
static bool add_const_expr_p(statement stat)
Definition: deatomizer.c:288
static list da_process_list(list seq, bool repOnlyInIndex, bool(*stat_to_process)(statement))
Definition: deatomizer.c:381
void gen_free_list(list l)
free the spine of the list
Definition: list.c:327
#define instruction_sequence_p(x)
Definition: ri.h:1512
#define sequence_statements(x)
Definition: ri.h:2360
#define instruction_sequence(x)
Definition: ri.h:1514

References add_const_expr_p(), da_process_list(), gen_free_list(), instruction_sequence, instruction_sequence_p, sequence_statements, and statement_instruction.

Referenced by da_simple_statements().

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

◆ daCallReplaceReference()

static void daCallReplaceReference ( call  c,
reference  ref,
expression  next 
)
static

nothing to replace

I'd rather assume, nothing to replace for symbolic constants

We assume that it is legal to replace arguments (because it should have been verified with the effects that the index is not WRITTEN).

Definition at line 189 of file deatomizer.c.

190 {
191  value vin;
192  entity f;
193 
194  f = call_function(c);
195  vin = entity_initial(f);
196 
197  switch (value_tag(vin)) {
198  case is_value_constant:
199  /* nothing to replace */
200  break;
201  case is_value_symbolic:
202  /* I'd rather assume, nothing to replace for symbolic constants */
203  break;
204  case is_value_intrinsic:
205  case is_value_unknown:
206  case is_value_code:
207  /* We assume that it is legal to replace arguments (because it should
208  have been verified with the effects that the index is not WRITTEN).
209  */
210  MAPL(a,
211  {
213  }, call_arguments(c));
214  break;
215  default:
216  pips_internal_error("unknown tag: %d",
217  (int) value_tag(vin));
218 
219  abort();
220  }
221 }
#define MAPL(_map_list_cp, _code, _l)
Apply some code on the addresses of all the elements of a list.
Definition: newgen_list.h:203
#define abort()
Definition: misc-local.h:53
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
#define value_tag(x)
Definition: ri.h:3064
@ 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

References abort, call_arguments, call_function, daExpressionReplaceReference(), entity_initial, f(), is_value_code, is_value_constant, is_value_intrinsic, is_value_symbolic, is_value_unknown, MAPL, pips_internal_error, ref, and value_tag.

Referenced by da_process_list(), and daExpressionReplaceReference().

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

◆ daCheckCallReplace()

static void daCheckCallReplace ( call  c,
reference  ref 
)
static

nothing to replace

I'd rather assume, nothing to replace for symbolic constants

We assume that it is legal to replace arguments (because it should have been verified with the effects that the index is not WRITTEN).

Definition at line 107 of file deatomizer.c.

108 {
109  value vin;
110  entity f;
111 
112  f = call_function(c);
113  vin = entity_initial(f);
114 
115  switch (value_tag(vin)) {
116  case is_value_constant:
117  /* nothing to replace */
118  break;
119  case is_value_symbolic:
120  /* I'd rather assume, nothing to replace for symbolic constants */
121  break;
122  case is_value_intrinsic:
123  case is_value_unknown:
124  case is_value_code:
125  /* We assume that it is legal to replace arguments (because it should
126  have been verified with the effects that the index is not WRITTEN).
127  */
128  {
130  {
132  }
133  }
134  break;
135  default:
136  pips_internal_error("unknown tag: %d",
137  (int) value_tag(vin));
138 
139  abort();
140  }
141 }

References abort, call_arguments, call_function, checkReplaceReference(), entity_initial, EXPRESSION, f(), FOREACH, is_value_code, is_value_constant, is_value_intrinsic, is_value_symbolic, is_value_unknown, pips_internal_error, ref, and value_tag.

Referenced by checkReplaceReference(), and da_process_list().

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

◆ daExpressionReplaceReference()

static void daExpressionReplaceReference ( list  e,
reference  ref,
expression  next 
)
static

replace if equal to ref

Definition at line 145 of file deatomizer.c.

146 {
148 
149  switch(syntax_tag(s)) {
150  case is_syntax_reference : {
152  /* replace if equal to ref */
153  if ( reference_indices(r) == NIL ) {
157  gRepDone = true;
158 
160  {
163  }
164 
166  }
167  }
168  else {
169  MAPL(lexpr,
170  {
171  daExpressionReplaceReference(lexpr, ref, next);
172  }, reference_indices(r));
173  }
174  }
175  break;
176  case is_syntax_range :
177  pips_internal_error("tag syntax_range not implemented");
178  break;
179  case is_syntax_call :
181  break;
182  default :
183  pips_internal_error("unknown tag: %d",
185  }
186 }
void free_normalized(normalized p)
Definition: ri.c:1407
syntax copy_syntax(syntax p)
SYNTAX.
Definition: ri.c:2442
#define NORMALIZE_EXPRESSION(e)
#define normalized_undefined
Definition: ri.h:1745
#define expression_normalized(x)
Definition: ri.h:1249

References CAR, copy_syntax(), daCallReplaceReference(), exp, EXPRESSION, expression_normalized, expression_syntax, free_normalized(), gRepDone, is_syntax_call, is_syntax_range, is_syntax_reference, MAPL, NIL, NORMALIZE_EXPRESSION, normalized_undefined, pips_internal_error, ref, reference_equal_p(), reference_indices, syntax_call, syntax_reference, and syntax_tag.

Referenced by da_process_list(), and daCallReplaceReference().

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

◆ deatomizer()

bool deatomizer ( char *  mod_name)

deatomizer.c

get the resources

Now do the job

Reorder the module, because new statements have been added

update/release resources

Parameters
mod_nameod_name

Definition at line 726 of file deatomizer.c.

727 {
728  /* get the resources */
729  statement mod_stmt = (statement)
730  db_get_memory_resource(DBR_CODE, mod_name, true);
731 
734  set_ordering_to_statement(mod_stmt);
735 
736  dep_graph = (graph) db_get_memory_resource(DBR_DG, mod_name, true);
737 
739  db_get_memory_resource(DBR_PROPER_EFFECTS, mod_name, true));
740 
741  debug_on("DEATOMIZER");
742 
743  /* Now do the job */
744 
745  // To prevent some warnings
747 
748  gen_recurse(mod_stmt, statement_domain,
750 
751  // Restore the warning
753 
754  pips_assert("Statement is consistent after DEATOMIZER",
755  statement_consistent_p(mod_stmt));
756 
757  /* Reorder the module, because new statements have been added */
758  module_reorder(mod_stmt);
759  DB_PUT_MEMORY_RESOURCE(DBR_CODE, mod_name, mod_stmt);
760 
761  /* update/release resources */
766 
767  debug_off();
768 
769  return true;
770 }
bool statement_consistent_p(statement p)
Definition: ri.c:2195
static bool da_simple_sequence_filter(statement s)
Definition: deatomizer.c:698
static void da_simple_statements(statement s)
Definition: deatomizer.c:676
static graph dep_graph
Definition: deatomizer.c:65
void reset_proper_rw_effects(void)
void set_proper_rw_effects(statement_effects)
#define gen_recurse(start, domain_number, flt, rwt)
Definition: genC.h:283
struct _newgen_struct_graph_ * graph
Definition: graph.h:31
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
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
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
void hash_dont_warn_on_redefinition(void)
Definition: hash.c:188
void hash_warn_on_redefinition(void)
these function set the variable should_i_warn_on_redefinition to the value true or false
Definition: hash.c:183
#define debug_on(env)
Definition: misc-local.h:157
#define debug_off()
Definition: misc-local.h:160
hash_table set_ordering_to_statement(statement s)
To be used instead of initialize_ordering_to_statement() to make sure that the hash table ots is in s...
Definition: ordering.c:172
void reset_ordering_to_statement(void)
Reset the mapping from ordering to statement.
Definition: ordering.c:185
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
Definition: reorder.c:244
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362

References da_simple_sequence_filter(), da_simple_statements(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, dep_graph, gen_recurse, hash_dont_warn_on_redefinition(), hash_warn_on_redefinition(), module_name_to_entity(), module_reorder(), pips_assert, reset_current_module_entity(), reset_current_module_statement(), reset_ordering_to_statement(), reset_proper_rw_effects(), set_current_module_entity(), set_current_module_statement(), set_ordering_to_statement(), set_proper_rw_effects(), statement_consistent_p(), and statement_domain.

+ Here is the call graph for this function:

◆ expr_has_write_eff_ref_p()

static bool expr_has_write_eff_ref_p ( reference  ref,
expression  expr 
)
static

Definition at line 244 of file deatomizer.c.

245 {
246  bool actionWrite = false;
247 
249 
250  FOREACH(EFFECT, f, ef)
251  {
252  entity effEnt = effect_entity(f);
253 
256  {
257  actionWrite = true;
258  }
259 
260  }
261 
262  gen_free_list(ef);
263 
264  return actionWrite;
265 }
list expression_to_proper_effects(expression)
entity effect_entity(effect)
cproto-generated files
Definition: effects.c:52
#define effect_action(x)
Definition: effects.h:642
#define action_write_p(x)
Definition: effects.h:314
#define EFFECT(x)
EFFECT.
Definition: effects.h:608

References action_write_p, EFFECT, effect_action, effect_entity(), expression_to_proper_effects(), f(), FOREACH, gen_free_list(), ref, reference_variable, and same_entity_p().

Referenced by da_process_list().

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

◆ stat_has_write_eff_ref_p()

static bool stat_has_write_eff_ref_p ( reference  ref,
statement  stat 
)
static

Definition at line 270 of file deatomizer.c.

271 {
272  bool actionWrite = false;
273 
275  {
276  entity effEnt = effect_entity(f);
277 
279  {
280  actionWrite = true;
281  }
282 
283  }
284 
285  return actionWrite;
286 }
list load_proper_rw_effects_list(statement)

References action_write_p, EFFECT, effect_action, effect_entity(), f(), FOREACH, load_proper_rw_effects_list(), ref, reference_variable, and same_entity_p().

Referenced by da_process_list().

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

◆ stats_has_rw_conf_p()

static bool stats_has_rw_conf_p ( statement  si,
statement  sj,
reference  refi,
reference  refj 
)
static

Definition at line 344 of file deatomizer.c.

346 {
347  if((gen_length(reference_indices(refi)) != 0) ||
348  (gen_length(reference_indices(refj)) != 0))
349  {
350  return false;
351  }
352 
354  {
356  {
358  {
361 
362  if((s1 == si) &&
363  (s2 == sj) &&
365  effect_write_p(conflict_sink(conf)) &&
366  !reference_equal_p(refi, refj))
367  {
368  return true;
369  }
370 
371  }
372  }
373  }
374 
375  return false;
376 }
#define conflict_sink(x)
Definition: dg.h:167
#define CONFLICT(x)
CONFLICT.
Definition: dg.h:134
#define dg_arc_label_conflicts(x)
Definition: dg.h:201
#define conflict_source(x)
Definition: dg.h:165
#define effect_write_p(eff)
#define effect_read_p(eff)
#define effect_scalar_p(eff) entity_scalar_p(effect_entity(eff))
#define successor_vertex(x)
Definition: graph.h:118
#define successor_arc_label(x)
Definition: graph.h:116
#define vertex_successors(x)
Definition: graph.h:154
#define SUCCESSOR(x)
SUCCESSOR.
Definition: graph.h:86
#define graph_vertices(x)
Definition: graph.h:82
#define VERTEX(x)
VERTEX.
Definition: graph.h:122
statement vertex_to_statement(vertex v)
Vertex_to_statement looks for the statement that is pointed to by vertex v.
Definition: util.c:45
s1
Definition: set.c:247

References CONFLICT, conflict_sink, conflict_source, dep_graph, dg_arc_label_conflicts, effect_read_p, effect_write_p, FOREACH, gen_length(), graph_vertices, reference_equal_p(), reference_indices, s1, SUCCESSOR, successor_arc_label, successor_vertex, VERTEX, vertex_successors, and vertex_to_statement().

Referenced by da_process_list().

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

Variable Documentation

◆ dep_graph

graph dep_graph
static

Definition at line 65 of file deatomizer.c.

Referenced by deatomizer(), quick_privatize_graph(), and stats_has_rw_conf_p().

◆ gInIndex

int gInIndex = 0
static

Definition at line 59 of file deatomizer.c.

Referenced by checkReplaceReference(), and da_process_list().

◆ gRepDone

bool gRepDone = false
static

Definition at line 63 of file deatomizer.c.

Referenced by da_simple_statements(), and daExpressionReplaceReference().

◆ gReplaceAllowed

bool gReplaceAllowed = false
static

Definition at line 61 of file deatomizer.c.

Referenced by checkReplaceReference(), and da_process_list().

◆ gRepOnlyInIndex

bool gRepOnlyInIndex = 0
static

Definition at line 60 of file deatomizer.c.

Referenced by checkReplaceReference(), and da_process_list().