PIPS
scalopify.c File Reference
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "ri-util.h"
#include "prettyprint.h"
#include "effects-util.h"
#include "misc.h"
#include "effects-generic.h"
#include "effects-simple.h"
#include "control.h"
#include "callgraph.h"
#include "pipsdbm.h"
#include "properties.h"
#include "accel-util.h"
#include "resources.h"
+ Include dependency graph for scalopify.c:

Go to the source code of this file.

Functions

static bool call_load_store_p (call c)
 A simple phase that change wrap references to flow outside kernel for dataflow runtime manager. More...
 
static bool find_call_to_wrap (call c, list *call_to_wrap)
 
static bool find_entities_to_wrap (call c, set *entities_to_wrap)
 
static bool pointer_to_array_p (entity e)
 
static type convert_local_to_pointer_array (type local_type)
 
bool scalopify (char *module_name)
 Warning! Do not modify this file that is automatically generated! More...
 

Function Documentation

◆ call_load_store_p()

static bool call_load_store_p ( call  c)
static

A simple phase that change wrap references to flow outside kernel for dataflow runtime manager.

cleme.nosp@m.nt.m.nosp@m.argue.nosp@m.t@hp.nosp@m.c-pro.nosp@m.ject.nosp@m..com

Definition at line 29 of file scalopify.c.

29  {
30  if(strstr(entity_name(call_function(c)),get_string_property("KERNEL_LOAD_STORE_LOAD_FUNCTION"))!=NULL
31  || strstr(entity_name(call_function(c)),get_string_property("KERNEL_LOAD_STORE_STORE_FUNCTION"))!=NULL){
32  return true;
33  }
34 
35  return false;
36 
37 }
char * get_string_property(const char *)
#define call_function(x)
Definition: ri.h:709
#define entity_name(x)
Definition: ri.h:2790

References call_function, entity_name, and get_string_property().

Referenced by find_entities_to_wrap(), and scalopify().

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

◆ convert_local_to_pointer_array()

static type convert_local_to_pointer_array ( type  local_type)
static

Definition at line 79 of file scalopify.c.

79  {
80 
81  list ls = variable_dimensions(type_variable(local_type));
82  size_t size = gen_length(ls);
84  basic b;
85 
86  for(unsigned int i = 0; i<size; i++){
87  b = make_basic_pointer(pointer_type);
88  pointer_type = make_type_variable(make_variable(b,NIL,NIL));
89  }
90 
91  return pointer_type;
92 }
type make_type_variable(variable _field_)
Definition: ri.c:2715
basic copy_basic(basic p)
BASIC.
Definition: ri.c:104
basic make_basic_pointer(type _field_)
Definition: ri.c:179
variable make_variable(basic a1, list a2, list a3)
Definition: ri.c:2895
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
size_t gen_length(const list l)
Definition: list.c:150
#define type_variable(x)
Definition: ri.h:2949
#define variable_dimensions(x)
Definition: ri.h:3122
#define variable_basic(x)
Definition: ri.h:3120
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References copy_basic(), gen_length(), make_basic_pointer(), make_type_variable(), make_variable(), NIL, type_variable, variable_basic, and variable_dimensions.

Referenced by scalopify().

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

◆ find_call_to_wrap()

static bool find_call_to_wrap ( call  c,
list call_to_wrap 
)
static

Definition at line 39 of file scalopify.c.

39  {
40  *call_to_wrap = CONS(CALL,c,*call_to_wrap);
41  return false;
42 }
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
#define CALL(x)
CALL.
Definition: ri.h:679

References CALL, and CONS.

Referenced by scalopify().

+ Here is the caller graph for this function:

◆ find_entities_to_wrap()

static bool find_entities_to_wrap ( call  c,
set entities_to_wrap 
)
static

Definition at line 45 of file scalopify.c.

45  {
46 
47  if(call_load_store_p(c)){
49 
51  call expcall = expression_call(exp);
52  if(call_intrinsic_p(expcall)){
53  c = expcall;
54  }
55  }
56 
58  pips_debug(1,"=========================\n");
59 
61 
62  if(!set_belong_p(*entities_to_wrap,e)) {
63  set_add_element(*entities_to_wrap,*entities_to_wrap,e);
64  }
65  }
66  return true;
67 }
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
bool set_belong_p(const set, const void *)
Definition: set.c:194
set set_add_element(set, const set, const void *)
Definition: set.c:152
void print_expression(expression e)
no file descriptor is passed to make is easier to use in a debugging stage.
Definition: expression.c:58
#define call_intrinsic_p(C)
bool expression_call_p(expression e)
Definition: expression.c:415
call expression_call(expression e)
Definition: expression.c:445
entity expression_variable(expression e)
Definition: expression.c:532
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define call_arguments(x)
Definition: ri.h:711
static bool call_load_store_p(call c)
A simple phase that change wrap references to flow outside kernel for dataflow runtime manager.
Definition: scalopify.c:29
#define exp
Avoid some warnings from "gcc -Wshadow".
Definition: vasnprintf.c:207

References call_arguments, call_intrinsic_p, call_load_store_p(), CAR, exp, EXPRESSION, expression_call(), expression_call_p(), expression_variable(), pips_debug, print_expression(), set_add_element(), and set_belong_p().

Referenced by scalopify().

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

◆ pointer_to_array_p()

static bool pointer_to_array_p ( entity  e)
static

Definition at line 70 of file scalopify.c.

70  {
71 
73 
74  if(ENDP(ls)) return true;
75 
76  return false;
77 }
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
#define entity_type(x)
Definition: ri.h:2792

