PIPS
compile.c File Reference
#include "defines-local.h"
#include "pipsdbm.h"
#include "workspace-util.h"
#include "prettyprint.h"
#include "resources.h"
#include "effects-generic.h"
#include "effects-simple.h"
#include "effects-convex.h"
#include "expressions.h"
+ Include dependency graph for compile.c:

Go to the source code of this file.

Macros

#define src(name, suf)    strdup(concatenate(WORKSPACE_SRC_SPACE "/", name, suf, NULL))
 HPFC by Fabien Coelho, May 1993 and later... More...
 
#define full_name(dir, name)   concatenate(dir, "/", name, NULL)
 

Functions

void make_host_and_node_modules (entity module)
 compile.c More...
 
static void drop_distributed_arguments (entity module)
 kind of a quick hack to remove distributed arguments for the host More...
 
static entity create_bound_entity (entity module, entity array, bool upper, int dim, int number)
 
static list add_one_bound_argument (list lp, entity module, entity array, bool upper, int dim, int formal_number)
 
static void add_bound_arguments (entity module)
 for the node More...
 
void init_host_and_node_entities ()
 both host and node modules are initialized with the same declarations than the compiled module, but the distributed arrays declarations... More...
 
FILE * hpfc_fopen (string name)
 
void hpfc_fclose (FILE *f, string name)
 
static const char * old_name (entity module, entity obj)
 old name of obj while in module now. More...
 
static string hpfc_head_hook (entity m)
 to be used by the prettyprinter at the head of a file. More...
 
static string hpfc_common_hook (entity module, entity common)
 to be used by the prettyprinter when dealing with a common. More...
 
void hpfc_print_code (FILE *file, entity module, statement stat)
 
void put_generated_resources_for_common (entity common)
 
void compile_a_special_io_function (entity module)
 just copied for the host More...
 
void compile_a_pure_function (entity module)
 simply copied for both host and node... More...
 
void put_generated_resources_for_module (_UNUSED_ statement stat, statement host_stat, statement node_stat)
 
void put_generated_resources_for_program (_UNUSED_ string program_name)
 
void hpfcompile (const char *module_name)
 Compiler call, obsole. More...
 
static bool expression_simple_nondist_p (expression e)
 drivers for atomize_as_required in transformations More...
 
static bool hpfc_decision (reference r, expression e)
 break expression e in reference r if ... More...
 
entity hpfc_new_variable (entity module, basic b)
 
void hpfc_compile_error_handler ()
 
static bool invariant_expression_p (expression e, list loe, list le)
 true if no written effect on any variables of e in loe More...
 
static bool vect_in_p (Pvecteur vin, Pvecteur vref)
 returns if vin is in vref More...
 
static bool expression_flt (expression e)
 
static void substitute_and_create (statement s, entity v, expression e)
 
static bool loop_flt (loop l)
 
static void extract_distributed_non_constant_terms (statement s)
 transformation: DOALL I,J ... More...
 
static bool test_atomization (test t, _UNUSED_ expression e)
 
void NormalizeCodeForHpfc (statement s)
 
static void update_common_rewrite (reference r)
 To manage the common entities, I decided arbitrarilly that all commons will have to be declared exactly the same way (name and so), so I can safely unify the entities among the modules. More...
 
static void update_loop_rewrite (loop l)
 
static void debug_ref_rwt (reference r)
 
void debug_print_referenced_entities (void *obj)
 
void update_common_references_in_obj (void *obj)
 
void update_common_references_in_regions ()
 
void NormalizeCommonVariables (entity module, statement stat)
 

Variables

static entity subs_v
 substitute all occurences of expression e in statement s by variable v More...
 
static expression subs_e
 
static Pvecteur subs_pv
 

Macro Definition Documentation

◆ full_name

#define full_name (   dir,
  name 
)    concatenate(dir, "/", name, NULL)

Definition at line 414 of file compile.c.

◆ src

#define src (   name,
  suf 
)     strdup(concatenate(WORKSPACE_SRC_SPACE "/", name, suf, NULL))

HPFC by Fabien Coelho, May 1993 and later...

Definition at line 41 of file compile.c.

Function Documentation

◆ add_bound_arguments()

static void add_bound_arguments ( entity  module)
static

for the node

of parameter

Definition at line 196 of file compile.c.

197 {
198  type t = entity_type(module);
199  functional f;
200  list /* of parameter */ le = NIL, lp;
201  int len, i, next;
202 
203  message_assert("functional", type_functional_p(t));
204  f = type_functional(t);
205  lp = functional_parameters(f);
206  len = gen_length(lp);
207  next = len+1;
208 
209  for(i=1; i<=len; i++)
210  {
211  entity arg = find_ith_parameter(module, i),
212  old = load_old_node(arg);
213  pips_debug(8, "array %s\n", entity_name(old));
214 
215  if (array_distributed_p(old))
216  {
217  int dim, ndim;
218  ndim = NumberOfDimension(arg);
219 
220  for(dim=1; dim<=ndim; dim++)
221  {
222  if (ith_dim_overlapable_p(old, dim))
223  {
225  (le, module, arg, false, dim, next++);
227  (le, module, arg, true, dim, next++);
228  }
229  }
230  }
231  }
232 
233  if (le)
234  {
235  functional_parameters(f) = gen_nconc(lp, le);
236  }
237 }
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
size_t gen_length(const list l)
Definition: list.c:150
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
bool ith_dim_overlapable_p(entity array, int i)
Definition: hpfc-util.c:178
static list add_one_bound_argument(list lp, entity module, entity array, bool upper, int dim, int formal_number)
Definition: compile.c:177
entity load_old_node(entity)
bool array_distributed_p(entity)
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define message_assert(msg, ex)
Definition: newgen_assert.h:47
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
static char * module
Definition: pips.c:74
int NumberOfDimension(entity)
Definition: size.c:588
entity find_ith_parameter(entity, int)
Definition: util.c:93
#define type_functional_p(x)
Definition: ri.h:2950
#define type_functional(x)
Definition: ri.h:2952
#define entity_name(x)
Definition: ri.h:2790
#define functional_parameters(x)
Definition: ri.h:1442
#define entity_type(x)
Definition: ri.h:2792
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References add_one_bound_argument(), array_distributed_p(), entity_name, entity_type, f(), find_ith_parameter(), functional_parameters, gen_length(), gen_nconc(), ith_dim_overlapable_p(), load_old_node(), message_assert, module, NIL, NumberOfDimension(), pips_debug, type_functional, and type_functional_p.

Referenced by init_host_and_node_entities().

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

◆ add_one_bound_argument()

static list add_one_bound_argument ( list  lp,
entity  module,
entity  array,
bool  upper,
int  dim,
int  formal_number 
)
static
Parameters
lpof parameter

Definition at line 177 of file compile.c.

184 {
185  (void) create_bound_entity(module, array, upper, dim, formal_number);
186  lp = CONS(PARAMETER,
189  make_mode_reference(), // FI: Used to be value...
191  lp);
192  return lp;
193 }
parameter make_parameter(type a1, mode a2, dummy a3)
Definition: ri.c:1495
type make_type_variable(variable _field_)
Definition: ri.c:2715
mode make_mode_reference(void)
Definition: ri.c:1356
variable make_variable(basic a1, list a2, list a3)
Definition: ri.c:2895
dummy make_dummy_unknown(void)
Definition: ri.c:617
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
static entity create_bound_entity(entity module, entity array, bool upper, int dim, int number)
Definition: compile.c:153
basic MakeBasic(int)
END_EOLE.
Definition: type.c:128
@ is_basic_int
Definition: ri.h:571
#define PARAMETER(x)
PARAMETER.
Definition: ri.h:1788
static entity array

References array, CONS, create_bound_entity(), is_basic_int, make_dummy_unknown(), make_mode_reference(), make_parameter(), make_type_variable(), make_variable(), MakeBasic(), module, NIL, and PARAMETER.

Referenced by add_bound_arguments().

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

◆ compile_a_pure_function()

void compile_a_pure_function ( entity  module)

simply copied for both host and node...

Parameters
moduleodule

Definition at line 493 of file compile.c.

494 {
495  string file_name, hn_name, dir_name, fs, ft;
496 
497  pips_debug(1, "compiling pure a function (%s)\n", entity_name(module));
498 
499  const char* prefix = module_local_name(module);
501  file_name = db_get_file_resource(DBR_SOURCE_FILE, prefix, true);
502  hn_name = src(prefix, BOTH_SUFFIX);
503 
504  fs = strdup(concatenate(dir_name, "/", file_name, NULL));
505  ft = strdup(concatenate(dir_name, "/", hn_name, NULL));
506  safe_copy(fs, ft);
507  free(fs), free(ft);
508 
509  DB_PUT_FILE_RESOURCE(DBR_HPFC_HOST, prefix, hn_name);
510  DB_PUT_FILE_RESOURCE(DBR_HPFC_NODE, prefix, strdup(hn_name));
511  DB_PUT_FILE_RESOURCE(DBR_HPFC_RTINIT, prefix, NO_FILE);
512  DB_PUT_FILE_RESOURCE(DBR_HPFC_PARAMETERS, prefix, NO_FILE);
513 }
void safe_copy(char *source, char *target)
Definition: file.c:706
void free(void *)
#define DB_PUT_FILE_RESOURCE
Put a file resource into the current workspace database.
Definition: pipsdbm-local.h:85
#define src(name, suf)
HPFC by Fabien Coelho, May 1993 and later...
Definition: compile.c:41
#define NO_FILE
fake resources...
#define BOTH_SUFFIX
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
#define db_get_file_resource
string db_get_current_workspace_directory(void)
Definition: workspace.c:96
static const char * prefix
const char * module_local_name(entity e)
Returns the module local user name.
Definition: entity.c:582
char * strdup()
static string file_name

References BOTH_SUFFIX, concatenate(), db_get_current_workspace_directory(), db_get_file_resource, DB_PUT_FILE_RESOURCE, entity_name, file_name, free(), module, module_local_name(), NO_FILE, pips_debug, prefix, safe_copy(), src, and strdup().

Referenced by hpfc_compile().

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

◆ compile_a_special_io_function()

void compile_a_special_io_function ( entity  module)

just copied for the host

Parameters
moduleodule

Definition at line 469 of file compile.c.

470 {
471  string file_name, h_name, dir_name, fs, ft;
472 
473  const char *prefix = module_local_name(module);
474  file_name = db_get_file_resource(DBR_SOURCE_FILE, prefix, true);
476  h_name = src(prefix, HOST_SUFFIX);
477 
478  fs = strdup(concatenate(dir_name, "/", file_name, NULL));
479  ft = strdup(concatenate(dir_name, "/", h_name, NULL));
480  safe_copy(fs, ft);
481  free(fs);
482  free(ft);
483 
484  DB_PUT_FILE_RESOURCE(DBR_HPFC_HOST, prefix, h_name);
485  DB_PUT_FILE_RESOURCE(DBR_HPFC_NODE, prefix, NO_FILE);
486  DB_PUT_FILE_RESOURCE(DBR_HPFC_RTINIT, prefix, NO_FILE);
487  DB_PUT_FILE_RESOURCE(DBR_HPFC_PARAMETERS, prefix, NO_FILE);
488 }
#define HOST_SUFFIX
File suffixes.

References concatenate(), db_get_current_workspace_directory(), db_get_file_resource, DB_PUT_FILE_RESOURCE, file_name, free(), HOST_SUFFIX, module, module_local_name(), NO_FILE, prefix, safe_copy(), src, and strdup().

Referenced by hpfc_compile().

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

◆ create_bound_entity()

static entity create_bound_entity ( entity  module,
entity  array,
bool  upper,
int  dim,
int  number 
)
static

Definition at line 153 of file compile.c.

159 {
160  entity result = argument_bound_entity(module, array, upper, dim);
161 
162  free_storage(entity_storage(result));
163  entity_storage(result) =
165 
166  pips_assert("formal variable", type_variable_p(entity_type(result)));
167 
169 
170  pips_debug(9, "creating %s in %s (arg %d)\n",
171  entity_name(result), entity_name(module), number);
172 
173  return result;
174 }
storage make_storage(enum storage_utype tag, void *val)
Definition: ri.c:2273
void free_storage(storage p)
Definition: ri.c:2231
formal make_formal(entity a1, intptr_t a2)
Definition: ri.c:1067
entity argument_bound_entity(entity, entity, bool, int)
Definition: run-time.c:499
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
void AddEntityToDeclarations(entity, entity)
END_EOLE.
Definition: variable.c:108
#define entity_storage(x)
Definition: ri.h:2794
@ is_storage_formal
Definition: ri.h:2493
#define type_variable_p(x)
Definition: ri.h:2947

References AddEntityToDeclarations(), argument_bound_entity(), array, entity_name, entity_storage, entity_type, free_storage(), is_storage_formal, make_formal(), make_storage(), module, pips_assert, pips_debug, and type_variable_p.

Referenced by add_one_bound_argument().

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

◆ debug_print_referenced_entities()

void debug_print_referenced_entities ( void *  obj)
Parameters
objbj

Definition at line 906 of file compile.c.

907 {
909 }
void gen_multi_recurse(void *o,...)
Multi recursion visitor function.
Definition: genClib.c:3428
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
Definition: genClib.c:2780
static void debug_ref_rwt(reference r)
Definition: compile.c:897
#define reference_domain
newgen_range_domain_defined
Definition: ri.h:338

References debug_ref_rwt(), gen_multi_recurse(), gen_true(), and reference_domain.

Referenced by update_common_references_in_obj().

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

◆ debug_ref_rwt()

static void debug_ref_rwt ( reference  r)
static

Definition at line 897 of file compile.c.

898 {
899  entity var = reference_variable(r);
900 
901  if (entity_in_common_p(var))
902  fprintf(stderr, "[debug_ref_rwt] reference to %s\n",
903  entity_name(var));
904 }
bool entity_in_common_p(entity e)
Definition: entity.c:1082
#define reference_variable(x)
Definition: ri.h:2326
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...

References entity_in_common_p(), entity_name, fprintf(), and reference_variable.

Referenced by debug_print_referenced_entities().

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

◆ drop_distributed_arguments()

static void drop_distributed_arguments ( entity  module)
static

kind of a quick hack to remove distributed arguments for the host

of the host

of parameter

number of next kept parameter

Definition at line 111 of file compile.c.

112 {
113  type t = entity_type(module);
114  functional f;
115  list /* of parameter */ le = NIL, lp;
116  int len, i, n /* number of next kept parameter */;
117 
118  message_assert("functional", type_functional_p(t));
119  f = type_functional(t);
120  lp = functional_parameters(f);
121  len = gen_length(lp);
122 
123  pips_debug(8, "considering %d arg(s) of %s\n", len, entity_name(module));
124 
125  for (i=1, n=1; i<=len; i++, POP(lp))
126  {
127  entity ent = find_ith_parameter(module, i);
128 
129  if (!entity_undefined_p(ent) && !array_distributed_p(ent))
130  {
131  le = CONS(PARAMETER, PARAMETER(CAR(lp)), le);
132  pips_debug(8, "keeping %d argument %s\n", i, entity_name(ent));
133 
135  n++;
136  }
137  else
138  {
139  if (!entity_undefined_p(ent))
141 
142  pips_debug(8, "dropping %d argument %s\n", i,
143  entity_undefined_p(ent)? "undefined": entity_name(ent));
144  }
145  }
146 
147  lp = functional_parameters(f);
149  gen_free_list(lp);
150 }
list gen_nreverse(list cp)
reverse a list in place
Definition: list.c:304
#define POP(l)
Modify a list pointer to point on the next element of the list.
Definition: newgen_list.h:59
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
void gen_free_list(list l)
free the spine of the list
Definition: list.c:327
#define formal_offset(x)
Definition: ri.h:1408
#define storage_formal(x)
Definition: ri.h:2524
#define entity_undefined_p(x)
Definition: ri.h:2762

References array_distributed_p(), CAR, CONS, entity_name, entity_storage, entity_type, entity_undefined_p, f(), find_ith_parameter(), formal_offset, functional_parameters, gen_free_list(), gen_length(), gen_nreverse(), message_assert, module, NIL, PARAMETER, pips_debug, POP, storage_formal, type_functional, and type_functional_p.

Referenced by init_host_and_node_entities().

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

◆ expression_flt()

static bool expression_flt ( expression  e)
static

does sg about the linearization of the expression

??? memory leak, but how to deal with effect references?

Definition at line 709 of file compile.c.

710 {
711  /* does sg about the linearization of the expression
712  */
713  if (subs_pv && expression_linear_p(e))
714  {
717  if (vect_in_p(subs_pv, v))
718  {
721  vect_rm(v);
723  }
724  }
725 
726  if (expression_equal_p(e, subs_e))
727  {
728  /* ??? memory leak, but how to deal with effect references? */
729  expression_syntax(e) =
735  return false;
736  }
737  return true;
738 }
void free_normalized(normalized p)
Definition: ri.c:1407
normalized make_normalized(enum normalized_utype tag, void *val)
Definition: ri.c:1447
reference make_reference(entity a1, list a2)
Definition: ri.c:2083
syntax make_syntax(enum syntax_utype tag, void *val)
Definition: ri.c:2491
#define VALUE_ONE
#define newgen_Pvecteur(p)
Definition: compsec.h:26
static expression subs_e
Definition: compile.c:686
static Pvecteur subs_pv
Definition: compile.c:687
static bool vect_in_p(Pvecteur vin, Pvecteur vref)
returns if vin is in vref
Definition: compile.c:691
static entity subs_v
substitute all occurences of expression e in statement s by variable v
Definition: compile.c:685
bool expression_linear_p(expression e)
returns if e is already normalized and linear.
Definition: eval.c:951
bool expression_equal_p(expression e1, expression e2)
Syntactic equality e1==e2.
Definition: expression.c:1347
#define normalized_linear_(x)
Definition: ri.h:1780
@ is_syntax_reference
Definition: ri.h:2691
#define expression_normalized(x)
Definition: ri.h:1249
#define normalized_linear(x)
Definition: ri.h:1781
#define expression_syntax(x)
Definition: ri.h:1247
@ is_normalized_linear
Definition: ri.h:1760
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
Definition: vecteur-local.h:60
Pvecteur vect_new(Variable var, Value coeff)
Pvecteur vect_new(Variable var,Value coeff): allocation d'un vecteur colineaire au vecteur de base va...
Definition: alloc.c:110
void vect_rm(Pvecteur v)
void vect_rm(Pvecteur v): desallocation des couples de v;
Definition: alloc.c:78
Pvecteur vect_substract(Pvecteur v1, Pvecteur v2)
Pvecteur vect_substract(Pvecteur v1, Pvecteur v2): allocation d'un vecteur v dont la valeur est la di...
Definition: binaires.c:75
void vect_add_elem(Pvecteur *pvect, Variable var, Value val)
void vect_add_elem(Pvecteur * pvect, Variable var, Value val): addition d'un vecteur colineaire au ve...
Definition: unaires.c:72

References expression_equal_p(), expression_linear_p(), expression_normalized, expression_syntax, free_normalized(), is_normalized_linear, is_syntax_reference, make_normalized(), make_reference(), make_syntax(), newgen_Pvecteur, NIL, normalized_linear, normalized_linear_, subs_e, subs_pv, subs_v, VALUE_ONE, vect_add_elem(), vect_in_p(), vect_new(), vect_rm(), and vect_substract().

Referenced by substitute_and_create().

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

◆ expression_simple_nondist_p()

static bool expression_simple_nondist_p ( expression  e)
static

drivers for atomize_as_required in transformations

Definition at line 614 of file compile.c.

615 {
616  reference r;
617  if (!expression_reference_p(e)) return(false);
621 }
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
bool expression_reference_p(expression e)
Test if an expression is a reference.
Definition: expression.c:528
#define syntax_reference(x)
Definition: ri.h:2730
#define reference_indices(x)
Definition: ri.h:2328

References array_distributed_p(), ENDP, expression_reference_p(), expression_syntax, reference_indices, reference_variable, and syntax_reference.

Referenced by hpfc_decision().

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

◆ extract_distributed_non_constant_terms()

static void extract_distributed_non_constant_terms ( statement  s)
static

transformation: DOALL I,J ...

A(I,J,e) -> DOALL E=e,e,1 ,I,J A(I,J,E)

Definition at line 826 of file compile.c.

828 {
829  DEBUG_STAT(2, "in", s);
830 
831  make_c_stmt_stack();
833  statement_domain, c_stmt_filter, c_stmt_rewrite,
835  NULL);
836  free_c_stmt_stack();
837 
838  DEBUG_STAT(2, "out", s);
839 }
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
Definition: genClib.c:2752
static bool loop_flt(loop l)
Definition: compile.c:772
#define DEBUG_STAT(D, W, S)
#define loop_domain
newgen_language_domain_defined
Definition: ri.h:218
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362

References DEBUG_STAT, gen_multi_recurse(), gen_null(), loop_domain, loop_flt(), and statement_domain.

Referenced by NormalizeCodeForHpfc().

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

◆ hpfc_common_hook()

static string hpfc_common_hook ( entity  module,
entity  common 
)
static

to be used by the prettyprinter when dealing with a common.

inclusion of the parameters and commons...

old_name(module, common);

Definition at line 381 of file compile.c.

384 {
385  const char* name = module_local_name(common);/* old_name(module, common); */
386  return strdup(concatenate
387  (" include \"", name, PARM_SUFFIX "\"\n"
388  " include \"", name,
389  module==host_module ? HINC_SUFFIX "\"\n" : NINC_SUFFIX "\"\n", NULL));
390 }
entity host_module
HPFC - Fabien Coelho, May 1993 and later...
Definition: compiler.c:47
#define NINC_SUFFIX
#define PARM_SUFFIX
#define HINC_SUFFIX

References concatenate(), HINC_SUFFIX, host_module, module, module_local_name(), NINC_SUFFIX, PARM_SUFFIX, and strdup().

Referenced by hpfc_print_code().

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

◆ hpfc_compile_error_handler()

void hpfc_compile_error_handler ( void  )

Definition at line 644 of file compile.c.

645 {
646  error_reset_c_stmt_stack();
647 }

Referenced by hpfc_error_handler().

+ Here is the caller graph for this function:

◆ hpfc_decision()

static bool hpfc_decision ( reference  r,
expression  e 
)
static

break expression e in reference r if ...

Definition at line 625 of file compile.c.

626 {
630 }
static bool expression_simple_nondist_p(expression e)
drivers for atomize_as_required in transformations
Definition: compile.c:614
bool expression_integer_constant_p(expression e)
Definition: expression.c:2417

References array_distributed_p(), expression_integer_constant_p(), expression_simple_nondist_p(), and reference_variable.

Referenced by NormalizeCodeForHpfc().

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

◆ hpfc_fclose()

void hpfc_fclose ( FILE *  f,
string  name 
)
Parameters
nameame

Definition at line 341 of file compile.c.

344 {
345  string base = pips_basename(name, NULL);
346  fprintf(f, "!\n! That is all for %s\n!\n", base);
347  free(base);
348  safe_fclose(f, name);
349 }
bdt base
Current expression.
Definition: bdt_read_paf.c:100
int safe_fclose(FILE *stream, const char *filename)
Definition: file.c:77
char * pips_basename(char *fullpath, char *suffix)
Definition: file.c:822

References base, f(), fprintf(), free(), pips_basename(), and safe_fclose().

Referenced by generate_hpf_remapping_file(), put_generated_resources_for_common(), put_generated_resources_for_module(), and put_generated_resources_for_program().

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

◆ hpfc_fopen()

FILE* hpfc_fopen ( string  name)
Parameters
nameame

Definition at line 329 of file compile.c.

331 {
332  string base = pips_basename(name, NULL);
333  FILE *f = (FILE *) safe_fopen(name, "w");
334  fprintf(f, "!\n! File %s\n! This file has been automatically generated "
335  "by the HPF compiler\n!\n", base);
336  free(base);
337  return f;
338 }
FILE * safe_fopen(const char *filename, const char *what)
Definition: file.c:67

References base, f(), fprintf(), free(), pips_basename(), and safe_fopen().

Referenced by generate_hpf_remapping_file(), put_generated_resources_for_common(), put_generated_resources_for_module(), and put_generated_resources_for_program().

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

◆ hpfc_head_hook()

static string hpfc_head_hook ( entity  m)
static

to be used by the prettyprinter at the head of a file.

inclusion of needed runtime headers. module

Definition at line 366 of file compile.c.

368 {
369  return strdup(concatenate
370  (" implicit none\n"
371  " include \"" GLOBAL_PARAMETERS_H "\"\n"
372  " include \"hpfc_commons.h\"\n"
373  " include \"hpfc_includes.h\"\n"
374  " include \"", old_name(m, m), PARM_SUFFIX "\"\n", NULL));
375 }
static const char * old_name(entity module, entity obj)
old name of obj while in module now.
Definition: compile.c:354
#define GLOBAL_PARAMETERS_H
file names to be generated

References concatenate(), GLOBAL_PARAMETERS_H, old_name(), PARM_SUFFIX, and strdup().

Referenced by hpfc_print_code().

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

◆ hpfc_new_variable()

entity hpfc_new_variable ( entity  module,
basic  b 
)
Parameters
moduleodule

Definition at line 632 of file compile.c.

633 {
635  AddEntityToCurrentModule(new_ent);
636  return new_ent;
637 }
basic copy_basic(basic p)
BASIC.
Definition: ri.c:104
entity make_new_scalar_variable(entity, basic)
Definition: variable.c:741
void AddEntityToCurrentModule(entity)
Add a variable entity to the current module declarations.
Definition: variable.c:260

References AddEntityToCurrentModule(), copy_basic(), make_new_scalar_variable(), and module.

Referenced by extract_lattice(), generate_copy_loop_nest(), loop_flt(), and NormalizeCodeForHpfc().

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

◆ hpfc_print_code()

void hpfc_print_code ( FILE *  file,
entity  module,
statement  stat 
)
Parameters
fileile
moduleodule
stattat

Definition at line 393 of file compile.c.

397 {
398  text t;
399  debug_on("PRETTYPRINT_DEBUG_LEVEL");
400 
403 
404  t = text_module(module, stat);
405  print_text(file, t);
406  free_text(t);
407 
410 
411  debug_off();
412 }
void free_text(text p)
Definition: text.c:74
void reset_prettyprinter_common_hook(void)
static string hpfc_head_hook(entity m)
to be used by the prettyprinter at the head of a file.
Definition: compile.c:366
static string hpfc_common_hook(entity module, entity common)
to be used by the prettyprinter when dealing with a common.
Definition: compile.c:381
#define debug_on(env)
Definition: misc-local.h:157
#define debug_off()
Definition: misc-local.h:160
void reset_prettyprinter_head_hook()
Definition: misc.c:3964
void set_prettyprinter_head_hook(string(*f)(entity))
Definition: misc.c:3963
text text_module(entity, statement)
void set_prettyprinter_common_hook(string(*)(entity, entity))
declarations2.c
void print_text(FILE *fd, text t)
Definition: print.c:195

References debug_off, debug_on, free_text(), hpfc_common_hook(), hpfc_head_hook(), module, print_text(), reset_prettyprinter_common_hook(), reset_prettyprinter_head_hook(), set_prettyprinter_common_hook(), set_prettyprinter_head_hook(), and text_module().

Referenced by put_generated_resources_for_module().

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

◆ hpfcompile()

void hpfcompile ( const char *  module_name)

Compiler call, obsole.

left here for allowing linking

Parameters
module_nameodule_name

Definition at line 601 of file compile.c.

602 {
603  debug_on("HPFC_DEBUG_LEVEL");
604  pips_debug(1, "module: %s\n", module_name);
605  pips_internal_error("obsolete");
606  debug_off();
607 }
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
#define pips_internal_error
Definition: misc-local.h:149

References debug_off, debug_on, module_name(), pips_debug, and pips_internal_error.

+ Here is the call graph for this function:

◆ init_host_and_node_entities()

void init_host_and_node_entities ( void  )

both host and node modules are initialized with the same declarations than the compiled module, but the distributed arrays declarations...

which are not declared in the case of the host_module, and the declarations of which are modified in the node_module (call to NewDeclarationsOfDistributedArrays)...

First, the commons are updated

COMMONS

Then, the other entities

parameters are selected. I think they may be either functional of variable (if declared...) FC 15/09/93

VARIABLES

PARAMETERS

Definition at line 246 of file compile.c.

247 {
249 
250  ifdebug(3)
251  {
252  text t;
253  debug_on("PRETTYPRINT_DEBUG_LEVEL");
254  pips_debug(3, "old declarations:\n");
256  print_text(stderr, t);
257  free_text(t);
258  debug_off();
259  }
260 
263 
264  /* First, the commons are updated
265  */
266  MAP(ENTITY, e,
267  {
268  type t = entity_type(e);
269 
270  if (type_area_p(t) && !entity_special_area_p(e))
271  {
272  debug(3, "init_host_and_node_entities", /* COMMONS */
273  "considering common %s\n", entity_name(e));
274 
276  add_a_common(e);
277  }
278  },
280 
281  /* Then, the other entities
282  */
283  MAP(ENTITY, e,
284  {
285  type t = entity_type(e);
286 
287  /* parameters are selected. I think they may be either
288  * functional of variable (if declared...) FC 15/09/93
289  */
290 
291  if ((type_variable_p(t)) || /* VARIABLES */
292  ((storage_rom_p(entity_storage(e))) &&
295  else
296  if (type_functional_p(t)) /* PARAMETERS */
297  {
300  }
301  },
303 
305 
308 
309  ifdebug(3)
310  {
311  text t;
312  debug_on("PRETTYPRINT_DEBUG_LEVEL");
313  pips_debug(3,"new declarations - node_module:\n");
316  print_text(stderr, t);
317  free_text(t);
318 
319  pips_debug(3, "new declarations - host_module:\n");
322  print_text(stderr, t);
323  free_text(t);
324  debug_off();
325  }
326 }
static string current_module
Definition: message.c:63
bool entity_consistent_p(entity p)
Definition: ri.c:2530
entity node_module
Definition: compiler.c:47
text text_declaration(entity module)
exported for hpfc.
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
Definition: newgen_list.h:226
void AddEntityToHostAndNodeModules(entity e)
AddEntityToHostAndNodeModules.
Definition: hpfc-util.c:298
void AddCommonToHostAndNodeModules(entity common)
Definition: hpfc-util.c:371
static void drop_distributed_arguments(entity module)
kind of a quick hack to remove distributed arguments for the host
Definition: compile.c:111
static void add_bound_arguments(entity module)
for the node
Definition: compile.c:196
void NewDeclarationsOfDistributedArrays()
this procedure generate the new declarations of every distributed arrays of the program,...
Definition: declarations.c:676
void add_a_common(entity c)
HPFC module by Fabien COELHO.
Definition: hpfc.c:48
entity load_new_node(entity)
entity load_new_host(entity)
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189
#define entity_declarations(e)
MISC: newgen shorthands.
bool entity_special_area_p(entity e)
Definition: area.c:154
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define value_symbolic_p(x)
Definition: ri.h:3068
#define type_area_p(x)
Definition: ri.h:2944
#define storage_rom_p(x)
Definition: ri.h:2525
#define entity_initial(x)
Definition: ri.h:2796
#define ifdebug(n)
Definition: sg.c:47

References add_a_common(), add_bound_arguments(), AddCommonToHostAndNodeModules(), AddEntityToDeclarations(), AddEntityToHostAndNodeModules(), current_module, debug(), debug_off, debug_on, drop_distributed_arguments(), ENTITY, entity_consistent_p(), entity_declarations, entity_initial, entity_name, entity_special_area_p(), entity_storage, entity_type, free_text(), get_current_module_entity(), host_module, ifdebug, load_new_host(), load_new_node(), MAP, NewDeclarationsOfDistributedArrays(), node_module, pips_debug, print_text(), storage_rom_p, text_declaration(), type_area_p, type_functional_p, type_variable_p, and value_symbolic_p.

Referenced by compile_module().

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

◆ invariant_expression_p()

static bool invariant_expression_p ( expression  e,
list  loe,
list  le 
)
static

true if no written effect on any variables of e in loe

of effect

Parameters
loeof effect
leof entity

Definition at line 651 of file compile.c.

655 {
656  list /* of effect */ l = proper_effects_of_expression(e);
657 
658  ifdebug(3) {
659  pips_debug(3, "considering expression:");
660  print_expression(e);
661  }
662 
663  FOREACH(EFFECT, ef1, l) {
664  FOREACH(EFFECT, ef2, loe) {
665  if(store_effect_p(ef1) && store_effect_p(ef2)) {
666  entity v = effect_variable(ef1);
667  if ((v==effect_variable(ef2) && effect_write_p(ef2)) ||
668  gen_in_list_p(v, le))
669  {
670  gen_free_list(l);
671  pips_debug(3, "variant\n");
672  return false;
673  }
674  }
675  }
676  }
677 
678  gen_free_list(l);
679  pips_debug(3, "invariant\n");
680  return true;
681 }
list proper_effects_of_expression(expression)
#define effect_write_p(eff)
#define effect_variable(e)
For COMPATIBILITY purpose only - DO NOT USE anymore.
bool store_effect_p(effect)
Definition: effects.c:1062
#define EFFECT(x)
EFFECT.
Definition: effects.h:608
bool gen_in_list_p(const void *vo, const list lx)
tell whether vo belongs to lx
Definition: list.c:734
#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 print_expression(expression e)
no file descriptor is passed to make is easier to use in a debugging stage.
Definition: expression.c:58

References EFFECT, effect_variable, effect_write_p, FOREACH, gen_free_list(), gen_in_list_p(), ifdebug, pips_debug, print_expression(), proper_effects_of_expression(), and store_effect_p().

Referenced by loop_flt().

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

◆ loop_flt()

static bool loop_flt ( loop  l)
static

of effect

of entity

Definition at line 772 of file compile.c.

773 {
774  statement s;
775  list /* of effect */ loce;
776  list /* of entity */ lsubs = NIL;
777 
779  return true;
780 
781  s = c_stmt_head();
783 
784  FOREACH(EFFECT, e, loce)
785  {
786  if(store_effect_p(e)) {
788  entity v = reference_variable(r);
789 
790  if (array_distributed_p(v) && effect_write_p(e))
791  {
792  int dim = 0;
793  int p;
794  entity n;
795 
796  pips_debug(3, "considering reference to %s[%zd]\n",
798 
800  {
801  dim++;
802  ifdebug(3) {
803  pips_debug(3, "considering on dim. %d:\n", dim);
805  }
806  if (ith_dim_distributed_p(v, dim, &p) &&
807  invariant_expression_p(x, loce, lsubs) &&
809  {
812  substitute_and_create(s, n, x);
813  lsubs = CONS(ENTITY, n, lsubs);
814  }
815  }
816  }
817  }
818  }
819 
820  return false;
821 }
effects load_cumulated_references(statement)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
#define effects_effects(x)
Definition: effects.h:710
bool ith_dim_distributed_p(entity array, int i, int *pprocdim)
whether a dimension is distributed or not.
Definition: hpfc-util.c:160
static bool invariant_expression_p(expression e, list loe, list le)
true if no written effect on any variables of e in loe
Definition: compile.c:651
entity hpfc_new_variable(entity module, basic b)
Definition: compile.c:632
static void substitute_and_create(statement s, entity v, expression e)
Definition: compile.c:739
#define loop_execution(x)
Definition: ri.h:1648
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define execution_sequential_p(x)
Definition: ri.h:1208
static char * x
Definition: split_file.c:159

References array_distributed_p(), CONS, EFFECT, effect_any_reference, effect_write_p, effects_effects, ENTITY, entity_name, execution_sequential_p, EXPRESSION, expression_integer_constant_p(), FOREACH, gen_length(), get_current_module_entity(), hpfc_new_variable(), ifdebug, invariant_expression_p(), is_basic_int, ith_dim_distributed_p(), load_cumulated_references(), loop_execution, MakeBasic(), NIL, pips_debug, print_expression(), reference_indices, reference_variable, store_effect_p(), substitute_and_create(), and x.

Referenced by extract_distributed_non_constant_terms().

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

◆ make_host_and_node_modules()

void make_host_and_node_modules ( entity  module)

compile.c

HOST and NODE empty routines...

Arity and result

then the variable corresponding to the function name must be created for those new functions. The overloaded basic is used to be sure that the variable will not be put in the declarations by the enforced coherency. ??? this issue could be managed by the coherency function ?

to allow the update of the call sites.

Parameters
moduleodule

Definition at line 45 of file compile.c.

46 {
47  const char* name = entity_local_name(module);
48  entity host, node;
49 
51  return;
52 
54  {
57  }
58  else
59  {
60  string tmp;
61 
62  /* HOST and NODE empty routines...
63  */
64  tmp = strdup(concatenate(name, "_", HOST_NAME, NULL));
66  free(tmp);
67 
68  tmp = strdup(concatenate(name, "_", NODE_NAME, NULL));
70  free(tmp);
71 
72  /* Arity and result
73  */
76 
78  {
79  /* then the variable corresponding to the function name
80  * must be created for those new functions. The overloaded
81  * basic is used to be sure that the variable will not be put
82  * in the declarations by the enforced coherency.
83  * ??? this issue could be managed by the coherency function ?
84  */
85  string
86  var_name = concatenate(name, MODULE_SEP_STRING, name, NULL);
87  entity
88  var = gen_find_tabulated(var_name, entity_domain), neh, nen;
89 
90  pips_assert("defined", !entity_undefined_p(var));
91 
92  const char* tmp_name = entity_local_name(host);
93  neh = find_or_create_scalar_entity(tmp_name, tmp_name,
95  tmp_name = entity_local_name(node);
96  nen = find_or_create_scalar_entity(tmp_name, tmp_name,
98  store_new_host_node_variable(neh, nen, var);
99  }
100  }
101 
102  /* to allow the update of the call sites.
103  */
106 }
static void node(FILE *out, string name)
Build for module name a node and link to its successors.
Definition: graph.c:56
language make_language_fortran(void)
Definition: ri.c:1250
void store_new_node_variable(entity new, entity old)
void store_new_host_node_variable(entity neh, entity nen, entity old)
void store_new_host_variable(entity new, entity old)
#define NODE_NAME
#define update_functional_as_model(e, model)
Definition: defines-local.h:98
#define HOST_NAME
Constants.
bool bound_new_node_p(entity)
#define MODULE_SEP_STRING
Definition: naming-local.h:30
void * gen_find_tabulated(const char *, int)
Definition: tabulated.c:218
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
Definition: entity.c:453
entity make_empty_subroutine(const char *name, language l)
Definition: entity.c:268
bool entity_main_module_p(entity e)
Definition: entity.c:700
bool entity_function_p(entity e)
Definition: entity.c:724
entity find_or_create_scalar_entity(const char *, const char *, tag)
Looks for an entity which should be a scalar of the specified basic.
Definition: variable.c:1025
@ is_basic_overloaded
Definition: ri.h:574
#define entity_domain
newgen_syntax_domain_defined
Definition: ri.h:410

References bound_new_node_p(), concatenate(), entity_domain, entity_function_p(), entity_local_name(), entity_main_module_p(), entity_undefined_p, find_or_create_scalar_entity(), free(), gen_find_tabulated(), HOST_NAME, is_basic_overloaded, make_empty_subroutine(), make_language_fortran(), module, MODULE_SEP_STRING, node(), NODE_NAME, pips_assert, store_new_host_node_variable(), store_new_host_variable(), store_new_node_variable(), strdup(), and update_functional_as_model.

Referenced by compile_module().

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

◆ NormalizeCodeForHpfc()

void NormalizeCodeForHpfc ( statement  s)

reference test

function call test

test condition test

range test

whileloop test

Definition at line 848 of file compile.c.

849 {
853  hpfc_decision, /* reference test */
854  (bool(*)(call,expression)) gen_false2, /* function call test */
855  (bool(*)(test,expression)) test_atomization,/* test condition test */
856  (bool(*)(range,expression)) gen_false2, /* range test */
857  (bool(*)(whileloop,expression)) gen_false2, /* whileloop test */
859 }
void atomize_as_required(statement, bool(*)(reference, expression), bool(*)(call, expression), bool(*)(test, expression), bool(*)(range, expression), bool(*)(whileloop, expression), entity(*)(entity, basic))
bool gen_false2(__attribute__((unused)) gen_chunk *u1, __attribute__((unused)) void *u2)
Definition: genClib.c:2801
static void extract_distributed_non_constant_terms(statement s)
transformation: DOALL I,J ...
Definition: compile.c:826
static bool hpfc_decision(reference r, expression e)
break expression e in reference r if ...
Definition: compile.c:625
static bool test_atomization(test t, _UNUSED_ expression e)
Definition: compile.c:841
void normalize_all_expressions_of(void *obj)
Definition: normalize.c:668

References atomize_as_required(), extract_distributed_non_constant_terms(), gen_false2(), hpfc_decision(), hpfc_new_variable(), normalize_all_expressions_of(), and test_atomization().

Referenced by compile_module().

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

◆ NormalizeCommonVariables()

void NormalizeCommonVariables ( entity  module,
statement  stat 
)

the new entities for the common variables are created and inserted in the common. The declarations are updated.

the references within the program are updated with the new entities

Parameters
moduleodule
stattat

Definition at line 940 of file compile.c.

943 {
944  list ldecl = code_declarations(entity_code(module)), lnewdecl = NIL, ltmp;
945  entity common, new_e;
946 
947  /* the new entities for the common variables are created and
948  * inserted in the common. The declarations are updated.
949  */
950  MAP(ENTITY, e,
951  {
952  if (entity_in_common_p(e))
953  {
954  common = ram_section(storage_ram(entity_storage(e)));
955  new_e = AddEntityToModule(e, common);
956  ltmp = area_layout(type_area(entity_type(common)));
957 
958  if (gen_find_eq(new_e, ltmp)==entity_undefined)
959  gen_insert_after(new_e, e, ltmp);
960 
961  lnewdecl = CONS(ENTITY, new_e, lnewdecl);
962  store_entity_update_common(e, new_e);
963 
964  pips_debug(8, "module %s: %s -> %s\n",
966  }
967  else
968  lnewdecl = CONS(ENTITY, e, lnewdecl);
969  },
970  ldecl);
971 
972  gen_free_list(ldecl);
973  code_declarations(entity_code(module)) = lnewdecl;
974 
975  /* the references within the program are updated with the new entities
976  */
978 }
void * gen_find_eq(const void *item, const list seq)
Definition: list.c:422
void gen_insert_after(const void *no, const void *o, list l)
Definition: list.c:223
void update_common_references_in_obj(void *obj)
Definition: compile.c:911
void store_entity_update_common(entity, entity)
code entity_code(entity e)
Definition: entity.c:1098
entity AddEntityToModule(entity e, entity module)
!!! caution, it may not be a module, but a common...
Definition: entity.c:3171
#define code_declarations(x)
Definition: ri.h:784
#define ram_section(x)
Definition: ri.h:2249
#define entity_undefined
Definition: ri.h:2761
#define area_layout(x)
Definition: ri.h:546
#define type_area(x)
Definition: ri.h:2946
#define storage_ram(x)
Definition: ri.h:2521

References AddEntityToModule(), area_layout, code_declarations, CONS, ENTITY, entity_code(), entity_in_common_p(), entity_name, entity_storage, entity_type, entity_undefined, gen_find_eq(), gen_free_list(), gen_insert_after(), MAP, module, NIL, pips_debug, ram_section, storage_ram, store_entity_update_common(), type_area, and update_common_references_in_obj().

Referenced by hpfc_directives_handler().

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

◆ old_name()

static const char* old_name ( entity  module,
entity  obj 
)
static

old name of obj while in module now.

obj

Parameters
objmodule in which obj appears

Definition at line 354 of file compile.c.

357 {
358  return module_local_name
360 }
entity load_old_host(entity)

References host_module, load_old_host(), load_old_node(), module, and module_local_name().

Referenced by hpfc_head_hook(), make_new_index_entity(), and make_tile_index_entity_n().

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

◆ put_generated_resources_for_common()

void put_generated_resources_for_common ( entity  common)
Parameters
commonommon

Definition at line 417 of file compile.c.

418 {
419  FILE *host_file, *node_file, *parm_file, *init_file;
420  string host_name, node_name, parm_name, init_name, dir_name;
421  entity node_common, host_common;
422 
423  node_common = load_new_node(common),
424  host_common = load_new_host(common);
425  const char *prefix = module_local_name(common);
427 
428  host_name = src(prefix, HINC_SUFFIX);
429  node_name = src(prefix, NINC_SUFFIX);
430  parm_name = src(prefix, PARM_SUFFIX);
431  init_name = src(prefix, INIT_SUFFIX);
432 
433  host_file = hpfc_fopen(full_name(dir_name, host_name));
434  hpfc_print_common(host_file, host_module, host_common);
435  hpfc_fclose(host_file, host_name);
436 
437  node_file = hpfc_fopen(full_name(dir_name, node_name));
438  hpfc_print_common(node_file, node_module, node_common);
439  hpfc_fclose(node_file, node_name);
440 
441  parm_file = hpfc_fopen(full_name(dir_name, parm_name));
442  create_parameters_h(parm_file, common);
443  hpfc_fclose(parm_file, parm_name);
444 
445  init_file = hpfc_fopen(full_name(dir_name, init_name));
446  create_init_common_param_for_arrays(init_file, common);
447  hpfc_fclose(init_file, init_name);
448 
449  ifdebug(1)
450  {
451  fprintf(stderr, "Result of HPFC for common %s\n", entity_name(common));
452  fprintf(stderr, "-----------------\n");
453 
454  hpfc_print_file(parm_name);
455  hpfc_print_file(init_name);
456  hpfc_print_file(host_name);
457  hpfc_print_file(node_name);
458  }
459 
460  free(parm_name),
461  free(init_name),
462  free(host_name),
463  free(node_name);
464 }
void hpfc_print_file(string file_name)
Definition: debug-util.c:169
void hpfc_print_common(FILE *file, entity module, entity common)
Definition: debug-util.c:154
#define full_name(dir, name)
Definition: compile.c:414
FILE * hpfc_fopen(string name)
Definition: compile.c:329
void hpfc_fclose(FILE *f, string name)
Definition: compile.c:341
#define INIT_SUFFIX
void create_init_common_param_for_arrays(FILE *, entity)
Definition: inits.c:158
void create_parameters_h(FILE *, entity)
create_parameters_h
Definition: inits.c:65

References create_init_common_param_for_arrays(), create_parameters_h(), db_get_current_workspace_directory(), entity_name, fprintf(), free(), full_name, HINC_SUFFIX, host_module, hpfc_fclose(), hpfc_fopen(), hpfc_print_common(), hpfc_print_file(), ifdebug, INIT_SUFFIX, load_new_host(), load_new_node(), module_local_name(), NINC_SUFFIX, node_module, PARM_SUFFIX, prefix, and src.

Referenced by compile_common().

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

◆ put_generated_resources_for_module()

void put_generated_resources_for_module ( _UNUSED_ statement  stat,
statement  host_stat,
statement  node_stat 
)

Definition at line 516 of file compile.c.

520 {
521  FILE *host_file, *node_file, *parm_file, *init_file;
523  string host_name, node_name, parm_name, init_name, dir_name;
524 
525  const char *prefix = module_local_name(module);
527 
528  host_name = src(prefix, HOST_SUFFIX);
529  host_file = hpfc_fopen(full_name(dir_name, host_name));
530  hpfc_print_code(host_file, host_module, host_stat);
531  hpfc_fclose(host_file, host_name);
532 
533  node_name = src(prefix, NODE_SUFFIX);
534  node_file = hpfc_fopen(full_name(dir_name, node_name));
535  hpfc_print_code(node_file, node_module, node_stat);
536  hpfc_fclose(node_file, node_name);
537 
538  parm_name = src(prefix, PARM_SUFFIX);
539  parm_file = hpfc_fopen(full_name(dir_name, parm_name));
540  create_parameters_h(parm_file, module);
541  hpfc_fclose(parm_file, parm_name);
542 
543  init_name = src(prefix, INIT_SUFFIX);
544  init_file = hpfc_fopen(full_name(dir_name, init_name));
546  hpfc_fclose(init_file, init_name);
547 
548  ifdebug(1)
549  {
550  fprintf(stderr, "Result of HPFC for module %s:\n",
552  fprintf(stderr, "-----------------\n");
553 
554  hpfc_print_file(parm_name);
555  hpfc_print_file(init_name);
556  hpfc_print_file(host_name);
557  hpfc_print_file(node_name);
558  }
559 
560  DB_PUT_FILE_RESOURCE(DBR_HPFC_PARAMETERS, prefix, parm_name);
561  DB_PUT_FILE_RESOURCE(DBR_HPFC_HOST, prefix, host_name);
562  DB_PUT_FILE_RESOURCE(DBR_HPFC_NODE, prefix, node_name);
563  DB_PUT_FILE_RESOURCE(DBR_HPFC_RTINIT, prefix, init_name);
564 }
void hpfc_print_code(FILE *file, entity module, statement stat)
Definition: compile.c:393
#define NODE_SUFFIX

References create_init_common_param_for_arrays(), create_parameters_h(), db_get_current_workspace_directory(), DB_PUT_FILE_RESOURCE, fprintf(), full_name, get_current_module_entity(), host_module, HOST_SUFFIX, hpfc_fclose(), hpfc_fopen(), hpfc_print_code(), hpfc_print_file(), ifdebug, INIT_SUFFIX, module, module_local_name(), node_module, NODE_SUFFIX, PARM_SUFFIX, prefix, and src.

Referenced by compile_module().

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

◆ put_generated_resources_for_program()

void put_generated_resources_for_program ( _UNUSED_ string  program_name)

Definition at line 567 of file compile.c.

568 {
569  FILE *comm_file, *init_file;
570  string comm, init, dir_name;
571 
573 
574  comm = src(GLOBAL_PARAMETERS_H, "");
575  init = src(GLOBAL_INIT_H, "");
576 
577  comm_file = hpfc_fopen(full_name(dir_name, comm));
578  create_common_parameters_h(comm_file);
579  hpfc_fclose(comm_file, comm);
580 
581  init_file = hpfc_fopen(full_name(dir_name, init));
582  create_init_common_param(init_file);
583  hpfc_fclose(init_file, init);
584 
585  ifdebug(1)
586  {
587  fprintf(stderr, "Results of HPFC for the program\n");
588  fprintf(stderr, "-----------------\n");
589 
590  hpfc_print_file(comm);
592  }
593 
594  free(comm);
595  free(init);
596 }
#define GLOBAL_INIT_H
void create_init_common_param(FILE *)
create_init_common_param (templates and modules)
Definition: inits.c:511
void create_common_parameters_h(FILE *)
inits.c
Definition: inits.c:36
static int init
Maximal value set for Fortran 77.
Definition: entity.c:320

References create_common_parameters_h(), create_init_common_param(), db_get_current_workspace_directory(), fprintf(), free(), full_name, GLOBAL_INIT_H, GLOBAL_PARAMETERS_H, hpfc_fclose(), hpfc_fopen(), hpfc_print_file(), ifdebug, init, and src.

Referenced by hpfc_close().

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

◆ substitute_and_create()

static void substitute_and_create ( statement  s,
entity  v,
expression  e 
)
static

the copy is reused!

Definition at line 739 of file compile.c.

740 {
741  instruction i;
742 
743  ifdebug(3) {
744  pips_debug(3, "variable %s substituted for\n", entity_name(v));
745  print_expression(e);
746  }
747 
748  subs_v = v;
749  subs_e = copy_expression(e);
750 
753  (Pvecteur) NULL;
754 
756 
758 
760  (make_loop(v,
762  subs_e, /* the copy is reused! */
763  int_to_expression(1)),
767  NIL));
768 
769  statement_instruction(s) = i;
770 }
execution make_execution(enum execution_utype tag, void *val)
Definition: ri.c:838
loop make_loop(entity a1, range a2, statement a3, entity a4, execution a5, list a6)
Definition: ri.c:1301
expression copy_expression(expression p)
EXPRESSION.
Definition: ri.c:850
range make_range(expression a1, expression a2, expression a3)
Definition: ri.c:2041
#define gen_recurse(start, domain_number, flt, rwt)
Definition: genC.h:283
statement instruction_to_statement(instruction)
Build a statement from a give instruction.
Definition: statement.c:597
static bool expression_flt(expression e)
Definition: compile.c:709
#define UU
Definition: newgen_types.h:98
#define loop_to_instruction
entity entity_empty_label(void)
Definition: entity.c:1105
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
Definition: expression.c:1188
#define expression_domain
newgen_execution_domain_defined
Definition: ri.h:154
#define statement_instruction(x)
Definition: ri.h:2458
@ is_execution_parallel
Definition: ri.h:1190
struct Svecteur * Pvecteur
Pvecteur vect_dup(Pvecteur v_in)
Pvecteur vect_dup(Pvecteur v_in): duplication du vecteur v_in; allocation de et copie dans v_out;.
Definition: alloc.c:51

References copy_expression(), entity_empty_label(), entity_name, expression_domain, expression_flt(), expression_linear_p(), expression_normalized, gen_null(), gen_recurse, ifdebug, instruction_to_statement(), int_to_expression(), is_execution_parallel, loop_to_instruction, make_execution(), make_loop(), make_range(), NIL, normalized_linear, pips_debug, print_expression(), statement_instruction, subs_e, subs_pv, subs_v, UU, vect_dup(), and vect_rm().

Referenced by loop_flt().

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

◆ test_atomization()

static bool test_atomization ( test  t,
_UNUSED_ expression  e 
)
static

Definition at line 841 of file compile.c.

842 {
843  return ref_to_dist_array_p(t);
844 }
bool ref_to_dist_array_p(void *obj)
this file describe a few functions usefull to the compiler to manage the hpfc data structures.
Definition: hpfc-util.c:48

References ref_to_dist_array_p().

Referenced by NormalizeCodeForHpfc().

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

◆ update_common_references_in_obj()

void update_common_references_in_obj ( void *  obj)
Parameters
objbj

Definition at line 911 of file compile.c.

912 {
913  gen_multi_recurse(obj,
916  NULL);
917 
919 }
void debug_print_referenced_entities(void *obj)
Definition: compile.c:906
static void update_loop_rewrite(loop l)
Definition: compile.c:887
static void update_common_rewrite(reference r)
To manage the common entities, I decided arbitrarilly that all commons will have to be declared exact...
Definition: compile.c:875

References debug_print_referenced_entities(), gen_multi_recurse(), gen_true(), ifdebug, loop_domain, reference_domain, update_common_rewrite(), and update_loop_rewrite().

Referenced by NormalizeCommonVariables().

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

◆ update_common_references_in_regions()

void update_common_references_in_regions ( void  )

Definition at line 921 of file compile.c.

922 {
923 
924  STATEMENT_EFFECTS_MAP(stat, effs,
925  {
926  list lef = effects_effects(effs);
927 
928  pips_debug(3, "statement %p (%zu effects)\n",
929  stat, gen_length((list) lef));
930 
931  // FI: Let's hope the rw effects do not have to be
932  // filtered to keep only the store effects...
934  (list) lef);
935  },
936  get_rw_effects());
937 }
statement_effects get_rw_effects(void)
#define STATEMENT_EFFECTS_MAP(k, v, c, f)
Definition: effects.h:1057

References EFFECT, effect_any_reference, effects_effects, gen_length(), get_rw_effects(), MAP, pips_debug, STATEMENT_EFFECTS_MAP, and update_common_rewrite().

+ Here is the call graph for this function:

◆ update_common_rewrite()

static void update_common_rewrite ( reference  r)
static

To manage the common entities, I decided arbitrarilly that all commons will have to be declared exactly the same way (name and so), so I can safely unify the entities among the modules.

The rational for this stupid ugly transformation is that it is much easier to manage the common overlaps for instance if they are simply linked to the same entity.

??? very ugly, indeed.

Definition at line 875 of file compile.c.

876 {
877  entity var = reference_variable(r),
878  new_var = load_entity_update_common(var);
879 
880  pips_debug(7, "%s to %s\n", entity_name(var),
881  entity_undefined_p(new_var) ? "undefined" : entity_name(new_var));
882 
883  if (!entity_undefined_p(new_var))
884  reference_variable(r) = new_var;
885 }
entity load_entity_update_common(entity)

References entity_name, entity_undefined_p, load_entity_update_common(), pips_debug, and reference_variable.

Referenced by update_common_references_in_obj(), and update_common_references_in_regions().

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

◆ update_loop_rewrite()

static void update_loop_rewrite ( loop  l)
static

Definition at line 887 of file compile.c.

889 {
890  entity var = loop_index(l),
891  new_var = load_entity_update_common(var);
892 
893  if (!entity_undefined_p(new_var))
894  loop_index(l) = new_var;
895 }
#define loop_index(x)
Definition: ri.h:1640

References entity_undefined_p, load_entity_update_common(), and loop_index.

Referenced by update_common_references_in_obj().

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

◆ vect_in_p()

static bool vect_in_p ( Pvecteur  vin,
Pvecteur  vref 
)
static

returns if vin is in vref

Definition at line 691 of file compile.c.

692 {
693  Pvecteur v;
694 
695  for (v=vin; v; v=v->succ)
696  {
697  Variable x = vecteur_var(v);
698  if (x)
699  {
700  if (value_ne(vecteur_val(v),vect_coeff(x, vref)))
701  return false;
702  }
703  }
704 
705  return true;
706 }
#define value_ne(v1, v2)
struct Svecteur * succ
Definition: vecteur-local.h:92
#define vecteur_val(v)
#define vecteur_var(v)
Value vect_coeff(Variable var, Pvecteur vect)
Variable vect_coeff(Variable var, Pvecteur vect): coefficient de coordonnee var du vecteur vect —> So...
Definition: unaires.c:228

References Svecteur::succ, value_ne, vect_coeff(), vecteur_val, vecteur_var, and x.

Referenced by expression_flt().

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

Variable Documentation

◆ subs_e

expression subs_e
static

Definition at line 686 of file compile.c.

Referenced by expression_flt(), and substitute_and_create().

◆ subs_pv

Pvecteur subs_pv
static

Definition at line 687 of file compile.c.

Referenced by expression_flt(), and substitute_and_create().

◆ subs_v

entity subs_v
static

substitute all occurences of expression e in statement s by variable v

Definition at line 685 of file compile.c.

Referenced by expression_flt(), and substitute_and_create().