PIPS
pocc-interface.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool condition_body_contains_loop_p (statement)
 Warning! Do not modify this file that is automatically generated! More...
 
bool condition_contains_loop_p (statement)
 Checks if a test contains a loop. More...
 
bool is_SCOP_rich (sequence, statement, statement, bool *)
 Checks if there is at least one loop in the sequence. More...
 
bool is_subroutine (instruction)
 Returns true if the instruction is a subroutine. More...
 
bool pocc_prettyprinter (char *)
 use the result of control static to add pragmas for pocc compiler , that pragmas delimit control static parts (static control region which can contains many loop nests More...
 

Function Documentation

◆ condition_body_contains_loop_p()

bool condition_body_contains_loop_p ( statement  s)

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

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

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

Definition at line 73 of file pocc_prettyprinter.c.

73  {
74  if(statement_sequence_p(s)) {
76  sequence seq = instruction_sequence(inst);
77  list stmts = sequence_statements(seq);
78  FOREACH(statement, stmt, stmts) {
80  return true;
81  }
82  }
83  else {
85  return true;
86  }
87  return false;
88 }
#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 statement_test_p(statement)
Definition: statement.c:343
bool statement_forloop_p(statement)
Definition: statement.c:374
bool statement_loop_p(statement)
Definition: statement.c:349
bool statement_sequence_p(statement)
Statement classes induced from instruction type.
Definition: statement.c:335
bool condition_contains_loop_p(statement s)
Checks if a test contains a loop.
#define sequence_statements(x)
Definition: ri.h:2360
#define instruction_sequence(x)
Definition: ri.h:1514
#define statement_instruction(x)
Definition: ri.h:2458
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
Definition: statement.c:54

References condition_contains_loop_p(), FOREACH, instruction_sequence, sequence_statements, statement_forloop_p(), statement_instruction, statement_loop_p(), statement_sequence_p(), and statement_test_p().

Referenced by condition_contains_loop_p().

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

◆ condition_contains_loop_p()

bool condition_contains_loop_p ( statement  s)

Checks if a test contains a loop.

Definition at line 91 of file pocc_prettyprinter.c.

91  {
92  if (!statement_test_p(s))
93  return false;
95  test t = instruction_test(inst);
96  statement true_body = test_true(t);
97  statement false_body = test_false(t);
99  return true;
100  else
101  return false;
102 }
bool condition_body_contains_loop_p(statement s)
Look for a loop in a statement.
#define test_false(x)
Definition: ri.h:2837
#define test_true(x)
Definition: ri.h:2835
#define instruction_test(x)
Definition: ri.h:1517

References condition_body_contains_loop_p(), instruction_test, statement_instruction, statement_test_p(), test_false, and test_true.

Referenced by condition_body_contains_loop_p(), and is_SCOP_rich().

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

◆ is_SCOP_rich()

bool is_SCOP_rich ( sequence  seq,
statement  last_added_pragma,
statement  curStmt,
bool pragma_added_p 
)

Checks if there is at least one loop in the sequence.

If not it removes the previously added pragma on the last_added_pragma statement.

Parameters
seqeq
last_added_pragmaast_added_pragma
curStmturStmt
pragma_added_pragma_added_p

Definition at line 107 of file pocc_prettyprinter.c.

107  {
108  // Should not occur but just in case
109  if(!statement_with_pragma_p(last_added_pragma)) {
110  return false;
111  }
112  bool startSearch = false;
113  list stmts = sequence_statements(seq);
114  FOREACH(statement, stmt, stmts) {
115  // We start searching in sequence from the current statement
116  if (are_stmts_eq(stmt, last_added_pragma)) {
117  startSearch = true;
118  }
119  // We stop searching when we are at the current statement in the sequence
120  else if (are_stmts_eq(stmt, curStmt)) {
121  startSearch = false;
122  }
123  if (startSearch) {
124  // If the statement is a loop or if it is a test containing a loop
126  return true;
127  }
128  }
129  }
130  // Clearing pragma
131  clear_pragma_on_statement(last_added_pragma);
132  *pragma_added_p = false;
133  return false;
134 }
void clear_pragma_on_statement(statement)
Remove all pragma attached to a given statement.
bool statement_with_pragma_p(statement)
Test if a statement has some pragma.
Definition: statement.c:3836
static bool are_stmts_eq(statement stmt1, statement stmt2)

References are_stmts_eq(), clear_pragma_on_statement(), condition_contains_loop_p(), FOREACH, sequence_statements, statement_forloop_p(), statement_loop_p(), statement_test_p(), and statement_with_pragma_p().

Referenced by insert_endscop_after_stmt(), and insert_endscop_before_stmt().

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

◆ is_subroutine()

bool is_subroutine ( instruction  inst)

Returns true if the instruction is a subroutine.

Parameters
instnst

Definition at line 173 of file pocc_prettyprinter.c.

173  {
174  // Is the call's entity a functional type ?
175  bool testFunction = false;
176  // If it is a functional type, is the functional's result type void ?
177  bool isVoid = false;
178  if (instruction_call_p(inst)) {
180  if(testFunction) {
182  }
183  }
184  return isVoid;
185 }
#define type_functional_p(x)
Definition: ri.h:2950
#define functional_result(x)
Definition: ri.h:1444
#define call_function(x)
Definition: ri.h:709
#define type_functional(x)
Definition: ri.h:2952
#define type_void_p(x)
Definition: ri.h:2959
#define instruction_call_p(x)
Definition: ri.h:1527
#define instruction_call(x)
Definition: ri.h:1529
#define entity_type(x)
Definition: ri.h:2792

References call_function, entity_type, functional_result, instruction_call, instruction_call_p, type_functional, type_functional_p, and type_void_p.

Referenced by pragma_scop().

+ Here is the caller graph for this function:

◆ pocc_prettyprinter()

bool pocc_prettyprinter ( char *  module_name)

use the result of control static to add pragmas for pocc compiler , that pragmas delimit control static parts (static control region which can contains many loop nests

Parameters
module_nameodule_name

Definition at line 372 of file pocc_prettyprinter.c.

372  {
373  // Standard setup
374  statement module_stat;
377  module_stat = get_current_module_statement();
378 
379  Gsc_map = (statement_mapping)db_get_memory_resource(DBR_STATIC_CONTROL, module_name, true);
380 
381  // First call of the function on the global statement
382  pragma_scop(module_stat, false, false);
383 
384  // Standard procedure
385  DB_PUT_MEMORY_RESOURCE(DBR_CODE, module_name,module_stat);
388 
389  return true;
390 }
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
static void pragma_scop(statement s, bool pragma_added_p, bool in_loop_p)
Called recursively, place pragmas on statements according to SCoP conditions.
static statement_mapping Gsc_map
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_scop(), 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: