PIPS
rstream_interface.h File Reference

Go to the source code of this file.

Functions

void pragma_nonscop (statement, bool, bool)
 Warning! Do not modify this file that is automatically generated! More...
 
bool rstream_interface (char *)
 Phase in charge of putting pragmas around the non-SCoP of the code This phase only works if there has been a previous phase applied putting pragmas around SCoP of the code. More...
 

Function Documentation

◆ pragma_nonscop()

void pragma_nonscop ( statement  s,
bool  pragma_added_p,
bool  in_loop_p 
)

Warning! Do not modify this file that is automatically generated!

Modify src/Libs/rstream_interface/rstream_interface-local.h instead, to add your own modifications. header file built by cproto rstream_interface-local.h cproto-generated files rstream_interface.c

Parameters
pragma_added_pragma_added_p
in_loop_pn_loop_p

Definition at line 129 of file rstream_interface.c.

129  {
130 
131  statement save_stmt = statement_undefined,
132  last_added_pragma = statement_undefined;
133  instruction instTop = statement_instruction(s);
134 
135  switch (instruction_tag(instTop)) {
136 
138  {
139  sequence seqInst = instruction_sequence(instTop);
140  list stmts = sequence_statements(seqInst);
141  FOREACH(statement, stmt, stmts) {
142  save_stmt = stmt;
144  static_control sc;
145  switch (instruction_tag(inst)) {
146  case is_instruction_loop :
147  {
148  bool insideScop = searchPragma(stmt);
149  bool currentScop = statement_with_pragma_p(stmt);
150  loop l = instruction_loop(inst);
152  if (!static_control_yes(sc) && !pragma_added_p && !insideScop) {
153  add_to_stmt(stmt, &pragma_added_p);
154  last_added_pragma = stmt;
155  }
156  else if (!static_control_yes(sc) && !pragma_added_p && insideScop && !currentScop) {
157  pragma_nonscop(stmt, pragma_added_p, true);
158  }
159  else if (static_control_yes(sc) && pragma_added_p) {
160  insert_endscop_before_stmt(stmt, &pragma_added_p, seqInst, stmts, last_added_pragma);
161  }
162  }
163  break;
164  case is_instruction_test :
165  {
166  bool insideScop = searchPragma(stmt);
168  if (!static_control_yes(sc) && !pragma_added_p && !insideScop) {
169  add_to_stmt(stmt, &pragma_added_p);
170  last_added_pragma = stmt;
171  }
172  else if (!in_loop_p && !pragma_added_p && insideScop) {
173  pragma_nonscop(stmt, pragma_added_p, in_loop_p);
174  }
175  else if (static_control_yes(sc) && pragma_added_p) {
176  insert_endscop_before_stmt(stmt, &pragma_added_p, seqInst, stmts, last_added_pragma);
177  }
178  }
179  break;
181  {
182  bool insideScop = searchPragma(stmt);
183  if (!insideScop && !pragma_added_p) {
184  add_to_stmt(stmt, &pragma_added_p);
185  last_added_pragma = stmt;
186  }
187  else if (insideScop) {
188  pragma_nonscop(whileloop_body(instruction_whileloop(inst)), pragma_added_p, in_loop_p);
189  }
190  }
191  break;
192  case is_instruction_call :
193  {
195  bool isDeclaration = declaration_statement_p(stmt);
196  if (return_statement_p(stmt) && pragma_added_p) {
197  insert_endscop_before_stmt(stmt, &pragma_added_p, seqInst, stmts, last_added_pragma);
198  }
199  else if (!static_control_yes(sc) && !pragma_added_p && !isDeclaration) {
200  add_to_stmt(stmt, &pragma_added_p);
201  last_added_pragma = stmt;
202  }
203  else if (static_control_yes(sc) && pragma_added_p) {
204  insert_endscop_before_stmt(stmt, &pragma_added_p, seqInst, stmts, last_added_pragma);
205  }
206  }
207  break;
208  default :
209  {
211  bool currentScop = statement_with_pragma_p(stmt);
212  bool insideScop = searchPragma(stmt);
213  if (pragma_added_p && static_control_yes(sc)) {
214  insert_endscop_before_stmt(stmt, &pragma_added_p, seqInst, stmts, last_added_pragma);
215  }
216  else if (!pragma_added_p && !static_control_yes(sc) && !currentScop && !insideScop) {
217  add_to_stmt(stmt, &pragma_added_p);
218  last_added_pragma = stmt;
219  }
220  }
221  break;
222  }
223  }
224  if (pragma_added_p) {
225  insert_endscop_after_stmt(save_stmt, &pragma_added_p, seqInst, last_added_pragma);
226  }
227  }
228  break;
229  case is_instruction_loop :
230  {
231  loop loopAlone = instruction_loop(instTop);
233  bool insideScop = searchPragma(s);
234  bool currentScop = statement_with_pragma_p(s);
235  if (!static_control_yes(scAlone) && !pragma_added_p && !insideScop && !currentScop) {
236  add_to_stmt(s, &pragma_added_p);
237  last_added_pragma = s;
238  insert_endscop_in_sequence(s, &pragma_added_p, false);
239  }
240  else if (!static_control_yes(scAlone) && insideScop && !currentScop) {
241  pragma_nonscop(loop_body(loopAlone), pragma_added_p, in_loop_p);
242  }
243  }
244  break;
245 
247  {
248  }
249  break;
250 
252  {
253  whileloop whileAlone = instruction_whileloop(instTop);
254  bool currentScop = statement_with_pragma_p(s);
255  if (!currentScop)
256  pragma_nonscop(whileloop_body(whileAlone), pragma_added_p, in_loop_p);
257  }
258  break;
259 
260  case is_instruction_test :
261  {
262  test testAlone = instruction_test(instTop);
263  bool currentScop = statement_with_pragma_p(s);
264  if (!currentScop) {
265  pragma_nonscop(test_true(testAlone), pragma_added_p, in_loop_p);
266  pragma_nonscop(test_false(testAlone), pragma_added_p, in_loop_p);
267  }
268  }
269  break;
270 
271  default :
272  break;
273  }
274  return;
275 }
#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
bool return_statement_p(statement)
Test if a statement is a C or Fortran "return".
Definition: statement.c:172
bool statement_with_pragma_p(statement)
Test if a statement has some pragma.
Definition: statement.c:3836
bool declaration_statement_p(statement)
Had to be optimized according to Beatrice Creusillet.
Definition: statement.c:224
#define GET_STATEMENT_MAPPING(map, stat)
Definition: newgen-local.h:49
struct _newgen_struct_static_control_ * static_control
Definition: paf_ri.h:184
#define static_control_yes(x)
Definition: paf_ri.h:753
#define loop_body(x)
Definition: ri.h:1644
#define instruction_loop(x)
Definition: ri.h:1520
#define test_false(x)
Definition: ri.h:2837
@ is_instruction_whileloop
Definition: ri.h:1472
@ is_instruction_test
Definition: ri.h:1470
@ is_instruction_call
Definition: ri.h:1474
@ is_instruction_sequence
Definition: ri.h:1469
@ is_instruction_forloop
Definition: ri.h:1477
@ is_instruction_loop
Definition: ri.h:1471
#define instruction_tag(x)
Definition: ri.h:1511
#define test_true(x)
Definition: ri.h:2835
#define sequence_statements(x)
Definition: ri.h:2360
#define instruction_sequence(x)
Definition: ri.h:1514
#define instruction_whileloop(x)
Definition: ri.h:1523
#define whileloop_body(x)
Definition: ri.h:3162
#define statement_instruction(x)
Definition: ri.h:2458
#define instruction_test(x)
Definition: ri.h:1517
#define statement_undefined
Definition: ri.h:2419
static void add_to_stmt(statement stmt, bool *pragma_added_p)
static bool searchPragma(statement s)
static statement_mapping Gsc_map
static void insert_endscop_after_stmt(statement stmt, bool *pragma_added_p, sequence seqInst, statement last_added_pragma)
static void insert_endscop_in_sequence(statement stmt, bool *pragma_added_p, bool insertBefore)
static void insert_endscop_before_stmt(statement stmt, bool *pragma_added_p, sequence seqInst, list stmts, statement last_added_pragma)
void pragma_nonscop(statement s, bool pragma_added_p, bool in_loop_p)
Warning! Do not modify this file that is automatically generated!
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
Definition: statement.c:54

References add_to_stmt(), declaration_statement_p(), FOREACH, GET_STATEMENT_MAPPING, Gsc_map, insert_endscop_after_stmt(), insert_endscop_before_stmt(), insert_endscop_in_sequence(), instruction_loop, instruction_sequence, instruction_tag, instruction_test, instruction_whileloop, is_instruction_call, is_instruction_forloop, is_instruction_loop, is_instruction_sequence, is_instruction_test, is_instruction_whileloop, loop_body, return_statement_p(), searchPragma(), sequence_statements, statement_instruction, statement_undefined, statement_with_pragma_p(), static_control_yes, test_false, test_true, and whileloop_body.

Referenced by rstream_interface().

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

◆ rstream_interface()

bool rstream_interface ( char *  module_name)

Phase in charge of putting pragmas around the non-SCoP of the code This phase only works if there has been a previous phase applied putting pragmas around SCoP of the code.

Parameters
module_nameodule_name

Definition at line 281 of file rstream_interface.c.

281  {
282  statement module_stat;
285 
286  module_stat = get_current_module_statement();
287 
288  Gsc_map = (statement_mapping)db_get_memory_resource(DBR_STATIC_CONTROL, module_name, true);
289 
290  pragma_nonscop(module_stat, false, false);
291 
292  DB_PUT_MEMORY_RESOURCE(DBR_CODE, module_name,module_stat);
293 
296 
297  return true;
298 }
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
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
hash_table statement_mapping
these macros are obsolete! newgen functions (->) should be used instead
Definition: newgen-local.h:42
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

References db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, get_current_module_statement(), Gsc_map, local_name_to_top_level_entity(), module_name(), pragma_nonscop(), reset_current_module_entity(), reset_current_module_statement(), set_current_module_entity(), and set_current_module_statement().

+ Here is the call graph for this function: