PIPS
print.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "genC.h"
#include "linear.h"
#include "misc.h"
#include "pipsdbm.h"
#include "properties.h"
#include "ri-util.h"
#include "text-util.h"
#include "top-level.h"
#include "prettyprint.h"
#include "pips-libs.h"
+ Include dependency graph for print.c:

Go to the source code of this file.

Macros

#define all_priv   "PRETTYPRINT_ALL_PRIVATE_VARIABLES"
 
#define print_effects(e)    pips_internal_error("print_effects function not available")
 
#define print_effect(e)    pips_internal_error("print_effect function not available")
 
#define print_region(x)    pips_internal_error("print_region function not available")
 
#define transformer_with_temporary_values_p(t)   ((t) != NULL)
 
#define dump_transformer(t)    pips_internal_error("dump_transformer function not available")
 
#define print_transformer(t)    pips_internal_error("print_transformer function not available")
 
#define points_to_domain   (-1)
 
#define points_to_list_domain   (-1)
 
#define points_to_graph_domain   (-1)
 
#define print_points_to(x)    pips_internal_error("print_points_to function not available")
 
#define print_points_to_cell(x)    pips_internal_error("print_points_to_cell function not available")
 
#define print_points_to_cells(x)    pips_internal_error("print_points_to_cells function not available")
 
#define print_points_to_list(x)    pips_internal_error("print_points_to_list function not available")
 
#define print_points_to_graph(x)    pips_internal_error("print_points_to_graph function not available")
 
#define print_points_to_relations(x)    pips_internal_error("print_points_to_relations function not available")
 

Functions

bool make_text_resource (const char *mod_name, const char *res_name, const char *file_ext, text texte)
 Main C functions to print code, sequential or parallel. More...
 
bool make_text_resource_and_free (const char *mod_name, const char *res_name, const char *file_ext, text t)
 
bool user_view_p ()
 print_code or print_source More...
 
bool print_code_or_source (string mod_name)
 Generic function to prettyprint some sequential or parallel code, or even user view for the given module. More...
 
static bool print_parallelized_code_common (const char *mod_name, const char *style)
 Build a textual resource for a parallel code using a string optional parallel style (dialect such as "f90", "doall", "hpf", "omp". More...
 
bool print_code (const string mod_name)
 
bool print_source (const string mod_name)
 
bool print_parallelized_code (const string mod_name)
 
bool print_parallelized90_code (const string mod_name)
 
bool print_parallelized77_code (const string mod_name)
 
bool print_parallelizedHPF_code (const string module_name)
 
bool print_parallelizedOMP_code (const string mod_name)
 
bool print_parallelizedMPI_code (const string mod_name)
 
void dprint (expression x)
 For debugging: prettyprint many different kinds of newgen objects FC: type should be gen_chunk... More...
 

Variables

static bool is_user_view
 

Macro Definition Documentation

◆ all_priv

#define all_priv   "PRETTYPRINT_ALL_PRIVATE_VARIABLES"

Definition at line 304 of file print.c.

◆ dump_transformer

#define dump_transformer (   t)     pips_internal_error("dump_transformer function not available")

Definition at line 355 of file print.c.

◆ points_to_domain

#define points_to_domain   (-1)

Definition at line 367 of file print.c.

◆ points_to_graph_domain

#define points_to_graph_domain   (-1)

Definition at line 373 of file print.c.

◆ points_to_list_domain

#define points_to_list_domain   (-1)

Definition at line 370 of file print.c.

◆ print_effect

#define print_effect (   e)     pips_internal_error("print_effect function not available")

Definition at line 336 of file print.c.

◆ print_effects

#define print_effects (   e)     pips_internal_error("print_effects function not available")

Definition at line 334 of file print.c.

◆ print_points_to

#define print_points_to (   x)     pips_internal_error("print_points_to function not available")

Definition at line 375 of file print.c.

◆ print_points_to_cell

#define print_points_to_cell (   x)     pips_internal_error("print_points_to_cell function not available")

Definition at line 377 of file print.c.

◆ print_points_to_cells

#define print_points_to_cells (   x)     pips_internal_error("print_points_to_cells function not available")

Definition at line 379 of file print.c.

◆ print_points_to_graph

#define print_points_to_graph (   x)     pips_internal_error("print_points_to_graph function not available")

Definition at line 383 of file print.c.

◆ print_points_to_list

#define print_points_to_list (   x)     pips_internal_error("print_points_to_list function not available")

Definition at line 381 of file print.c.

◆ print_points_to_relations

#define print_points_to_relations (   x)     pips_internal_error("print_points_to_relations function not available")

Definition at line 385 of file print.c.

◆ print_region

#define print_region (   x)     pips_internal_error("print_region function not available")

Definition at line 343 of file print.c.

◆ print_transformer

#define print_transformer (   t)     pips_internal_error("print_transformer function not available")

Definition at line 357 of file print.c.

◆ transformer_with_temporary_values_p

#define transformer_with_temporary_values_p (   t)    ((t) != NULL)

Definition at line 354 of file print.c.

Function Documentation

◆ dprint()

void dprint ( expression  x)

For debugging: prettyprint many different kinds of newgen objects FC: type should be gen_chunk...

Definition at line 392 of file print.c.

393 {
394  debug_on("PRETTYPRINT_DEBUG_LEVEL");
396  (void) fprintf(stderr, "UNDEFINED NEWGEN OBJECT\n");
397  else if(x==0)
398  (void) fprintf(stderr, "EMPTY LIST\n");
399  else {
400  int ot = expression_domain_number(x);
401  if(ot==0)
402  (void) fprintf(stderr,"PROBABLY AN EMPTY LIST\n");
403  else if(expression_undefined_p(x))
404  (void) fprintf(stderr,"UNDEFINED NEWGEN OBJECT\n");
405  else if(ot==expression_domain)
407  else if(ot==reference_domain)
409  else if(ot==points_to_domain)
410  print_points_to((points_to) x); // See also print_points_to_relation
411  else if(ot==cell_domain) {
413  fprintf(stderr, "\n");
414  }
415  else if(ot==type_domain)
416  print_type((type) x);
417  else if(ot==statement_domain)
419  else if(ot==effect_domain) {
421  if(descriptor_none_p(d))
422  print_effect((effect) x);
423  else
424  print_region((effect) x);
425  }
426  else if(ot==points_to_list_domain)
428  else if(ot==points_to_graph_domain)
430  else if(ot==text_domain)
431  print_text(stderr, (text) x);
432  else if(ot==entity_domain) {
435  if(entity_undefined_p(mx))
436  fprintf(stderr, "%s\n", entity_name((entity) x));
437  else {
438  if(m!=mx)
439  fprintf(stderr,"%s" MODULE_SEP_STRING, entity_local_name(mx));
440  fprintf(stderr, "%s\n", entity_local_name((entity) x));
441  }
442  }
443  else if(ot==basic_domain) {
444  string s = basic_to_string((basic) x);
445  fprintf(stderr, "%s\n", s);
446  free(s);
447  }
448  else if(ot==transformer_domain) {
451  dump_transformer(t);
452  else {
453  // FI: print_transformer() core dumps in interprocedural
454  // settings and dump_transformer() is as good for debugging ig
455  // not better
456  dump_transformer(t);
457  }
458  }
459  else if(ot==effects_domain) {
460  list el = effects_effects((effects) x);
461  dprint((expression) el);
462  }
463  else if(ot==dimension_domain) {
464  dimension d = (dimension) x;
467  // list ql = dimension_qualifiers(d);
468  // FI: lets forget abut qualifiers
469  print_expression(l);
470  print_expression(u);
471  }
472  else if(ot==qualifier_domain) {
473  qualifier q = (qualifier) x;
474  print_qualifier(q);
475  }
476  else if(0<=ot && ot<1000)
477  (void) fprintf(stderr, "Unprocessed Newgen Object with tag %d\n", ot);
478  else if(ot>1000 || ot<=0) {
479  // FI: I do not know how to get the largest Newgen type
480  // We could assume that the object is a list and look for the type
481  // of the first object...
482  (void) fprintf(stderr,"NOT A NEWGEN OBJECT. MAYBE A LIST\n");
483  expression cx = EXPRESSION(CAR((list) x));
484  int cot = expression_domain_number(cx);
485  if(cot==expression_domain)
487  else if(cot==reference_domain)
489  else if(cot==cell_domain)
491  else if(cot==type_domain)
492  print_types((list) x);
493  else if(cot==statement_domain)
495  else if(cot==effect_domain)
496  print_effects((list) x);
497  else if(cot==points_to_domain)
499  else if(cot==transformer_domain) {
500  list tl = (list) x;
501  FOREACH(TRANSFORMER, t, tl) {
503  dump_transformer(t);
504  else
505  dump_transformer(t);
506  }
507  }
508  else if(cot==entity_domain) {
509  // print_entities((list) x);
510  list el = (list) x;
512  FOREACH(ENTITY, e, el) {
514  if(m!=me)
515  fprintf(stderr,"%s" MODULE_SEP_STRING, entity_local_name(me));
516  fprintf(stderr, "%s\n", entity_local_name(e));
517  }
518  }
519  else if(cot==dimension_domain) {
520  list dl = (list) x;
521  FOREACH(DIMENSION, d, dl) {
524  // list ql = dimension_qualifiers(d);
525  // FI: lets forget abut qualifiers
526  print_expression(l);
527  print_expression(u);
528  }
529  }
530  else if(cot==qualifier_domain) {
531  list ql = (list) x;
532  print_qualifiers(ql);
533  }
534  else
535  (void) fprintf(stderr, "If a list, a list of unknown objects: tag=%d\n", (int) cot);
536  }
537  }
538  debug_off();
539 }
struct _newgen_struct_qualifier_ * qualifier
#define cell_domain
newgen_cell_interpretation_domain_defined
Definition: effects.h:85
#define effects_domain
newgen_effects_classes_domain_defined
Definition: effects.h:133
#define effect_descriptor(x)
Definition: effects.h:646
#define effects_effects(x)
Definition: effects.h:710
#define descriptor_none_p(x)
Definition: effects.h:602
#define effect_domain
newgen_descriptor_domain_defined
Definition: effects.h:117
void free(void *)
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
#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 debug_on(env)
Definition: misc-local.h:157
#define debug_off()
Definition: misc-local.h:160
#define MODULE_SEP_STRING
Definition: naming-local.h:30
struct cons * list
Definition: newgen_types.h:106
void print_references(list rl)
Definition: expression.c:163
void print_expressions(list le)
Definition: expression.c:98
void print_expression(expression e)
no file descriptor is passed to make is easier to use in a debugging stage.
Definition: expression.c:58
void print_reference(reference r)
Definition: expression.c:142
#define print_effect(e)
Definition: print.c:336
#define transformer_with_temporary_values_p(t)
Definition: print.c:354
#define points_to_list_domain
Definition: print.c:370
#define print_points_to_relations(x)
Definition: print.c:385
#define points_to_domain
Definition: print.c:367
#define print_region(x)
Definition: print.c:343
#define print_points_to_graph(x)
Definition: print.c:383
#define print_points_to_cells(x)
Definition: print.c:379
#define points_to_graph_domain
Definition: print.c:373
void dprint(expression x)
For debugging: prettyprint many different kinds of newgen objects FC: type should be gen_chunk....
Definition: print.c:392
#define print_points_to_list(x)
Definition: print.c:381
#define print_effects(e)
Definition: print.c:334
#define dump_transformer(t)
Definition: print.c:355
#define print_points_to_cell(x)
Definition: print.c:377
#define print_points_to(x)
Definition: print.c:375
void print_type(type)
For debugging.
Definition: type.c:111
void print_qualifiers(list)
Definition: type.c:131
void print_qualifier(qualifier)
Definition: type.c:138
void print_statements(list)
Definition: statement.c:103
string basic_to_string(basic)
Definition: type.c:87
void print_types(list)
Very basic and crude debugging function.
Definition: type.c:96
void print_statement(statement)
Print a statement on stderr.
Definition: statement.c:98
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 module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479
const char * entity_module_name(entity e)
See comments about module_name().
Definition: entity.c:1092
#define expression_domain
newgen_execution_domain_defined
Definition: ri.h:154
#define TRANSFORMER(x)
TRANSFORMER.
Definition: ri.h:2841
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
struct _newgen_struct_dimension_ * dimension
Definition: ri.h:111
#define transformer_domain
newgen_test_domain_defined
Definition: ri.h:426
#define dimension_lower(x)
Definition: ri.h:980
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define entity_undefined_p(x)
Definition: ri.h:2762
#define reference_domain
newgen_range_domain_defined
Definition: ri.h:338
#define basic_domain
newgen_area_domain_defined
Definition: ri.h:42
#define entity_name(x)
Definition: ri.h:2790
#define dimension_upper(x)
Definition: ri.h:982
#define dimension_domain
newgen_control_domain_defined
Definition: ri.h:106
#define type_domain
newgen_transformer_domain_defined
Definition: ri.h:434
#define expression_undefined_p(x)
Definition: ri.h:1224
struct _newgen_struct_transformer_ * transformer
Definition: ri.h:431
#define qualifier_domain
newgen_preference_domain_defined
Definition: ri.h:314
#define entity_domain
newgen_syntax_domain_defined
Definition: ri.h:410
#define expression_domain_number(x)
Definition: ri.h:1245
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
static char * x
Definition: split_file.c:159
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
void print_text(FILE *fd, text t)
Definition: print.c:195
#define text_domain
newgen_sentence_domain_defined
Definition: text.h:18

References basic_domain, basic_to_string(), CAR, cell_domain, debug_off, debug_on, descriptor_none_p, DIMENSION, dimension_domain, dimension_lower, dimension_upper, dprint(), dump_transformer, effect_descriptor, effect_domain, effects_domain, effects_effects, ENTITY, entity_domain, entity_local_name(), entity_module_name(), entity_name, entity_undefined_p, EXPRESSION, expression_domain, expression_domain_number, expression_undefined_p, FOREACH, fprintf(), free(), get_current_module_entity(), module_name_to_entity(), MODULE_SEP_STRING, points_to_domain, points_to_graph_domain, points_to_list_domain, print_effect, print_effects, print_expression(), print_expressions(), print_points_to, print_points_to_cell, print_points_to_cells, print_points_to_graph, print_points_to_list, print_points_to_relations, print_qualifier(), print_qualifiers(), print_reference(), print_references(), print_region, print_statement(), print_statements(), print_text(), print_type(), print_types(), qualifier_domain, reference_domain, statement_domain, text_domain, TRANSFORMER, transformer_domain, transformer_with_temporary_values_p, type_domain, and x.

Referenced by dprint().

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

◆ make_text_resource()

bool make_text_resource ( const char *  mod_name,
const char *  res_name,
const char *  file_ext,
text  texte 
)

Main C functions to print code, sequential or parallel.

print.c

generate resource res_name for module mod_name with prefix file_ext as the text provided. it should be made clear who is to free the texte structure. currently it looks like a massive memory leak.

Parameters
mod_nameod_name
res_namemodule name
file_extresource name [DBR_...]
textefile extension text to be printed as this resource

Definition at line 55 of file print.c.

60 {
61  string filename, localfilename, dir;
62  FILE *fd;
63 
64  localfilename = db_build_file_resource_name(res_name, mod_name, file_ext);
66  filename = strdup(concatenate(dir, "/", localfilename, NULL));
67  free(dir);
68 
69  fd = safe_fopen(filename, "w");
70  debug_on("PRETTYPRINT_DEBUG_LEVEL");
71  print_text(fd, texte);
72  debug_off();
73  safe_fclose(fd, filename);
74 
75  DB_PUT_FILE_RESOURCE(res_name, mod_name, localfilename);
76  write_an_attachment_file(filename);
77  free(filename);
78 
79  return true;
80 }
void write_an_attachment_file(string file_name)
Add the attachment in Emacs mode by creating a twin file that is decorated with Emacs properties:
FILE * safe_fopen(const char *filename, const char *what)
Definition: file.c:67
int safe_fclose(FILE *stream, const char *filename)
Definition: file.c:77
#define DB_PUT_FILE_RESOURCE
Put a file resource into the current workspace database.
Definition: pipsdbm-local.h:85
string db_build_file_resource_name(const char *rname, const char *oname, const char *suffix)
returns an allocated file name for a file resource.
Definition: lowlevel.c:169
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
string db_get_current_workspace_directory(void)
Definition: workspace.c:96
char * strdup()

References concatenate(), db_build_file_resource_name(), db_get_current_workspace_directory(), DB_PUT_FILE_RESOURCE, debug_off, debug_on, free(), print_text(), safe_fclose(), safe_fopen(), strdup(), and write_an_attachment_file().

Referenced by make_text_resource_and_free(), print_aliases(), print_code_or_source(), print_code_semantics(), print_code_static_control(), print_code_with_comp_regions(), print_parallelized_code_common(), print_parallelizedCMF_code(), print_parallelizedCRAFT_code(), store_new_module(), and wp65().

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

◆ make_text_resource_and_free()

bool make_text_resource_and_free ( const char *  mod_name,
const char *  res_name,
const char *  file_ext,
text  t 
)
Parameters
mod_nameod_name
res_namees_name
file_extile_ext

Definition at line 82 of file print.c.

87 {
88  bool ok = make_text_resource(mod_name, res_name, file_ext, t);
89  free_text(t);
90  return ok;
91 }
void free_text(text p)
Definition: text.c:74
bool make_text_resource(const char *mod_name, const char *res_name, const char *file_ext, text texte)
Main C functions to print code, sequential or parallel.
Definition: print.c:55
static bool ok

References free_text(), make_text_resource(), and ok.

Referenced by create_HRE_module(), generic_print_code_pv(), print_any_reductions(), print_code_or_source_comp(), print_code_points_to(), print_continuation_conditions(), print_initial_precondition(), print_program_precondition(), ProcessEntries(), and ProcessEntry().

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

◆ print_code()

bool print_code ( const string  mod_name)
Parameters
mod_nameod_name

Definition at line 272 of file print.c.

273 {
274  is_user_view = false;
275  return print_code_or_source(mod_name);
276 }
bool print_code_or_source(string mod_name)
Generic function to prettyprint some sequential or parallel code, or even user view for the given mod...
Definition: print.c:103
static bool is_user_view
Definition: print.c:93

References is_user_view, and print_code_or_source().

Referenced by print_code_as_a_graph().

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

◆ print_code_or_source()

bool print_code_or_source ( string  mod_name)

Generic function to prettyprint some sequential or parallel code, or even user view for the given module.

FI: This test could be moved up in pipsmake?

FI: Should be a pips_internal_error() as pipsmake is here to avoid this very problem...

Since we want to prettyprint with a sequential syntax, save the PRETTYPRINT_PARALLEL property that may select the parallel output style before overriding it:

Select the default prettyprint style for sequential prettyprint:

Restore the previous PRETTYPRINT_PARALLEL property for the next parallel code prettyprint:

Parameters
mod_nameod_name

Definition at line 103 of file print.c.

103  {
104  bool success = false;
105  text r = make_text(NIL);
106  entity module;
108  string pp;
109  bool print_graph_p = get_bool_property("PRETTYPRINT_UNSTRUCTURED_AS_A_GRAPH");
110  string resource_name =
111  strdup(print_graph_p ? DBR_GRAPH_PRINTED_FILE
112  : (is_user_view ? DBR_PARSED_PRINTED_FILE
113  : DBR_PRINTED_FILE));
114  string file_ext = string_undefined;
115 
116  /* FI: This test could be moved up in pipsmake? */
118  /* FI: Should be a pips_internal_error() as pipsmake is here to
119  avoid this very problem... */
120  pips_user_error("Module \"\%s\"\n not found", mod_name);
121  return false;
122  }
123 
124  /*
125  * Set the current language
126  */
128  if(value_code_p(mv)) {
129  code c = value_code(mv);
131  }
132 
133  switch(get_prettyprint_language_tag()) {
134  case is_language_fortran:
135  file_ext = strdup(concatenate(is_user_view ? PRETTYPRINT_FORTRAN_EXT
136  : PREDICAT_FORTRAN_EXT,
137  print_graph_p ? GRAPH_FILE_EXT : "",
138  NULL));
139  break;
140  case is_language_c:
141  file_ext = strdup(concatenate(is_user_view ? PRETTYPRINT_C_EXT
142  : PREDICAT_C_EXT,
143  print_graph_p ? GRAPH_FILE_EXT : "",
144  NULL));
145  break;
147  file_ext = strdup(concatenate(is_user_view ? PRETTYPRINT_F95_EXT
148  : PREDICAT_F95_EXT,
149  print_graph_p ? GRAPH_FILE_EXT : "",
150  NULL));
151  break;
152  default:
153  pips_internal_error("Language unknown !");
154  break;
155  }
156 
158 
159  /* Since we want to prettyprint with a sequential syntax, save the
160  PRETTYPRINT_PARALLEL property that may select the parallel output
161  style before overriding it: */
162  pp = strdup(get_string_property("PRETTYPRINT_PARALLEL"));
163  /* Select the default prettyprint style for sequential prettyprint: */
164  set_string_property("PRETTYPRINT_PARALLEL",
165  get_string_property("PRETTYPRINT_SEQUENTIAL_STYLE"));
166 
168  : DBR_CODE,
169  mod_name,
170  true);
171 
173 
174  debug_on("PRETTYPRINT_DEBUG_LEVEL");
175 
179  success = make_text_resource(mod_name, resource_name, file_ext, r);
181 
182  debug_off();
183 
184  /* Restore the previous PRETTYPRINT_PARALLEL property for the next
185  parallel code prettyprint: */
186  set_string_property("PRETTYPRINT_PARALLEL", pp);
187  free(pp);
188 
191 
192  free_text(r);
194  free(file_ext);
195 
196  return success;
197 }
text make_text(list a)
Definition: text.c:107
void begin_attachment_prettyprint(void)
The translation functions between unique names and objects:
void end_attachment_prettyprint(void)
Clean the things related with the attachment of properties:
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
#define resource_name(x)
Definition: database.h:108
char * get_string_property(const char *)
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
bool success
Definition: gpips-local.h:59
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
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
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
static statement mod_stat
We want to keep track of the current statement inside the recurse.
Definition: impact_check.c:41
void set_prettyprint_language_from_property(enum language_utype native)
set the prettyprint language according to the property PRETTYPRINT_LANGUAGE @description If the prope...
Definition: language.c:103
enum language_utype get_prettyprint_language_tag()
Definition: language.c:67
#define pips_internal_error
Definition: misc-local.h:149
#define pips_user_error
Definition: misc-local.h:147
#define string_undefined
Definition: newgen_types.h:40
static char * module
Definition: pips.c:74
text empty_text(entity __attribute__((unused)) e, int __attribute__((unused)) m, statement __attribute__((unused)) s)
Definition: misc.c:219
void init_prettyprint(text(*hook)(entity, int, statement))
checks that the prettyprint hook was actually reset...
Definition: misc.c:231
text text_module(entity, statement)
void set_string_property(const char *, const char *)
#define value_code_p(x)
Definition: ri.h:3065
#define value_code(x)
Definition: ri.h:3067
#define code_language(x)
Definition: ri.h:792
#define language_tag(x)
Definition: ri.h:1590
@ is_language_fortran
Definition: ri.h:1566
@ is_language_fortran95
Definition: ri.h:1568
@ is_language_c
Definition: ri.h:1567
#define entity_initial(x)
Definition: ri.h:2796
#define MERGE_TEXTS(r, t)

References begin_attachment_prettyprint(), code_language, concatenate(), db_get_memory_resource(), debug_off, debug_on, empty_text(), end_attachment_prettyprint(), entity_initial, entity_undefined_p, free(), free_text(), get_bool_property(), get_prettyprint_language_tag(), get_string_property(), init_prettyprint(), is_language_c, is_language_fortran, is_language_fortran95, is_user_view, language_tag, make_text(), make_text_resource(), MERGE_TEXTS, mod_stat, module, module_name_to_entity(), NIL, pips_internal_error, pips_user_error, reset_current_module_entity(), reset_current_module_statement(), resource_name, set_current_module_entity(), set_current_module_statement(), set_prettyprint_language_from_property(), set_string_property(), strdup(), string_undefined, text_module(), value_code, and value_code_p.

Referenced by print_code(), and print_source().

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

◆ print_parallelized77_code()

bool print_parallelized77_code ( const string  mod_name)
Parameters
mod_nameod_name

Definition at line 294 of file print.c.

295 {
296  return print_parallelized_code_common(mod_name, "doall");
297 }
static bool print_parallelized_code_common(const char *mod_name, const char *style)
Build a textual resource for a parallel code using a string optional parallel style (dialect such as ...
Definition: print.c:202

References print_parallelized_code_common().

+ Here is the call graph for this function:

◆ print_parallelized90_code()

bool print_parallelized90_code ( const string  mod_name)
Parameters
mod_nameod_name

Definition at line 289 of file print.c.

290 {
291  return print_parallelized_code_common(mod_name, "f90");
292 }

References print_parallelized_code_common().

+ Here is the call graph for this function:

◆ print_parallelized_code()

bool print_parallelized_code ( const string  mod_name)
Parameters
mod_nameod_name

Definition at line 284 of file print.c.

285 {
286  return print_parallelized_code_common(mod_name, NULL);
287 }

References print_parallelized_code_common().

+ Here is the call graph for this function:

◆ print_parallelized_code_common()

static bool print_parallelized_code_common ( const char *  mod_name,
const char *  style 
)
static

Build a textual resource for a parallel code using a string optional parallel style (dialect such as "f90", "doall", "hpf", "omp".

Definition at line 202 of file print.c.

205 {
206  bool success = false;
207  text r = make_text(NIL);
208  entity module = module_name_to_entity(mod_name);
210  string pp = string_undefined;
211 
213 
214  if (style) {
215  pp = strdup(get_string_property("PRETTYPRINT_PARALLEL"));
216  set_string_property("PRETTYPRINT_PARALLEL", style);
217  }
218 
220 
222 
223  mod_stat = (statement)
224  db_get_memory_resource(DBR_PARALLELIZED_CODE, mod_name, true);
225 
226  debug_on("PRETTYPRINT_DEBUG_LEVEL");
228  debug_off();
229 
231 
232  switch(get_prettyprint_language_tag()) {
233  case is_language_fortran:
234  success = make_text_resource(mod_name,
235  DBR_PARALLELPRINTED_FILE,
236  PARALLEL_FORTRAN_EXT,
237  r);
238  break;
239  case is_language_c:
240  success = make_text_resource(mod_name,
241  DBR_PARALLELPRINTED_FILE,
242  PARALLEL_C_EXT,
243  r);
244  break;
246  success = make_text_resource(mod_name,
247  DBR_PARALLELPRINTED_FILE,
248  PARALLEL_FORTRAN95_EXT,
249  r);
250  break;
251  default:
252  pips_internal_error("Language unknown !");
253  break;
254  }
255 
257 
258  if (style) {
259  set_string_property("PRETTYPRINT_PARALLEL", pp);
260  free(pp);
261  }
262 
264 
265  free_text(r);
266  return success;
267 }
void close_prettyprint()
because some prettyprint functions may be used for debug, so the last hook set by somebody may have s...
Definition: misc.c:242

References begin_attachment_prettyprint(), close_prettyprint(), db_get_memory_resource(), debug_off, debug_on, empty_text(), end_attachment_prettyprint(), free(), free_text(), get_prettyprint_language_tag(), get_string_property(), init_prettyprint(), is_language_c, is_language_fortran, is_language_fortran95, make_text(), make_text_resource(), MERGE_TEXTS, mod_stat, module, module_name_to_entity(), NIL, pips_internal_error, reset_current_module_entity(), set_current_module_entity(), set_string_property(), strdup(), string_undefined, and text_module().

Referenced by print_parallelized77_code(), print_parallelized90_code(), print_parallelized_code(), print_parallelizedHPF_code(), print_parallelizedMPI_code(), and print_parallelizedOMP_code().

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

◆ print_parallelizedHPF_code()

bool print_parallelizedHPF_code ( const string  module_name)
Parameters
module_nameodule_name

Definition at line 299 of file print.c.

300 {
302 }
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296

References module_name(), and print_parallelized_code_common().

+ Here is the call graph for this function:

◆ print_parallelizedMPI_code()

bool print_parallelizedMPI_code ( const string  mod_name)
Parameters
mod_nameod_name

Definition at line 314 of file print.c.

315 {
316  return print_parallelized_code_common(mod_name, "mpi");
317 }

References print_parallelized_code_common().

+ Here is the call graph for this function:

◆ print_parallelizedOMP_code()

bool print_parallelizedOMP_code ( const string  mod_name)
Parameters
mod_nameod_name

Definition at line 306 of file print.c.

307 {
309  pips_user_warning("avoid property " all_priv "=TRUE with OMP\n");
310 
311  return print_parallelized_code_common(mod_name, "omp");
312 }
#define pips_user_warning
Definition: misc-local.h:146
#define all_priv
Definition: print.c:304

References all_priv, get_bool_property(), pips_user_warning, and print_parallelized_code_common().

+ Here is the call graph for this function:

◆ print_source()

bool print_source ( const string  mod_name)
Parameters
mod_nameod_name

Definition at line 278 of file print.c.

279 {
280  is_user_view = true;
281  return print_code_or_source(mod_name);
282 }

References is_user_view, and print_code_or_source().

+ Here is the call graph for this function:

◆ user_view_p()

bool user_view_p ( void  )

print_code or print_source

Definition at line 95 of file print.c.

96 {
97  return is_user_view;
98 }

References is_user_view.

Variable Documentation

◆ is_user_view

bool is_user_view
static

Definition at line 93 of file print.c.

Referenced by print_code(), print_code_or_source(), print_source(), and user_view_p().