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

Go to the source code of this file.

Functions

static bool quick_privatize_loop (statement, list)
 QUICK PRIVATIZATION
More...
 
static bool quick_privatize_statement_pair (statement, statement, list)
 
void quick_privatize_graph (graph dep_graph)
 quick_privatize.c More...
 

Function Documentation

◆ quick_privatize_graph()

void quick_privatize_graph ( graph  dep_graph)

quick_privatize.c

we analyze arcs exiting from loop statements

Parameters
dep_graphep_graph

Definition at line 38 of file quick_privatize.c.

38  {
39  /* we analyze arcs exiting from loop statements */
43  if(statement_loop_p(s1)) {
44  loop l = statement_loop(s1);
45  list locals = loop_locals(l);
46  entity ind = loop_index(l);
47 
48  if(gen_find_eq(ind, locals) == entity_undefined) {
49  if(// entity_privatizable_in_loop_p(ind, l) && /* to be restored when global variables are uniformly treated everywhere. BC.*/
51  pips_debug(1, "Index for loop %" PRIdPTR " privatized\n",
53  loop_locals(l) = CONS(ENTITY, ind, locals);
54  } else {
55  pips_debug(1, "could not privatize loop %" PRIdPTR "\n",
57  }
58  }
59  }
60  }
61 }
static list successors(list l)
static graph dep_graph
Definition: deatomizer.c:65
#define vertex_successors(x)
Definition: graph.h:154
#define graph_vertices(x)
Definition: graph.h:82
#define VERTEX(x)
VERTEX.
Definition: graph.h:122
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
#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
void * gen_find_eq(const void *item, const list seq)
Definition: list.c:422
loop statement_loop(statement)
Get the loop of a statement.
Definition: statement.c:1374
bool statement_loop_p(statement)
Definition: statement.c:349
statement vertex_to_statement(vertex v)
Vertex_to_statement looks for the statement that is pointed to by vertex v.
Definition: util.c:45
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
static bool quick_privatize_loop(statement, list)
QUICK PRIVATIZATION
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define entity_undefined
Definition: ri.h:2761
#define loop_locals(x)
Definition: ri.h:1650
#define statement_number(x)
Definition: ri.h:2452
#define loop_index(x)
Definition: ri.h:1640
s1
Definition: set.c:247
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References CONS, dep_graph, ENTITY, entity_undefined, FOREACH, gen_find_eq(), graph_vertices, loop_index, loop_locals, pips_debug, quick_privatize_loop(), s1, statement_loop(), statement_loop_p(), statement_number, successors(), VERTEX, vertex_successors, and vertex_to_statement().

Referenced by compute_dg_on_statement_from_chains_in_place(), and rice_dependence_graph().

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

◆ quick_privatize_loop()

static bool quick_privatize_loop ( statement  stat,
list  successors 
)
static

QUICK PRIVATIZATION

Parameters
stattat
successorsuccessors

Definition at line 63 of file quick_privatize.c.

63  {
64  pips_debug(3, "arcs from %" PRIdPTR "\n", statement_number(stat));
68 
69  pips_debug(3, "arcs to %" PRIdPTR "\n", statement_number(st));
70 
72  return (false);
73  }
74 
75  return (true);
76 }
struct _newgen_struct_dg_arc_label_ * dg_arc_label
Definition: dg.h:60
#define dg_arc_label_conflicts(x)
Definition: dg.h:201
#define successor_vertex(x)
Definition: graph.h:118
#define successor_arc_label(x)
Definition: graph.h:116
#define SUCCESSOR(x)
SUCCESSOR.
Definition: graph.h:86
static bool quick_privatize_statement_pair(statement, statement, list)

References dg_arc_label_conflicts, FOREACH, pips_debug, quick_privatize_statement_pair(), statement_number, SUCCESSOR, successor_arc_label, successor_vertex, successors(), and vertex_to_statement().

Referenced by quick_privatize_graph().

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

◆ quick_privatize_statement_pair()

static bool quick_privatize_statement_pair ( statement  s1,
statement  s2,
list  conflicts 
)
static

equivalence or conflict not created by loop index. I give up !

we must know where this read effect come from. if it comes from the loop body, the arc may be ignored.

s2 is a loop. if there are no read effet in the range part, ignore this conflict.

Parameters
s11
s22
conflictsonflicts

Definition at line 80 of file quick_privatize.c.

81  {
82  loop l1 = statement_loop(s1);
83  entity ind1 = loop_index(l1);
84  FOREACH(CONFLICT, c, conflicts) {
85  effect f1 = conflict_source(c);
87  entity e1 = reference_variable(r1);
88 
89  effect f2 = conflict_sink(c);
91  entity e2 = reference_variable(r2);
92 
93  pips_debug(2, "conflict between %s & %s\n",
94  entity_name(e1), entity_name(e2));
95 
96  /* equivalence or conflict not created by loop index. I give up ! */
97  if(e1 != ind1)
98  continue;
99 
101  /* we must know where this read effect come from. if it
102  comes from the loop body, the arc may be ignored. */
103 
105 
107  loop l2;
108  entity ind2;
109  list range_effects;
110 
111  pips_debug(3, "the arc goes outside the loop body.\n");
112 
114  pips_debug(3, "s2 is an implied loop\n");
115  return (true);
116  }
117  if(!statement_loop_p(s2)) {
118  pips_debug(3, "s2 not a loop\n");
119  return (false);
120  }
121 
122  /* s2 is a loop. if there are no read effet in the range
123  part, ignore this conflict. */
124  l2 = statement_loop(s2);
125  ind2 = loop_index(l2);
126  range_effects = proper_effects_of_range(loop_range(l2));
127  FOREACH(EFFECT, e, range_effects) {
129  && action_read_p(effect_action(e))) {
130 
131  pips_debug(3, "index read in range expressions\n");
132 
133  free_effects(make_effects(range_effects));
134  return (false);
135  }
136  }
137  free_effects(make_effects(range_effects));
138  }
139  }
140  }
141 
142  return (true);
143 }
effects make_effects(list a)
Definition: effects.c:568
void free_effects(effects p)
Definition: effects.c:535
static list loops
#define conflict_sink(x)
Definition: dg.h:167
#define CONFLICT(x)
CONFLICT.
Definition: dg.h:134
#define conflict_source(x)
Definition: dg.h:165
list proper_effects_of_range(range)
bool is_implied_do_index(entity, instruction)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
#define effect_action(x)
Definition: effects.h:642
#define action_write_p(x)
Definition: effects.h:314
#define action_read_p(x)
Definition: effects.h:311
#define EFFECT(x)
EFFECT.
Definition: effects.h:608
int f2(int off1, int off2, int w, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:1
list load_statement_enclosing_loops(statement)
#define reference_variable(x)
Definition: ri.h:2326
#define entity_name(x)
Definition: ri.h:2790
#define statement_instruction(x)
Definition: ri.h:2458
#define loop_range(x)
Definition: ri.h:1642

References action_read_p, action_write_p, CONFLICT, conflict_sink, conflict_source, EFFECT, effect_action, effect_any_reference, entity_name, entity_undefined, f2(), FOREACH, free_effects(), gen_find_eq(), is_implied_do_index(), load_statement_enclosing_loops(), loop_index, loop_range, loops, make_effects(), pips_debug, proper_effects_of_range(), reference_variable, s1, statement_instruction, statement_loop(), and statement_loop_p().

Referenced by quick_privatize_loop().

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