References ENDP, entity_type, type_variable, and variable_dimensions.

Referenced by scalopify().

+ Here is the caller graph for this function:

◆ scalopify()

bool scalopify ( char *  module_name)

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

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

wo cases: vector or scalar

Parameters
module_nameodule_name

Definition at line 94 of file scalopify.c.

94  {
95 
96  // Use this module name and this environment variable to set
98  "SCALOPIFY_DEBUG_LEVEL");
99  set entities_to_wrap=set_make(set_pointer);
100  list call_to_wrap=NIL;
101 
102  expression exp;
103  type t;
104 
105  entity get_call_entity = local_name_to_top_level_entity("P4A_scmp_flow");
106 
108 
109  gen_context_recurse(module_statement,&entities_to_wrap,
111 
112  gen_context_recurse(module_statement, &call_to_wrap,
114 
115  FOREACH(CALL, c , call_to_wrap){
116 
117  if(!call_load_store_p(c)){
118 
119  SET_FOREACH(entity, e, entities_to_wrap){
120 
121  /*Two cases: vector or scalar*/
122  if(entity_array_p(e)) {
123 
124  exp = MakeUnaryCall(get_call_entity, entity_to_expression(e));
125 
126  if(!pointer_to_array_p(e)){
128  }
129  else{
130  t= entity_type(e);
131  }
132 
134  }
135  else{
136 
139 
141  exp = MakeUnaryCall(get_call_entity, exp);
144  }
146  }
147  }
148  }
149 
150 
151 
152  gen_free_list(call_to_wrap);
153  set_free(entities_to_wrap);
154 
155  // We may have outline some code, so recompute the callees:
156  DB_PUT_MEMORY_RESOURCE(DBR_CALLEES, module_name,
158 
160  // Put back the new statement module
162 
163  return true;
164 }
cast make_cast(type a1, expression a2)
Definition: ri.c:311
expression make_expression(syntax a1, normalized a2)
Definition: ri.c:886
type copy_type(type p)
TYPE.
Definition: ri.c:2655
syntax make_syntax_cast(cast _field_)
Definition: ri.c:2503
static statement module_statement
Definition: alias_check.c:125
callees compute_callees(const statement stat)
Recompute the callees of a module statement.
Definition: callgraph.c:355
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
#define gen_context_recurse(start, ctxt, domain_number, flt, rwt)
Definition: genC.h:285
statement get_current_module_statement(void)
Get the current module statement.
Definition: static.c:208
void replace_entity_by_expression(void *s, entity ent, expression exp)
replace all reference to entity ent by expression exp in s.
Definition: replace.c:220
void gen_null2(__attribute__((unused)) void *u1, __attribute__((unused)) void *u2)
idem with 2 args, to please overpeaky compiler checks
Definition: genClib.c:2758
void gen_free_list(list l)
free the spine of the list
Definition: list.c:327
#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_PHASE_POSTLUDE(new_module_statement)
End a transformation phase by putting back into PIPS the (possibly) modified statement.
#define PIPS_PHASE_PRELUDE(module_name, debug_env_var)
Start a phase that use a module CODE.
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 SET_FOREACH(type_name, the_item, the_set)
enumerate set elements in their internal order.
Definition: newgen_set.h:78
void set_free(set)
Definition: set.c:332
@ set_pointer
Definition: newgen_set.h:44
set set_make(set_type)
Create an empty set of any type but hash_private.
Definition: set.c:102
#define DEREFERENCING_OPERATOR_NAME
Definition: ri-util-local.h:93
#define ADDRESS_OF_OPERATOR_NAME
bool entity_array_p(entity e)
Is e a variable with an array type?
Definition: entity.c:754
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
entity entity_intrinsic(const char *name)
FI: I do not understand this function name (see next one!).
Definition: entity.c:1292
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
Definition: expression.c:165
expression MakeUnaryCall(entity f, expression a)
Creates a call expression to a function with one argument.
Definition: expression.c:342
#define normalized_undefined
Definition: ri.h:1745
#define call_domain
newgen_callees_domain_defined
Definition: ri.h:58
static bool pointer_to_array_p(entity e)
Definition: scalopify.c:70
static bool find_entities_to_wrap(call c, set *entities_to_wrap)
Definition: scalopify.c:45
static type convert_local_to_pointer_array(type local_type)
Definition: scalopify.c:79
static bool find_call_to_wrap(call c, list *call_to_wrap)
Definition: scalopify.c:39
FI: I do not understand why the type is duplicated at the set level.
Definition: set.c:59

References ADDRESS_OF_OPERATOR_NAME, CALL, call_domain, call_load_store_p(), compute_callees(), convert_local_to_pointer_array(), copy_type(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, DEREFERENCING_OPERATOR_NAME, entity_array_p(), entity_intrinsic(), entity_to_expression(), entity_type, exp, find_call_to_wrap(), find_entities_to_wrap(), FOREACH, gen_context_recurse, gen_free_list(), gen_null2(), get_current_module_statement(), local_name_to_top_level_entity(), make_basic_pointer(), make_cast(), make_expression(), make_syntax_cast(), make_type_variable(), make_variable(), MakeUnaryCall(), module_name(), module_statement, NIL, normalized_undefined, PIPS_PHASE_POSTLUDE, PIPS_PHASE_PRELUDE, pointer_to_array_p(), replace_entity_by_expression(), reset_cumulated_rw_effects(), set_cumulated_rw_effects(), SET_FOREACH, set_free(), set_make(), and set_pointer.

+ Here is the call graph for this function: