PIPS
taskify.c File Reference

Task generation. More...

#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "ri-util.h"
#include "prettyprint.h"
#include "effects-util.h"
#include "gpu.h"
#include "accel-util.h"
#include "text.h"
#include "pipsdbm.h"
#include "pipsmake.h"
#include "resources.h"
#include "properties.h"
#include "misc.h"
#include "control.h"
#include "callgraph.h"
#include "effects-generic.h"
#include "effects-convex.h"
#include "preprocessor.h"
#include "expressions.h"
#include "text-util.h"
#include "parser_private.h"
+ Include dependency graph for taskify.c:

Go to the source code of this file.

Functions

static string get_next_task_name ()
 
static bool loop_found_p (_UNUSED_ loop l, bool *found)
 
bool taskify_statement (statement s)
 
bool taskify (char *module_name)
 

Detailed Description

Task generation.

Author
Mehdi Amini mehdi.nosp@m..ami.nosp@m.ni@si.nosp@m.lkan.nosp@m..com

Definition in file taskify.c.

Function Documentation

◆ get_next_task_name()

static string get_next_task_name ( )
static

Definition at line 56 of file taskify.c.

56  {
57  string prefix = (string)get_string_property("TASKIFY_TASK_PREFIX");
59  return task_name;
60 }
char * get_string_property(const char *)
string build_outline_name(const char *base_prefix, const char *mod_name)
Build the outline function name.
Definition: gpu-ify.c:78
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
char * string
STRING.
Definition: newgen_types.h:39
static const char * prefix
const char * entity_user_name(entity e)
Since entity_local_name may contain PIPS special characters such as prefixes (label,...
Definition: entity.c:487

References build_outline_name(), entity_user_name(), get_current_module_entity(), get_string_property(), and prefix.

Referenced by taskify_statement().

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

◆ loop_found_p()

static bool loop_found_p ( _UNUSED_ loop  l,
bool found 
)
static

Definition at line 62 of file taskify.c.

62  {
63  *found = true;
64  return false;
65 }

Referenced by taskify_statement().

+ Here is the caller graph for this function:

◆ taskify()

bool taskify ( char *  module_name)

regions

Initialize set for each statement

Definition at line 88 of file taskify.c.

88  {
89 
90  statement module_stat = (statement)db_get_memory_resource(DBR_CODE,
92  true);
93  set_current_module_statement(module_stat);
94 
96 
97  debug_on("TASKIFY_DEBUG_LEVEL");
98 
99 
100  /* regions */
101  string region = db_get_memory_resource(DBR_REGIONS, module_name, true);
104  module_name,
105  true));
106 
107 
108  // Save the value of a property we are going to change locally:
109  bool old_outline_independent_compilation_unit =
110  get_bool_property("OUTLINE_INDEPENDENT_COMPILATION_UNIT");
111  set_bool_property("OUTLINE_INDEPENDENT_COMPILATION_UNIT",false);
112 
113  /* Initialize set for each statement */
115 
116  // Restore the original property value:
117  set_bool_property("OUTLINE_INDEPENDENT_COMPILATION_UNIT",
118  old_outline_independent_compilation_unit);
119 
120 
122  DB_PUT_MEMORY_RESOURCE(DBR_CODE,
123  module_name,
124  module_stat);
125 
126  // We may have outline some code, so recompute the callees:
127  DB_PUT_MEMORY_RESOURCE(DBR_CALLEES, module_name,
129 
130 
131  debug_off();
132 
137 
138  return true;
139 }
callees compute_callees(const statement stat)
Recompute the callees of a module statement.
Definition: callgraph.c:355
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
#define region
simulation of the type region
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
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
#define gen_recurse(start, domain_number, flt, rwt)
Definition: genC.h:283
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
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
Definition: genClib.c:2752
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 debug_off()
Definition: misc-local.h:160
void set_bool_property(const char *, bool)
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
Definition: reorder.c:244
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
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362
bool taskify_statement(statement s)
Definition: taskify.c:67

References compute_callees(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, gen_null(), gen_recurse, get_bool_property(), get_current_module_statement(), local_name_to_top_level_entity(), module_name(), module_reorder(), region, reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), reset_proper_rw_effects(), set_bool_property(), set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), set_proper_rw_effects(), statement_domain, and taskify_statement().

+ Here is the call graph for this function:

◆ taskify_statement()

bool taskify_statement ( statement  s)

Definition at line 67 of file taskify.c.

67  {
68  bool contains_a_loop = false;
69  if(!statement_loop_p(s)) {
70  gen_context_recurse(s, &contains_a_loop, loop_domain, loop_found_p, gen_null2);
71  }
72 
73  if( !contains_a_loop
75  && !return_statement_p(s)
78  ifdebug(2) {
79  pips_debug(2,"Ouline statement into a new task : ");
80  print_statement(s);
81  }
83  return false;
84  }
85  return true;
86 }
statement outliner(const char *, list)
outline the statements in statements_to_outline into a module named outline_module_name the outlined ...
Definition: outlining.c:1327
#define gen_context_recurse(start, ctxt, domain_number, flt, rwt)
Definition: genC.h:285
void gen_null2(__attribute__((unused)) void *u1, __attribute__((unused)) void *u2)
idem with 2 args, to please overpeaky compiler checks
Definition: genClib.c:2758
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
bool empty_statement_or_continue_p(statement)
Return true if the statement is an empty instruction block or a continue or a recursive combination o...
Definition: statement.c:474
bool statement_loop_p(statement)
Definition: statement.c:349
bool statement_contains_user_call_p(statement)
Definition: statement.c:3939
bool return_statement_p(statement)
Test if a statement is a C or Fortran "return".
Definition: statement.c:172
bool declaration_statement_p(statement)
Had to be optimized according to Beatrice Creusillet.
Definition: statement.c:224
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
void print_statement(statement)
Print a statement on stderr.
Definition: statement.c:98
#define loop_domain
newgen_language_domain_defined
Definition: ri.h:218
#define ifdebug(n)
Definition: sg.c:47
static bool loop_found_p(_UNUSED_ loop l, bool *found)
Definition: taskify.c:62
static string get_next_task_name()
Definition: taskify.c:56

References CONS, declaration_statement_p(), empty_statement_or_continue_p(), gen_context_recurse, gen_null2(), get_next_task_name(), ifdebug, loop_domain, loop_found_p(), NIL, outliner(), pips_debug, print_statement(), return_statement_p(), statement_contains_user_call_p(), and statement_loop_p().

Referenced by taskify().

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