PIPS
prettyprint.h File Reference
#include "effects.h"
+ Include dependency graph for prettyprint.h:

Go to the source code of this file.

Functions

entity find_or_create_allocatable_struct (basic, string, int)
 Warning! Do not modify this file that is automatically generated! More...
 
bool check_common_inclusion (entity)
 area.c More...
 
conswords_cmf_loop_range (range)
 cmfortran.c More...
 
text text_loop_cmf (entity, const char *, int, loop, int, list, list)
 ===================================================================== More...
 
expression remove_modulo (expression)
 craft.c More...
 
text text_loop_craft (entity, const char *, int, loop, int, list, list)
 ===================================================================== More...
 
void sc_syst_debug (Psysteme)
 constraint_to_text.c More...
 
void inegalite_debug (Pcontrainte)
 
void egalite_debug (Pcontrainte)
 
string contrainte_text_format (string, string, text, Pcontrainte, bool, string(*)(Variable), bool, bool)
 
string egalite_text_format (string, string, text, Pcontrainte, string(*)(Variable), bool, bool)
 
string inegalite_text_format (string, string, text, Pcontrainte, string(*)(void), bool, bool)
 
void system_sorted_text_format (string, string, text, Psysteme, string(*)(Variable), bool(*)(Pvecteur), bool)
 lower level hook for regions. More...
 
void system_text_format (string, string, text, Psysteme, string(*)(Variable), bool)
 appends ps to line/txt with prefix continuations. More...
 
void entity_list_text_format (string, string, text, list, const char *(*)(entity))
 
list words_declaration (entity, bool, list *)
 declarations.c More...
 
list words_basic (basic, list *)
 what about simple DOUBLE PRECISION, REAL, INTEGER... More...
 
sentence sentence_variable (entity, list *)
 
sentence Sentence_Variable (entity)
 
sentence sentence_head (entity, list *)
 We have no way to distinguish between the SUBROUTINE and PROGRAM They two have almost the same properties. More...
 
list words_qualifiers (list)
 
list words_type (type, list *, bool)
 obj is the type to describe More...
 
list Words_Type (type)
 
bool c_brace_expression_p (expression)
 
list words_brace_expression (expression, list *)
 
list words_dimensions (list, list *)
 
list generic_c_words_entity (type, list, bool, bool, list *)
 This recursive function prints a C variable with its type. More...
 
list generic_c_words_simplified_entity (type, list, bool, bool, bool, bool, bool, list *)
 Same as above, but the bool is_first is used to skip a type specifier which is useful when several variables or types are defined in a unique statement such as "int i, *pi, ai[10],...;". More...
 
list c_words_simplified_entity (type, list, bool, bool, list *)
 The declaration list pointer ppdl is passed down to determine if an internal derived type must be fully expanded within another declaration or not. More...
 
list c_words_entity (type, list, list *)
 
list safe_c_words_entity (type, list)
 
text c_text_entities (entity, list, int, list *)
 Generate declarations for a list of entities belonging to the same statement declaration. More...
 
text c_text_related_entities (entity, list, int, int, list *, list)
 It is assumed that all entities in list el can be declared by an unique statement, i.e. More...
 
text c_text_entity (entity, entity, int, list *, bool)
 Regeneration of declarations from the symbol table. More...
 
text c_text_entity_simple (entity, entity, int)
 
void set_prettyprinter_common_hook (string(*)(entity, entity))
 declarations2.c More...
 
void reset_prettyprinter_common_hook (void)
 
text text_declaration (entity)
 exported for hpfc. More...
 
text text_common_declaration (entity, entity)
 needed for hpfc More...
 
text text_initializations (entity)
 
void print_entity_variable (entity)
 entity.c More...
 
void fprint_expression (FILE *, expression)
 expression.c More...
 
void print_expression (expression)
 no file descriptor is passed to make is easier to use in a debugging stage. More...
 
string expression_to_string (expression)
 
string reference_to_string (reference)
 
void print_expressions (list)
 
void print_syntax_expressions (list)
 
void print_syntax (syntax)
 
void fprint_reference (FILE *, reference)
 
void print_reference (reference)
 
void print_reference_list (list)
 
void print_references (list)
 
void print_normalized (normalized)
 
bool maxima_simplify (expression *)
 call maxima to simplify an expression prefer simplify_expression ! More...
 
void fprint_list_of_exp (FILE *, list)
 void fprint_list_of_exp(FILE *fp, list exp_l): prints in the file "fp" the list of expression "exp_l". More...
 
string close_extension (extension)
 extension.c More...
 
string close_extensions (extensions, bool)
 
string extension_to_string (extension)
 
string extensions_to_string (extensions, bool)
 return a new allocated string with the string representation of the extensions. More...
 
text text_loop_90 (entity, const char *, int, loop, int)
 fortran90.c More...
 
expression expand_reference (syntax, expression, entity, range)
 A reference cannot always be expanded. More...
 
expression expand_expression (expression, entity, range)
 
void html_output (const char *, bool)
 html_prettyprinter.c More...
 
void html_print_entity_full (entity)
 
void html_print_symbol_table (void)
 
bool html_prettyprint (const string)
 
bool html_prettyprint_symbol_table (const string)
 
void printf_loop (loop)
 loop.c More...
 
void print_loops_list (entity, list)
 
string get_comment_sentinel (void)
 Start a single line comment. More...
 
string get_comment_continuation (void)
 Start a single line comment with continuation (blank spaces) More...
 
unsigned int get_prettyprint_indentation (void)
 
text empty_text (entity, int, statement)
 
void init_prettyprint (text(*)(entity, int, statement))
 checks that the prettyprint hook was actually reset... More...
 
void close_prettyprint (void)
 because some prettyprint functions may be used for debug, so the last hook set by somebody may have stayed there although being non sense... More...
 
bool one_liner_p (statement)
 True is statement "s" can be printed out without enclosing braces when it is the true branch of a test. More...
 
bool gcc_if_block_braces_required_p (test)
 
list words_loop_range (range, list *)
 exported for craft More...
 
list C_loop_range (range, entity, list *)
 Output a Fortan-like do-loop range as a C-like for-loop index part. More...
 
list words_range (range, list *)
 
list words_subscript_range (range, list *)
 @description FI: array constructor R433, p. More...
 
list words_any_reference (reference, list *, const char *(*)(entity))
 
list Words_Any_Reference (reference, list, const char *(*)(entity))
 
list words_reference (reference, list *)
 
list Words_Reference (reference)
 
void set_alternate_return_set (void)
 
void reset_alternate_return_set (void)
 
void add_target_to_alternate_return_set (entity)
 
text generate_alternate_return_targets (void)
 
list words_regular_call (call, bool, list *)
 words_regular_call used for user subroutine and user function and intrinsics called like user function such as MOD(). More...
 
list Words_Regular_Call (call, bool)
 
list words_call_intrinsic (call, int, bool, list *)
 
list words_goto_label (const char *)
 This function is useful only for parsed codes since gotos are removed by the controlizer. More...
 
list eole_fma_specific_op (call, int, bool, list *)
 EOLE : The multiply-add operator is used within the optimize transformation ( JZ - sept 98) - fma(a,b,c) -> ((a*b)+c) More...
 
list eole_fms_specific_op (call, int, bool, list *)
 MULTIPLY-SUB operator. More...
 
void register_intrinsic_handler (const char *, intrinsic_desc_t *)
 after this call, name and desc are owned by intrinsic_handlers, but will never be deallocated they must point to permanent storage More...
 
list words_call (call, int, bool, bool, list *)
 exported for cmfortran.c More...
 
list Words_Call (call, int, bool, bool)
 
list words_expression (expression, list *)
 This one is exported. More...
 
list Words_Expression (expression)
 of string More...
 
list words_syntax (syntax, list *)
 exported for expression.c More...
 
list Words_Syntax (syntax)
 
list words_subexpression (expression, int, bool, list *)
 exported for cmfortran.c More...
 
list Words_Subexpression (expression, int, bool)
 
sentence sentence_goto_label (entity, const char *, int, const char *, int)
 
text text_omp_directive (loop, int)
 
text text_loop_default (entity, const char *, int, loop, int, list *, bool)
 exported for fortran90.c More...
 
text text_loop (entity, const char *, int, loop, int, list *, bool)
 exported for conversion/look_for_nested_loops.c More...
 
text init_text_statement (entity, int, statement)
 exported for unstructured.c More...
 
void set_prettyprinter_head_hook (string(*)(entity))
 
void reset_prettyprinter_head_hook (void)
 
bool C_comment_p (string)
 In case the input code is not C code, non-standard comments have to be detected. More...
 
text C_any_comment_to_text (int, string)
 In case comments are not formatted according to C rules, e.g. More...
 
text C_standard_comment_to_text (int, string)
 
text C_comment_to_text (int, string)
 Special handling for C comments with each line indented according to the context. More...
 
text generic_text_statement_enclosed (entity, int, statement, bool, bool, list *, bool, bool)
 
text text_statement_enclosed (entity, int, statement, bool, bool, list *)
 
text Text_Statement_Enclosed (entity, int, statement, bool, bool)
 
text text_statement (entity, int, statement, list *)
 
text Text_Statement (entity, int, statement)
 
text Text_Proper_Statement (entity, int, statement)
 
string proper_statement_to_string (statement)
 
statement find_last_statement (statement)
 
void set_last_statement (statement)
 
void reset_last_statement (void)
 
bool last_statement_p (statement)
 
void insure_return_as_last_statement (entity, statement *)
 
list initialize_previously_declared_entities (entity)
 
text text_named_module (entity, entity, statement)
 
text text_module (entity, statement)
 
void add_control_node_identifier_to_text (text, control)
 
void output_a_graph_view_of_the_unstructured_successors (text, entity, int, control)
 
bool output_a_graph_view_of_the_unstructured_from_a_control (text, entity, int, control, control)
 
void output_a_graph_view_of_the_unstructured (text, entity, const char *, int, unstructured, int)
 
bool recompile_module (const string)
 module.c More...
 
void print_parameter (parameter)
 parameter.c More...
 
void print_parameters (list)
 Display a parameter on stderr, useful for debugging. More...
 
void print_mode (mode)
 Display a "mode" on stderr, useful for debugging. More...
 
void print_dummy (dummy)
 Display a "dummy" on stderr, useful for debugging. More...
 
string close_pragma (pragma)
 pragma.c More...
 
string pragma_to_string (pragma)
 
void add_expr_to_pragma_expr_list (pragma, expression)
 Add an expression to the pragma current expression list. More...
 
bool make_text_resource (const char *, const char *, const char *, text)
 print.c More...
 
bool make_text_resource_and_free (const char *, const char *, const char *, text)
 
bool user_view_p (void)
 print_code or print_source More...
 
bool print_code_or_source (string)
 Generic function to prettyprint some sequential or parallel code, or even user view for the given module. More...
 
bool print_code (const string)
 
bool print_source (const string)
 
bool print_parallelized_code (const string)
 
bool print_parallelized90_code (const string)
 
bool print_parallelized77_code (const string)
 
bool print_parallelizedHPF_code (const string)
 
bool print_parallelizedOMP_code (const string)
 
bool print_parallelizedMPI_code (const string)
 
void dprint (expression)
 For debugging: prettyprint many different kinds of newgen objects FC: type should be gen_chunk... More...
 
bool print_code_as_a_graph (const string)
 print_code_as_a_graph.c More...
 
bool same_lexpr_name_p (list, list)
 same_names.c More...
 
bool same_entity_lname_p (entity, entity)
 
bool same_call_name_p (call, call)
 
bool same_ref_name_p (reference, reference)
 
bool same_range_name_p (range, range)
 
bool same_sizeofexpression_name_p (sizeofexpression, sizeofexpression)
 
bool same_subscript_name_p (subscript, subscript)
 
bool same_cast_name_p (cast, cast)
 
bool same_application_name_p (application, application)
 
bool same_va_arg_name_p (list, list)
 
bool same_syntax_name_p (syntax, syntax)
 
bool same_expression_name_p (expression, expression)
 compare two entities for their appearance point of view. More...
 
void print_statement_set (FILE *, set)
 statement.c More...
 
void fprint_statement (FILE *, statement)
 Print statement "s" on file descriptor "fd". More...
 
void print_statement (statement)
 Print a statement on stderr. More...
 
void print_statements (list)
 
void print_statement_of_module (statement, const char *)
 
text statement_to_text (statement)
 
void safe_print_statement (statement)
 
void print_parallel_statement (statement)
 
statement last_statement (statement)
 A simplified version of find_last_statement() located in prettyprint.c and designed to be used within the prettyprinter. More...
 
void print_number_to_statement (hash_table)
 
list find_statements_interactively (statement)
 prompt the user to select contiguous statement in s More...
 
void dump_common_layout (string_buffer, entity, bool, bool)
 symbol_table.c More...
 
string get_symbol_table (entity, bool)
 
void actual_symbol_table_dump (const char *, bool)
 
bool parsed_symbol_table (const char *)
 bool c_symbol_table(const char* module_name) More...
 
bool symbol_table (const char *)
 To replace c_symbol_table() and fortran_symbol_table() because the information about the language is available in the symbol table. More...
 
string type_to_full_string_definition (type)
 type.c More...
 
string string_of_type (const type)
 
bool same_type_name_p (const type, const type)
 For naming homogeneity: expression_to_string(), reference_to_string()... More...
 
string basic_to_string (basic)
 
void print_types (list)
 Very basic and crude debugging function. More...
 
void print_type (type)
 For debugging. More...
 
void print_qualifiers (list)
 
void print_qualifier (qualifier)
 
text text_unstructured (entity, const char *, int, unstructured, int, list *)
 unstructured.c More...
 
list unstructured_to_trail (unstructured)
 
void dump_trail (list)
 
void dump_control_to_label_name (hash_table)
 

Variables

char lib_ri_util_prettyprint_c_rcsid []
 misc.c More...
 

Function Documentation

◆ actual_symbol_table_dump()

void actual_symbol_table_dump ( const char *  module_name,
bool  is_parsed 
)

This function is called in two different context: as a standalone phase or as part of debugging the parser?!?

Parameters
module_nameodule_name
is_parseds_parsed

Definition at line 582 of file symbol_table.c.

583 {
584  FILE *out;
585  string ppt;
586  bool isfortran = false;
587 
590  if(value_code_p(v)) {
591  code c = value_code(v);
592  language l = code_language(c);
594  isfortran = true;
595  }
596  else if(language_c_p(l)) {
597  isfortran = false;
599  }
600  else {
601  pips_internal_error("Language %d is not supported.\n");
602  }
603  }
604  else {
605  pips_internal_error("Module \"%s\" has no code.\n", module_name);
606  }
607 
608  string symboltable = db_build_file_resource_name(DBR_SYMBOL_TABLE_FILE,
609  module_name, NULL);
610  string dir = db_get_current_workspace_directory();
611  string filename = strdup(concatenate(dir, "/", symboltable, NULL));
612  bool reset_p = false;
613 
614  debug_on("SYMBOL_TABLE_DEBUG_LEVEL");
615 
616  /* This function is called in two different context: as a
617  standalone phase or as part of debugging the parser?!? */
619  reset_p = true;
621  }
622 
623  out = safe_fopen(filename, "w");
624 
625  ppt = get_symbol_table(module, isfortran);
626 
627  fprintf(out, "%s\n%s", module_name, ppt);
628  safe_fclose(out, filename);
629 
630  free(dir);
631  free(filename);
632 
633  if(reset_p)
635 
636  debug_off();
637 
638  if(is_parsed)
639  DB_PUT_FILE_RESOURCE(DBR_PARSED_SYMBOL_TABLE_FILE, module_name, symboltable);
640  else
641  DB_PUT_FILE_RESOURCE(DBR_SYMBOL_TABLE_FILE, module_name, symboltable);
642 
643 }
static FILE * out
Definition: alias_check.c:128
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
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
void free(void *)
void reset_current_module_entity(void)
Reset the current module entity.
Definition: static.c:97
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
#define DB_PUT_FILE_RESOURCE
Put a file resource into the current workspace database.
Definition: pipsdbm-local.h:85
void set_prettyprint_language_tag(enum language_utype lang)
set the prettyprint language from a language_utype argument
Definition: language.c:143
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
#define debug_on(env)
Definition: misc-local.h:157
#define pips_internal_error
Definition: misc-local.h:149
#define debug_off()
Definition: misc-local.h:160
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
static char * module
Definition: pips.c:74
string db_get_current_workspace_directory(void)
Definition: workspace.c:96
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479
#define value_code_p(x)
Definition: ri.h:3065
#define language_fortran95_p(x)
Definition: ri.h:1597
#define entity_undefined_p(x)
Definition: ri.h:2762
#define language_c_p(x)
Definition: ri.h:1594
#define value_code(x)
Definition: ri.h:3067
#define code_language(x)
Definition: ri.h:792
#define language_fortran_p(x)
Definition: ri.h:1591
@ is_language_c
Definition: ri.h:1567
#define entity_initial(x)
Definition: ri.h:2796
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
char * strdup()
string get_symbol_table(entity m, bool isfortran)
Definition: symbol_table.c:304

References code_language, concatenate(), db_build_file_resource_name(), db_get_current_workspace_directory(), DB_PUT_FILE_RESOURCE, debug_off, debug_on, entity_initial, entity_undefined_p, fprintf(), free(), get_current_module_entity(), get_symbol_table(), is_language_c, language_c_p, language_fortran95_p, language_fortran_p, module, module_name(), module_name_to_entity(), out, pips_internal_error, reset_current_module_entity(), safe_fclose(), safe_fopen(), set_current_module_entity(), set_prettyprint_language_tag(), strdup(), value_code, and value_code_p.

Referenced by parsed_symbol_table(), and symbol_table().

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

◆ add_control_node_identifier_to_text()

void add_control_node_identifier_to_text ( text  ,
control   
)

Referenced by ensure_comment_consistency().

+ Here is the caller graph for this function:

◆ add_expr_to_pragma_expr_list()

void add_expr_to_pragma_expr_list ( pragma  pr,
expression  ex 
)

Add an expression to the pragma current expression list.

Returns
void
Parameters
pr,thepragma to process.
ex,theexpression to add.

Add the new pragma to the extension list:

Parameters
prr
exx

Definition at line 147 of file pragma.c.

147  {
148  pips_assert ("the pragma need to be an expression", pragma_expression_p (pr) );
149  /* Add the new pragma to the extension list: */
150  list exprs = pragma_expression (pr);
151  exprs = gen_expression_cons (ex, exprs);
152  pragma_expression (pr) = exprs;
153  string str = pragma_to_string (pr);
154  pips_debug(5, "after: %s", str);
155  free (str);
156  return;
157 }
list gen_expression_cons(expression p, list l)
Definition: ri.c:866
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
string pragma_to_string(pragma p)
Definition: pragma.c:69
#define pragma_expression_p(x)
Definition: ri.h:2034
#define pragma_expression(x)
Definition: ri.h:2036
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References free(), gen_expression_cons(), pips_assert, pips_debug, pragma_expression, pragma_expression_p, and pragma_to_string().

Referenced by add_loop_parallel_threshold().

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

◆ add_target_to_alternate_return_set()

void add_target_to_alternate_return_set ( entity  l)

Definition at line 814 of file misc.c.

815 {
816  ifdebug(1) {
817  pips_assert("The target list is initialized",
819  }
822 }
#define list_undefined_p(c)
Return if a list is undefined.
Definition: newgen_list.h:75
list gen_once(const void *vo, list l)
Prepend an item to a list only if it is not already in the list.
Definition: list.c:722
static list set_of_labels_required_for_alternate_returns
Management of alternate returns.
Definition: misc.c:793
#define ifdebug(n)
Definition: sg.c:47

References gen_once(), ifdebug, list_undefined_p, pips_assert, and set_of_labels_required_for_alternate_returns.

Referenced by words_regular_call().

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

◆ basic_to_string()

string basic_to_string ( basic  b)

Nga Nguyen, 19/09/2003: To not rewrite the same thing, I use the words_basic() function

Definition at line 87 of file type.c.

88 {
89  /* Nga Nguyen, 19/09/2003: To not rewrite the same thing, I use the words_basic() function*/
90  list pdl = NIL;
91  return list_to_string(words_basic(b, &pdl));
92  gen_free_list(pdl);
93 }
string list_to_string(list l)
Return the malloc()ed version of the concatenation of all the strings in the list.
Definition: args.c:74
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
void gen_free_list(list l)
free the spine of the list
Definition: list.c:327
list words_basic(basic obj, list *ppdl)
what about simple DOUBLE PRECISION, REAL, INTEGER...
Definition: declarations.c:323

References gen_free_list(), list_to_string(), NIL, and words_basic().

Referenced by add_formal_to_actual_bindings(), any_expression_to_transformer(), any_user_call_site_to_transformer(), arguments_are_something(), can_terapixify_expression_p(), check_call_basic(), DeclareVariable(), dprint(), dump_common_layout(), dump_functional(), entities_type_and_name(), fortran_user_call_to_transformer(), fprint_any_environment(), fprint_functional(), get_symbol_table(), is_varibale_array_element_specifier(), mpi_recv_ctx(), mpi_send_ctx(), print_entity_variable(), register_scalar_communications(), relation_to_transformer(), rename_op(), sac_commenter(), sentence_basic_declaration(), string_expression_to_transformer(), stub_head(), stub_var_decl(), this_entity_cdeclaration(), type_and_size_of_var(), type_this_call(), type_this_entity_if_needed(), type_this_expression(), type_this_instruction(), TypeFunctionalEntity(), typing_arguments_of_user_function(), typing_function_argument_type_to_return_type(), variable_to_string(), xml_Full_Type(), and xml_TaskReturnParameter().

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

◆ C_any_comment_to_text()

text C_any_comment_to_text ( int  r_margin,
string  c 
)

In case comments are not formatted according to C rules, e.g.

when prettyprinting Fortran code as C code, add // at beginning of lines

Note: this is supposed to have been dealt with by another function called before, ensure_comment_consistency()

line beginning

line end

current position, pointer in comments

We do not need spaces before a line feed

Parameters
r_margin_margin

Definition at line 4165 of file misc.c.

4166 {
4167  string lb = c; /* line beginning */
4168  string le = c; /* line end */
4169  string cp = c; /* current position, pointer in comments */
4170  text ct = make_text(NIL);
4171  bool is_C_comment = C_comment_p(c);
4172  int e_margin = r_margin;
4173 
4174  /* We do not need spaces before a line feed */
4175  if(strcmp(c, "\n")==0)
4176  e_margin = 0;
4177 
4178  if(strlen(c)>0) {
4179  for(;*cp!='\0';cp++) {
4180  if(*cp=='\n') {
4181  if(cp!=c || true){ // Do not skip \n
4182  string cl = gen_strndup0(lb, le-lb);
4184  if(is_C_comment)
4185  s = MAKE_ONE_WORD_SENTENCE(e_margin, cl);
4186  else if(strlen(cl)>0){
4187  list pc = CHAIN_SWORD(NIL, cl); // cl is uselessly duplicated
4188  pc = CONS(STRING, MAKE_SWORD("//"), pc);
4190  make_unformatted((char *) NULL, 0, e_margin, pc));
4191  }
4192  else {
4193  s = MAKE_ONE_WORD_SENTENCE(0, cl);
4194  }
4195  ADD_SENTENCE_TO_TEXT(ct, s);
4196  free(cl);
4197  }
4198  lb = cp+1;
4199  le = cp+1;
4200  }
4201  else
4202  le++;
4203  }
4204  // Final \n has been removed in the parser presumably by Ronan
4205  // But this is also useful when non-standard comments are added,
4206  // for instance by phase "comment_prepend"
4207  if(lb<cp){
4209  string sl = gen_strndup0(lb,le-lb);
4210  if(is_C_comment) {
4211  s = MAKE_ONE_WORD_SENTENCE(e_margin,sl);
4212  }
4213  else {
4214  list pc = CHAIN_SWORD(NIL, sl); // sl is uselessly duplicated
4215  pc = CONS(STRING, MAKE_SWORD("//"), pc);
4217  make_unformatted((char *) NULL, 0, e_margin, pc));
4218  }
4219  ADD_SENTENCE_TO_TEXT(ct,s);
4220  free(sl);
4221  } else{
4222  //ADD_SENTENCE_TO_TEXT(ct,MAKE_ONE_WORD_SENTENCE(0,""));
4223  ;
4224  }
4225  }
4226  else{// Final \n has been removed by Ronan
4227  //ADD_SENTENCE_TO_TEXT(ct,MAKE_ONE_WORD_SENTENCE(0,""));
4228  ;
4229  }
4230 
4231  return ct;
4232 }
unformatted make_unformatted(string a1, intptr_t a2, intptr_t a3, list a4)
Definition: text.c:149
sentence make_sentence(enum sentence_utype tag, void *val)
Definition: text.c:59
text make_text(list a)
Definition: text.c:107
#define STRING(x)
Definition: genC.h:87
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
string gen_strndup0(string, size_t)
Like strdup() but copy at most n characters.
Definition: string.c:83
bool C_comment_p(string c)
In case the input code is not C code, non-standard comments have to be detected.
Definition: misc.c:4094
Pvecteur cp
pointeur sur l'egalite ou l'inegalite courante
Definition: sc_read.c:87
#define CHAIN_SWORD(l, s)
#define MAKE_ONE_WORD_SENTENCE(m, s)
#define ADD_SENTENCE_TO_TEXT(t, p)
#define MAKE_SWORD(s)
#define sentence_undefined
Definition: text.h:42
@ is_sentence_unformatted
Definition: text.h:58

References ADD_SENTENCE_TO_TEXT, C_comment_p(), CHAIN_SWORD, CONS, cp, free(), gen_strndup0(), is_sentence_unformatted, MAKE_ONE_WORD_SENTENCE, make_sentence(), MAKE_SWORD, make_text(), make_unformatted(), NIL, sentence_undefined, and STRING.

Referenced by C_comment_to_text().

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

◆ c_brace_expression_p()

bool c_brace_expression_p ( expression  e)

Definition at line 898 of file declarations.c.

899 {
900  if (expression_call_p(e))
901  {
904  return true;
905  }
906  return false;
907 }
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
#define ENTITY_BRACE_INTRINSIC_P(e)
C initialization expression.
bool expression_call_p(expression e)
Definition: expression.c:415
#define call_function(x)
Definition: ri.h:709
#define syntax_call(x)
Definition: ri.h:2736
#define expression_syntax(x)
Definition: ri.h:1247

References call_function, ENTITY_BRACE_INTRINSIC_P, expression_call_p(), expression_syntax, f(), and syntax_call.

Referenced by words_brace_expression().

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

◆ C_comment_p()

bool C_comment_p ( string  c)

In case the input code is not C code, non-standard comments have to be detected.

Definition at line 4094 of file misc.c.

4094  {
4095  bool is_C_comment=true;
4096  char * ccp=c;
4097  char cc=' ';
4098 
4099  init:
4100  cc=*ccp++;
4101  if(cc==' '|| cc=='\t' || cc=='\n')
4102  goto init;
4103  else if( cc=='/')
4104  goto slash;
4105  else if(cc=='\000')
4106  goto end;
4107  else {
4108  is_C_comment=false;
4109  goto end;
4110  }
4111 
4112  slash:
4113  cc=*ccp++;
4114  if(cc=='*')
4115  goto slash_star;
4116  else if(cc=='/')
4117  goto slash_slash;
4118  else{
4119  is_C_comment=false;
4120  goto end;
4121  }
4122 
4123  slash_star:
4124  cc=*ccp++;
4125  if(cc=='*')
4126  goto slash_star_star;
4127  else if(cc=='\0'){
4128  is_C_comment=false;
4129  goto end;
4130  }
4131  else
4132  goto slash_star;
4133 
4134  slash_slash:
4135  cc=*ccp++;
4136  if(cc=='\n')
4137  goto init;
4138  if(cc=='\0') // The comment may not end first with a '\n'
4139  goto end;
4140  else
4141  goto slash_slash;
4142 
4143  slash_star_star:
4144  cc=*ccp++;
4145  if(cc=='/')
4146  goto init;
4147  else if(cc=='*')
4148  goto slash_star_star;
4149  else if(cc=='\0'){
4150  is_C_comment=false;
4151  goto end;
4152  }
4153  else
4154  goto slash_star;
4155 
4156  end : return is_C_comment;
4157 }
char end
Definition: gtk_status.c:82
static int init
Maximal value set for Fortran 77.
Definition: entity.c:320

References end, and init.

Referenced by C_any_comment_to_text(), and C_comment_to_text().

+ Here is the caller graph for this function:

◆ C_comment_to_text()

text C_comment_to_text ( int  margin,
string  comment 
)

Special handling for C comments with each line indented according to the context.

I do not see the interest if the user code is already indented... RK OK, since the blanks outside the comments are removed by the parser.

Parameters
marginargin
commentomment

Definition at line 4270 of file misc.c.

4271 {
4272  text ct = text_undefined;
4273 
4274  if(C_comment_p(comment))
4275  //ct = C_standard_comment_to_text(margin, comment);
4276  ct = C_any_comment_to_text(margin, comment);
4277  else
4278  ct = C_any_comment_to_text(margin, comment);
4279  return ct;
4280 }
static void comment(string_buffer code, spoc_hardware_type hw, dagvtx v, int stage, int side, bool flip)
Definition: freia_spoc.c:52
text C_any_comment_to_text(int r_margin, string c)
In case comments are not formatted according to C rules, e.g.
Definition: misc.c:4165
#define text_undefined
Definition: text.h:91

References C_any_comment_to_text(), C_comment_p(), comment(), and text_undefined.

Referenced by text_trail().

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

◆ C_loop_range()

list C_loop_range ( range  obj,
entity  i,
list ppdl 
)

Output a Fortan-like do-loop range as a C-like for-loop index part.

@description Assume that the increment is an integer so we can generate the good condition. Since the do-loops are recognized in C program part only with this assumptions, it is a good assumption.

call c = syntax_call(expression_syntax(range_increment(obj)));

Complete the initialization assignment

Check the final bound

Increasing or decreasing index?

Assume the increment has an integer value with a known sign If The increment is negative, that means the index is tested against a lower bound Else we assume to test against an upper bound

check if we have something of the form exp -1 as range_upper

Additionally, we want to pretty print a strict comparison if certain conditions are met. This could be the default choice , but the impact on the validation would be huge

Priority for LESS, GREATER, LESS_OR_EQUAL, GREATER_OR_EQUAL: 15

Increment the loop index

Parameters
objbj
ppdlpdl

Definition at line 457 of file misc.c.

458 {
459  list pc;
460  /* call c = syntax_call(expression_syntax(range_increment(obj))); */
461 
462  /* Complete the initialization assignment */
463  pc = words_subexpression(range_lower(obj), 0, true, ppdl);
464  pc = CHAIN_SWORD(pc,"; ");
465 
466  /* Check the final bound */
467  pc = CHAIN_SWORD(pc, entity_user_name(i));
468 
469  /* Increasing or decreasing index? */
470  expression inc = range_increment(obj);
471  /* Assume the increment has an integer value with a known sign
472  If The increment is negative, that means the index is tested against
473  a lower bound
474  Else we assume to test against an upper bound
475  */
476 
477  expression ru = range_upper(obj);
478  /* check if we have something of the form exp -1 as range_upper */
480  copy_expression(ru),
482  );
483 
484  /* Additionally, we want to pretty print a strict comparison if
485  certain conditions are met. This could be the default choice ,
486  but the impact on the validation would be huge */
487  set re = get_referenced_entities(ru);
488  bool references_unsigned_entity_p = false;
489  SET_FOREACH(entity,e,re) {
490  references_unsigned_entity_p |= unsigned_type_p(ultimate_type(entity_type(e)));
491  }
492  set_free(re);
493  if( references_unsigned_entity_p ) {
494  if(positive_expression_p(inc))
495  pc = CHAIN_SWORD(pc, " < ");
496  else if(negative_expression_p(inc))
497  pc = CHAIN_SWORD(pc, " > ");
498  else {
499  //pips_internal_error("loop range cannot be prettyprinted because increment sign"
500  // " is unknown\n");
501  pips_user_warning("loop increment sign is unknown: assumed positive\n");
502  pc = CHAIN_SWORD(pc, " < ");
503  }
504  pc = gen_nconc(pc, words_subexpression(ru_minus_one, 0, true, ppdl));
505  }
506  else {
507  // FI: when inc is not a constant integer,
508  // expression_negative_integer_value_p() always return false
509  if(positive_expression_p(inc))
510  pc = CHAIN_SWORD(pc, " <= ");
511  else if(negative_expression_p(inc))
512  pc = CHAIN_SWORD(pc, " >= ");
513  else {
514  //pips_internal_error("loop range cannot be prettyprinted because increment sign"
515  // " is unknown\n");
516  pips_user_warning("loop increment sign is unknown: assumed positive\n");
517  pc = CHAIN_SWORD(pc, " <= ");
518  }
519  /* Priority for LESS, GREATER, LESS_OR_EQUAL, GREATER_OR_EQUAL: 15 */
520  pc = gen_nconc(pc, words_subexpression(ru, 15, true, ppdl));
521  }
522  free_expression(ru_minus_one);
523  pc = CHAIN_SWORD(pc,"; ");
524 
525  /* Increment the loop index */
526  pc = CHAIN_SWORD(pc, entity_user_name(i));
527  pc = CHAIN_SWORD(pc," += ");
528  pc = gen_nconc(pc, words_expression(inc, ppdl));
529  pc = CHAIN_SWORD(pc,")");
530 
531  return(pc);
532 }
expression copy_expression(expression p)
EXPRESSION.
Definition: ri.c:850
void free_expression(expression p)
Definition: ri.c:853
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
#define pips_user_warning
Definition: misc-local.h:146
#define SET_FOREACH(type_name, the_item, the_set)
enumerate set elements in their internal order.
Definition: newgen_set.h:78
void set_free(set)
Definition: set.c:332
list words_subexpression(expression obj, int precedence, bool leftmost, list *ppdl)
exported for cmfortran.c
Definition: misc.c:2674
list words_expression(expression obj, list *ppdl)
This one is exported.
Definition: misc.c:2611
#define PLUS_OPERATOR_NAME
const char * entity_user_name(entity e)
Since entity_local_name may contain PIPS special characters such as prefixes (label,...
Definition: entity.c:487
set get_referenced_entities(void *elem)
retrieves the set of entities used in elem beware that this entities may be formal parameters,...
Definition: entity.c:3063
bool positive_expression_p(expression e)
Use constants and type information to decide if the value of sigma(e) is always positive,...
Definition: eval.c:826
bool negative_expression_p(expression e)
Use constants and type information to decide if the value of sigma(e) is always negative,...
Definition: eval.c:896
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
expression make_op_exp(char *op_name, expression exp1, expression exp2)
================================================================
Definition: expression.c:2012
type ultimate_type(type)
Definition: type.c:3466
bool unsigned_type_p(type)
Predicates on types.
Definition: type.c:2821
#define range_upper(x)
Definition: ri.h:2290
#define range_increment(x)
Definition: ri.h:2292
#define range_lower(x)
Definition: ri.h:2288
#define entity_type(x)
Definition: ri.h:2792
FI: I do not understand why the type is duplicated at the set level.
Definition: set.c:59

References CHAIN_SWORD, copy_expression(), entity_type, entity_user_name(), free_expression(), gen_nconc(), get_referenced_entities(), int_to_expression(), make_op_exp(), negative_expression_p(), pips_user_warning, PLUS_OPERATOR_NAME, positive_expression_p(), range_increment, range_lower, range_upper, SET_FOREACH, set_free(), ultimate_type(), unsigned_type_p(), words_expression(), and words_subexpression().

Referenced by text_loop_default().

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

◆ C_standard_comment_to_text()

text C_standard_comment_to_text ( int  margin,
string  comment 
)

position of a line end

Find the first end of line:

No end-of-line, so use all the rest of the comment:

Skip the '
' at the end since the line concept is the notion of sentence

Analyze the next line:

Do not indent if the line is empty

Parameters
marginargin
commentomment

Definition at line 4237 of file misc.c.

4238 {
4239  string line;
4240  string le = comment; /* position of a line end */
4241  text ct = make_text(NIL);
4242 
4243  do {
4244  /* Find the first end of line: */
4245  le = strchr(comment, '\n');
4246  if (le == NULL)
4247  /* No end-of-line, so use all the rest of the comment: */
4248  line = strdup(comment);
4249  else {
4250  /* Skip the '\n' at the end since the line concept is the notion of
4251  sentence */
4252  line = gen_strndup0(comment, le - comment);
4253  /* Analyze the next line: */
4254  comment = le + 1;
4255  }
4256  /* Do not indent if the line is empty */
4258  MAKE_ONE_WORD_SENTENCE(line[0] == '\0' ? 0 : margin,
4259  line));
4260  } while (le != NULL);
4261  return ct;
4262 }
static int line
FLEX_SCANNER.
Definition: scanner.c:852

References ADD_SENTENCE_TO_TEXT, comment(), gen_strndup0(), line, MAKE_ONE_WORD_SENTENCE, make_text(), NIL, and strdup().

+ Here is the call graph for this function:

◆ c_text_entities()

text c_text_entities ( entity  module,
list  ldecl,
int  margin,
list ppdl 
)

Generate declarations for a list of entities belonging to the same statement declaration.

ppdl: derived from the parser declared entity; used to decide if a derived type entity de must be declared as a reference to de (e.g. "struct s") or as the type definition of de (e.g. "struct s {}"). Of course, the type can be defined only once, even if it is referenced several times. Hence, pdl, the list pointed to by ppdl is updated in the loop to avoid redeclarations.

Dummy enum must be printed sometimes because their members are exposed directly.

Parameters
moduleodule
ldecldecl
marginargin
ppdlpdl

Definition at line 1452 of file declarations.c.

1453 {
1454  text r = make_text(NIL);
1455  //list npdl = gen_copy_seq(pdl); // new parser declaration list
1456 
1457  FOREACH(ENTITY, e, ldecl) {
1458  text tmp = text_undefined;
1459  type t = entity_type(e);
1460 
1461  if(!type_area_p(t)
1462  && ! type_statement_p(t)
1463  && !type_unknown_p(t)
1465  && !implicit_c_variable_p(e)) {
1466  string n = entity_name(e);
1467 
1468  /* Dummy enum must be printed sometimes because their members
1469  are exposed directly. */
1470  if(((strstr(n,DUMMY_ENUM_PREFIX)==NULL)
1471  || !type_used_in_type_declarations_p(e, ldecl))
1472  && (strstr(n,STRUCT_PREFIX DUMMY_STRUCT_PREFIX)==NULL
1473  ||strstr(n,MEMBER_SEP_STRING)!=NULL)
1474  && (strstr(n,UNION_PREFIX DUMMY_UNION_PREFIX)==NULL
1475  ||strstr(n,MEMBER_SEP_STRING)!=NULL) ) {
1476  type et = ultimate_type(entity_type(e));
1477  bool init_p = true; // So as not to modify the behavior although no initializations are expected here
1478  // FI: I do not understand the copies of pdl in npdl
1479  tmp = c_text_entity(module, e, margin, ppdl, init_p);
1480  MERGE_TEXTS(r,tmp);
1481 
1482  if(derived_type_p(et)) {
1484  //gen_remove(&npdl, (void *) de);
1485  *ppdl = gen_once((void *) de, *ppdl);
1486  }
1487  }
1488  }
1489  }
1490 
1491  //gen_free_list(npdl);
1492 
1493  return r;
1494 }
#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 DUMMY_STRUCT_PREFIX
Definition: naming-local.h:87
#define DUMMY_ENUM_PREFIX
For enum and struct and union without names (see c_syntax/cyacc.y)
Definition: naming-local.h:86
#define UNION_PREFIX
Definition: naming-local.h:58
#define DUMMY_UNION_PREFIX
Definition: naming-local.h:88
#define MEMBER_SEP_STRING
Definition: naming-local.h:53
#define STRUCT_PREFIX
Definition: naming-local.h:56
text c_text_entity(entity module, entity e, int margin, list *ppdl, bool init_p)
Regeneration of declarations from the symbol table.
bool type_used_in_type_declarations_p(entity e, list ldecl)
check if e is used to declare one of the entities in entity list ldecl
Definition: entity.c:2289
bool derived_type_p(type)
Returns true if t is of type struct, union or enum.
Definition: type.c:3104
bool implicit_c_variable_p(entity)
Definition: variable.c:1877
#define storage_formal_p(x)
Definition: ri.h:2522
#define type_unknown_p(x)
Definition: ri.h:2956
#define basic_derived(x)
Definition: ri.h:640
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define type_variable(x)
Definition: ri.h:2949
#define entity_storage(x)
Definition: ri.h:2794
#define type_statement_p(x)
Definition: ri.h:2941
#define entity_name(x)
Definition: ri.h:2790
#define type_area_p(x)
Definition: ri.h:2944
#define variable_basic(x)
Definition: ri.h:3120
#define MERGE_TEXTS(r, t)

References basic_derived, c_text_entity(), derived_type_p(), DUMMY_ENUM_PREFIX, DUMMY_STRUCT_PREFIX, DUMMY_UNION_PREFIX, ENTITY, entity_name, entity_storage, entity_type, FOREACH, gen_once(), implicit_c_variable_p(), make_text(), MEMBER_SEP_STRING, MERGE_TEXTS, module, NIL, storage_formal_p, STRUCT_PREFIX, text_undefined, type_area_p, type_statement_p, type_unknown_p, type_used_in_type_declarations_p(), type_variable, ultimate_type(), UNION_PREFIX, and variable_basic.

Referenced by c_text_related_entities(), and ensure_comment_consistency().

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

◆ c_text_entity()

text c_text_entity ( entity  module,
entity  e,
int  margin,
list ppdl,
bool  init_p 
)

Regeneration of declarations from the symbol table.

FI: strange recursion, probably due to Francois...

Regeneration of declarations... ==================== Variables and Function prototypes for C =========== pdl is the parser declaration list. It is used to decide if a derived entity should be simply declared, "struct s", or fully defined, "struct s {....}". It is accessed by its pointer ppdl

c_text_related_entities calls c_text_entities calls c_text_entity calls back c_text_related_entities (!) but with only one element... may call words_variable_or_function calls c_words_simplified_entity calls generic_c_words_simplified_entity

Note: text when newline are involved, words when everything fits on one line.

Parameters
moduleodule
marginargin
ppdlpdl
init_pnit_p

Definition at line 2087 of file declarations.c.

2088 {
2089  list el = CONS(ENTITY, e, NIL);
2090  list il = CONS(EXPRESSION, int_to_expression(init_p? 1 : 0), NIL);
2091  // No implicit "extern" keyword
2092  il = CONS(EXPRESSION, int_to_expression(0), NIL);
2093  text t = c_text_related_entities(module, el, margin, 0, ppdl, il);
2094  gen_free_list(el);
2095  gen_full_free_list(il);
2096 
2097  return t;
2098 }
void gen_full_free_list(list l)
Definition: genClib.c:1023
text c_text_related_entities(entity module, list del, int margin, int sn, list *ppdl, list cl)
It is assumed that all entities in list el can be declared by an unique statement,...
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217

References c_text_related_entities(), CONS, ENTITY, EXPRESSION, gen_free_list(), gen_full_free_list(), int_to_expression(), module, and NIL.

Referenced by c_text_entities(), c_text_entity_simple(), and compilation_unit_text().

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

◆ c_text_entity_simple()

text c_text_entity_simple ( entity  module,
entity  e,
int  margin 
)
Parameters
moduleodule
marginargin

Definition at line 2100 of file declarations.c.

2101 {
2102  list pdl = NIL; // pdl is useless in Fortran or in some debugging situations
2103  bool init_p = true;
2104  text t = c_text_entity(module, e, margin, &pdl, init_p);
2105  gen_free_list(pdl);
2106 
2107  return t;
2108 }

References c_text_entity(), gen_free_list(), module, and NIL.

Referenced by stub_text().

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

◆ c_text_related_entities()

text c_text_related_entities ( entity  module,
list  del,
int  margin,
int  sn,
list ppdl,
list  cl 
)

It is assumed that all entities in list el can be declared by an unique statement, i.e.

their types must be closely related, as in

"int i, *pj, foo();".

But you can also have:

"struct one { struct too {int a;};};"

where no variable is declared. And the parser generate a declaration list stating that "struct two" and "struct one" are declared in this statement.

In other words, this function prints out a C declaration statement, taking into account the derived entities that have to be defined exactly once, pdl. Of course, pdl can be updated by the caller when a derived entity is declared so as to avoid a redeclaration.

At this first level, the declarations of derived types use several lines. If a nested declaration occurs, the nested declaration is packed on a unique line.

List icl indicates for each entity if it should be initialized or not. This is useful for global variable initializations.

If we are not in a compilation unit, the initialization control list is useless and may be wrong because of program transformations such as scalar renaming.

The last entity may be a place holder

overwrite the parser declaration list pdl with del

A declaration has two parts: declaration specifiers and declarator (even with initializer) In declaration specifiers, we can have:

  • storage specifiers : typedef, extern, static, auto, register
  • type specifiers : void, char, short, int, long, float, double, signed, unsigned, struct-or-union specifiers, enum specifier, typedef name
  • type qualifiers : const, restrict, volatile
  • function specifiers : inline

This part is for storage specifiers

&& (extern_p || explicit_extern_entity_p(module, e_last)

|| (extern_entity_p(module, e_last) && !type_functional_p(t_last))))

The global variables stored in static area and in ram but they are not static so a condition is needed, which checks if it is not a global variable

If a derived type is declared first, the qualifiers are carried by the type of the second entity

This part is for type specifiers, type qualifiers, function specifiers and declarator Three special cases for struct/union/enum definitions are treated here. Variable (scalar, array), pointer, function, variables of type struct/union/enum and typedef are treated by function c_words_entity

c = words_variable_or_function(module, e1, true, pc, in_type_declaration, pdl);

the word list pc must have been inserted in text r

Add the declared variables or more declared variables.

add the asm qualifier if needed

the final semi column,

the word list pc must be added to the last sentence of text r

Parameters
moduleodule
delel
marginargin
snn
ppdlpdl
cll

Definition at line 1815 of file declarations.c.

1816 {
1817  /* If we are not in a compilation unit, the initialization control
1818  * list is useless and may be wrong because of program
1819  * transformations such as scalar renaming.
1820  */
1821  bool cu_p = entity_undefined_p(module)?
1822  false :
1824  list icl = ENDP(cl)? NIL : (cu_p? CDR(cl) : NIL);
1825  list el = filtered_declaration_list(del, &icl);
1826  text r = make_text(NIL);
1827  entity e1 = ENTITY(CAR(el)); // Let's use the first declared entity.
1828  const char* name1 = entity_user_name(e1);
1829  type t1 = entity_type(e1);
1830  entity e_last = ENTITY(CAR(gen_last(el))); // Let's also use the last declared entity.
1831  //type t_last = entity_type(e_last);
1832  //storage s1 = entity_storage(e1);
1833  storage s_last = entity_storage(e_last);
1834  //value val1 = entity_initial(e1);
1835  list pc = NIL;
1836  bool space_p = get_bool_property("PRETTYPRINT_LISTS_WITH_SPACES");
1837  bool skip_first_comma_p = true;
1838 
1839  bool place_holder_p = false;
1840  if(gen_length(el)==2) {
1841  /* The last entity may be a place holder */
1842  entity e2 = ENTITY(CAR(CDR(el)));
1843  if(place_holder_variable_p(e2)) {
1844  place_holder_p = true;
1845  }
1846  }
1847 
1848  /* overwrite the parser declaration list pdl with del */
1849  //pdl = del;
1850  // Not a good idea with recursive calls to this function
1851 
1852  pips_assert("the entity list is not empty", gen_length(el)>0);
1853 
1854  pips_debug(5,"Print declaration for first entity %s in module %s\n",
1855  entity_name(e1),
1856  entity_undefined_p(module)? "UNDEFINED" : entity_name(module));
1857 
1858  /* A declaration has two parts: declaration specifiers and declarator (even with initializer)
1859  In declaration specifiers, we can have:
1860  - storage specifiers : typedef, extern, static, auto, register
1861  - type specifiers : void, char, short, int, long, float, double, signed, unsigned,
1862  struct-or-union specifiers, enum specifier, typedef name
1863  - type qualifiers : const, restrict, volatile
1864  - function specifiers : inline */
1865 
1866  /* This part is for storage specifiers */
1867  bool extern_p = false; // so as not to change the default behavior
1868  bool dummy_p = false;
1869  if(!ENDP(cl)) {
1870  expression first = EXPRESSION(CAR(cl));
1871  int ic = integer_constant_expression_value(first);
1872  extern_p = (ic==1 || ic==3)? true : false;
1873  //dummy_p = (ic==2 || ic==3)? true : false;
1874  // FI: the information about dummy_p is not reliable
1875  // several derived entities may be used or declared within one declaration
1876  // statement, but only one flag is stored by the parser...
1877  dummy_p = false;
1878  }
1879  if (!entity_undefined_p(module) && extern_p) {
1880  /* && (extern_p || explicit_extern_entity_p(module, e_last) */
1881  /* || (extern_entity_p(module, e_last) && !type_functional_p(t_last)))) */
1882  pc = CHAIN_SWORD(pc,"extern ");
1883  }
1884 
1885  if (strstr(entity_name(e_last),TYPEDEF_PREFIX) != NULL) {
1886  pc = CHAIN_SWORD(pc,"typedef ");
1887  // FI: too early for typedef17.c
1888  //*ppdl = CONS(ENTITY, e_last, *ppdl);
1889  //if(same_string_p(entity_user_name(e_last), "__gconv_t")) {
1890  // fprintf(stderr, "Entity \"%s\" found.\n", entity_user_name(e_last));
1891  //}
1892  }
1893 
1894  /* The global variables stored in static area and in ram but they
1895  are not static so a condition is needed, which checks if it is not a
1896  global variable*/
1897  // entity m = get_current_module_entity();
1898  if ((storage_ram_p(s_last)
1900  && !strstr(entity_name(e_last),TOP_LEVEL_MODULE_NAME))
1901  || (entity_module_p(e_last) && static_module_p(e_last)))
1902  pc = CHAIN_SWORD(pc,"static ");
1903 
1904  /* If a derived type is declared first, the qualifiers are carried
1905  * by the type of the second entity
1906  */
1907  if(derived_entity_p(e1) && gen_length(el)>1) {
1908  entity e2 = ENTITY(CAR(CDR(el)));
1909  type t2 = entity_type(e2);
1910  if(type_variable_p(t2)) {
1911  variable v2 = type_variable(t2);
1912  list ql2 = variable_qualifiers(v2);
1913  pc = gen_nconc(pc, words_qualifiers(ql2));
1914  }
1915  }
1916 
1917 
1918  /* This part is for type specifiers, type qualifiers, function specifiers and declarator
1919  Three special cases for struct/union/enum definitions are treated here.
1920  Variable (scalar, array), pointer, function, variables of type struct/union/enum and typedef
1921  are treated by function c_words_entity */
1922 
1923  bool in_type_declaration = true;
1924  switch (type_tag(t1)) {
1925  case is_type_struct:
1926  {
1927  list l = type_struct(t1);
1928  const char * lname = entity_local_name(e1);
1929  bool init_p = strstr(lname, STRUCT_PREFIX DUMMY_STRUCT_PREFIX ) != NULL;
1930  if(!init_p)
1931  init_p = !dummy_p && !ENDP(l) && !gen_in_list_p(e1, *ppdl)
1932  && declarable_type_p(t1, *ppdl) && !place_holder_p;
1933  pc = words_struct_reference(name1, pc, init_p);
1935  make_unformatted(NULL,sn,margin,pc)));
1936  if(init_p) {
1937  *ppdl = gen_once(e1, *ppdl);
1938  text fields = c_text_entities(module, l, margin+INDENTATION, ppdl);
1939  pc = CHAIN_SWORD(NIL, "{");
1940  add_words_to_text(r, pc);
1941  MERGE_TEXTS(r, fields);
1943  }
1944  break;
1945  }
1946  case is_type_union:
1947  {
1948  list l = type_union(t1);
1949  const char * lname = entity_local_name(e1);
1950  bool init_p = strstr(lname, UNION_PREFIX DUMMY_UNION_PREFIX ) != NULL;
1951  if(!init_p)
1952  init_p = !dummy_p && !ENDP(l) && !gen_in_list_p(e1, *ppdl)
1953  && declarable_type_p(t1, *ppdl) && !place_holder_p;
1954  pc = words_union(name1, pc, init_p);
1956  make_unformatted(NULL,sn,margin,pc)));
1957  if(init_p) {
1958  *ppdl = gen_once(e1, *ppdl);
1959  text fields = c_text_entities(module,l,margin+INDENTATION, ppdl);
1960  pc = CHAIN_SWORD(NIL, "{");
1961  add_words_to_text(r, pc);
1962  MERGE_TEXTS(r,fields);
1964  }
1965  break;
1966  }
1967  case is_type_enum:
1968  {
1969  list l = type_enum(t1);
1970  const char * lname = entity_local_name(e1);
1971  bool init_p = strstr( lname, ENUM_PREFIX DUMMY_ENUM_PREFIX ) != NULL;
1972  if(!init_p)
1973  init_p = !dummy_p && !ENDP(l) && !gen_in_list_p(e1, *ppdl)
1974  && declarable_type_p(t1, *ppdl) && !place_holder_p;
1975  if(init_p) {
1976  *ppdl = gen_once((void *) e1, *ppdl);
1977  pc = words_enum(name1, l, space_p, pc, ppdl);
1979  make_unformatted(NULL,sn,margin,pc)));
1980  }
1981  else {
1982  pc = words_enum_reference(name1, pc, init_p);
1984  make_unformatted(NULL,sn,margin,pc)));
1985  }
1986  break;
1987  }
1988  case is_type_variable:
1989  case is_type_functional:
1990  case is_type_void:
1991  case is_type_unknown:
1992  {
1993  /*pc = words_variable_or_function(module, e1, true, pc,
1994  in_type_declaration, pdl);*/
1995  in_type_declaration=false;
1996 
1997  bool init_p = extern_p? false : true;
1998  if(!ENDP(icl)) {
1999  expression ice = EXPRESSION(CAR(icl)); // Initialization control expression
2000  int ic = integer_constant_expression_value(ice);
2001  init_p = ic==1? true : false;
2002  }
2003 
2004  pc = words_variable_or_function(module, e1, true, pc,
2005  in_type_declaration, ppdl, init_p);
2007  make_unformatted(NULL,sn,margin,pc)));
2008  skip_first_comma_p = false;
2009  break;
2010  }
2011  case is_type_varargs:
2012  case is_type_statement:
2013  case is_type_area:
2014  default:
2015  pips_internal_error("unexpected type tag");
2016  }
2017 
2018  /* the word list pc must have been inserted in text r*/
2019  pc = NIL;
2020 
2021 
2022 
2023  /* Add the declared variables or more declared variables. */
2024  list oel = list_undefined; // other entities after e1
2025  if(place_holder_p)
2026  oel = CDR(CDR(el)); // skip the place holder variable
2027  else
2028  oel = CDR(el);
2029  //print_entities(oel);
2030  list oicl = ENDP(icl) ? NIL : CDR(icl);
2031  FOREACH(ENTITY, e, oel) {
2032  if(skip_first_comma_p) {
2033  skip_first_comma_p = false;
2034  pc = gen_nconc(pc,CHAIN_SWORD(NIL, " "));
2035  }
2036  else
2037  pc = gen_nconc(pc,CHAIN_SWORD(NIL,space_p? ", " : ","));
2038  bool init_p = true;
2039  if(!ENDP(oicl)) {
2040  expression ice = EXPRESSION(CAR(oicl)); // Initialization control expression
2041  int ic = integer_constant_expression_value(ice);
2042  init_p = ic==1? true : false;
2043  POP(oicl);
2044  }
2045  pc = words_variable_or_function(module, e, false, pc, in_type_declaration,
2046  ppdl, init_p);
2047  }
2048  /* add the asm qualifier if needed */
2049  string asm_qual = strdup("");
2051  if(qualifier_asm_p(q)) {
2052  asprintf(&asm_qual,"%s __asm(%s)", asm_qual, qualifier_asm(q));
2053  }
2054  }
2055  pc = CHAIN_SWORD(pc,asm_qual);
2056  free(asm_qual);
2057  /* the final semi column,*/
2058  pc = CHAIN_SWORD(pc,";");
2059 
2060  /* the word list pc must be added to the last sentence of text r */
2061  if(ENDP(text_sentences(r))) {
2062  pips_internal_error("Unexpected empty text");
2063  }
2064  else {
2065  add_words_to_text(r, pc);
2066  }
2067 
2068  if (strstr(entity_name(e_last),TYPEDEF_PREFIX) != NULL) {
2069  *ppdl = CONS(ENTITY, e_last, *ppdl);
2070  }
2071 
2072  return r;
2073 }
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
#define POP(l)
Modify a list pointer to point on the next element of the list.
Definition: newgen_list.h:59
size_t gen_length(const list l)
Definition: list.c:150
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
list gen_last(list l)
Return the last element of a list.
Definition: list.c:578
bool gen_in_list_p(const void *vo, const list lx)
tell whether vo belongs to lx
Definition: list.c:734
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
#define list_undefined
Undefined list definition :-)
Definition: newgen_list.h:69
#define asprintf
Definition: misc-local.h:225
#define TYPEDEF_PREFIX
Definition: naming-local.h:62
#define ENUM_PREFIX
Definition: naming-local.h:60
#define TOP_LEVEL_MODULE_NAME
Module containing the global variables in Fortran and C.
Definition: naming-local.h:101
#define true
Definition: newgen_types.h:81
#define false
Definition: newgen_types.h:80
static list words_variable_or_function(entity module, entity e, bool is_first, list pc, bool in_type_declaration, list *ppdl, bool init_p)
text c_text_entities(entity module, list ldecl, int margin, list *ppdl)
Generate declarations for a list of entities belonging to the same statement declaration.
static list words_enum_reference(const char *name1, list pc, bool init_p)
Prolog to print out a struct definition, such as "struct s { int a; int b;}"; for the time being,...
static list words_enum(const char *name1, list l, bool space_p, list pc, list *ppdl)
list words_qualifiers(list obj)
Definition: declarations.c:795
static list words_union(const char *name1, list pc, bool init_p)
static list filtered_declaration_list(list del, list *pcl)
Fix the declaration list produced by the parser, which includes declared program variables but also d...
static list words_struct_reference(const char *name1, list pc, bool init_p)
To print out a struct reference, such as "struct s".
#define INDENTATION
bool static_area_p(entity aire)
Definition: area.c:77
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
list entity_qualifiers(entity e)
return the qualifiers associated to entity e if it's a variable NIL otherwise
Definition: entity.c:1394
bool entity_module_p(entity e)
Definition: entity.c:683
bool derived_entity_p(entity e)
Definition: entity.c:1048
int integer_constant_expression_value(expression e)
Definition: expression.c:1545
bool static_module_p(entity e)
Check if the given module entity is a static module.
Definition: module.c:80
bool compilation_unit_entity_p(entity e)
Check if the given module entity is a compilation unit.
Definition: module.c:87
bool place_holder_variable_p(entity)
Definition: variable.c:2069
bool declarable_type_p(type, list)
Are all types necessary to define fully type "t" listed in list "pdl"?
Definition: type.c:4361
#define type_struct(x)
Definition: ri.h:2964
#define QUALIFIER(x)
QUALIFIER.
Definition: ri.h:2106
#define type_tag(x)
Definition: ri.h:2940
#define storage_ram_p(x)
Definition: ri.h:2519
#define qualifier_asm_p(x)
Definition: ri.h:2194
#define ram_section(x)
Definition: ri.h:2249
#define type_enum(x)
Definition: ri.h:2970
#define qualifier_asm(x)
Definition: ri.h:2196
#define variable_qualifiers(x)
Definition: ri.h:3124
#define storage_ram(x)
Definition: ri.h:2521
@ is_type_varargs
Definition: ri.h:2902
@ is_type_void
Definition: ri.h:2904
@ is_type_enum
Definition: ri.h:2907
@ is_type_statement
Definition: ri.h:2898
@ is_type_functional
Definition: ri.h:2901
@ is_type_variable
Definition: ri.h:2900
@ is_type_union
Definition: ri.h:2906
@ is_type_area
Definition: ri.h:2899
@ is_type_unknown
Definition: ri.h:2903
@ is_type_struct
Definition: ri.h:2905
#define type_variable_p(x)
Definition: ri.h:2947
#define type_union(x)
Definition: ri.h:2967
static int lname(char *s, int look_for_entry)
check for keywords for subprograms return 0 if comment card, 1 if found name and put in arg string.
Definition: split_file.c:283
void add_words_to_text(text, list)
Add the word list wl to the end of the last sentence of text t.
Definition: util.c:273
#define text_sentences(x)
Definition: text.h:113

References ADD_SENTENCE_TO_TEXT, add_words_to_text(), asprintf, c_text_entities(), CAR, CDR, CHAIN_SWORD, compilation_unit_entity_p(), CONS, declarable_type_p(), derived_entity_p(), DUMMY_ENUM_PREFIX, DUMMY_STRUCT_PREFIX, DUMMY_UNION_PREFIX, ENDP, ENTITY, entity_local_name(), entity_module_p(), entity_name, entity_qualifiers(), entity_storage, entity_type, entity_undefined_p, entity_user_name(), ENUM_PREFIX, EXPRESSION, false, filtered_declaration_list(), FOREACH, free(), gen_in_list_p(), gen_last(), gen_length(), gen_nconc(), gen_once(), get_bool_property(), INDENTATION, integer_constant_expression_value(), is_sentence_unformatted, is_type_area, is_type_enum, is_type_functional, is_type_statement, is_type_struct, is_type_union, is_type_unknown, is_type_varargs, is_type_variable, is_type_void, list_undefined, lname(), MAKE_ONE_WORD_SENTENCE, make_sentence(), make_text(), make_unformatted(), MERGE_TEXTS, module, NIL, pips_assert, pips_debug, pips_internal_error, place_holder_variable_p(), POP, QUALIFIER, qualifier_asm, qualifier_asm_p, ram_section, static_area_p(), static_module_p(), storage_ram, storage_ram_p, strdup(), STRUCT_PREFIX, text_sentences, TOP_LEVEL_MODULE_NAME, true, type_enum, type_struct, type_tag, type_union, type_variable, type_variable_p, TYPEDEF_PREFIX, UNION_PREFIX, variable_qualifiers, words_enum(), words_enum_reference(), words_qualifiers(), words_struct_reference(), words_union(), and words_variable_or_function().

Referenced by c_text_entity().

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

◆ c_words_entity()

list c_words_entity ( type  t,
list  name,
list ppdl 
)
Parameters
nameame
ppdlpdl

Definition at line 1421 of file declarations.c.

1422 {
1423  list pc = generic_c_words_entity(t, name, false, false, ppdl);
1424 
1425  ifdebug(8) {
1426  string s = list_to_string(pc);
1427  pips_debug(8, "End with \"\%s\"\n", s);
1428  }
1429 
1430  return pc;
1431 }
list generic_c_words_entity(type t, list name, bool is_safe, bool add_dummy_parameter_name_p, list *ppdl)
This recursive function prints a C variable with its type.
Definition: declarations.c:980

References generic_c_words_entity(), ifdebug, list_to_string(), and pips_debug.

Referenced by ensure_comment_consistency(), generic_c_words_simplified_entity(), UpdatePointerEntity(), words_basic(), and words_parameters().

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

◆ c_words_simplified_entity()

list c_words_simplified_entity ( type  t,
list  name,
bool  is_first,
bool  in_type_declaration,
list ppdl 
)

The declaration list pointer ppdl is passed down to determine if an internal derived type must be fully expanded within another declaration or not.

If it is declared by itself, there is no need to expand its declaration again.

Parameters
nameame
is_firsts_first
in_type_declarationn_type_declaration
ppdlpdl

Definition at line 1408 of file declarations.c.

1409 {
1410  list pc = generic_c_words_simplified_entity(t, name, false, false, is_first,
1411  in_type_declaration, false, ppdl);
1412 
1413  ifdebug(8) {
1414  string s = list_to_string(pc);
1415  pips_debug(8, "End with \"\%s\"\n", s);
1416  }
1417 
1418  return pc;
1419 }
list generic_c_words_simplified_entity(type t, list name, bool is_safe, bool add_dummy_parameter_name_p, bool is_first, bool in_type_declaration, bool argument_p, list *ppdl)
Same as above, but the bool is_first is used to skip a type specifier which is useful when several va...

References generic_c_words_simplified_entity(), ifdebug, list_to_string(), and pips_debug.

Referenced by ensure_comment_consistency(), and words_variable_or_function().

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

◆ check_common_inclusion()

bool check_common_inclusion ( entity  common)

area.c

area.c

of entity

empty common!

take the first function as the reference for the check.

SAME name, type, offset

Parameters
commonommon

Definition at line 107 of file area.c.

108 {
109  bool ok = true;
110  list /* of entity */ lv, lref;
111  entity ref;
112  pips_assert("entity is a common", entity_area_p(common));
113  lv = area_layout(type_area(entity_type(common)));
114 
115  if (!lv) return true; /* empty common! */
116 
117  /* take the first function as the reference for the check. */
119  lref = common_members_of_module(common, ref, false);
120 
121  /* SAME name, type, offset */
122  while (lv && ok)
123  {
124  entity v = ENTITY(CAR(lv));
126  ok = comparable_entity_in_list_p(common, v, lref);
127  POP(lv);
128  }
129 
130  gen_free_list(lref);
131  return ok;
132 }
static reference ref
Current stmt (an integer)
Definition: adg_read_paf.c:163
static bool comparable_entity_in_list_p(entity common, entity v, list l)
Functions closely related to the entity class, constructors, predicates,...
Definition: area.c:46
bool entity_area_p(entity e)
Definition: area.c:149
list common_members_of_module(entity common, entity module, bool only_primary)
returns the list of entity to appear in the common declaration.
Definition: entity.c:1741
#define area_layout(x)
Definition: ri.h:546
#define type_area(x)
Definition: ri.h:2946
#define ram_function(x)
Definition: ri.h:2247
static bool ok

References area_layout, CAR, common_members_of_module(), comparable_entity_in_list_p(), ENTITY, entity_area_p(), entity_storage, entity_type, gen_free_list(), ok, pips_assert, POP, ram_function, ref, storage_ram, and type_area.

Referenced by text_area_included().

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

◆ close_extension()

string close_extension ( extension  e)

extension.c

Returns
a new allocated string to close the extension.
Parameters
es,theextension to be closed

Today we only generate omp parallel do pragma so the close is pretty easy. Later we will have to analyze the extension to generate the close string accordingly.

Definition at line 49 of file extension.c.

49  {
50  return close_pragma (extension_pragma(e));
51 }
string close_pragma(pragma p __attribute__((unused)))
Definition: pragma.c:53
#define extension_pragma(x)
Definition: ri.h:1295

References close_pragma(), and extension_pragma.

Referenced by close_extensions().

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

◆ close_extensions()

string close_extensions ( extensions  es,
bool  nl 
)
Returns
a new allocated string to close the extensions.
Parameters
es,theextensions to be closed
nl,setto true to get the string with a final new line character

Use a string_buffer for efficient string concatenation:

Free the buffer with its strings:

Parameters
ess
nll

Definition at line 58 of file extension.c.

58  {
59  string s = string_undefined;
60 
61  if (!empty_extensions_p (es) ) {
62  /* Use a string_buffer for efficient string concatenation: */
64 
65  list el = extensions_extension(es);
66  FOREACH(EXTENSION, e, el) {
67  s = close_extension(e);
68  if (s != string_undefined) {
70  if (nl ) string_buffer_append(sb, strdup ("\n"));
71  nl = true;
72  }
73  }
75  /* Free the buffer with its strings: */
77  }
78 
79  return s;
80 }
void string_buffer_free_all(string_buffer *)
free string buffer structure and force string freeing
Definition: string_buffer.c:94
void string_buffer_append(string_buffer, const string)
append string s (if non empty) to string buffer sb, the duplication is done if needed according to th...
string string_buffer_to_string(const string_buffer)
return malloc'ed string from string buffer sb
string_buffer string_buffer_make(bool dup)
allocate a new string buffer
Definition: string_buffer.c:58
#define string_undefined
Definition: newgen_types.h:40
string close_extension(extension e)
extension.c
Definition: extension.c:49
bool empty_extensions_p(extensions es)
Definition: extension.c:50
#define EXTENSION(x)
EXTENSION.
Definition: ri.h:1253
#define extensions_extension(x)
Definition: ri.h:1330
internally defined structure.
Definition: string_buffer.c:47
Definition: statement.c:4047

References close_extension(), empty_extensions_p(), EXTENSION, extensions_extension, FOREACH, strdup(), string_buffer_append(), string_buffer_free_all(), string_buffer_make(), string_buffer_to_string(), and string_undefined.

+ Here is the call graph for this function:

◆ close_pragma()

string close_pragma ( pragma  )

pragma.c

◆ close_prettyprint()

void close_prettyprint ( void  )

because some prettyprint functions may be used for debug, so the last hook set by somebody may have stayed there although being non sense...

Definition at line 242 of file misc.c.

242  {
244 }
text empty_text(entity __attribute__((unused)) e, int __attribute__((unused)) m, statement __attribute__((unused)) s)
Definition: misc.c:219
static text(* text_statement_hook)(entity, int, statement)
Definition: misc.c:225

References empty_text(), and text_statement_hook.

Referenced by generic_print_code_pv(), get_any_comp_regions_text(), get_continuation_condition_text(), get_semantic_text(), print_code_or_source_comp(), print_code_points_to(), print_code_static_control(), print_parallelized_code_common(), print_parallelizedCMF_code(), print_parallelizedCRAFT_code(), store_new_module(), text_code_points_to(), text_code_reductions(), and wp65().

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

◆ contrainte_text_format()

string contrainte_text_format ( string  aux_line,
string  continuation,
text  txt,
Pcontrainte  c,
bool  is_inegalite,
string(*)(Variable variable_name,
bool  a_la_fortran,
bool  first_line 
)
Parameters
aux_lineux_line
continuationontinuation
txtxt
is_inegalites_inegalite
a_la_fortran_la_fortran
first_lineirst_line

Definition at line 285 of file constraint_to_text.c.

294 {
295  Pvecteur v;
296  int heuristique = 2;
297 
298  if (!CONTRAINTE_UNDEFINED_P(c))
299  v = contrainte_vecteur(c);
300  else
301  v = VECTEUR_NUL;
302 
303  pips_assert("vector v is okay", vect_check(v));
304 
305  switch(heuristique) {
306  case 1: aux_line = contrainte_to_text_1(aux_line,continuation,txt,
307  v,is_inegalite, variable_name,
308  a_la_fortran, first_line);
309  break;
310  case 2:aux_line = contrainte_to_text_2(aux_line,continuation,txt,v,
311  is_inegalite, variable_name,
312  a_la_fortran, first_line);
313  break;
314  default: contrainte_error("contrainte_sprint", "unknown heuristics\n");
315  }
316 
317  return aux_line;
318 }
static string contrainte_to_text_2(string buffer, string continuation, text txt, Pvecteur v, bool is_inegalite, string(*variable_name)(Variable), bool a_la_fortran, bool __attribute__((unused)) first_line)
FI: does not take into account constant floating point terms.
static char * contrainte_to_text_1(string buffer, string continuation, text txt, Pvecteur v, bool is_inegalite, char *(*variable_name)(Variable), bool a_la_fortran, bool __attribute__((unused)) first_line)
#define continuation
Definition: prettyprint.c:102
#define CONTRAINTE_UNDEFINED_P(c)
#define contrainte_vecteur(c)
passage au champ vecteur d'une contrainte "a la Newgen"
void contrainte_error(char *, char *,...)
error.c
Definition: error.c:49
bool vect_check(Pvecteur cv)
bool vect_check(Pvecteur v): renvoie true si le vecteur v est coherent avec les specifications du pac...
Definition: reductions.c:529
char * variable_name(Variable v)
polynome_ri.c
Definition: polynome_ri.c:73
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.

References continuation, contrainte_error(), contrainte_to_text_1(), contrainte_to_text_2(), CONTRAINTE_UNDEFINED_P, contrainte_vecteur, pips_assert, variable_name(), vect_check(), and VECTEUR_NUL.

Referenced by contraintes_text_format(), egalite_text_format(), and inegalite_text_format().

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

◆ 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
#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_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
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 reference_domain
newgen_range_domain_defined
Definition: ri.h:338
#define basic_domain
newgen_area_domain_defined
Definition: ri.h:42
#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
static char * x
Definition: split_file.c:159
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:

◆ dump_common_layout()

void dump_common_layout ( string_buffer  result,
entity  c,
bool  debug_p,
bool  isfortran 
)

symbol_table.c

symbol_table.c

FI: a weaker test to stay independent from the syntax library and its internal static variables.

This piece of code can be used in a pass or as debugging code for library syntax.

Parameters
resultesult
debug_pebug_p
isfortransfortran

Definition at line 120 of file symbol_table.c.

124 {
126  list members = get_common_members(c, mod, false);
127  list equiv_members = NIL;
128 
129  string_buffer_append(result,
130  concatenate(NL,"Layout for ",
131  isfortran?"common /":"memory area \"",
132  entity_name(c),isfortran?"/":"\""," of size ",
134  ":",NL,NULL));
135 
136 
137  if(ENDP(members)) {
138  pips_assert("An empty area has size 0",
139  area_size(type_area(entity_type(c))) ==0);
140  string_buffer_append(result, concatenate("\t* empty area *",NL,NL,NULL));
141  }
142  else {
143  // Different preconditions for C and fortran
144 
145  if(isfortran){
146  if(area_size(type_area(entity_type(c)))==0
147  /* FI: a weaker test to stay independent from the syntax
148  * library and its internal static variables.
149  *
150  * This piece of code can be used in a pass or as debugging
151  * code for library syntax.
152  */
153  // && fortran_relevant_area_entity_p(c))
154  && !heap_area_p(c) && !stack_area_p(c))
155  {
156  if(debug_p) {
157  user_warning("dump_common_layout",
158  "Non-empty area %s should have a final size greater than 0\n",
159  entity_module_name(c));
160  }
161  else {
162  pips_internal_error("Non-empty area %s should have a size greater than 0",
163  entity_module_name(c));
164  }
165  }
166  }
167  else {
168  if(area_size(type_area(entity_type(c))) == 0)
169  {
170  if(debug_p) {
171  user_warning("dump_common_layout",
172  "Non-empty area %s should have a final size greater than 0\n",
173  entity_module_name(c));
174  }
175  }
176  }
177 
178  if(isfortran){
179  FOREACH(ENTITY, m, members) {
180  pips_assert("RAM storage",
182  if(ram_function(storage_ram(entity_storage(m)))==mod) {
183  int s;
184 
186  pips_internal_error("Variable %s declared in area %s but allocated in area %s",
189  }
190 
191  if(!SizeOfArray(m, &s)) {
194  s = -1;
195  }
196  else {
197  user_warning("print_common_layout",
198  "Varying size of array \"%s\"\n", entity_name(m));
199  pips_internal_error("Fortran standard prohibit varying size array\n");
200  }
201  }
202 
203  string_buffer_append(result,
205  ("\tVariable ",entity_name(m),"\toffset = ",
207  string_buffer_append(result,
208  concatenate("\tsize = ",i2a(s),NL,NULL));
209  }
210  }
211  }
212  else { // C language
213  FOREACH(ENTITY, m, members) {
214  if(!place_holder_variable_p(m)) {
215  pips_assert("RAM storage",
217  int s;
218 
219  SizeOfArray(m, &s);
220 
221  pips_assert("An area has no offset as -1",
223 
225  string_buffer_append(result,
226  concatenate(
227  "\tDynamic Variable \"",entity_name(m),
228  "\"\toffset = UNKNOWN, \tsize = DYNAMIC",
229  NL,NULL));
230  }
232  string_buffer_append(result,
234  ("\tExternal Variable \"", entity_name(m),
235  "\"\toffset = UNKNOWN,\tsize = ",
236  s>0?i2a(s): "unknown", NL, NULL));
237  }
238  else {
239  string_buffer_append(result,
241  ("\tVariable \"", entity_name(m),"\"\toffset = ",
243  if (get_bool_property("EXTENDED_VARIABLE_INFORMATION")) {
244  pips_debug(3, "extended information required\n");
245  type t = entity_type (m);
246  if (type_variable_p(t)) {
247  variable v = type_variable(t);
248  basic b = variable_basic(v);
249  string_buffer_append(result,
250  concatenate("\ttype = \"",
251  basic_to_string(b), "\"",
252  "\tuser name = \"",
253  entity_user_name (m), "\"",
254  NULL));
255  // check if the basic is derived or typedef to be investigated
256  string deeper = check_derived_and_typedef (b, 2, entity_user_name (m));
257  if (strcmp (deeper, "") != 0) {
258  string_buffer_append (result, NL);
259  string_buffer_append (result, deeper);
260  }
261  else free (deeper);
262  }
263  }
264  string_buffer_append(result,
265  concatenate("\tsize = ",i2a(s),NL,NULL));
266  }
267  }
268  }
269  }
270 
271  string_buffer_append(result, NL);
272 
273  FOREACH(ENTITY, m, members) {
275 
276  equiv_members = arguments_union(equiv_members, equiv);
277  }
278 
279  if(!ENDP(equiv_members)){
280  equiv_members = arguments_difference(equiv_members, members);
281  if(!ENDP(equiv_members)) {
282  sort_list_of_entities(equiv_members);
283 
284  string_buffer_append(result, concatenate("\tVariables aliased to this common:",NL,
285  NULL));
286 
287  FOREACH(ENTITY, m, equiv_members) {
288  pips_assert("RAM storage",
290  string_buffer_append(result,
292  ("\tVariable", entity_name(m) ,"\toffset =",
293  ram_offset(storage_ram(entity_storage(m))),"\tsize = ",
294  array_size(m),NL,NULL));
295  }
296  string_buffer_append(result, concatenate(NL,NULL));
297  gen_free_list(equiv_members);
298  }
299  }
300  }
301  gen_free_list(members);
302 }
cons * arguments_union(cons *a1, cons *a2)
cons * arguments_union(cons * a1, cons * a2): returns a = union(a1, a2) where a1 and a2 are lists of ...
Definition: arguments.c:116
cons * arguments_difference(cons *a1, cons *a2)
set difference: a1 - a2 ; similar to set intersection
Definition: arguments.c:233
entity HeapArea
Definition: area.c:59
entity StackArea
Definition: area.c:60
static int array_size(dim)
ARRAY_SIZE returns the number of elements in the array whose dimension list is DIM.
Definition: genClib.c:155
#define user_warning(fn,...)
Definition: misc-local.h:262
char * i2a(int)
I2A (Integer TO Ascii) yields a string for a given Integer.
Definition: string.c:121
#define DYNAMIC_RAM_OFFSET
FI: I would have assumed that it is used for the stack area, but I must be wrong.....
#define UNDEFINED_RAM_OFFSET
bool stack_area_p(entity aire)
Definition: area.c:104
bool heap_area_p(entity aire)
Definition: area.c:86
list get_common_members(entity common, entity __attribute__((unused)) module, bool __attribute__((unused)) only_primary)
The fprint_functional() and fprint_environment() functions are moved from syntax/declaration....
Definition: declarations.c:106
void sort_list_of_entities(list l)
sorted in place.
Definition: entity.c:1358
bool SizeOfArray(entity, int *)
This function computes the total size of a variable in bytes, ie.
Definition: size.c:87
#define area_size(x)
Definition: ri.h:544
#define ram_shared(x)
Definition: ri.h:2253
#define ram_offset(x)
Definition: ri.h:2251
#define NL
Definition: symbol_table.c:42
static string check_derived_and_typedef(basic b, int indent, const char *parent)
Definition: symbol_table.c:93

References area_size, arguments_difference(), arguments_union(), array_size(), basic_to_string(), check_derived_and_typedef(), concatenate(), DYNAMIC_RAM_OFFSET, ENDP, ENTITY, entity_local_name(), entity_module_name(), entity_name, entity_storage, entity_type, entity_user_name(), FOREACH, free(), gen_free_list(), get_bool_property(), get_common_members(), get_current_module_entity(), heap_area_p(), HeapArea, i2a(), NIL, NL, pips_assert, pips_debug, pips_internal_error, place_holder_variable_p(), ram_function, ram_offset, ram_section, ram_shared, SizeOfArray(), sort_list_of_entities(), stack_area_p(), StackArea, storage_ram, storage_ram_p, string_buffer_append(), type_area, type_variable, type_variable_p, UNDEFINED_RAM_OFFSET, user_warning, and variable_basic.

Referenced by get_symbol_table().

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

◆ dump_control_to_label_name()

void dump_control_to_label_name ( hash_table  h)

Definition at line 500 of file unstructured.c.

501 {
502  int i = 0;
503 
504  fprintf(stderr,"[dump_control_to_label_name] Begin\n");
505  HASH_MAP(c,l,{
506  fprintf(stderr, "Label %s -> %s", (char *) l,
508  i++;
509  }, h);
510  fprintf(stderr,"[dump_control_to_label_name] %d labels, end\n", i);
511 }
string statement_identification(statement)
Like external_statement_identification(), but with internal information, the hexadecimal address of t...
Definition: statement.c:1700
#define HASH_MAP(k, v, code, ht)
Definition: newgen_hash.h:60
#define control_statement(x)
Definition: ri.h:941

References control_statement, fprintf(), HASH_MAP, and statement_identification().

Referenced by text_unstructured().

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

◆ dump_trail()

void dump_trail ( list  trail)
Parameters
trailrail

Definition at line 263 of file unstructured.c.

264 {
265  if(ENDP(trail)) {
266  fprintf(stderr, "[dump_trail] trail is empty\n");
267  }
268  else {
269  fprintf(stderr, "[dump_trail] begin\n");
270  MAPL(cc, {
272  fprintf(stderr, "[dump_trail] %s", statement_identification(s));
273  }, trail);
274  fprintf(stderr, "[dump_trail] end\n");
275  }
276 }
#define MAPL(_map_list_cp, _code, _l)
Apply some code on the addresses of all the elements of a list.
Definition: newgen_list.h:203
#define CONTROL(x)
CONTROL.
Definition: ri.h:910

References CAR, CONTROL, control_statement, ENDP, fprintf(), MAPL, and statement_identification().

Referenced by c_unstructured(), and text_unstructured().

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

◆ egalite_debug()

void egalite_debug ( Pcontrainte  c)

Definition at line 58 of file constraint_to_text.c.

59 {
61 }
void egalite_fprint(FILE *, Pcontrainte, char *(*)(Variable))
char *(* get_variable_name_t)(Variable)
Definition: vecteur-local.h:62

References egalite_fprint(), and entity_local_name().

Referenced by sc_projection_optim_along_vecteur_ofl().

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

◆ egalite_text_format()

string egalite_text_format ( string  aux_line,
string  continuation,
text  txt,
Pcontrainte  eg,
string(*)(Variable variable_name,
bool  a_la_fortran,
bool  first_line 
)
Parameters
aux_lineux_line
continuationontinuation
txtxt
egg
a_la_fortran_la_fortran
first_lineirst_line

Definition at line 321 of file constraint_to_text.c.

329 {
330  return contrainte_text_format(aux_line,continuation,txt,eg, false,
331  variable_name,a_la_fortran,first_line);
332 }
string contrainte_text_format(string aux_line, string continuation, text txt, Pcontrainte c, bool is_inegalite, string(*variable_name)(Variable), bool a_la_fortran, bool first_line)

References continuation, contrainte_text_format(), and variable_name().

+ Here is the call graph for this function:

◆ empty_text()

text empty_text ( entity  ,
int  ,
statement   
)

◆ entity_list_text_format()

void entity_list_text_format ( string  ,
string  ,
text  ,
list  ,
const char *  *)(entity 
)

◆ eole_fma_specific_op()

list eole_fma_specific_op ( call  obj,
int  precedence,
bool  leftmost,
list ppdl 
)

EOLE : The multiply-add operator is used within the optimize transformation ( JZ - sept 98) - fma(a,b,c) -> ((a*b)+c)

of string

Parameters
objbj
precedencerecedence
leftmosteftmost
ppdlpdl

Definition at line 2049 of file misc.c.

2050 {
2051  return eole_fmx_specific_op(obj, precedence, leftmost, true, ppdl);
2052 }
static list eole_fmx_specific_op(call obj, int __attribute__((unused)) precedence, bool __attribute__((unused)) leftmost, bool isadd, list *ppdl)
Definition: misc.c:1996

References eole_fmx_specific_op().

+ Here is the call graph for this function:

◆ eole_fms_specific_op()

list eole_fms_specific_op ( call  obj,
int  precedence,
bool  leftmost,
list ppdl 
)

MULTIPLY-SUB operator.

of string

Parameters
objbj
precedencerecedence
leftmosteftmost
ppdlpdl

Definition at line 2056 of file misc.c.

2057 {
2058  return eole_fmx_specific_op(obj, precedence, leftmost, false, ppdl);
2059 }

References eole_fmx_specific_op().

+ Here is the call graph for this function:

◆ expand_expression()

expression expand_expression ( expression  ,
entity  ,
range   
)

◆ expand_reference()

expression expand_reference ( syntax  s,
expression  e,
entity  i,
range  r 
)

A reference cannot always be expanded.

Subscript expression coupling as in A(I,I) prevent expansion and an undefined expression is returned. Non-affine expressions such as A(I**2) cannot be transformed into triplets but can be tranformed into implicit DO vectors.

Arguments s, e, i and r should not be shared with the returned expression.

expand occurence of loop index

expand 1 subscript expression or fail or leave unexpanded

If dim is greater than 1, subscript expressions are coupled as in A(I,I+1).

new_args should be freed

Just the spine or more?

Definition at line 225 of file fortran90.c.

226 {
227  reference rf = syntax_reference(s) ;
229 
230  if( same_entity_p( reference_variable( rf ), i )) {
231  /* expand occurence of loop index */
233  new_e = make_expression(new_s, normalized_undefined) ;
234  set_add_element( vectors, vectors, (char *) new_e ) ;
235  }
236  else {
237  /* expand 1 subscript expression or fail or leave unexpanded */
238  int dim = 0 ;
239  cons *new_args = NIL ;
240  reference new_r ;
241 
242  MAPL( args, {
243  expression arg = EXPRESSION( CAR( args )) ;
244 
245  new_e = expand_expression( arg, i, r ) ;
246 
247  if(expression_undefined_p(new_e))
248  return new_e;
249 
250  if(set_belong_p( vectors, (char *)new_e ))
251  dim++;
252 
253  new_args = CONS(EXPRESSION, new_e, new_args ) ;
254  }, reference_indices( rf )) ;
255 
256  if( dim==1 ) {
258  gen_nreverse(new_args)) ;
261  set_add_element( vectors, vectors, (char *)new_e ) ;
262  }
263  else if(dim > 1) {
264  /* If dim is greater than 1, subscript expressions are coupled
265  * as in A(I,I+1).
266  */
267  /* new_args should be freed */
268  new_e = expression_undefined;
269  }
270  else {
271  /* Just the spine or more? */
272  gen_free_list(new_args);
273  new_e = copy_expression(e);
274  }
275  }
276  return new_e;
277 }
range copy_range(range p)
RANGE.
Definition: ri.c:2005
expression make_expression(syntax a1, normalized a2)
Definition: ri.c:886
reference make_reference(entity a1, list a2)
Definition: ri.c:2083
syntax make_syntax(enum syntax_utype tag, void *val)
Definition: ri.c:2491
list gen_nreverse(list cp)
reverse a list in place
Definition: list.c:304
bool set_belong_p(const set, const void *)
Definition: set.c:194
set set_add_element(set, const set, const void *)
Definition: set.c:152
expression expand_expression(e, i, r)
Expression with a non-expandable sub-expression, e.g.
Definition: fortran90.c:286
static set vectors
Prettyprint one FORTRAN 90 loop as an array expression.
Definition: fortran90.c:56
bool same_entity_p(entity e1, entity e2)
predicates on entities
Definition: entity.c:1321
#define normalized_undefined
Definition: ri.h:1745
#define syntax_reference(x)
Definition: ri.h:2730
#define reference_variable(x)
Definition: ri.h:2326
@ is_syntax_range
Definition: ri.h:2692
@ is_syntax_reference
Definition: ri.h:2691
#define expression_undefined
Definition: ri.h:1223
#define reference_indices(x)
Definition: ri.h:2328

References CAR, CONS, copy_expression(), copy_range(), expand_expression(), EXPRESSION, expression_undefined, expression_undefined_p, gen_free_list(), gen_nreverse(), is_syntax_range, is_syntax_reference, make_expression(), make_reference(), make_syntax(), MAPL, NIL, normalized_undefined, reference_indices, reference_variable, same_entity_p(), set_add_element(), set_belong_p(), syntax_reference, and vectors.

Referenced by expand_expression().

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

◆ expression_to_string()

string expression_to_string ( expression  e)

Definition at line 77 of file expression.c.

77  {
78  list pdl = NIL;
79  list l = words_expression(e, &pdl) ;
80  string out = words_to_string(l);
81  FOREACH(STRING,w,l) free(w);
82  gen_free_list(l);
83  gen_free_list(pdl);
84  return out;
85 }
string words_to_string(cons *lw)
Definition: print.c:211

References FOREACH, free(), gen_free_list(), NIL, out, STRING, words_expression(), and words_to_string().

Referenced by adg_get_conjonctions(), any_assign_operation_to_transformer(), any_basic_update_to_transformer(), any_expression_to_transformer(), any_scalar_assign_to_transformer_list(), any_scalar_assign_to_transformer_without_effect(), any_update_to_transformer(), atomize_or_associate_for_level(), atomizer_of_array_indices(), atomizer_of_expression(), atomizer_of_intrinsic(), build_third_comb(), c_brace_expression_string(), c_convex_effects_on_formal_parameter_backward_translation(), c_dim_string(), cell_reference_compare(), comp_regions_of_instruction(), consecutive_expression_p(), constraint_to_bound(), copy_n_reference(), do_atomize_if_different_level(), edge_cost_polynome(), equal_condition_to_points_to(), equal_must_vreference(), expression_to_post_pv(), expressions_to_predicate(), fprint_bdt(), fprint_bdt_with_stat(), fprint_plc(), freed_pointer_to_points_to(), freia_is_transpose_call(), get_bounds_expression(), have_null_value_in_pointer_expression_p(), have_sizeof_value_in_multiply_pointer_expression_p(), imprime_quast(), internal_pointer_assignment_to_points_to(), interprocedural_abc_arrays(), intrinsic_call_to_points_to(), is_param_dynamic(), loop_annotate(), make_available_scalar(), make_bottom_up_abc_tests(), make_bounds(), make_expression_equalities(), make_interprocedural_abc_tests(), make_reindex(), MakeCaseStatement(), malloc_arg_to_type(), malloc_to_abstract_location(), mppa_compile_dag(), mppa_helper_args_params(), my_adg_expressions_to_predicate(), ndf_normalized_test(), nlc_linear_expression_p(), non_equal_condition_to_points_to(), normal_expression_of_expression(), normalize_test_leaves(), opkill_may_vreference(), opkill_must_vreference(), perform_array_element_substitutions_in_transformer(), perform_substitution_in_expression(), plc_make_distance(), pointer_binary_operation_to_transformer(), points_to_compare_cell(), points_to_compare_cells(), points_to_compare_location(), points_to_compare_ptr_cell(), points_to_unary_operation_to_transformer(), predicate_to_expression(), prepare_array_bounds(), print_list_of_expressions(), psystem_to_expression(), rational_op_exp(), remove_minmax(), sa_print_ins(), sc_conditional(), sc_delimiter(), semantics_usable_points_to_reference_p(), set_entity_initial(), side_effects_p(), sigmac_params_decl(), sp_feautrier_expression_p(), sp_linear_expression_p(), splc_feautrier_expression_p(), splc_linear_expression_p(), splc_positive_relation_p(), st_brace_expression_as_string(), st_declaration_init(), this_entity_cdeclaration(), translate_IO_ref(), vect_to_string(), words_points_to_reference(), xml_Argument(), xml_Array(), xml_AssignArgument(), xml_Bounds(), xml_Bounds_and_Stride(), xml_Call(), xml_Chain_Graph(), xml_loop(), and xml_Pattern_Paving().

+ Here is the call graph for this function:

◆ extension_to_string()

string extension_to_string ( extension  e)
Returns
a new allocated string with the extension textual representation.

to be added later when extension can be something else than pragma switch (extension_tag(e)) { case is_extension_pragma:

default: pips_internal_error("Unknown extension type"); }

Definition at line 86 of file extension.c.

86  {
87  string s;
88  /* to be added later when extension can be something else than pragma
89  switch (extension_tag(e)) {
90  case is_extension_pragma:
91  */
93  /* default:
94  pips_internal_error("Unknown extension type");
95  }*/
96  return s;
97 }

References extension_pragma, and pragma_to_string().

Referenced by extensions_to_string().

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

◆ extensions_to_string()

string extensions_to_string ( extensions  es,
bool  nl 
)

return a new allocated string with the string representation of the extensions.

Basically you'll get one extension per line

Assume that all the extension from the extensions (note the presence or not of the "s"...) are defined below.

Returns
string_undefined if es is extension_undefined, an malloc()ed textual string either.
Parameters
es,theextensions to translate to strings
nl,setto true to get the string with a final new line character

Prettyprint in the correct language:

Use a string_buffer for efficient string concatenation:

Free the buffer with its strings:

Parameters
ess
nll

Definition at line 111 of file extension.c.

111  {
112  string s = string_undefined;
113 
114  /* Prettyprint in the correct language: */
115 // set_prettyprint_language_from_property ();
116 
117  if (!empty_extensions_p (es) ) {
118  /* Use a string_buffer for efficient string concatenation: */
120 
121  list el = extensions_extension(es);
122  FOREACH(EXTENSION, e, el) {
123  s = extension_to_string(e);
125  if (nl ) string_buffer_append(sb, strdup ("\n"));
126  nl = true;
127  }
129  /* Free the buffer with its strings: */
131  }
132 
133  return s;
134 }
string extension_to_string(extension e)
Definition: extension.c:86

References empty_extensions_p(), EXTENSION, extension_to_string(), extensions_extension, FOREACH, strdup(), string_buffer_append(), string_buffer_free_all(), string_buffer_make(), string_buffer_to_string(), and string_undefined.

Referenced by loop_pragma().

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

◆ find_last_statement()

statement find_last_statement ( statement  )

Referenced by ensure_comment_consistency().

+ Here is the caller graph for this function:

◆ find_or_create_allocatable_struct()

entity find_or_create_allocatable_struct ( basic  b,
string  name,
int  ndim 
)

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

Modify src/Libs/prettyprint/prettyprint-local.h instead, to add your own modifications. header file built by cproto prettyprint-local.h cproto-generated files allocatable.c

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

Parameters
nameis the name of the array (prettyprint name)
Parameters
nameame
ndimdim

Definition at line 97 of file allocatable.c.

97  {
98  // FI: scaffolding code is not even guarded...
99  printf("Creating allocatable struct for dim %d\n", ndim);
100 
101  // Create the entity name according to the number of dims
102  string struct_name;
103  string b_str = STRING(CAR(words_basic(b,NULL)));
104  pips_assert("asprintf !",
105  asprintf( &struct_name, ALLOCATABLE_PREFIX"%s_%s_%dD", name, b_str,ndim));
106 
107  // Here is the internal PIPS name, there is a prefix for struct
108  string prefixed_name = strdup(concatenate(STRUCT_PREFIX, struct_name, NULL));
109 
110  // Let's try to localize the structure
111  entity struct_entity = FindEntity(TOP_LEVEL_MODULE_NAME, prefixed_name);
112 
113  // Localization failed, let's create it
114  if(struct_entity == entity_undefined) {
115  list fields = NULL;
116  list dimensions = NULL;
117  for (int dim = ndim; dim >= 1; dim--) {
118  entity lower = make_bound(struct_name, ALLOCATABLE_LBOUND_PREFIX, dim);
119  entity upper = make_bound(struct_name, ALLOCATABLE_UBOUND_PREFIX, dim);
120 
121  // Field for struct
122  fields = CONS(ENTITY,lower,fields);
123  fields = CONS(ENTITY,upper,fields);
124 
125  // Dimensions for the data array
127  entity_to_expression(upper),
128  NIL);
129  dimensions = CONS(DIMENSION,d,dimensions );
130  }
131 
132  // Create data holder
133  fields
134  = CONS(ENTITY,make_data_field(b, struct_name, name, dimensions),fields);
135 
136  // Create the struct
137  string field;
138  asprintf(&field,STRUCT_PREFIX "%s",struct_name);
139  struct_entity = FindOrCreateTopLevelEntity(field);
140  free(field);
141  entity_type(struct_entity) = make_type_struct(fields);
142  entity_storage(struct_entity) = make_storage_rom();
143  entity_initial(struct_entity) = make_value_unknown();
144  }
145 
146  free(prefixed_name);
147  free(struct_name);
148 
149  return struct_entity;
150 }
value make_value_unknown(void)
Definition: ri.c:2847
storage make_storage_rom(void)
Definition: ri.c:2285
type make_type_struct(list _field_)
Definition: ri.c:2730
dimension make_dimension(expression a1, expression a2, list a3)
Definition: ri.c:565
static entity make_data_field(basic b, const char *struct_name, const char *name, list dimensions)
Helper for creating an allocatable structure.
Definition: allocatable.c:45
static entity make_bound(const char *struct_name, const char *lname, int suffix)
Definition: allocatable.c:65
#define ALLOCATABLE_UBOUND_PREFIX
#define ALLOCATABLE_PREFIX
#define ALLOCATABLE_LBOUND_PREFIX
entity FindEntity(const char *package, const char *name)
Retrieve an entity from its package/module name and its local name.
Definition: entity.c:1503
entity FindOrCreateTopLevelEntity(const char *name)
Return a top-level entity.
Definition: entity.c:1603
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
Definition: expression.c:165
#define entity_undefined
Definition: ri.h:2761
int printf()

References ALLOCATABLE_LBOUND_PREFIX, ALLOCATABLE_PREFIX, ALLOCATABLE_UBOUND_PREFIX, asprintf, CAR, concatenate(), CONS, DIMENSION, ENTITY, entity_initial, entity_storage, entity_to_expression(), entity_type, entity_undefined, FindEntity(), FindOrCreateTopLevelEntity(), free(), make_bound(), make_data_field(), make_dimension(), make_storage_rom(), make_type_struct(), make_value_unknown(), NIL, pips_assert, printf(), strdup(), STRING, STRUCT_PREFIX, TOP_LEVEL_MODULE_NAME, and words_basic().

Referenced by gfc2pips_getbasic(), and gfc2pips_symbol2entity().

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

◆ find_statements_interactively()

list find_statements_interactively ( statement  s)

prompt the user to select contiguous statement in s

Parameters
sstatement to search into
Returns
list of selected statement

Definition at line 258 of file statement.c.

259 {
260  list l =NIL;
262  return gen_nreverse(l);
263 }
#define gen_context_recurse(start, ctxt, domain_number, flt, rwt)
Definition: genC.h:285
void gen_null2(__attribute__((unused)) void *u1, __attribute__((unused)) void *u2)
idem with 2 args, to please overpeaky compiler checks
Definition: genClib.c:2758
static bool find_statements_interactively_walker(statement s, list *l)
Definition: statement.c:218

References find_statements_interactively_walker(), gen_context_recurse, gen_nreverse(), gen_null2(), NIL, and statement_domain.

Referenced by outline().

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

◆ fprint_expression()

void fprint_expression ( FILE *  f,
expression  e 
)

expression.c

Definition at line 47 of file expression.c.

48 {
49  list pdl = NIL;
51  gen_free_list(pdl);
52 }
list words_syntax(syntax obj, list *ppdl)
exported for expression.c
Definition: misc.c:2623
void print_words(FILE *fd, cons *lw)
Definition: print.c:263

References expression_syntax, f(), gen_free_list(), NIL, print_words(), and words_syntax().

+ Here is the call graph for this function:

◆ fprint_list_of_exp()

void fprint_list_of_exp ( FILE *  fp,
list  exp_l 
)

void fprint_list_of_exp(FILE *fp, list exp_l): prints in the file "fp" the list of expression "exp_l".

We separate the expressions with a colon (","). We do not end the print with a line feed.

Parameters
fpp
exp_lxp_l

Definition at line 229 of file expression.c.

230 {
231  list aux_l;
232  expression exp;
233  list pdl = NIL;
234 
235  for(aux_l = exp_l; aux_l != NIL; aux_l = CDR(aux_l))
236  {
237  exp = EXPRESSION(CAR(aux_l));
238  fprintf(fp,"%s", words_to_string(words_expression(exp, &pdl)));
239  if(CDR(aux_l) != NIL)
240  fprintf(fp,",");
241  }
242  gen_free_list(pdl);
243 }
#define exp
Avoid some warnings from "gcc -Wshadow".
Definition: vasnprintf.c:207

References CAR, CDR, exp, EXPRESSION, fprintf(), gen_free_list(), NIL, words_expression(), and words_to_string().

Referenced by analyze_quast(), build_first_comb(), build_new_ref(), calculate_delay(), compatible_pc_p(), fprint_call(), fprint_dataflow(), fprint_loop(), get_unsatisfied_system(), include_trans_on_LC_in_ref(), list_of_exp_equals_1n_p(), make_causal_external(), make_causal_internal(), make_reindex(), printf_loop(), search_scc_bdt(), and simplify_dimension().

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

◆ fprint_reference()

void fprint_reference ( FILE *  fd,
reference  r 
)
Parameters
fdd

Definition at line 128 of file expression.c.

129 {
130  if(reference_undefined_p(r))
131  fprintf(fd, "reference undefined\n");
132  // For debugging with gdb, dynamic type checking
134  fprintf(fd, "Not a Newgen \"reference\" object\n");
135  else {
136  list pdl = NIL;
137  print_words(fd,words_reference(r, &pdl));
138  gen_free_list(pdl);
139  }
140 }
list words_reference(reference obj, list *ppdl)
Definition: misc.c:781
#define reference_undefined_p(x)
Definition: ri.h:2303
#define reference_domain_number(x)
Definition: ri.h:2324

References fprintf(), gen_free_list(), NIL, print_words(), reference_domain, reference_domain_number, reference_undefined_p, and words_reference().

Referenced by fprint_wp65_hash_tables(), and print_reference().

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

◆ fprint_statement()

void fprint_statement ( FILE *  fd,
statement  s 
)

Print statement "s" on file descriptor "fd".

Print the statement according to the current PRETTYPRINT_LANGUAGE property

See text_named_module() for improvements.

Parameters
fdd

Definition at line 68 of file statement.c.

69 {
71  fprintf(fd, "Undefined statement\n");
72  // For debugging with gdb, dynamic type checking
74  (void) fprintf(fd,"Arg. \"s\"is not a statement.\n");
75  else {
76  debug_on("TEXT_DEBUG_LEVEL");
80  list pdl = NIL;
81  text txt = text_statement(entity_undefined, 0, s, &pdl);
82  gen_free_list(pdl);
83  print_text(fd, txt);
84  free_text(txt);
87  debug_off();
88  }
89 }
void free_text(text p)
Definition: text.c:74
void push_current_module_statement(statement)
Set the statement of the current module and push the statement of the previous one on a stack.
Definition: static.c:180
void pop_current_module_statement(void)
Pop the current module statement stack and use it as the current module statement.
Definition: static.c:194
void set_alternate_return_set()
Definition: misc.c:795
void reset_alternate_return_set()
Definition: misc.c:804
text text_statement(entity, int, statement, list *)
void reset_label_counter()
Definition: entity.c:322
#define statement_domain_number(x)
Definition: ri.h:2448
#define statement_undefined_p(x)
Definition: ri.h:2420

References debug_off, debug_on, entity_undefined, fprintf(), free_text(), gen_free_list(), NIL, pop_current_module_statement(), print_text(), push_current_module_statement(), reset_alternate_return_set(), reset_label_counter(), set_alternate_return_set(), statement_domain, statement_domain_number, statement_undefined_p, and text_statement().

Referenced by initialize_array_variable(), initialize_scalar_variable(), insert_check_alias_before_statement(), insert_flag_before_call_site(), insert_test_before_caller(), insert_test_before_statement(), print_statement(), and step_compile_generated_module().

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

◆ gcc_if_block_braces_required_p()

bool gcc_if_block_braces_required_p ( test  obj)
Parameters
objbj

Definition at line 336 of file misc.c.

337 {
338  statement tb = effective_test_true(obj);
339 
340  if(one_liner_p(tb)) {
341  if (statement_test_p(tb)) {
342  test nested_test = statement_test(tb);
343  statement fb = test_false(nested_test);
344  if (!empty_statement_p(fb)) {
346  }
347  }
348  }
349  return false;
350 }
statement effective_test_true(test)
returns the effective true branch of a test by skipping a possible sequence of one element.
Definition: statement.c:1358
test statement_test(statement)
Get the test of a statement.
Definition: statement.c:1348
bool statement_test_p(statement)
Definition: statement.c:343
bool empty_statement_p(statement)
Test if a statement is empty.
Definition: statement.c:391
bool one_liner_p(statement s)
True is statement "s" can be printed out without enclosing braces when it is the true branch of a tes...
Definition: misc.c:301
static bool prettyprint_gcc_c_braces_p
This variable is used to gracefuly print braces around if / else blocks to avoid gcc warnings.
Definition: misc.c:200
#define test_false(x)
Definition: ri.h:2837

References effective_test_true(), empty_statement_p(), one_liner_p(), prettyprint_gcc_c_braces_p, statement_test(), statement_test_p(), and test_false.

Referenced by text_block_ifthen().

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

◆ generate_alternate_return_targets()

text generate_alternate_return_targets ( void  )

Definition at line 824 of file misc.c.

825 {
826  text ral = text_undefined;
827 
829  list sl = NIL;
832  string str_continue = string_undefined;
833  switch (get_prettyprint_language_tag()) {
835  case is_language_fortran:
836  str_continue = CONTINUE_FUNCTION_NAME;
837  break;
838  case is_language_c:
839  str_continue = C_CONTINUE_FUNCTION_NAME;
840  break;
841  default:
842  pips_internal_error("Language unknown !");
843  break;
844  }
845  unformatted u1 =
848  0,
849  CONS(STRING, strdup(str_continue), NIL));
851  sl = gen_nconc(sl, CONS(SENTENCE, s1, NIL));
852  }
853  ral = make_text(sl);
854  }
855  else {
856  ral = make_text(NIL);
857  }
858  return ral;
859 }
enum language_utype get_prettyprint_language_tag()
Definition: language.c:67
#define C_CONTINUE_FUNCTION_NAME
#define STATEMENT_NUMBER_UNDEFINED
default values
#define CONTINUE_FUNCTION_NAME
const char * label_local_name(entity e)
END_EOLE.
Definition: entity.c:604
@ is_language_fortran
Definition: ri.h:1566
@ is_language_fortran95
Definition: ri.h:1568
s1
Definition: set.c:247
#define SENTENCE(x)
newgen_unformatted_domain_defined
Definition: text.h:36

References C_CONTINUE_FUNCTION_NAME, CONS, CONTINUE_FUNCTION_NAME, ENDP, FOREACH, gen_nconc(), get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, is_sentence_unformatted, label_local_name(), make_sentence(), make_text(), make_unformatted(), NIL, pips_internal_error, s1, SENTENCE, sentence_undefined, set_of_labels_required_for_alternate_returns, STATEMENT_NUMBER_UNDEFINED, strdup(), STRING, string_undefined, and text_undefined.

Referenced by ensure_comment_consistency().

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

◆ generic_c_words_entity()

list generic_c_words_entity ( type  t,
list  name,
bool  is_safe,
bool  add_dummy_parameter_name_p,
list ppdl 
)

This recursive function prints a C variable with its type.

It can be a simple variable declaration such as "int a" or complicated one such as "int (* forces[10])()" (an array of 10 pointers, each pointer points to a function with no parameter and the return type is int).

Type "t" is recursively traversed and the obtained attribute are accumulated in the list "name" (name of the type, not name of the variable).

Purpose of "is_safe"? Seems to be passed down recursively but never to be used...

In C, functional type can be decorated by optional dummy parameter names.

Parameters
nameame
is_safes_safe
add_dummy_parameter_name_pdd_dummy_parameter_name_p
ppdlpdl

Definition at line 980 of file declarations.c.

981 {
982 // If this function is still used, NIL should be replaced by the
983 // module declaration list
984  return generic_c_words_simplified_entity(t, name, is_safe,
985  add_dummy_parameter_name_p,
986  true, false, false, ppdl);
987 }

References generic_c_words_simplified_entity().

Referenced by c_words_entity(), safe_c_words_entity(), and stub_text().

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

◆ generic_c_words_simplified_entity()

list generic_c_words_simplified_entity ( type  t,
list  name,
bool  is_safe,
bool  add_dummy_parameter_name_p,
bool  is_first,
bool  in_type_declaration,
bool  argument_p,
list ppdl 
)

Same as above, but the bool is_first is used to skip a type specifier which is useful when several variables or types are defined in a unique statement such as "int i, *pi, ai[10],...;".

type t: new type to add in front of the word list name

list name: later part of the declaration being built

bool is_safe: does not seem to be used anymore

bool add_dummy_parameter_name_p: for function declarations, add a dummy parameter name to the type of each formal parameter

bool is_first: prettyprint the qualifiers or not; they should be printed only once when they apply to several declarations as in:

"register int i, j;"

in_type_declaration is set to true when a variable is declared at the same time as its type

argument_p: the type is used as argument type in a function declaration

list ppdl: pointer to the declaration list to decide if data structures appearing in another data structure must be declared independently or not. See validation cases struct03.c, struct04.c and struct05.c.

Function name is an expression like *vfs[] in (*vfs[])() (syntax = application), or an abstract function type, so parentheses must be added

Function name is a simple reference

RK wants us to use another better function than i2a, but its name is not documented next to i2a() source code and here the string is going to be strduped, which makes i2a() a better choice.

ips_debug(3,"Parameter type %s\n ", type_undefined_p(t1)? "type_undefined" : words_to_string(words_type(t1, ppdl, true)));

c_words_entity(t1,NIL) should be replaced by c_words_entity(t1,name_of_corresponding_parameter)

Add type qualifiers if there are

FI: left out of the previous declaration internal representation

&& !qualifiers_p

Array name is an expression like __ctype+1 in (__ctype+1)[*np] (syntax = subscript), or abstract type, parentheses must be added

Array name is a simple reference

The derived type has been declared explicitly elsewhere: see struct05.c

The derived type is declared by itself

Do not recurse down if the derived type reference itself

A place holder variable has no name and require no space

This section is derived from c_text_entity()

it is used for structures, unions and enums which have no names because they are part of a more global declaration such as typedef s

FI: The union and the struct cases could be merged.

Parameters
nameame
is_safes_safe
add_dummy_parameter_name_pdd_dummy_parameter_name_p
is_firsts_first
in_type_declarationn_type_declaration
argument_prgument_p
ppdlpdl

Definition at line 1017 of file declarations.c.

1018 {
1019  list pc = NIL;
1020  bool space_p = get_bool_property("PRETTYPRINT_LISTS_WITH_SPACES");
1021 
1022  if(type_undefined_p(t)) {
1023  pc = CHAIN_SWORD(NIL, "type_undefined");
1024  pc = gen_nconc(pc,name);
1025  return pc;
1026  }
1027 
1028  if (type_functional_p(t))
1029  {
1031  type t2 = functional_result(f);
1033  list cparam = list_undefined;
1034  bool first = true;
1035  int pnum;
1036 
1037  pips_debug(9,"Function type with name = \"%s\" and length %zd\n",
1038  list_to_string(name), gen_length(name));
1039 
1040  if ((gen_length(name) > 1)
1041  || ((gen_length(name) == 1) && (strcmp(STRING(CAR(name)),"*")==0)))
1042  {
1043  /* Function name is an expression like *vfs[] in (*vfs[])()
1044  (syntax = application), or an abstract function type, so
1045  parentheses must be added */
1046  pc = CHAIN_SWORD(NIL,"(");
1047  pc = gen_nconc(pc,name);
1048  pc = CHAIN_SWORD(pc,")(");
1049 
1050  }
1051  else
1052  {
1053  /* Function name is a simple reference */
1054  pc = CHAIN_SWORD(name,"(");
1055  }
1056 
1058  for(cparam = lparams, pnum = 1; !ENDP(cparam); POP(cparam), pnum++) {
1059  parameter p = PARAMETER(CAR(cparam));
1060  type t1 = parameter_type(p);
1061  string pn = dummy_unknown_p(parameter_dummy(p))?
1064 
1065  if(add_dummy_parameter_name_p
1066  && string_undefined_p(pn)
1067  && !type_varargs_p(t1)
1068  && !type_void_p(t1)) {
1069  /* RK wants us to use another better function than i2a, but
1070  its name is not documented next to i2a() source code and
1071  here the string is going to be strduped, which makes
1072  i2a() a better choice. */
1073  pn = concatenate("f", i2a(pnum), NULL);
1074  }
1075 
1076  /*pips_debug(3,"Parameter type %s\n ",
1077  type_undefined_p(t1)? "type_undefined" :
1078  words_to_string(words_type(t1, ppdl, true))); */
1079  if (!first)
1080  pc = gen_nconc(pc,CHAIN_SWORD(NIL, space_p? ", " : ","));
1081  /* c_words_entity(t1,NIL) should be replaced by c_words_entity(t1,name_of_corresponding_parameter) */
1082  pc = gen_nconc(pc,
1084  string_undefined_p(pn)? NIL : CONS(STRING, strdup(pn), NIL),
1085  is_safe, false, true,in_type_declaration, true, ppdl));
1086  pips_debug(9,"List of parameters \"%s\"\n ",list_to_string(pc));
1087  first = false;
1088  }
1089  }
1090 
1091  pc = CHAIN_SWORD(pc,")");
1092  return generic_c_words_simplified_entity(t2, pc, is_safe, false,
1093  is_first, in_type_declaration,
1094  argument_p, ppdl);
1095  }
1096 
1097  if (pointer_type_p(t))
1098  {
1100  pips_debug(9,"Pointer type with name = %s\n", list_to_string(name));
1101 
1102  /*
1103  * No space : it's only "after a comma to separate items in lists such as
1104  * declaration lists or parameter lists in order to improve readability"
1105  *
1106  * FI: a space would be useful sometimes to separate "*" from an
1107  * identifier in "char *foo(void)" to obtain "char * foo(void)"
1108  * instead, but not "char * * foo(void)" nor "void foo(char * )".
1109  */
1110  // pc = CHAIN_SWORD(NIL, space_p? "*":"*");
1111  pc = CHAIN_SWORD(NIL, "*");
1112  // FI: qualifiers for type t1 are dealt with at a lower level,
1113  // qualifiers for type t are dealt here
1114  variable var = type_variable(t);
1115  list ql = variable_qualifiers(var);
1116  if (qualifiers_const_p(ql) || qualifiers_restrict_p(ql)) {
1118  // We may have other qualifiers which must be output somewhere
1119  // else, for instance "register"
1120  /*
1121  pc = gen_nconc(pc,
1122  words_qualifiers(variable_qualifiers(type_variable(t))));
1123  */
1124  }
1125  pc = gen_nconc(pc,name);
1126  pc = generic_c_words_simplified_entity(t1, pc, is_safe, false,
1127  is_first, in_type_declaration,
1128  argument_p, ppdl);
1129  pc = gen_nconc(words_initial_qualifiers(ql), pc);
1130  return pc;
1131  }
1132 
1133  /* Add type qualifiers if there are */
1134  bool qualifiers_p = false;
1135  if (false && ( is_first || in_type_declaration )
1136  && type_variable_p(t)
1139  qualifiers_p = true;
1140  }
1141  else if (false && ( is_first || in_type_declaration )
1142  && type_void_p(t)
1143  && type_void(t) != NIL)
1144  pc = words_qualifiers(type_void(t));
1145 
1146  if (basic_type_p(t)) {
1147  string sname = list_to_string(name);
1148  pips_debug(9,"Basic type with name = \"%s\"\n", sname);
1149 
1150  if(is_first) {
1151  pc = gen_nconc(pc,words_type(t, ppdl, argument_p));
1152  }
1153  if (string_type_p(t)) {
1154  // pc = CHAIN_SWORD(pc," *");
1155  ;
1156  }
1157  /* FI: left out of the previous declaration internal representation */
1158  if(strlen(sname)!=0 && is_first/* && !qualifiers_p*/)
1159  pc = CHAIN_SWORD(pc," ");
1160  if(!bit_type_p(t) || (strstr(sname,DUMMY_MEMBER_PREFIX)==NULL)) {
1161  pc = gen_nconc(pc,name);
1162  }
1163  free(sname);
1164  if (bit_type_p(t)) {
1167  list iew = words_expression(ie, ppdl);
1168  pc = CHAIN_SWORD(pc,":");
1169  pc = gen_nconc(pc, iew);
1170  }
1171  return pc;
1172  }
1173  if (array_type_p(t)) {
1174  variable var = type_variable(t);
1175  list dims = variable_dimensions(var);
1176  list ql = variable_qualifiers(var);
1177  type t1 = copy_type(t);
1178  list tmp = NIL;
1179  pips_debug(9,"Array type with name = %s\n", list_to_string(name));
1180 
1181  if ((gen_length(name) > 1) || ((gen_length(name) == 1) && (strcmp(STRING(CAR(name)),"*")==0)))
1182  {
1183  /* Array name is an expression like __ctype+1 in (__ctype+1)[*np]
1184  (syntax = subscript), or abstract type, parentheses must be added */
1185  tmp = CHAIN_SWORD(tmp,"(");
1186  tmp = gen_nconc(tmp,name);
1187  tmp = CHAIN_SWORD(tmp,")");
1188  }
1189  else
1190  {
1191  /* Array name is a simple reference */
1192  tmp = name;
1193  }
1196  // FI: I understand why the dimension information has to be
1197  // removed, I so not understand why the qualifiers have to be
1198  // removed too
1201  pips_debug(8, "Before concatenation, pc=\"\%s\"\n", list_to_string(pc));
1202  if(pc!=NIL && !qualifiers_p)
1203  pc = CHAIN_SWORD(pc, " ");
1204  list ret =
1205  gen_nconc(pc,
1207  is_safe, false, is_first,
1208  in_type_declaration,
1209  argument_p,
1210  ppdl));
1212  free_type(t1);
1213  return ret;
1214  }
1215 
1216  if (derived_type_p(t))
1217  {
1218  variable v = type_variable(t);
1219  basic b = variable_basic(v);
1220  list ql = variable_qualifiers(v);
1221  entity ent = basic_derived(b);
1222  if(is_first) {
1223  type t1 = entity_type(ent);
1224  string n = entity_name(ent);
1225  pips_debug(9,"Derived type with name = %s\n", list_to_string(name));
1226  if((strstr(n,ENUM_PREFIX DUMMY_ENUM_PREFIX)==NULL)
1227  &&(strstr(n,STRUCT_PREFIX DUMMY_STRUCT_PREFIX)==NULL)
1228  &&(strstr(n,UNION_PREFIX DUMMY_UNION_PREFIX)==NULL)) {
1229  if(gen_in_list_p((void *) ent, *ppdl) // previously defined
1230  || !declarable_type_p(t1, *ppdl) // not definable yet
1231  // FI: it might be better to pass down an extra parameter
1232  // rather than deduce this from name
1233  || (!ENDP(name) && same_string_p(STRING(CAR(name)), ""))) { // "struct s;" case
1234  /* The derived type has been declared explicitly
1235  elsewhere: see struct05.c */
1236  pc = gen_nconc(pc,words_type(t1, ppdl, argument_p));
1237  pc = CHAIN_SWORD(pc," ");
1238  pc = CHAIN_SWORD(pc,entity_user_name(ent));
1239  }
1240  else {
1241  /* The derived type is declared by itself*/
1242  const char* name = entity_user_name(ent);
1243  list epc = NIL;
1244  /* Do not recurse down if the derived type reference
1245  itself */
1246  *ppdl = gen_once((void *) ent, *ppdl);
1247  epc =
1249  CHAIN_SWORD(NIL,name),
1250  is_safe,
1251  add_dummy_parameter_name_p,
1252  is_first, in_type_declaration,
1253  argument_p, ppdl);
1254  pc = gen_nconc(pc, epc);
1255  //gen_free_list(npdl);
1256  }
1257  if(!ENDP(ql))
1258  pc = gen_nconc(words_qualifiers(ql), pc);
1259  }
1260  else {
1261  //pc = CHAIN_SWORD(pc,"problem!");
1262  pc = c_words_entity(t1, pc, ppdl);
1263  }
1264  /* A place holder variable has no name and require no space */
1265  if(gen_length(name)==1 && same_string_p(STRING(CAR(name)),""))
1266  ;
1267  else
1268  pc = CHAIN_SWORD(pc," ");
1269  }
1270  return gen_nconc(pc,name);
1271  }
1272  if (typedef_type_p(t))
1273  {
1274  if(is_first) {
1275  // FI: type_variable_p() is always true?
1276  variable var = type_variable(t);
1277  list ql = variable_qualifiers(var);
1278  basic b = variable_basic(var);
1279  entity ent = basic_typedef(b);
1280  pips_debug(9,"Typedef type with name = \"\%s\"\n",
1281  list_to_string(name));
1282  pc = CHAIN_SWORD(pc, entity_user_name(ent));
1283  pc = gen_nconc(words_qualifiers(ql), pc);
1284  if(name!=NIL)
1285  pc = CHAIN_SWORD(pc," ");
1286  }
1287  return gen_nconc(pc,name);
1288  }
1289  if (type_varargs_p(t))
1290  {
1291  pips_debug(9,"Varargs type ... with name = %s\n", list_to_string(name));
1292  pc = CHAIN_SWORD(pc,"...");
1293  return gen_nconc(pc,name);
1294  }
1295  /* This section is derived from c_text_entity() */
1296  /* it is used for structures, unions and enums which have no names
1297  because they are part of a more global declaration such as
1298  typedef s*/
1299  /* FI: The union and the struct cases could be merged. */
1300  if(type_struct_p(t))
1301  {
1302  list l = type_struct(t);
1303  string sname = list_to_string(name);
1304  list cl = list_undefined;
1305 
1306  pips_debug(9,"Struct type ... with name = %s\n", sname);
1307 
1308  pc = CHAIN_SWORD(pc,"struct ");
1309  // hmmm... name may be an empty list... and the sname test seems true
1310  if(name && strstr(sname,DUMMY_STRUCT_PREFIX)==NULL) {
1311  pc = gen_nconc(pc,name);
1312  if(!ENDP(l))
1313  pc = CHAIN_SWORD(pc," ");
1314  }
1315  free(sname);
1316  if(!ENDP(l)) {
1317  pc = CHAIN_SWORD(pc,"{");
1318 
1319  for(cl = l; !ENDP(cl); POP(cl)) {
1320  entity sm = ENTITY(CAR(cl));
1321  type tsm = entity_type(sm);
1322  pc = gen_nconc(pc,c_words_entity(tsm,CHAIN_SWORD(NIL,entity_user_name(sm)), ppdl));
1323  if(ENDP(CDR(cl)))
1324  pc = CHAIN_SWORD(pc,";");
1325  else
1326  pc = CHAIN_SWORD(pc,"; ");
1327  }
1328  pc = CHAIN_SWORD(pc,"}");
1329  }
1330  return pc;
1331  }
1332  if(type_union_p(t))
1333  {
1334  list l = type_union(t);
1335  string sname = list_to_string(name);
1336  list cl = list_undefined;
1337 
1338  pips_debug(9,"Union type ... with name = %s\n", sname);
1339 
1340  pc = CHAIN_SWORD(pc,"union ");
1341  //if(strstr(sname,DUMMY_UNION_PREFIX)==NULL) {
1342  // pc = gen_nconc(pc,name);
1343  // pc = CHAIN_SWORD(pc," ");
1344  //}
1345  free(sname);
1346  pc = CHAIN_SWORD(pc,"{");
1347 
1348  for(cl = l; !ENDP(cl); POP(cl)) {
1349  entity eu = ENTITY(CAR(cl));
1350  type tu = entity_type(eu);
1351  pc = gen_nconc(pc,c_words_entity(tu,CHAIN_SWORD(NIL,entity_user_name(eu)), ppdl));
1352  if(ENDP(CDR(cl)))
1353  pc = CHAIN_SWORD(pc,";");
1354  else
1355  pc = CHAIN_SWORD(pc,"; ");
1356  }
1357  pc = CHAIN_SWORD(pc,"}");
1358  return pc;
1359  }
1360  if(type_enum_p(t))
1361  {
1362  list l = type_enum(t);
1363  bool first = true;
1364  string sname = list_to_string(name);
1365  list cl = list_undefined;
1366  int cv = 0;
1367 
1368  pips_debug(9,"Enum type ... with name = %s\n", sname);
1369 
1370  pc = CHAIN_SWORD(pc,"enum ");
1371  if(strstr(sname,DUMMY_ENUM_PREFIX)==NULL && !same_string_p(sname,"")) {
1372  pc = gen_nconc(pc,name);
1373  pc = CHAIN_SWORD(pc," ");
1374  }
1375  free(sname);
1376  pc = CHAIN_SWORD(pc,"{");
1377 
1378  for(cl = l; !ENDP(cl); POP(cl)) {
1379  entity em = ENTITY(CAR(cl));
1380  value emv = entity_initial(em);
1381  symbolic ems = value_symbolic(emv);
1382  expression eme = symbolic_expression(ems);
1384  int n = constant_int(emc);
1385 
1386  if (!first)
1387  pc = CHAIN_SWORD(pc, space_p? ", " : ",");
1388  pc = CHAIN_SWORD(pc, entity_user_name(em));
1389  if(n!=cv || !constant_int_p(emc)) {
1390  pc = CHAIN_SWORD(pc, "=");
1391  pc = gen_nconc(pc, words_expression(eme, ppdl));
1392  cv = n;
1393  }
1394  cv++;
1395  first = false;
1396  };
1397  pc = CHAIN_SWORD(pc,"}");
1398  return pc;
1399  }
1400  pips_internal_error("unexpected case");
1401  return NIL;
1402 }
type copy_type(type p)
TYPE.
Definition: ri.c:2655
void free_type(type p)
Definition: ri.c:2658
#define ret(why, what)
true if not a remapping for old.
Definition: dynamic.c:986
#define DUMMY_MEMBER_PREFIX
Definition: naming-local.h:90
#define same_string_p(s1, s2)
#define string_undefined_p(s)
Definition: newgen_types.h:41
static list words_late_qualifiers(list obj)
Definition: declarations.c:805
list words_type(type obj, list *ppdl, bool argument_p)
obj is the type to describe
Definition: declarations.c:821
list words_dimensions(list dims, list *ppdl)
Definition: declarations.c:932
list c_words_entity(type t, list name, list *ppdl)
static list words_initial_qualifiers(list obj)
Definition: declarations.c:800
static bool argument_p(entity e)
This function return a bool indicating if related entity e represents an argument.
list lparams
Array bounds.
Definition: reindexing.c:111
bool array_type_p(type)
Definition: type.c:2942
bool qualifiers_restrict_p(list)
Check that a qualifier list contains the restrict qualifier.
Definition: type.c:5466
bool qualifiers_const_p(list)
Check that a qualifier list contains the const qualifier.
Definition: type.c:5453
bool overloaded_parameters_p(list)
Definition: type.c:5236
bool basic_type_p(type)
Safer than the other implementation? bool pointer_type_p(type t) { bool is_pointer = false;.
Definition: type.c:2912
bool pointer_type_p(type)
Check for scalar pointers.
Definition: type.c:2993
bool bit_type_p(type)
Definition: type.c:2843
bool string_type_p(type)
Definition: type.c:2854
bool typedef_type_p(type)
Returns true if t is a typedefED type.
Definition: type.c:3189
#define type_functional_p(x)
Definition: ri.h:2950
#define type_enum_p(x)
Definition: ri.h:2968
#define dummy_identifier(x)
Definition: ri.h:1033
#define basic_pointer(x)
Definition: ri.h:637
#define type_struct_p(x)
Definition: ri.h:2962
#define functional_result(x)
Definition: ri.h:1444
#define parameter_dummy(x)
Definition: ri.h:1823
#define parameter_type(x)
Definition: ri.h:1819
#define symbolic_constant(x)
Definition: ri.h:2599
#define constant_int(x)
Definition: ri.h:850
#define type_functional(x)
Definition: ri.h:2952
#define type_union_p(x)
Definition: ri.h:2965
#define value_symbolic(x)
Definition: ri.h:3070
#define basic_typedef(x)
Definition: ri.h:643
#define type_undefined_p(x)
Definition: ri.h:2884
#define dummy_unknown_p(x)
Definition: ri.h:1028
#define type_void(x)
Definition: ri.h:2961
#define constant_int_p(x)
Definition: ri.h:848
#define type_void_p(x)
Definition: ri.h:2959
#define functional_parameters(x)
Definition: ri.h:1442
#define PARAMETER(x)
PARAMETER.
Definition: ri.h:1788
#define basic_bit(x)
Definition: ri.h:634
#define type_varargs_p(x)
Definition: ri.h:2953
#define variable_dimensions(x)
Definition: ri.h:3122
#define symbolic_expression(x)
Definition: ri.h:2597

References argument_p(), array_type_p(), basic_bit, basic_derived, basic_pointer, basic_type_p(), basic_typedef, bit_type_p(), c_words_entity(), CAR, CDR, CHAIN_SWORD, concatenate(), CONS, constant_int, constant_int_p, copy_type(), declarable_type_p(), derived_type_p(), DUMMY_ENUM_PREFIX, dummy_identifier, DUMMY_MEMBER_PREFIX, DUMMY_STRUCT_PREFIX, DUMMY_UNION_PREFIX, dummy_unknown_p, ENDP, ENTITY, entity_initial, entity_local_name(), entity_name, entity_type, entity_user_name(), ENUM_PREFIX, f(), free(), free_type(), functional_parameters, functional_result, gen_full_free_list(), gen_in_list_p(), gen_length(), gen_nconc(), gen_once(), get_bool_property(), i2a(), list_to_string(), list_undefined, lparams, NIL, overloaded_parameters_p(), PARAMETER, parameter_dummy, parameter_type, pips_debug, pips_internal_error, pointer_type_p(), POP, qualifiers_const_p(), qualifiers_restrict_p(), ret, same_string_p, strdup(), STRING, string_type_p(), string_undefined, string_undefined_p, STRUCT_PREFIX, symbolic_constant, symbolic_expression, type_enum, type_enum_p, type_functional, type_functional_p, type_struct, type_struct_p, type_undefined_p, type_union, type_union_p, type_varargs_p, type_variable, type_variable_p, type_void, type_void_p, typedef_type_p(), UNION_PREFIX, value_symbolic, variable_basic, variable_dimensions, variable_qualifiers, words_dimensions(), words_expression(), words_initial_qualifiers(), words_late_qualifiers(), words_qualifiers(), and words_type().

Referenced by c_words_simplified_entity(), and generic_c_words_entity().

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

◆ generic_text_statement_enclosed()

text generic_text_statement_enclosed ( entity  ,
int  ,
statement  ,
bool  ,
bool  ,
list ,
bool  ,
bool   
)

Referenced by ensure_comment_consistency().

+ Here is the caller graph for this function:

◆ get_comment_continuation()

string get_comment_continuation ( void  )

Start a single line comment with continuation (blank spaces)

Returns
a string containing the begin of a comment line, language dependent

Definition at line 167 of file misc.c.

167  {
168  switch(get_prettyprint_language_tag()) {
169  case is_language_c: return "// ";
170  case is_language_fortran: return "C ";
171  case is_language_fortran95: return "! ";
172  default: pips_internal_error("language unknown not handled"); return NULL ;
173  }
174 }

References get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, and pips_internal_error.

Referenced by text_pointer_value(), text_pointer_values(), text_points_to_relation(), text_points_to_relations(), text_region_no_action(), and text_transformer().

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

◆ get_comment_sentinel()

string get_comment_sentinel ( void  )

Start a single line comment.

Returns
a string containing the begin of a comment line, language dependent

Definition at line 154 of file misc.c.

154  {
155  switch(get_prettyprint_language_tag()) {
156  case is_language_c: return "//";
157  case is_language_fortran: return "C";
158  case is_language_fortran95: return "!";
159  default: pips_internal_error("language unknown not handled"); return NULL ;
160  }
161 }

References get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, and pips_internal_error.

Referenced by init_text_statement(), loop_annotate(), mark_block(), print_any_reductions(), text_complexity(), text_continuation(), text_pointer_value(), text_pointer_values(), text_points_to(), text_points_to_relation(), text_points_to_relations(), text_reductions(), text_region_no_action(), text_transformer(), and text_unstructured().

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

◆ get_prettyprint_indentation()

unsigned int get_prettyprint_indentation ( void  )

Definition at line 177 of file misc.c.

177  {
179  return 0;
180  } else {
181  return INDENTATION;
182  }
183 }
bool prettyprint_language_is_fortran_p()
Definition: language.c:75

References INDENTATION, and prettyprint_language_is_fortran_p().

Referenced by ensure_comment_consistency(), sentence_area(), sentence_basic_declaration(), sentence_data(), sentence_data_statement(), sentence_external(), sentence_symbolic(), and text_entity_declaration().

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

◆ get_symbol_table()

string get_symbol_table ( entity  m,
bool  isfortran 
)

return variable

To simplify validation, at the expense of some information about the parsing process.

FI: struct, union and enum are also declared (in theory...), but their characteristics should be given differently.

&& (storage_ram_p(s) || storage_return_p(s) || storage_formal_p(s))

FI: How do we want to print out structures, unions and enums?

FI: How do we want to print out typedefs?

FI: it would be useful to dump more information aout fields and members

Formal parameters

Return variable

Structure of each area/common

Parameters
isfortransfortran

Definition at line 304 of file symbol_table.c.

305 {
306  string_buffer result = string_buffer_make(true);
307  string result2;
309  int nth = 0;
310  entity rv = entity_undefined; /* return variable */
311  list ce = list_undefined;
312 
313  pips_assert("m is a module", entity_module_p(m));
314  pips_assert("decls is a list of entities", entity_list_p(decls));
315 
316  /* To simplify validation, at the expense of some information about
317  the parsing process. */
318 
320 
321  string_buffer_append(result, concatenate(NL,"Declarations for module \"",
322  module_local_name(m),"\" with type \"", NULL));
323 
325  string_buffer_append(result, "\"" NL);
326 
327  /*
328  * List of implicitly and explicitly declared variables, functions
329  * and areas
330  *
331  */
332  if(ENDP(decls))
333  string_buffer_append(result, concatenate("\n* empty declaration list *",NL,NL,NULL));
334  else
335  string_buffer_append(result, concatenate("\nVariable list:",NL,NL,NULL));
336 
337  FOREACH(ENTITY, e, decls) {
338  // FI: more filtering needed for entities generated by the
339  // different passes, such as location entities
340  if(!typedef_entity_p(e) && !derived_entity_p(e)) {
341  type t = entity_type(e);
342 
343  pips_debug(8, "Processing entity \"%s\"\n", entity_name(e));
344  string_buffer_append(result, concatenate("\tDeclared entity \"",
345  entity_name(e),"\" with type \"",
346  type_to_string(t),"\" ",NULL));
347 
348  /* FI: struct, union and enum are also declared (in theory...), but
349  their characteristics should be given differently. */
350  if(type_variable_p(t)
351  /* && (storage_ram_p(s) || storage_return_p(s) || storage_formal_p(s))*/) {
352  variable v = type_variable(t);
353  list dl = variable_dimensions(v);
354  list ql = variable_qualifiers(v);
355  basic b = variable_basic(v);
358  string_buffer_append(result, "\"(");
359  dump_functional(f,result);
360  string_buffer_append(result, ") *\""NL);
361  }
362  else {
363  if(ENDP(dl)) {
364  if(ENDP(ql)) {
365  string_buffer_append(result,
366  concatenate("\"", basic_to_string(b), "\""NL,NULL));
367  }
368  else {
369  string sql = list_to_string(words_qualifiers(ql));
370  string_buffer_append(result,
371  concatenate("\"", sql, basic_to_string(b), "\""NL,NULL));
372  }
373  }
374  else {
375  list pdl = NIL;
376  string sdl = list_to_string(words_dimensions(dl, &pdl));
377  gen_free_list(pdl);
378  if(ENDP(ql)) {
379  string_buffer_append(result,
380  concatenate("\"", basic_to_string(b), sdl, "\""NL,NULL));
381  }
382  else {
383  string sql = list_to_string(words_qualifiers(ql));
384  string_buffer_append(result,
385  concatenate("\"", sql, basic_to_string(b), sdl, "\""NL,NULL));
386  }
387  }
388  }
389  }
390  else if(type_functional_p(t)) {
391  string_buffer_append(result, "\"");
392  dump_functional(type_functional(t),result);
393  string_buffer_append(result, "\""NL);
394  }
395  else if(type_area_p(t)) {
396  string_buffer_append(result,concatenate("with size ",
397  i2a(area_size(type_area(t))),NL, NULL));
398  }
399  else {
400  /* FI: How do we want to print out structures, unions and enums? */
401  /* FI: How do we want to print out typedefs? */
402  string_buffer_append(result, NL);
403  }
404  }
405  }
406 
407  /*
408  * Extern declarations
409  */
410 
411  if(!isfortran) {
413 
414  //gen_sort_list(decls, compare_entities);
415 
416  if(ENDP(edecls))
417  string_buffer_append(result, concatenate("\n* empty extern declaration list *",NL,NL,NULL));
418  else
419  string_buffer_append(result, concatenate("\nExternal variable list:",NL,NL,NULL));
420 
421  for(ce=edecls; !ENDP(ce); POP(ce)) {
422  entity e = ENTITY(CAR(ce));
423  type t = entity_type(e);
424 
425  pips_debug(8, "Processing external entity \"%s\"\n", entity_name(e));
426  pips_assert("e is an entity", entity_domain_number(e)==entity_domain);
427  string_buffer_append(result, concatenate("\tDeclared external entity \"",
428  entity_name(e),"\"\twith type \"",
429  type_to_string(t),"\" ",NULL));
430 
431  if(type_variable_p(t)) {
432  variable v = type_variable(t);
433  basic b = variable_basic(v);
436  string_buffer_append(result, "\"(");
437  dump_functional(f,result);
438  string_buffer_append(result, ") *\"" NL);
439  }
440  else {
441  string_buffer_append(result,
442  concatenate("\"", basic_to_string(b), "\""NL,NULL));
443  }
444  }
445  else if(type_functional_p(t)) {
446  string_buffer_append(result, "\"");
447  dump_functional(type_functional(t),result);
448  string_buffer_append(result, "\"" NL);
449  }
450  else if(type_area_p(t)) {
451  string_buffer_append(result,concatenate("with size ",
452  i2a(area_size(type_area(t))),NL, NULL));
453  }
454  else
455  string_buffer_append(result, NL);
456  }
457  }
458 
459  /*
460  * Derived entities: struct, union and enum
461  */
462 
463  nth = 0;
464  FOREACH(ENTITY, de, decls) {
465  if(entity_struct_p(de) || entity_union_p(de) || entity_enum_p(de)) {
466  nth++;
467  if(nth==1) {
468  string_buffer_append(result, concatenate(NL,"Derived entities:"
469  ,NL,NL,NULL));
470  }
471  /* FI: it would be useful to dump more information aout
472  fields and members */
473  string_buffer_append(result, concatenate("\tVariable \"", entity_name(de),
474  "\"\tkind = ",
475  entity_struct_p(de)? "struct" :
476  entity_union_p(de)? "union" : "enum",
477  "\n", NULL));
478  }
479  }
480 
481  /*
482  * Typedefs
483  */
484 
485  nth = 0;
486  FOREACH(ENTITY, te, decls) {
487  if(typedef_entity_p(te)) {
488  type t = entity_type(te);
489  nth++;
490  if(nth==1) {
491  string_buffer_append(result, concatenate(NL,"Typedef entities:"
492  ,NL,NL,NULL));
493  }
494  string_buffer_append(result, concatenate("\tTypedef \"", entity_name(te),
495  "\"\twith type \"",type_to_string(t),"\" ", NULL));
496 
497  if(type_variable_p(t)) {
498  variable v = type_variable(t);
499  basic b = variable_basic(v);
502  string_buffer_append(result, "\"(");
503  dump_functional(f,result);
504  string_buffer_append(result, ") *\"" NL);
505  }
506  else {
507  string_buffer_append(result,
508  concatenate("\"", basic_to_string(b), "\""NL,NULL));
509  }
510  }
511  else if(type_functional_p(t)) {
512  string_buffer_append(result, "\"");
513  dump_functional(type_functional(t),result);
514  string_buffer_append(result, "\"" NL);
515  }
516  else if(type_void_p(t)) {
517  string_buffer_append(result, "\"void\"" NL);
518  }
519  else {
520  pips_internal_error("unexpected type for a typedef");
521  }
522  }
523  }
524 
525  /* Formal parameters */
526  nth = 0;
527  FOREACH(ENTITY, v, decls) {
528  storage vs = entity_storage(v);
529 
530  pips_assert("All storages are defined", !storage_undefined_p(vs));
531 
532  if(storage_formal_p(vs)) {
533  nth++;
534  if(nth==1) {
535  string_buffer_append(result, concatenate(NL,"Layout for formal parameters:"
536  ,NL,NL,NULL));
537  }
538  string_buffer_append(result, concatenate("\tVariable ", entity_name(v),
539  "\toffset = ",
541  "\n", NULL));
542  }
543  else if(storage_return_p(vs)) {
544  pips_assert("No more than one return variable", entity_undefined_p(rv));
545  rv = v;
546  }
547  }
548 
549  /* Return variable */
550  if(!entity_undefined_p(rv)) {
552  string_buffer_append(result, concatenate(NL,"Layout for return variable:",NL,NL,NULL));
553  string_buffer_append(result, concatenate("\tVariable \"",
554  entity_name(rv),
555  "\"\tsize = ",
556  strdup(i2a(SizeOfElements(rb))),
557  "\n", NULL));
558  }
559 
560  /* Structure of each area/common */
561  if(!ENDP(decls)) {
562  string_buffer_append(result, concatenate(NL,"Layouts for ",isfortran?"commons:":"memory areas:",NL,NULL));
563  }
564 
565  FOREACH (ENTITY, e, decls) {
566  if(type_area_p(entity_type(e))) {
567  dump_common_layout(result, e, false, isfortran);
568  }
569  }
570 
571  string_buffer_append(result, concatenate("End of declarations for module ",
572  module_local_name(m), NL,NL, NULL));
573 
574  gen_free_list(decls);
575 
576  result2 = string_buffer_to_string(result);
577  string_buffer_free(&result);
578 
579  return result2;
580 }
list gen_copy_seq(list l)
Copy a list structure.
Definition: list.c:501
void gen_sort_list(list l, gen_cmp_func_t compare)
Sorts a list of gen_chunks in place, to avoid allocations...
Definition: list.c:796
void string_buffer_free(string_buffer *)
free string buffer structure, also free string contents according to the dup field
Definition: string_buffer.c:82
int(* gen_cmp_func_t)(const void *, const void *)
Definition: newgen_types.h:114
void dump_functional(functional f, string_buffer result)
Definition: declarations.c:581
bool entity_list_p(list el)
Checks that el only contains entity.
Definition: entity.c:1411
int compare_entities(const entity *pe1, const entity *pe2)
Comparison function for qsort.
Definition: entity.c:1328
bool entity_struct_p(entity e)
Is entity e the entity corresponding to a struct declaration?
Definition: entity.c:1002
bool entity_enum_p(entity e)
Definition: entity.c:968
bool typedef_entity_p(entity e)
Definition: entity.c:1902
const char * module_local_name(entity e)
Returns the module local user name.
Definition: entity.c:582
bool entity_union_p(entity e)
Is entity e an entity representing the union declaration?
Definition: entity.c:1038
_int SizeOfElements(basic)
This function returns the length in bytes of the Fortran or C type represented by a basic,...
Definition: size.c:297
string type_to_string(const type)
type.c
Definition: type.c:51
#define formal_offset(x)
Definition: ri.h:1408
#define code_externs(x)
Definition: ri.h:790
#define basic_pointer_p(x)
Definition: ri.h:635
#define code_declarations(x)
Definition: ri.h:784
#define storage_formal(x)
Definition: ri.h:2524
#define entity_domain_number(x)
Definition: ri.h:2788
#define storage_return_p(x)
Definition: ri.h:2516
#define storage_undefined_p(x)
Definition: ri.h:2477
void dump_common_layout(string_buffer result, entity c, bool debug_p, bool isfortran)
This function is called from c_parse() via ResetCurrentModule() and fprint_environment()
Definition: symbol_table.c:120

References area_size, basic_pointer, basic_pointer_p, basic_to_string(), CAR, code_declarations, code_externs, compare_entities(), concatenate(), derived_entity_p(), dump_common_layout(), dump_functional(), ENDP, ENTITY, entity_domain, entity_domain_number, entity_enum_p(), entity_initial, entity_list_p(), entity_module_p(), entity_name, entity_storage, entity_struct_p(), entity_type, entity_undefined, entity_undefined_p, entity_union_p(), f(), FOREACH, formal_offset, gen_copy_seq(), gen_free_list(), gen_sort_list(), i2a(), list_to_string(), list_undefined, module_local_name(), NIL, NL, pips_assert, pips_debug, pips_internal_error, POP, SizeOfElements(), storage_formal, storage_formal_p, storage_return_p, storage_undefined_p, strdup(), string_buffer_append(), string_buffer_free(), string_buffer_make(), string_buffer_to_string(), type_area, type_area_p, type_functional, type_functional_p, type_to_string(), type_variable, type_variable_p, type_void_p, typedef_entity_p(), ultimate_type(), value_code, variable_basic, variable_dimensions, variable_qualifiers, words_dimensions(), and words_qualifiers().

Referenced by actual_symbol_table_dump().

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

◆ html_output()

void html_output ( const char *  out,
bool  cr 
)

html_prettyprinter.c

Parameters
outut
crr

Definition at line 105 of file html_prettyprinter.c.

105  {
106  if(cr) {
107  html_print("<li><span>%s</span></li>" NL, out);
108  } else {
109  html_print("<li class=\"inlined\"><span>%s</span></li>" NL, out);
110  }
111 }
#define NL
#define html_print(format, args...)

References html_print, NL, and out.

Referenced by html_print_area(), html_print_basic(), html_print_constant(), html_print_entity_full(), html_print_entity_name(), html_print_expression(), html_print_formal(), html_print_mode(), html_print_parameter(), html_print_qualifier(), html_print_ram(), html_print_rom(), html_print_statement(), html_print_storage(), html_print_type(), html_print_unstructured(), html_print_value(), and html_print_whileloop().

+ Here is the caller graph for this function:

◆ html_prettyprint()

bool html_prettyprint ( const  string)

Set the current module entity required to have many things working in PIPS:

The debug is now controled by this environment variable name:

Print current module

Parameters
stringod_name

Definition at line 818 of file html_prettyprinter.c.

819 {
820 
822  mod_name,
823  true);
824 
826 
827  /* Set the current module entity required to have many things
828  working in PIPS: */
830 
831 
832  /* The debug is now controled by this environment variable name: */
833  debug_on("HTML_PRETTYPRINT_DEBUG_LEVEL");
834  pips_assert("Statement should be OK at entry...",
836 
837  // Prepare the output file
838  string html_file_name = db_build_file_resource_name( "RI", mod_name, ".ri.html" );
839  string output_file = strdup( concatenate( db_get_current_workspace_directory( ),
840  "/",
841  html_file_name,
842  NULL ) );
843  pips_debug(2,"Output in %s",output_file);
844  FILE *fp = safe_fopen( output_file, "w" );
845  html_set_output(fp);
846 
847  /* Print current module */
848  html_print(NL "<li><ul class=\"module\">" NL);
849  begin_block(mod_name, true);
851  end_block(mod_name, true);
852  html_print("<li class=\"endmodule\">&nbsp;</li>" NL "</ul></li>" NL);
853 
854 
855  if(get_bool_property("HTML_PRETTYPRINT_SYMBOL_TABLE")) {
857  }
858 
859  // Reset output file
860  html_set_output(0);
861  safe_fclose( fp, output_file );
862 
863 
864  DB_PUT_FILE_RESOURCE( DBR_HTML_IR_FILE, strdup( mod_name ), html_file_name );
865 
868 
869  return true;
870 }
bool statement_consistent_p(statement p)
Definition: ri.c:2195
static statement module_statement
Definition: alias_check.c:125
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
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
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
void html_print_symbol_table(void)
static void end_block(const char *block, bool cr)
static void html_print_statement(statement r)
static void begin_block(const char *block, bool cr)
static void html_set_output(FILE *new_fp)

References begin_block(), concatenate(), db_build_file_resource_name(), db_get_current_workspace_directory(), db_get_memory_resource(), DB_PUT_FILE_RESOURCE, debug_on, end_block(), get_bool_property(), html_print, html_print_statement(), html_print_symbol_table(), html_set_output(), module_name_to_entity(), module_statement, NL, pips_assert, pips_debug, reset_current_module_entity(), reset_current_module_statement(), safe_fclose(), safe_fopen(), set_current_module_entity(), set_current_module_statement(), statement_consistent_p(), and strdup().

+ Here is the call graph for this function:

◆ html_prettyprint_symbol_table()

bool html_prettyprint_symbol_table ( const  string)
Parameters
stringodule

Definition at line 872 of file html_prettyprinter.c.

873 {
874  pips_debug(1, "working on %s", module);
875 
876  // Prepare the output file
877  string html_file_name =
878  db_build_file_resource_name( "Symbols", "", ".symbols.html" );
879  string output_file =
881  "/", html_file_name, NULL ) );
882  FILE *fp = safe_fopen( output_file, "w" );
883  html_set_output(fp);
884 
885  // Reset output file
886  html_set_output(0);
887  safe_fclose( fp, output_file );
888 
889  DB_PUT_FILE_RESOURCE( DBR_HTML_IR_FILE, "", html_file_name );
890 
891  return true;
892 }

References concatenate(), db_build_file_resource_name(), db_get_current_workspace_directory(), DB_PUT_FILE_RESOURCE, html_set_output(), module, pips_debug, safe_fclose(), safe_fopen(), and strdup().

+ Here is the call graph for this function:

◆ html_print_entity_full()

void html_print_entity_full ( entity  e)

Definition at line 521 of file html_prettyprinter.c.

521  {
522  begin_block("entity", true);
523  html_output(entity_name( e ), true);
527 
528  end_block("entity", true);
529 }
static void html_print_storage(storage s)
void html_output(const char *out, bool cr)
html_prettyprinter.c
static void html_print_value(value v)
static void html_print_type(type t)

References begin_block(), end_block(), entity_initial, entity_name, entity_storage, entity_type, html_output(), html_print_storage(), html_print_type(), and html_print_value().

Referenced by html_print_symbol_table().

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

◆ html_print_symbol_table()

void html_print_symbol_table ( void  )

Print symbol table

Definition at line 805 of file html_prettyprinter.c.

806 {
807  /* Print symbol table */
808  html_print(NL "<li><ul class=\"symbolTable\">" NL);
809  begin_block("Symbol table", true);
811  FOREACH(entity, e, entities ) {
813  }
814  html_print("<li class=\"endSymbolTable\">&nbsp;</li>" NL "</ul></li>" NL);
815  end_block("Symbol table", true);
816 }
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
Definition: genClib.c:2780
void html_print_entity_full(entity e)
list gen_filter_tabulated(bool(*)(gen_chunk *), int)
returns the list of entities with this caracteristics.
Definition: tabulated.c:144

References begin_block(), end_block(), entity_domain, FOREACH, gen_filter_tabulated(), gen_true(), html_print, html_print_entity_full(), and NL.

Referenced by html_prettyprint().

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

◆ inegalite_debug()

void inegalite_debug ( Pcontrainte  c)

Definition at line 53 of file constraint_to_text.c.

54 {
56 }
void inegalite_fprint(FILE *, Pcontrainte, char *(*)(Variable))

References entity_local_name(), and inegalite_fprint().

+ Here is the call graph for this function:

◆ inegalite_text_format()

string inegalite_text_format ( string  ,
string  ,
text  ,
Pcontrainte  ,
string(*)(void)  ,
bool  ,
bool   
)

◆ init_prettyprint()

void init_prettyprint ( text(*)(entity, int, statement hook)

◆ init_text_statement()

text init_text_statement ( entity  module,
int  margin,
statement  obj 
)

exported for unstructured.c

FI: before calling the hook, statement_ordering(obj) should be checked

Parameters
moduleodule
marginargin
objbj

Definition at line 3462 of file misc.c.

3466 {
3468  text r;
3469 
3470  if (get_bool_property("PRETTYPRINT_ALL_EFFECTS")
3471  || !((instruction_block_p(i) &&
3472  !get_bool_property("PRETTYPRINT_BLOCKS")) ||
3474  !get_bool_property("PRETTYPRINT_UNSTRUCTURED")))) {
3475  /* FI: before calling the hook,
3476  * statement_ordering(obj) should be checked */
3477  r = (*text_statement_hook)( module, margin, obj );
3480  }
3481  else
3482  r = make_text( NIL ) ;
3483 
3484  if (get_bool_property("PRETTYPRINT_ALL_EFFECTS") ||
3485  get_bool_property("PRETTYPRINT_STATEMENT_ORDERING")) {
3486  char *buffer;
3487  int so = statement_ordering(obj) ;
3488 
3490  (! get_bool_property("PRETTYPRINT_BLOCKS")))) {
3491  if (so != STATEMENT_ORDERING_UNDEFINED)
3492  asprintf(&buffer, "%s (%d,%d)\n", get_comment_sentinel(),
3494  else
3495  asprintf(&buffer, "%s (statement ordering unavailable)\n",
3498  buffer));
3499  }
3500  }
3501  return( r ) ;
3502 }
void attach_decoration_to_text(text t)
Attach a decoration:
#define STATEMENT_ORDERING_UNDEFINED
mapping.h inclusion
Definition: newgen-local.h:35
string get_comment_sentinel()
Start a single line comment.
Definition: misc.c:154
#define instruction_block_p(i)
#define ORDERING_NUMBER(o)
#define ORDERING_STATEMENT(o)
#define statement_ordering(x)
Definition: ri.h:2454
#define instruction_unstructured_p(x)
Definition: ri.h:1530
#define statement_instruction(x)
Definition: ri.h:2458
static string buffer
Definition: string.c:113
@ is_sentence_formatted
Definition: text.h:57

References ADD_SENTENCE_TO_TEXT, asprintf, attach_decoration_to_text(), buffer, empty_text(), get_bool_property(), get_comment_sentinel(), instruction_block_p, instruction_unstructured_p, is_sentence_formatted, make_sentence(), make_text(), module, NIL, ORDERING_NUMBER, ORDERING_STATEMENT, statement_instruction, statement_ordering, STATEMENT_ORDERING_UNDEFINED, and text_statement_hook.

Referenced by text_trail().

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

◆ initialize_previously_declared_entities()

list initialize_previously_declared_entities ( entity  )

Referenced by ensure_comment_consistency().

+ Here is the caller graph for this function:

◆ insure_return_as_last_statement()

void insure_return_as_last_statement ( entity  ,
statement  
)

Referenced by ensure_comment_consistency().

+ Here is the caller graph for this function:

◆ last_statement()

statement last_statement ( statement  s)

A simplified version of find_last_statement() located in prettyprint.c and designed to be used within the prettyprinter.

Hopefully it is a return statement. Since the semantics of STOP is ignored by the parser, a final STOp should be followed by a RETURN.

Definition at line 168 of file statement.c.

169 {
171 
172  pips_assert("statement is defined", !statement_undefined_p(s));
173 
174  if(statement_sequence_p(s)) {
176 
177  last = (ENDP(ls)? statement_undefined :
179  }
180  else if(statement_unstructured_p(s)) {
182  list trail = unstructured_to_trail(u);
183 
184  last = control_statement(CONTROL(CAR(trail)));
185 
186  gen_free_list(trail);
187  }
188  else if(statement_call_p(s)) {
189  /* Hopefully it is a return statement.
190  * Since the semantics of STOP is ignored by the parser, a
191  * final STOp should be followed by a RETURN.
192  */
193  last = s;
194  }
195  else if(statement_goto_p(s))
196  last = s;
197  else if(statement_expression_p(s))
198  last = s;
199  else if(statement_loop_p(s))
200  last = s;
201  else if(statement_whileloop_p(s))
202  last = s;
203  else if(statement_forloop_p(s))
204  last = s;
205 
206  return last;
207 }
unstructured statement_unstructured(statement s)
Get the unstructured of a statement.
Definition: statement.c:1416
bool statement_expression_p(statement s)
Definition: statement.c:384
bool statement_goto_p(statement s)
Definition: statement.c:359
bool statement_whileloop_p(statement s)
Definition: statement.c:354
bool statement_call_p(statement s)
Definition: statement.c:364
bool statement_forloop_p(statement s)
Definition: statement.c:374
bool statement_loop_p(statement s)
Definition: statement.c:349
bool statement_sequence_p(statement s)
Statement classes induced from instruction type.
Definition: statement.c:335
bool statement_unstructured_p(statement s)
Definition: statement.c:369
statement last_statement(statement s)
A simplified version of find_last_statement() located in prettyprint.c and designed to be used within...
Definition: statement.c:168
list unstructured_to_trail(unstructured)
Definition: unstructured.c:240
#define instruction_block(i)
#define statement_undefined
Definition: ri.h:2419
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413

References CAR, CONTROL, control_statement, ENDP, gen_free_list(), gen_last(), instruction_block, last_statement(), pips_assert, STATEMENT, statement_call_p(), statement_expression_p(), statement_forloop_p(), statement_goto_p(), statement_instruction, statement_loop_p(), statement_sequence_p(), statement_undefined, statement_undefined_p, statement_unstructured(), statement_unstructured_p(), statement_whileloop_p(), and unstructured_to_trail().

Referenced by compile_omp(), FixCReturnStatements(), last_statement(), and step_compile_analysed_module().

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

◆ last_statement_p()

bool last_statement_p ( statement  )

Referenced by ensure_comment_consistency().

+ 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 
)

print.c

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:

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 }
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

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:

◆ maxima_simplify()

bool maxima_simplify ( expression presult)

call maxima to simplify an expression prefer simplify_expression !

try to call maxima to simplify this expression

strip out banner

look for first %

skip the three next chars

parse the output

Parameters
presultresult

Definition at line 180 of file expression.c.

180  {
181  bool success = true;
182  expression result = *presult;
183  /* try to call maxima to simplify this expression */
184  if(!expression_undefined_p(result) ) {
185  list pdl = NIL;
186  list w = words_expression(result,&pdl);
187  gen_free_list(pdl);
188  string str = words_to_string(w);
189  gen_free_list(w);
190  char * cmd;
191  asprintf(&cmd,"maxima -q --batch-string \"string(fullratsimp(%s));\"\n",str);
192  free(str);
193  FILE* pout = popen(cmd,"r");
194  if(pout) {
195  /* strip out banner */
196  fgetc(pout);fgetc(pout);
197  /* look for first % */
198  while(!feof(pout) && fgetc(pout)!='%');
199  if(!feof(pout)) {
200  /* skip the three next chars */
201  fgetc(pout);fgetc(pout);fgetc(pout);
202  /* parse the output */
203  char bufline[strlen(cmd)];
204  if(fscanf(pout," %s\n",&bufline[0]) == 1 ) {
207  free_expression(result);
208  *presult=exp;
209  }
210  else
211  success= false;
212  }
213  }
214  else
215  success= false;
216  pclose(pout);
217  }
218  else
219  success= false;
220  free(cmd);
221  }
222  return success;
223 }
expression string_to_expression(const char *s, entity module)
Functions using simultaneously pipsdbm, which is based on strings, and ri-util, which contains basic ...
Definition: expressions.c:50
bool success
Definition: gpips-local.h:59

References asprintf, exp, expression_undefined_p, free(), free_expression(), gen_free_list(), get_current_module_entity(), NIL, string_to_expression(), words_expression(), and words_to_string().

+ Here is the call graph for this function:

◆ one_liner_p()

bool one_liner_p ( statement  s)

True is statement "s" can be printed out without enclosing braces when it is the true branch of a test.

This is a special case because of dangling else clauses. bool one_liner_true_branch_p(statement s) { bool one_p = false; if(!statement_test_p(s)) one_p = one_liner_p(s); else { test t = instruction_test(statement_instruction(s)); statement f = test_false(t); if(!(empty_statement_p(f) || nop_statement_p(f))) one_p = true; // No need to worry, the else clause exists else { // Make sure there is no internal dangling else... one_p = one_liner_test_p(t); } } return one_p; }

True is test "t" contains a non-empty final "else" clause. bool one_liner_test_p(test t) { bool one_liner_p = false; /* We must make sure that the final else clause is not empty *\/ statement f = test_false(t); if(empty_statement_p(f) || nop_statement_p(f)) one_liner_p = false; else if(statement_test_p(f)) { /* Go down recursively for "else if" constructs. *\/ instruction i = statement_instruction(f); test ft = instruction_test(i); one_liner_p = one_liner_test_p(ft); } else one_liner_p = true; return one_liner_p; }

Can this statement be printed on one line, without enclosing braces, if it is embedded in a loop?

Another test must be used if Statement "s" is embedded in a test a a true branch.

There may be many lines hidden behind another block construct when code is generated in a non canonical way as for {{x=1;y=2;}}

OK, we could check deeper, but this is only useful for redundant internal representations. Let's forget about niceties such as skipping useless braces.

Definition at line 301 of file misc.c.

302 {
306  || return_instruction_p(i));
307 
308  yes = yes && ENDP(statement_declarations(s));
309 
310  if(!yes && instruction_sequence_p(i)) {
312  int sc = gen_length(sl);
313 
314  if(sc==1) {
315  /* There may be many lines hidden behind another block construct
316  when code is generated in a non canonical way as for
317  {{x=1;y=2;}} */
319 
320  if(instruction_sequence_p(ii)) {
321  /* OK, we could check deeper, but this is only useful for
322  redundant internal representations. Let's forget about
323  niceties such as skipping useless braces. */
324  yes = false;
325  }
326  else
327  yes = ENDP(statement_declarations(s));
328  }
329  else
330  yes = (sc < 1) && ENDP(statement_declarations(s));
331  }
332 
333  return yes;
334 }
bool return_instruction_p(instruction i)
Test if an instruction is a C or Fortran "return".
Definition: instruction.c:185
#define instruction_sequence_p(x)
Definition: ri.h:1512
#define instruction_loop_p(x)
Definition: ri.h:1518
#define instruction_forloop_p(x)
Definition: ri.h:1536
#define sequence_statements(x)
Definition: ri.h:2360
#define instruction_sequence(x)
Definition: ri.h:1514
#define instruction_call_p(x)
Definition: ri.h:1527
#define statement_declarations(x)
Definition: ri.h:2460
#define instruction_whileloop_p(x)
Definition: ri.h:1521
#define instruction_test_p(x)
Definition: ri.h:1515
#define instruction_goto_p(x)
Definition: ri.h:1524
#define instruction_expression_p(x)
Definition: ri.h:1539

References CAR, ENDP, gen_length(), instruction_call_p, instruction_expression_p, instruction_forloop_p, instruction_goto_p, instruction_loop_p, instruction_sequence, instruction_sequence_p, instruction_test_p, instruction_whileloop_p, return_instruction_p(), sequence_statements, STATEMENT, statement_declarations, and statement_instruction.

Referenced by ensure_comment_consistency(), gcc_if_block_braces_required_p(), text_block_else(), text_block_elseif(), text_block_ifthen(), text_loop_default(), text_trail(), and text_whileloop().

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

◆ output_a_graph_view_of_the_unstructured()

void output_a_graph_view_of_the_unstructured ( text  ,
entity  ,
const char *  ,
int  ,
unstructured  ,
int   
)

Referenced by ensure_comment_consistency(), and text_unstructured().

+ Here is the caller graph for this function:

◆ output_a_graph_view_of_the_unstructured_from_a_control()

bool output_a_graph_view_of_the_unstructured_from_a_control ( text  ,
entity  ,
int  ,
control  ,
control   
)

Referenced by ensure_comment_consistency().

+ Here is the caller graph for this function:

◆ output_a_graph_view_of_the_unstructured_successors()

void output_a_graph_view_of_the_unstructured_successors ( text  ,
entity  ,
int  ,
control   
)

Referenced by ensure_comment_consistency().

+ Here is the caller graph for this function:

◆ parsed_symbol_table()

bool parsed_symbol_table ( const char *  module_name)

bool c_symbol_table(const char* module_name)

{ set_prettyprint_language_tag(is_language_c); //all the way down to words_basic() actual_symbol_table_dump(module_name, false); return true; } bool fortran_symbol_table(const char* module_name) { actual_symbol_table_dump(module_name, true); return true; } To replace c_symbol_table() and fortran_symbol_table() because the information about the language is available in the symbol table.

This the symbol table is never duplicated, this function's output is correct only if the controlizer has not been applied.

Parameters
module_nameodule_name

Definition at line 665 of file symbol_table.c.

666 {
668  return true;
669 }
void actual_symbol_table_dump(const char *module_name, bool is_parsed)
Definition: symbol_table.c:582

References actual_symbol_table_dump(), and module_name().

+ Here is the call graph for this function:

◆ pragma_to_string()

string pragma_to_string ( pragma  p)
Returns
a new allocated string with the pragma textual representation.

Definition at line 69 of file pragma.c.

69  {
70  bool flg = false;
71  list l_str = NULL; //list of string
72  list l_expr = NULL; // list of expression
73  size_t line_sz = 0; // the pragma line size
74  string s = string_undefined;
76 
77  switch(pragma_tag (p)) {
78  case is_pragma_string:
79  s = pragma_string(p);
80  break;
82  l_expr = gen_nreverse(pragma_expression (p));
83  FOREACH (EXPRESSION, e, l_expr)
84  {
85  if(flg ) {
87  line_sz += 1;
88  }
89  flg = true;
90  list pdl = NIL;
91  l_str = words_expression(e, &pdl);
92  gen_free_list(pdl);
93  // l_str = gen_nreverse (l_str);
95  // In fortran line size can not be more than 72
96  FOREACH (STRING, str, l_str)
97  {
98  pips_assert ("algo bug", line_sz < MAX_LINE_LENGTH - 7);
99  size_t size = strlen(str);
100  pips_assert ("not handled case need to split the str between two lines",
101  size < (MAX_LINE_LENGTH - 7));
102  line_sz += size;
103  if(line_sz >= MAX_LINE_LENGTH - 8) {
105  str,
106  l_str);
107  line_sz = size;
108  }
109  }
110  }
112  gen_free_list(l_str);
113  }
115  // Free the buffer with its strings
117  // restore the list as it was at the begining
118  gen_nreverse(l_expr);
119  break;
120  default:
121  pips_internal_error("Unknown pragma type");
122  break;
123  }
124  if(s != string_undefined) {
125  switch(get_prettyprint_language_tag()) {
126  case is_language_fortran:
129  break;
130  case is_language_c:
131  s = strdup(concatenate(C_PRAGMA_HEADER_STRING, " ", s, NULL));
132  break;
133  default:
134  pips_internal_error("Language unknown !");
135  break;
136  }
137  }
138  return s;
139 }
list gen_insert_before(const void *no, const void *o, list l)
Definition: list.c:238
#define FORTRAN_PRAGMA_HEADER_STRING
Definition: naming-local.h:116
#define C_PRAGMA_HEADER_STRING
Constants for pragma management.
Definition: naming-local.h:115
#define FORTRAN_OMP_CONTINUATION_STRING
Definition: naming-local.h:117
void string_buffer_append_list(string_buffer, const list)
append a list of string to a string buffer.
#define pragma_string(x)
Definition: ri.h:2033
@ is_pragma_expression
Definition: ri.h:2013
@ is_pragma_string
Definition: ri.h:2012
#define pragma_tag(x)
Definition: ri.h:2030
#define MAX_LINE_LENGTH
maximum length of a line when prettyprinting...

References C_PRAGMA_HEADER_STRING, concatenate(), EXPRESSION, FOREACH, FORTRAN_OMP_CONTINUATION_STRING, FORTRAN_PRAGMA_HEADER_STRING, gen_free_list(), gen_insert_before(), gen_nreverse(), get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, is_pragma_expression, is_pragma_string, MAX_LINE_LENGTH, NIL, pips_assert, pips_internal_error, pragma_expression, pragma_string, pragma_tag, prettyprint_language_is_fortran_p(), strdup(), STRING, string_buffer_append(), string_buffer_append_list(), string_buffer_free_all(), string_buffer_make(), string_buffer_to_string(), string_undefined, and words_expression().

Referenced by add_expr_to_pragma_expr_list(), build_omp_pragma_list(), build_outer(), extension_to_string(), inner_rewrite(), and pragma_scmp_task_p().

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

◆ print_code()

bool print_code ( const  string)
Parameters
stringod_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_as_a_graph()

bool print_code_as_a_graph ( const string  mod_name)

print_code_as_a_graph.c

print_code_as_a_graph.c

Ronan.nosp@m..Ker.nosp@m.yell@.nosp@m.cri..nosp@m.ensmp.nosp@m..fr, 5/09/1995.

Parameters
mod_nameod_name

Definition at line 47 of file print_code_as_a_graph.c.

48 {
49  bool success;
50 
51  set_bool_property("PRETTYPRINT_UNSTRUCTURED_AS_A_GRAPH", true);
52  success = print_code(mod_name);
53  set_bool_property("PRETTYPRINT_UNSTRUCTURED_AS_A_GRAPH", false);
54 
55  return success;
56 }
bool print_code(const string)
Definition: print.c:272
void set_bool_property(const char *, bool)

References print_code(), and set_bool_property().

+ Here is the call 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 }
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:
#define resource_name(x)
Definition: database.h:108
char * get_string_property(const char *)
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
#define pips_user_error
Definition: misc-local.h:147
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 language_tag(x)
Definition: ri.h:1590

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_dummy()

void print_dummy ( dummy  d)

Display a "dummy" on stderr, useful for debugging.

Parameters
dis the dummy to display

Definition at line 93 of file parameter.c.

93  {
94  if(!dummy_defined_p(d)) {
95  fprintf(stderr, "DUMMY UNDEFINED\n");
96  } else {
97  fprintf(stderr, "%s",entity_name(dummy_identifier(d)));
98  }
99 }
bool dummy_defined_p(dummy p)
Definition: ri.c:584

References dummy_defined_p(), dummy_identifier, entity_name, and fprintf().

Referenced by print_parameter().

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

◆ print_entity_variable()

void print_entity_variable ( entity  e)

entity.c

entity.c

if it is just a variable, the type is printed, otherwise just the entity name is printed

Definition at line 56 of file entity.c.

57 {
58  variable v;
59 
60  (void) fprintf(stderr,"name: %s\n",entity_name(e));
61 
63  return;
64 
65  v = type_variable(entity_type(e));
66 
67  fprintf(stderr,"basic %s\n",basic_to_string(variable_basic(v)));
69 }
void gen_map(gen_iter_func_t fp, const list l)
Definition: list.c:172
void(* gen_iter_func_t)(void *)
Definition: newgen_types.h:116
static void print_dimension(dimension d)
Functions closely related to the prettyprint of entity class.
Definition: entity.c:44

References basic_to_string(), entity_name, entity_type, fprintf(), gen_map(), print_dimension(), type_variable, type_variable_p, variable_basic, and variable_dimensions.

Referenced by apply_abstract_effect_to_transformer(), call_to_transformer(), copy_write_statement_with_cumulated_regions(), entity_in_ref(), generic_apply_effect_to_transformer(), make_send_receive_conversion(), prepare_context(), print_ctx(), print_ctx_task(), print_distributed_arrays(), print_processors(), print_templates(), and regenerate_toggles().

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

◆ print_expression()

void print_expression ( expression  e)

no file descriptor is passed to make is easier to use in a debugging stage.

Do not make macros of those printing functions

Definition at line 58 of file expression.c.

59 {
61  (void) fprintf(stderr,"EXPRESSION UNDEFINED\n");
62  // For debugging with gdb, dynamic type checking
64  (void) fprintf(stderr,"Arg. \"e\"is not an expression.\n");
65  else {
66  normalized n;
67  (void) fprintf(stderr,"syntax = ");
69  (void) fprintf(stderr,"\nnormalized = ");
72  else
73  (void) fprintf(stderr,"NORMALIZED UNDEFINED\n");
74  }
75 }
void print_normalized(normalized n)
Definition: expression.c:168
void print_syntax(syntax s)
Definition: expression.c:121
#define expression_normalized(x)
Definition: ri.h:1249

References expression_domain, expression_domain_number, expression_normalized, expression_syntax, expression_undefined, fprintf(), normalized_undefined, print_normalized(), and print_syntax().

Referenced by abc_with_allocation_size(), affine_expression_of_loop_index_p(), alias_check_array_and_scalar_variable_in_caller_flt(), alias_check_array_variable_in_caller_flt(), any_basic_update_to_transformer(), any_expression_to_transformer(), array_size_stride(), atom_cse_expression(), atomize_this_expression(), bottom_up_abc_base_reference_implied_do(), bottom_up_abc_reference(), call_rwt(), copy_from_statement(), copy_from_test(), copy_to_statement(), copy_to_test(), cse_expression_flt(), debug_cost_expression_array(), dprint(), expr_cse_flt(), expression_equal_in_context_p(), expression_in_array_subscript(), expression_less_than_in_context(), expression_substitute_variable(), expression_to_points_to_sources(), find_entities_to_wrap(), formal_variable_add_aliases(), gfc2pips_code2instruction_(), Hierarchical_tiling(), HpfcExpressionToInt(), impact_check_two_scalar_variables_in_path(), integer_expression_to_transformer(), interprocedural_abc_arrays(), invariant_expression_p(), loop_flt(), loop_strip_mine(), make_list_of_flags(), make_send_receive_conversion(), MakeDimension(), MemberIdentifierToExpression(), partial_eval_reference(), pointer_expression_to_transformer(), print_alias_association(), print_alignment(), print_dimension(), print_distribution(), print_eformat(), print_expressions(), proper_to_summary_simple_effect(), ram_variable_add_aliases(), remove_minmax(), rename_statement_declarations(), same_or_equivalence_argument_add_aliases(), size_of_dummy_array(), split_update_call(), store_initial_value(), subscript_value(), substitute_and_create(), substitute_ghost_variable_in_expression(), Tiling_buffer_allocation(), top_down_abc_array(), top_down_abc_call(), transformer_add_condition_information_updown(), transformer_add_integer_relation_information(), translate_to_module_frame(), verify_array_element(), verify_used_before_set_call(), and verify_used_before_set_expression().

+ Here is the call graph for this function:

◆ print_expressions()

void print_expressions ( list  le)
Parameters
lee

Definition at line 98 of file expression.c.

99 {
100 
101  MAP(EXPRESSION, e , {
102  print_expression(e);
103  },
104  le);
105 
106 }
#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

References EXPRESSION, MAP, and print_expression().

Referenced by add_prettyprint_control_list_to_declaration_statement(), dprint(), MakeFunctionExpression(), outliner_parameters(), and verify_used_before_set_call().

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

◆ print_loops_list()

void print_loops_list ( entity  mod,
list  sl 
)
Parameters
modod
sll

Definition at line 79 of file loop.c.

80 {
81  FOREACH(LOOP, l, sl) {
82  list pdl = NIL;
83  text t = text_loop(mod, entity_name(loop_label(l)), 2, l, 0, &pdl, true);
84  gen_free_list(pdl);
85  print_text(stderr,t);
86  }
87 }
text text_loop(entity module, const char *label, int margin, loop obj, int n, list *ppdl, bool is_recursive_p)
exported for conversion/look_for_nested_loops.c
Definition: misc.c:3264
#define LOOP(x)
LOOP.
Definition: ri.h:1606
#define loop_label(x)
Definition: ri.h:1646

References entity_name, FOREACH, gen_free_list(), LOOP, loop_label, NIL, print_text(), and text_loop().

+ Here is the call graph for this function:

◆ print_mode()

void print_mode ( mode  m)

Display a "mode" on stderr, useful for debugging.

Parameters
pis the mode to display

Definition at line 76 of file parameter.c.

76  {
77  if(!mode_defined_p(m)) {
78  fprintf(stderr, "MODE UNDEFINED\n");
79  } else if( mode_value_p(m)) {
80  fprintf(stderr, "value");
81  } else if( mode_reference_p(m)) {
82  fprintf(stderr, "reference");
83  } else {
84  fprintf(stderr, "unknown");
85  }
86 }
bool mode_defined_p(mode p)
Definition: ri.c:1320
#define mode_value_p(x)
Definition: ri.h:1694
#define mode_reference_p(x)
Definition: ri.h:1697

References fprintf(), mode_defined_p(), mode_reference_p, and mode_value_p.

Referenced by print_parameter().

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

◆ print_normalized()

void print_normalized ( normalized  n)

should be replaced by a call to expression_fprint() if it's ever added to linear library

Definition at line 168 of file expression.c.

169 {
170  if(normalized_complex_p(n))
171  (void) fprintf(stderr,"COMPLEX\n");
172  else
173  /* should be replaced by a call to expression_fprint() if it's
174  ever added to linear library */
176 }
void vect_debug(Pvecteur v)
constraint.c
Definition: constraint.c:43
#define normalized_complex_p(x)
Definition: ri.h:1782
#define normalized_linear(x)
Definition: ri.h:1781

References fprintf(), normalized_complex_p, normalized_linear, and vect_debug().

Referenced by print_expression().

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

◆ print_number_to_statement()

void print_number_to_statement ( hash_table  nts)
Parameters
ntsts

Definition at line 209 of file statement.c.

210 {
211  HASH_MAP(number, stmt, {
212  fprintf(stderr,"%td\t", (_int) number);
214  }, nts);
215 }
static hash_table nts
Definition: prettyprint.c:63
intptr_t _int
_INT
Definition: newgen_types.h:53
void print_statement(statement s)
Print a statement on stderr.
Definition: statement.c:98
Definition: statement.c:54

References fprintf(), HASH_MAP, nts, and print_statement().

Referenced by get_any_comp_regions_text(), get_continuation_condition_text(), and get_semantic_text().

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

◆ print_parallel_statement()

void print_parallel_statement ( statement  s)

Definition at line 156 of file statement.c.

157 {
160  print_statement(s);
162  free(cstyle);
163 }
#define PRETTYPRINT_PARALLEL

References free(), get_string_property(), PRETTYPRINT_PARALLEL, print_statement(), set_string_property(), and strdup().

Referenced by CodeGenerate(), do_it(), MakeLoopAs(), rice_loop(), and rice_statement().

+ 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)
Parameters
stringod_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)
Parameters
stringod_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)
Parameters
stringod_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_parallelizedHPF_code()

bool print_parallelizedHPF_code ( const  string)
Parameters
stringodule_name

Definition at line 299 of file print.c.

300 {
302 }

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)
Parameters
stringod_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)
Parameters
stringod_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 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_parameter()

void print_parameter ( parameter  p)

parameter.c

parameter.c

Parameters
pis the parameter to display

Definition at line 45 of file parameter.c.

45  {
46  if(p == parameter_undefined) {
47  fprintf(stderr, "PARAMETER UNDEFINED\n");
48  } else {
49  fprintf(stderr, "type = ");
51  fprintf(stderr, "\nmode= ");
53  fprintf(stderr, "\ndummy= ");
55  fprintf(stderr, "\n");
56  }
57 }
void print_mode(mode m)
Display a "mode" on stderr, useful for debugging.
Definition: parameter.c:76
void print_dummy(dummy d)
Display a "dummy" on stderr, useful for debugging.
Definition: parameter.c:93
#define parameter_undefined
Definition: ri.h:1794
#define parameter_mode(x)
Definition: ri.h:1821

References fprintf(), parameter_dummy, parameter_mode, parameter_type, parameter_undefined, print_dummy(), print_mode(), and print_type().

Referenced by print_parameters().

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

◆ print_parameters()

void print_parameters ( list  lp)

Display a parameter on stderr, useful for debugging.

Parameters
lpis the list of parameters to display
Parameters
lpp

Definition at line 63 of file parameter.c.

63  {
64  FOREACH(PARAMETER, p , lp)
65  {
66  print_parameter(p);
67  }
68 }
void print_parameter(parameter p)
Display a parameter on stderr, useful for debugging.
Definition: parameter.c:45

References FOREACH, PARAMETER, and print_parameter().

Referenced by outliner_parameters().

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

◆ print_qualifier()

void print_qualifier ( qualifier  q)

Definition at line 138 of file type.c.

139 {
140  list ql = CONS(QUALIFIER, q, NIL);
141  print_qualifiers(ql);
142  gen_free_list(ql);
143 }
void print_qualifiers(list ql)
Definition: type.c:131

References CONS, gen_free_list(), NIL, print_qualifiers(), and QUALIFIER.

Referenced by dprint().

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

◆ print_qualifiers()

void print_qualifiers ( list  ql)
Parameters
qll

Definition at line 131 of file type.c.

132 {
133  list wl = words_qualifiers(ql);
134  dump_words(wl);
135  gen_full_free_list(wl);
136 }
void dump_words(list lw)
Definition: print.c:251

References dump_words(), gen_full_free_list(), and words_qualifiers().

Referenced by dprint(), and print_qualifier().

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

◆ print_reference()

◆ print_reference_list()

void print_reference_list ( list  lr)
Parameters
lrr

Definition at line 147 of file expression.c.

148 {
149  if(ENDP(lr))
150  fputs("NIL", stderr);
151  else
152  MAPL(cr,
153  {
154  reference r = REFERENCE(CAR(cr));
155  entity e = reference_variable(r);
156  (void) fprintf(stderr,"%s, ", entity_local_name(e));
157  },
158  lr);
159 
160  (void) putc('\n', stderr);
161 }
#define REFERENCE(x)
REFERENCE.
Definition: ri.h:2296

References CAR, ENDP, entity_local_name(), fprintf(), MAPL, REFERENCE, and reference_variable.

Referenced by call_instruction_to_communications(), loop_nest_to_local_variables(), and print_references().

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

◆ print_references()

void print_references ( list  rl)
Parameters
rll

Definition at line 163 of file expression.c.

164 {
166 }
void print_reference_list(list lr)
Definition: expression.c:147

References print_reference_list().

Referenced by dprint(), and UseFormalArguments().

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

◆ print_source()

bool print_source ( const  string)
Parameters
stringod_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:

◆ print_statement()

void print_statement ( statement  s)

Print a statement on stderr.

Print the statement according to the current PRETTYPRINT_LANGUAGE property

See text_named_module() for improvements.

Definition at line 98 of file statement.c.

99 {
100  fprint_statement(stderr, s);
101 }
void fprint_statement(FILE *fd, statement s)
Print statement "s" on file descriptor "fd".
Definition: statement.c:68

References fprint_statement().

Referenced by abc_instrumentation_insert_before_statement(), add_aliases_for_current_call_site(), adg_dataflowgraph(), adg_dataflowgraph_with_extremities(), assign_statement_task_mapping(), atomize_as_required(), bottom_up_abc_insert_before_statement(), bottom_up_abc_statement_rwt(), build_binary_operators_with_huffman(), c_code_string(), c_unstructured(), call_flt(), call_to_transformer(), comEngine_opt_loop_interchange(), compile_body(), compute_distribution_controlization_context(), compute_region(), connect_unstructured(), controlize_distribution(), copy_n_reference(), copy_n_statement(), copy_write_statement_with_cumulated_regions(), create_module_with_statement(), cse_expression_flt(), ctx_get_send_statement(), da_process_list(), debug_statement(), debug_unstructured(), distribute_code(), do_it(), do_loop_unroll_with_epilogue(), do_loop_unroll_with_prologue(), do_substitute(), dprint(), extract_matching_statements(), extract_non_conflicting_statements(), filter_live_out_regions_statement(), find_statements_interactively_walker(), fprint_bdt_with_stat(), fs_filter(), fsmize_statement(), full_loop_unroll(), full_spaghettify(), full_spaghettify_statement(), generate_code(), generate_code_loop(), generate_code_test_proc(), get_externalized_and_analyzed_function_name(), get_function_name_by_searching_tag(), get_points_to_graph_from_statement(), get_statements_with_comments_containing(), gpu_ify_statement(), gpu_memory_apply(), gpu_promote_sequential_on_sequence(), HRE_distribute(), HRE_distribute_stat(), icm_codegen(), identify_statements_to_distribute(), if_conv_init_statement(), if_conversion_compact_stats(), if_conversion_init(), init_statement_equivalence_table(), initial_code_abc_statement_rwt(), inline_calls(), inline_expression(), inline_expression_call(), inline_statement_crawler(), interprocedural_abc_insert_before_statement(), invariant_code_motion(), is_elsif_test_p(), isolate_code_portion(), loop_strip_mine(), make_array_communication_statement(), make_bottom_up_abc_tests(), make_interprocedural_abc_tests(), make_lInitStats(), make_lSwitchStats(), make_mpi_conversion(), make_send_receive_conversion(), make_statement_copy_i(), make_task_mapping(), mark_loop_to_outline(), mpi_initialize(), opt_loop_interchange_fill_lists(), outliner_patch_parameters(), outliner_statements_referenced_entities(), partial_eval_statement(), phrase_distributor_control_code(), phrase_remove_dependences_rwt(), postcondition_filter(), prepare_context(), prettyprint_dot_dependence_graph(), print_number_to_statement(), print_parallel_statement(), print_statement_of_module(), print_statements(), process_true_call_stat(), reduce_sequence(), reductions_rewrite(), remove_begin_tag(), remove_end_tag(), rename_statement_reductions(), replace_in_sequence_statement_with(), replace_reductions_in_statement(), replicate_declaration(), rice_loop(), rm_db_block(), safe_print_statement(), safescale_distributor(), safescale_module_analysis(), seq_flt(), sequence_to_post_pv(), simdize_simple_statements_pass2(), SimplifyGraph(), smalltalk_code_string(), some_conflicts_between(), spaghettify_statement(), st_statement(), statement_convert_to_statement_with_sequence_of_intruction(), statement_filter(), statement_rewrite(), step_directive_print(), step_update_comm(), store_new_module(), SupressDependances(), taskify_statement(), Tiling2_buffer(), top_down_abc_flt(), top_down_abc_rwt(), variable_private_to_loop_p(), verify_array_element(), verify_array_variable(), verify_scalar_variable(), verify_used_before_set_statement_flt(), wp65_debug_print_text(), and xml_code_string().

+ Here is the call graph for this function:

◆ print_statement_of_module()

void print_statement_of_module ( statement  s,
const char *  mn 
)
Parameters
mnn

Definition at line 111 of file statement.c.

112 {
117  print_statement(s);
119  }
120  else
121  print_statement(s);
122 }
entity local_name_to_top_level_entity(const char *n)
This function try to find a top-level entity from a local name.
Definition: entity.c:1450

References entity_undefined_p, get_current_module_entity(), local_name_to_top_level_entity(), print_statement(), reset_current_module_entity(), reset_label_counter(), and set_current_module_entity().

+ Here is the call graph for this function:

◆ print_statement_set()

void print_statement_set ( FILE *  fd,
set  r 
)

statement.c

Parameters
fdd

Definition at line 49 of file statement.c.

50 {
51  fprintf(fd, "Set contains statements");
52 
53  SET_MAP(s, {
54  fprintf(fd, " %02td", statement_number((statement) s));
55  }, r);
56 
57  fprintf(fd, "\n");
58 }
#define SET_MAP(element, code, the_set)
Definition: newgen_set.h:54
#define statement_number(x)
Definition: ri.h:2452

References fprintf(), SET_MAP, and statement_number.

Referenced by CodeGenerate(), rdg_loop(), rice_loop(), and rice_update_dependence_graph().

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

◆ print_statements()

void print_statements ( list  sl)
Parameters
sll

Definition at line 103 of file statement.c.

104 {
105  FOREACH(STATEMENT, s, sl) {
106  print_statement(s);
107  }
108 }

References FOREACH, print_statement(), and STATEMENT.

Referenced by dprint(), rename_statement_declarations(), and simdize_simple_statements_pass2().

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

◆ print_syntax()

void print_syntax ( syntax  s)

Definition at line 121 of file expression.c.

122 {
123  list pdl = NIL;
124  print_words(stderr,words_syntax(s, &pdl));
125  gen_free_list(pdl);
126 }

References gen_free_list(), NIL, print_words(), and words_syntax().

Referenced by interprocedural_mapping(), make_send_receive_conversion(), print_expression(), and print_syntax_expressions().

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

◆ print_syntax_expressions()

void print_syntax_expressions ( list  le)
Parameters
lee

Definition at line 108 of file expression.c.

109 {
110 
111  MAP(EXPRESSION, e , {
113  if(!ENDP(CDR(le))) {
114  (void) fprintf(stderr, ", ");
115  }
116  },
117  le);
118 
119 }

References CDR, ENDP, EXPRESSION, expression_syntax, fprintf(), MAP, and print_syntax().

+ Here is the call graph for this function:

◆ print_type()

void print_type ( type  t)

For debugging.

Definition at line 111 of file type.c.

112 {
113  debug_on("RI-UTIL_DEBUG_LEVEL");
114  if(t==NULL)
115  fprintf(stderr, "type is NULL.\n");
116  else if(type_undefined_p(t))
117  fprintf(stderr, "type is undefined.\n");
118  else if(type_domain_number(t)!=type_domain)
119  fprintf(stderr, "The argument is not a type.\n");
120  else {
121  // Might be better to pass true, or even more information, to see
122  // what happens with the unknown type
123  list pdl = NIL;
124  list wl = words_type(t, &pdl, false);
125  gen_free_list(pdl);
126  dump_words(wl);
127  }
128  debug_off();
129 }
#define type_domain_number(x)
Definition: ri.h:2939

References debug_off, debug_on, dump_words(), fprintf(), gen_free_list(), NIL, type_domain, type_domain_number, type_undefined_p, and words_type().

Referenced by build_view_file(), create_scalar_stub_sink_cell(), dprint(), entity_all_xxx_locations_typed(), expression_to_points_to_sources(), generic_stub_source_to_sinks(), get_dont_build_view_file(), get_view_file(), gpips_display_plain_file(), print_parameter(), type_dereferencement_depth(), wpips_display_plain_file(), and wpips_display_WP65_file().

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

◆ print_types()

void print_types ( list  tl)

Very basic and crude debugging function.

Parameters
tll

Definition at line 96 of file type.c.

97 {
98  bool first_p = true;
99 
100  fprintf(stderr, "Type list: ");
101 
102  FOREACH(TYPE, t, tl) {
103  fprintf(stderr, first_p? "%p" : ", %p", t);
104  first_p = false;
105  }
106 
107  fprintf(stderr, "\n");
108 }
#define TYPE(bp)
non user domain must be taken care from outside?
Definition: genC.c:50

References FOREACH, fprintf(), and TYPE.

Referenced by dprint().

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

◆ printf_loop()

void printf_loop ( loop  lp)

loop.c

loop.c

void fprint_loop(fp, lp): print a loop.

AC 94/06/07 copied from reindexing/reindexing_utils.c for debugging

Parameters
lpp

Definition at line 48 of file loop.c.

48  {
49  FILE *fp = stdout;
50 
51  fprintf(fp,"\nLoop index information:");
53 
54  fprintf(fp,"\nDomaine (lower, upper, inc):");
57  fprintf(fp,", ");
60  fprintf(fp,", ");
63 
64  fprintf(fp,"\nLabel:");
66 
67  fprintf(fp,"\nExecution Type");
69  fprintf(fp, " ->sequentiel");
70  else
71  fprintf(fp, " ->parallele");
72 
73  fprintf(fp, "\nLocals: ");
75 
76  fprintf(fp,"\n");
77 }
void fprint_entity_list(FILE *fp, list l)
void fprint_entity_list(FILE *fp,list l): prints a list of entities on file fp.
Definition: entity.c:3188
void fprint_list_of_exp(FILE *fp, list exp_l)
void fprint_list_of_exp(FILE *fp, list exp_l): prints in the file "fp" the list of expression "exp_l"...
Definition: expression.c:229
#define loop_execution(x)
Definition: ri.h:1648
#define execution_sequential_p(x)
Definition: ri.h:1208
#define loop_locals(x)
Definition: ri.h:1650
#define loop_range(x)
Definition: ri.h:1642
#define loop_index(x)
Definition: ri.h:1640

References CONS, ENTITY, execution_sequential_p, EXPRESSION, fprint_entity_list(), fprint_list_of_exp(), fprintf(), loop_execution, loop_index, loop_label, loop_locals, loop_range, NIL, range_increment, range_lower, and range_upper.

Referenced by loop_replace_variable().

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

◆ proper_statement_to_string()

string proper_statement_to_string ( statement  )

Referenced by ensure_comment_consistency(), semantics_user_warning_alist(), and spear_log_alist().

+ Here is the caller graph for this function:

◆ recompile_module()

bool recompile_module ( const string  module)

module.c

module.c

Parameters
moduleodule

Definition at line 87 of file module.c.

88 {
89  entity modified_module = module_name_to_entity(module);
90  statement modified_module_statement =
91  (statement) db_get_memory_resource(DBR_CODE, module, true);
92  do_recompile_module(modified_module,modified_module_statement);
93  return true;
94 }
static void do_recompile_module(entity module, statement module_statement)
High-level functions about modules, using prettyprint, pipsdbm and ri-util.
Definition: module.c:50

References db_get_memory_resource(), do_recompile_module(), module, and module_name_to_entity().

Referenced by do_inlining(), and do_unfolding().

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

◆ reference_to_string()

string reference_to_string ( reference  r)

Definition at line 87 of file expression.c.

87  {
88  list pdl = NIL;
89  list l = words_reference(r,&pdl) ;
90  gen_free_list(pdl);
91  string out = words_to_string(l);
92  FOREACH(STRING,w,l) free(w);
93  gen_free_list(l);
94  return out;
95 }

References FOREACH, free(), gen_free_list(), NIL, out, STRING, words_reference(), and words_to_string().

Referenced by adapt_reference_to_type(), add_address_of_value(), analyzed_reference_p(), any_assign_to_transformer(), any_basic_update_to_transformer(), any_update_to_transformer(), attach_ref_to_loop(), basic_update_reflhs_with_rhs_to_transformer(), cell_is_xxx_p(), cell_reference_to_type(), constant_memory_access_path_to_location_name(), convex_cell_reference_preceding_p(), count_dataflows_on_ref(), dereferencing_to_sinks(), extended_source_to_sinks(), filter_formal_context_according_to_actual_context(), forward_substitute_array_location_in_transformer(), fprint_dataflow(), generic_eval_cell_with_points_to(), lhs_subs_in_ins(), new_array_element_backward_substitution_in_transformer(), new_filter_formal_context_according_to_actual_context(), perform_substitution_in_expression(), points_to_cell_name(), points_to_name(), points_to_rank(), points_to_unary_operation_to_transformer(), potential_to_effective_memory_leaks(), print_value_mappings(), print_variables(), process_ref_list(), reduction_as_str(), reference_to_address_entity(), reference_to_address_of_value(), sa_do_it(), semantics_usable_points_to_reference_p(), simple_cell_reference_preceding_p(), simple_pv_translate(), successor_only_has_rr_conflict_p(), and update_reflhs_with_rhs_to_transformer().

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

◆ register_intrinsic_handler()

void register_intrinsic_handler ( const char *  name,
intrinsic_desc_t desc 
)

after this call, name and desc are owned by intrinsic_handlers, but will never be deallocated they must point to permanent storage

Parameters
nameame
descesc

Definition at line 2517 of file misc.c.

2517  {
2520  }
2521  hash_put(intrinsic_handlers,name,desc);
2522 }
void hash_put(hash_table htp, const void *key, const void *val)
This functions stores a couple (key,val) in the hash table pointed to by htp.
Definition: hash.c:364
#define hash_table_undefined_p(h)
Definition: newgen_hash.h:50
static hash_table intrinsic_handlers
Definition: misc.c:2502
static void init_intrinsic_handlers()
Definition: misc.c:2504

References hash_put(), hash_table_undefined_p, init_intrinsic_handlers(), and intrinsic_handlers.

Referenced by step_analyse_init().

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

◆ remove_modulo()

expression remove_modulo ( expression  exp)

craft.c

craft.c

Parameters
expxp

Definition at line 83 of file craft.c.

85 {
87 
88  return(exp);
89 }
static void rewrite_modulo_expression(expression exp)
Prettyprinter for CRAFT loops.
Definition: craft.c:57
#define gen_recurse(start, domain_number, flt, rwt)
Definition: genC.h:283

References exp, expression_domain, gen_recurse, gen_true(), and rewrite_modulo_expression().

Referenced by text_loop_craft().

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

◆ reset_alternate_return_set()

void reset_alternate_return_set ( void  )

Definition at line 804 of file misc.c.

References gen_free_list(), ifdebug, list_undefined, list_undefined_p, pips_assert, and set_of_labels_required_for_alternate_returns.

Referenced by ensure_comment_consistency(), fprint_statement(), and statement_to_text().

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

◆ reset_last_statement()

void reset_last_statement ( void  )

Referenced by ensure_comment_consistency().

+ Here is the caller graph for this function:

◆ reset_prettyprinter_common_hook()

void reset_prettyprinter_common_hook ( void  )

Definition at line 787 of file declarations2.c.

788 {
790 }
static string(* common_hook)(entity, entity)
static string default_common_hook(entity __attribute__((unused)) module, entity common)
We add this function to cope with the declaration When the user declare sth.

References common_hook, and default_common_hook().

Referenced by hpfc_print_code().

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

◆ reset_prettyprinter_head_hook()

void reset_prettyprinter_head_hook ( void  )

Definition at line 3964 of file misc.c.

3964 { head_hook=NULL;}
static string(* head_hook)(entity)
hook for adding something in the head.
Definition: misc.c:3962

References head_hook.

Referenced by compile_mpi(), and hpfc_print_code().

+ Here is the caller graph for this function:

◆ safe_c_words_entity()

list safe_c_words_entity ( type  t,
list  name 
)

Ignore the parser declared entities?

Parameters
nameame

Definition at line 1433 of file declarations.c.

1434 {
1435  /* Ignore the parser declared entities? */
1436  list pdl = NIL;
1437  list l = generic_c_words_entity(t, name, true, false, &pdl);
1438  gen_free_list(pdl);
1439  return l;
1440 }

References gen_free_list(), generic_c_words_entity(), and NIL.

Referenced by FindOrCreateCurrentEntity(), UpdateEntity(), and UpdateFunctionEntity().

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

◆ safe_print_statement()

void safe_print_statement ( statement  s)

The return label only can be associated to a RETURN call, however the controlizer does not follow this consistency rule.

Definition at line 140 of file statement.c.

141 {
142  if(statement_undefined_p(s)) {
143  fprintf(stderr, "Statement undefined\n");
144  }
145  else if(continue_statement_p(s)
147  /* The return label only can be associated to a RETURN call,
148  however the controlizer does not follow this consistency
149  rule. */
150  fprintf(stderr, "%s\n", statement_identification(s));
151  }
152  else
153  print_statement(s);
154 }
bool continue_statement_p(statement s)
Test if a statement is a CONTINUE, that is the FORTRAN nop, the ";" in C or the "pass" in Python....
Definition: statement.c:203
bool entity_return_label_p(entity e)
Definition: entity.c:673
#define statement_label(x)
Definition: ri.h:2450

References continue_statement_p(), entity_return_label_p(), fprintf(), print_statement(), statement_identification(), statement_label, and statement_undefined_p.

Referenced by check_new_arc_for_structured_statement(), and IsolatedStatement().

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

◆ same_application_name_p()

bool same_application_name_p ( application  a1,
application  a2 
)
Parameters
a11
a22

Definition at line 109 of file same_names.c.

110 {
113 }
#define application_arguments(x)
Definition: ri.h:510
#define application_function(x)
Definition: ri.h:508
bool same_expression_name_p(expression, expression)
compare two entities for their appearance point of view.
Definition: same_names.c:159
bool same_lexpr_name_p(list l1, list l2)
same_names.c
Definition: same_names.c:53

References application_arguments, application_function, same_expression_name_p(), and same_lexpr_name_p().

Referenced by same_syntax_name_p().

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

◆ same_call_name_p()

bool same_call_name_p ( call  c1,
call  c2 
)
Parameters
c11
c22

Definition at line 69 of file same_names.c.

70 {
73 }
#define call_arguments(x)
Definition: ri.h:711
bool same_entity_lname_p(entity e1, entity e2)
Definition: same_names.c:64

References call_arguments, call_function, same_entity_lname_p(), and same_lexpr_name_p().

Referenced by same_syntax_name_p().

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

◆ same_cast_name_p()

bool same_cast_name_p ( cast  cs1,
cast  cs2 
)
Parameters
cs1s1
cs2s2

Definition at line 103 of file same_names.c.

104 {
105  return same_type_name_p(cast_type(cs1), cast_type(cs2)) &&
107 }
bool same_type_name_p(const type, const type)
For naming homogeneity: expression_to_string(), reference_to_string()...
Definition: type.c:74
#define cast_expression(x)
Definition: ri.h:747
#define cast_type(x)
Definition: ri.h:745

References cast_expression, cast_type, same_expression_name_p(), and same_type_name_p().

Referenced by same_syntax_name_p().

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

◆ same_entity_lname_p()

bool same_entity_lname_p ( entity  e1,
entity  e2 
)
Parameters
e11
e22

Definition at line 64 of file same_names.c.

65 {
67 }

References entity_local_name(), and same_string_p.

Referenced by inline_should_inline(), outline_remove_duplicates(), same_call_name_p(), same_ref_name_p(), simd_replace_parameters(), and UseFormalArguments().

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

◆ same_expression_name_p()

bool same_expression_name_p ( expression  e1,
expression  e2 
)

compare two entities for their appearance point of view.

used for putting common in includes.

Parameters
e11
e22

Definition at line 159 of file same_names.c.

160 {
162 }
bool same_syntax_name_p(syntax s1, syntax s2)
Definition: same_names.c:130

References expression_syntax, and same_syntax_name_p().

Referenced by same_application_name_p(), same_cast_name_p(), same_lexpr_name_p(), same_range_name_p(), same_sizeofexpression_name_p(), and same_subscript_name_p().

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

◆ same_lexpr_name_p()

bool same_lexpr_name_p ( list  l1,
list  l2 
)

same_names.c

else

Parameters
l11
l22

Definition at line 53 of file same_names.c.

54 {
55  if (gen_length(l1)!=gen_length(l2))
56  return false;
57  /* else */
58  for(; l1 && l2; POP(l1), POP(l2))
60  return false;
61  return true;
62 }

References CAR, EXPRESSION, gen_length(), POP, and same_expression_name_p().

Referenced by same_application_name_p(), same_call_name_p(), same_ref_name_p(), and same_subscript_name_p().

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

◆ same_range_name_p()

bool same_range_name_p ( range  r1,
range  r2 
)
Parameters
r11
r22

Definition at line 81 of file same_names.c.

References range_increment, range_lower, range_upper, and same_expression_name_p().

Referenced by same_syntax_name_p().

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

◆ same_ref_name_p()

bool same_ref_name_p ( reference  r1,
reference  r2 
)
Parameters
r11
r22

Definition at line 75 of file same_names.c.

References reference_indices, reference_variable, same_entity_lname_p(), and same_lexpr_name_p().

Referenced by get_complement_expression(), and same_syntax_name_p().

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

◆ same_sizeofexpression_name_p()

bool same_sizeofexpression_name_p ( sizeofexpression  s0,
sizeofexpression  s1 
)
Parameters
s00
s11

Definition at line 88 of file same_names.c.

89 {
94  return false;
95 }
#define sizeofexpression_type(x)
Definition: ri.h:2406
#define sizeofexpression_expression(x)
Definition: ri.h:2409
#define sizeofexpression_expression_p(x)
Definition: ri.h:2407
#define sizeofexpression_type_p(x)
Definition: ri.h:2404

References s1, same_expression_name_p(), same_type_name_p(), sizeofexpression_expression, sizeofexpression_expression_p, sizeofexpression_type, and sizeofexpression_type_p.

Referenced by same_syntax_name_p(), and same_va_arg_name_p().

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

◆ same_subscript_name_p()

bool same_subscript_name_p ( subscript  ss1,
subscript  ss2 
)
Parameters
ss1s1
ss2s2

Definition at line 97 of file same_names.c.

98 {
101 }
#define subscript_indices(x)
Definition: ri.h:2563
#define subscript_array(x)
Definition: ri.h:2561

References same_expression_name_p(), same_lexpr_name_p(), subscript_array, and subscript_indices.

Referenced by same_syntax_name_p().

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

◆ same_syntax_name_p()

bool same_syntax_name_p ( syntax  s1,
syntax  s2 
)

else

Parameters
s11
s22

Definition at line 130 of file same_names.c.

131 {
132  if (syntax_tag(s1)!=syntax_tag(s2))
133  return false;
134  /* else */
135  switch (syntax_tag(s1))
136  {
137  case is_syntax_call:
139  case is_syntax_reference:
141  case is_syntax_range:
145  case is_syntax_subscript:
147  case is_syntax_cast:
151  case is_syntax_va_arg:
153  default:
154  pips_internal_error("unexpected syntax tag: %d", syntax_tag(s1));
155  }
156  return false;
157 }
#define syntax_tag(x)
Definition: ri.h:2727
#define syntax_cast(x)
Definition: ri.h:2739
#define syntax_application(x)
Definition: ri.h:2748
#define syntax_va_arg(x)
Definition: ri.h:2751
#define syntax_range(x)
Definition: ri.h:2733
@ is_syntax_application
Definition: ri.h:2697
@ is_syntax_cast
Definition: ri.h:2694
@ is_syntax_call
Definition: ri.h:2693
@ is_syntax_va_arg
Definition: ri.h:2698
@ is_syntax_sizeofexpression
Definition: ri.h:2695
@ is_syntax_subscript
Definition: ri.h:2696
#define syntax_sizeofexpression(x)
Definition: ri.h:2742
#define syntax_subscript(x)
Definition: ri.h:2745
bool same_sizeofexpression_name_p(sizeofexpression s0, sizeofexpression s1)
Definition: same_names.c:88
bool same_call_name_p(call c1, call c2)
Definition: same_names.c:69
bool same_ref_name_p(reference r1, reference r2)
Definition: same_names.c:75
bool same_subscript_name_p(subscript ss1, subscript ss2)
Definition: same_names.c:97
bool same_application_name_p(application a1, application a2)
Definition: same_names.c:109
bool same_va_arg_name_p(list l1, list l2)
Definition: same_names.c:115
bool same_cast_name_p(cast cs1, cast cs2)
Definition: same_names.c:103
bool same_range_name_p(range r1, range r2)
Definition: same_names.c:81

References is_syntax_application, is_syntax_call, is_syntax_cast, is_syntax_range, is_syntax_reference, is_syntax_sizeofexpression, is_syntax_subscript, is_syntax_va_arg, pips_internal_error, s1, same_application_name_p(), same_call_name_p(), same_cast_name_p(), same_range_name_p(), same_ref_name_p(), same_sizeofexpression_name_p(), same_subscript_name_p(), same_va_arg_name_p(), syntax_application, syntax_call, syntax_cast, syntax_range, syntax_reference, syntax_sizeofexpression, syntax_subscript, syntax_tag, and syntax_va_arg.

Referenced by same_expression_name_p().

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

◆ same_type_name_p()

bool same_type_name_p ( const type  t0,
const type  t1 
)

For naming homogeneity: expression_to_string(), reference_to_string()...

but type_to_string() is already implemented in ri-util in a less useful form string type_to_string(cons type t) { return string_of_type(t); } This function cannot be in ri-util because of string_of_type()

Parameters
t00
t11

Definition at line 74 of file type.c.

74  {
75  string s0 = string_of_type(t0),
76  s1 =string_of_type(t1);
77  bool same = same_string_p(s0,s1);
78  free(s0); free(s1);
79  return same;
80 }
string string_of_type(const type t)
Definition: type.c:56

References free(), s1, same_string_p, and string_of_type().

Referenced by comparable_entity_in_list_p(), same_cast_name_p(), and same_sizeofexpression_name_p().

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

◆ same_va_arg_name_p()

bool same_va_arg_name_p ( list  l1,
list  l2 
)
Parameters
l11
l22

Definition at line 115 of file same_names.c.

116 {
117  if (gen_length(l1)!=gen_length(l2))
118  return false;
119 
120  for(; l1 && l2; POP(l1), POP(l2)) {
124  return false;
125  }
126  return true;
127 }
#define SIZEOFEXPRESSION(x)
SIZEOFEXPRESSION.
Definition: ri.h:2364

References CAR, gen_length(), POP, s1, same_sizeofexpression_name_p(), and SIZEOFEXPRESSION.

Referenced by same_syntax_name_p().

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

◆ sc_syst_debug()

void sc_syst_debug ( Psysteme  s)

constraint_to_text.c

Definition at line 46 of file constraint_to_text.c.

47 {
49 }
void sc_fprint(FILE *fp, Psysteme ps, get_variable_name_t nom_var)
void sc_fprint(FILE * f, Psysteme ps, char * (*nom_var)()): cette fonction imprime dans le fichier po...
Definition: sc_io.c:220

References entity_local_name(), and sc_fprint().

Referenced by build_and_test_dependence_context(), dependence_cone_positive(), loop_regions_normalize(), region_exact_projection_along_variable(), region_sc_minimal(), regions_may_convex_hull(), regions_must_convex_hull(), sc_projection_optim_along_vecteur_ofl(), TestDependence(), text_transformer(), and unimodular().

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

◆ sentence_goto_label()

sentence sentence_goto_label ( entity  ,
const char *  ,
int  ,
const char *  ,
int   
)

◆ sentence_head()

sentence sentence_head ( entity  e,
list ppdl 
)

We have no way to distinguish between the SUBROUTINE and PROGRAM They two have almost the same properties.

For the time being, especially for the PUMA project, we have a temporary idea to deal with it: When there's no argument(s), it should be a PROGRAM, otherwise, it should be a SUBROUTINE. Lei ZHOU 18/10/91

correct PROGRAM and SUBROUTINE distinction added, FC 18/08/94 approximate BLOCK DATA / SUBROUTINE distinction also added. FC 09/97

Parameters
ppdlpdl

Definition at line 601 of file declarations.c.

602 {
603  list pc = NIL;
604  type te = entity_type(e);
605  functional fe;
606  type tr;
607  list args = words_parameters(e, ppdl);
608 
609  pips_assert("is functionnal", type_functional_p(te));
610 
611  if (static_module_p(e))
612  pc = CHAIN_SWORD(pc,"static ");
613 
614  fe = type_functional(te);
615  tr = functional_result(fe);
616 
617  switch(type_tag(tr)) {
618  case is_type_void:
619  switch(get_prettyprint_language_tag()) {
620  case is_language_fortran:
622  if (entity_main_module_p(e))
623  pc = CHAIN_SWORD(pc,"PROGRAM ");
624  else {
625  if (entity_blockdata_p(e))
626  pc = CHAIN_SWORD(pc, "BLOCKDATA ");
627  else if (entity_f95module_p(e))
628  pc = CHAIN_SWORD(pc, "MODULE ");
629  else
630  pc = CHAIN_SWORD(pc,"SUBROUTINE ");
631  }
632  break;
633  case is_language_c:
634  pc = CHAIN_SWORD(pc,"void ");
635  break;
636  default:
637  pips_internal_error("Language unknown !");
638  break;
639  }
640  break;
641  case is_type_variable: {
642  list pdl = NIL;
643  // FI: the qualifiers are dropped...
644  variable var = type_variable(tr);
645  basic b = variable_basic(var);
646  list ql = variable_qualifiers(var);
647  pc = gen_nconc(pc, words_basic(b, &pdl));
648  pc = gen_nconc(words_qualifiers(ql), pc);
649  switch(get_prettyprint_language_tag()) {
650  case is_language_fortran:
652  pc = CHAIN_SWORD(pc," FUNCTION ");
653  break;
654  case is_language_c:
655  pc = CHAIN_SWORD(pc," ");
656  break;
657  default:
658  pips_internal_error("Language unknown !");
659  break;
660  }
661  break;
662  }
663  case is_type_unknown:
664  /*
665  * For C functions with no return type.
666  * It can be treated as of type int, but we keep it unknown
667  * for the moment, to make the differences and to regenerate initial code
668  */
669  break;
670  default:
671  pips_internal_error("unexpected type for result");
672  }
673 
674  pc = CHAIN_SWORD(pc, entity_user_name(e));
675 
676  if (!ENDP(args)) {
677  pc = CHAIN_SWORD(pc, "(");
678  pc = gen_nconc(pc, args);
679  pc = CHAIN_SWORD(pc, ")");
680  } else if (type_variable_p(tr)
682  && (type_unknown_p(tr) || type_void_p(tr)))) {
683  pc = CHAIN_SWORD(pc, "()");
684  }
685 
687  0,
688  0,
689  pc)));
690 }
bool prettyprint_language_is_c_p()
Definition: language.c:91
static list words_parameters(entity e, list *ppdl)
Definition: declarations.c:96
bool entity_main_module_p(entity e)
Definition: entity.c:700
bool entity_blockdata_p(entity e)
Definition: entity.c:712
bool entity_f95module_p(entity e)
Definition: entity.c:707

References CHAIN_SWORD, ENDP, entity_blockdata_p(), entity_f95module_p(), entity_main_module_p(), entity_type, entity_user_name(), functional_result, gen_nconc(), get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, is_sentence_unformatted, is_type_unknown, is_type_variable, is_type_void, make_sentence(), make_unformatted(), NIL, pips_assert, pips_internal_error, prettyprint_language_is_c_p(), static_module_p(), type_functional, type_functional_p, type_tag, type_unknown_p, type_variable, type_variable_p, type_void_p, variable_basic, variable_qualifiers, words_basic(), words_parameters(), and words_qualifiers().

Referenced by ensure_comment_consistency().

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

◆ Sentence_Variable()

sentence Sentence_Variable ( entity  e)

Definition at line 583 of file declarations.c.

584 {
585  list pdl = NIL;
586  sentence s = sentence_variable(e, &pdl);
587  gen_free_list(pdl);
588  return s;
589 }
sentence sentence_variable(entity e, list *ppdl)
Definition: declarations.c:567

References gen_free_list(), NIL, and sentence_variable().

Referenced by make_emulated_shared_variable(), and set_dimensions_of_local_variable_family().

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

◆ sentence_variable()

sentence sentence_variable ( entity  e,
list ppdl 
)
Parameters
ppdlpdl

Definition at line 567 of file declarations.c.

568 {
569  list pc = NIL;
570  type te = entity_type(e);
571 
572  pips_assert("is a variable", type_variable_p(te));
573 
574  pc = gen_nconc(pc, words_basic(variable_basic(type_variable(te)), ppdl));
575  pc = CHAIN_SWORD(pc, " ");
576 
577  pc = gen_nconc(pc, words_declaration(e, true, ppdl));
578 
580  make_unformatted(NULL, 0, 0, pc)));
581 }
list words_declaration(entity e, bool prettyprint_common_variable_dimensions_p, list *ppdl)
some compilers don't like dimensions that are declared twice.
Definition: declarations.c:277

References CHAIN_SWORD, entity_type, gen_nconc(), is_sentence_unformatted, make_sentence(), make_unformatted(), NIL, pips_assert, type_variable, type_variable_p, variable_basic, words_basic(), and words_declaration().

Referenced by Sentence_Variable().

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

◆ set_alternate_return_set()

void set_alternate_return_set ( void  )

Definition at line 795 of file misc.c.

796 {
797  ifdebug(1) {
798  pips_assert("The target list is undefined",
800  }
802 }

References ifdebug, list_undefined_p, NIL, pips_assert, and set_of_labels_required_for_alternate_returns.

Referenced by ensure_comment_consistency(), fprint_statement(), and statement_to_text().

+ Here is the caller graph for this function:

◆ set_last_statement()

void set_last_statement ( statement  )

Referenced by ensure_comment_consistency().

+ Here is the caller graph for this function:

◆ set_prettyprinter_common_hook()

void set_prettyprinter_common_hook ( string(*)(entity, entity )

declarations2.c

Referenced by hpfc_print_code().

+ Here is the caller graph for this function:

◆ set_prettyprinter_head_hook()

void set_prettyprinter_head_hook ( string(*)(entity f)

Definition at line 3963 of file misc.c.

3963 { head_hook=f;}

References f(), and head_hook.

Referenced by compile_mpi(), and hpfc_print_code().

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

◆ statement_to_text()

text statement_to_text ( statement  s)

Definition at line 124 of file statement.c.

125 {
126  text t = text_undefined;
127 
128  debug_on("PRETTYPRINT_DEBUG_LEVEL");
131  list pdl = NIL;
132  t = text_statement(entity_undefined, 0, s, &pdl);
133  gen_free_list(pdl);
135  debug_off();
136 
137  return t;
138 }

References debug_off, debug_on, entity_undefined, gen_free_list(), NIL, reset_alternate_return_set(), reset_label_counter(), set_alternate_return_set(), text_statement(), and text_undefined.

Referenced by control_graph(), insert_impact_description_as_comment(), and subtsitute_variable_in_reference().

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

◆ string_of_type()

string string_of_type ( const  type)

Definition at line 56 of file type.c.

57 {
58  list pdl = NIL;
59  list wl = words_type(t, &pdl, false);
60  gen_free_list(pdl);
61  string s = words_to_string(wl);
62  FOREACH(STRING,s,wl) free(s);
63  gen_free_list(wl);
64  return s;
65 }

References FOREACH, free(), gen_free_list(), NIL, STRING, words_to_string(), and words_type().

Referenced by binary_arithmetic_operator_to_post_pv(), check_type_of_points_to_cells(), declaration_to_post_pv(), FILE_star_effect_reference_p(), malloc_arg_to_type(), malloc_to_abstract_location(), malloc_type_to_abstract_location(), module_initial_parameter_pv(), and xml_print_parameter().

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

◆ symbol_table()

bool symbol_table ( const char *  module_name)

To replace c_symbol_table() and fortran_symbol_table() because the information about the language is available in the symbol table.

Parameters
module_nameodule_name

Definition at line 673 of file symbol_table.c.

674 {
676  return true;
677 }

References actual_symbol_table_dump(), and module_name().

Referenced by expression_similar_get_context_p(), and expression_similar_p().

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

◆ system_sorted_text_format()

void system_sorted_text_format ( string  line,
string  prefix,
text  txt,
Psysteme  ps,
string(*)(Variable variable_name,
bool(*)(Pvecteur put_first,
bool  a_la_fortran 
)

lower level hook for regions.

{

repeat twice: once for first, once for not first.

== / .EQ.

<= / .LE.

}

Parameters
lineine
prefixrefix
txtxt
pss
a_la_fortran_la_fortran

Definition at line 391 of file constraint_to_text.c.

399 {
400  bool invert, stop, some_previous = false;
401 
402  if (ps==NULL)
403  {
404  add_to_current_line(line, get_string_property("SYSTEM_NULL"), prefix, txt);
405  return;
406  }
407  else if (SC_UNDEFINED_P(ps))
408  {
409  add_to_current_line(line, get_string_property("SYSTEM_UNDEFINED"),
410  prefix, txt);
411  return;
412  }
413  else if (sc_empty_p(ps))
414  {
415  add_to_current_line(line, get_string_property("SYSTEM_NOT_FEASIBLE"),
416  prefix, txt);
417  return;
418  }
419 
420  /* {
421  */
422  if (!a_la_fortran) add_to_current_line(line, "{", prefix, txt);
423 
424  /* repeat twice: once for first, once for not first.
425  */
426  for(invert = false, stop = false; !stop; )
427  {
428  /* == / .EQ.
429  */
430  some_previous =
431  contraintes_text_format(line, prefix, txt, sc_egalites(ps),
432  variable_name, invert, put_first,
433  some_previous, false, a_la_fortran);
434 
435  /* <= / .LE.
436  */
437  some_previous =
438  contraintes_text_format(line, prefix, txt, sc_inegalites(ps),
439  variable_name, invert, put_first,
440  some_previous, true, a_la_fortran);
441 
442  if (invert || !put_first) stop = true;
443  invert = true;
444  }
445 
446  /* }
447  */
448  if (!a_la_fortran) add_to_current_line(line, "}", prefix, txt);
449 }
static bool contraintes_text_format(string line, string prefix, text txt, Pcontrainte cs, string(*variable_name)(Variable), bool invert_put_first, bool(*put_first)(Pvecteur), bool some_previous, bool is_inegalites, bool a_la_fortran)
static const char * prefix
bool sc_empty_p(Psysteme sc)
bool sc_empty_p(Psysteme sc): check if the set associated to sc is the constant sc_empty or not.
Definition: sc_alloc.c:350
void add_to_current_line(string, const char *, string, text)
Definition: util.c:140

References add_to_current_line(), contraintes_text_format(), get_string_property(), line, prefix, sc_empty_p(), and variable_name().

Referenced by system_text_format(), text_pointer_value(), text_points_to_relation(), and text_region_no_action().

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

◆ system_text_format()

void system_text_format ( string  line,
string  prefix,
text  txt,
Psysteme  ps,
string(*)(Variable variable_name,
bool  a_la_fortran 
)

appends ps to line/txt with prefix continuations.

Parameters
lineine
prefixrefix
txtxt
pss
a_la_fortran_la_fortran

Definition at line 453 of file constraint_to_text.c.

460 {
462  (line, prefix, txt, ps, variable_name, NULL, a_la_fortran);
463 }
void system_sorted_text_format(string line, string prefix, text txt, Psysteme ps, string(*variable_name)(Variable), bool(*put_first)(Pvecteur), bool a_la_fortran)
lower level hook for regions.

References line, prefix, system_sorted_text_format(), and variable_name().

Referenced by text_continuation(), and text_transformer().

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

◆ text_common_declaration()

text text_common_declaration ( entity  common,
entity  module 
)

needed for hpfc

Parameters
commonommon
moduleodule

Definition at line 1228 of file declarations2.c.

1231 {
1232  type t = entity_type(common);
1233  list l;
1234  text result;
1235  list pdl = NIL; // Assumed Fortran only
1236  pips_assert("indeed a common", type_area_p(t));
1237  l = CONS(ENTITY, common, common_members_of_module(common, module, false));
1238  result = text_entity_declaration(module, l, true, &pdl);
1239  gen_free_list(l);
1240  gen_free_list(pdl);
1241  return result;
1242 }
static text text_entity_declaration(entity module, list ldecl, bool force_common, list *ppdl)
This function compute the list of declaration at the begining of a module.

References common_members_of_module(), CONS, ENTITY, entity_type, gen_free_list(), module, NIL, pips_assert, text_entity_declaration(), and type_area_p.

Referenced by hpfc_print_common(), and text_area_included().

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

◆ text_declaration()

text text_declaration ( entity  module)

exported for hpfc.

Assume Fortran only!

Parameters
moduleodule

Definition at line 1216 of file declarations2.c.

1217 {
1218  /* Assume Fortran only! */
1219  list pdl = NIL;
1221  (module, code_declarations(entity_code(module)), false, &pdl);
1222  gen_free_list(pdl);
1223  return t;
1224 }
code entity_code(entity e)
Definition: entity.c:1098

References code_declarations, entity_code(), gen_free_list(), module, NIL, and text_entity_declaration().

Referenced by ensure_comment_consistency(), and init_host_and_node_entities().

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

◆ text_initializations()

text text_initializations ( entity  m)

The previous declaration list is useless in Fortran, but the signature of functions designed for C or Fortran must be respected.

Definition at line 1244 of file declarations2.c.

1245 {
1246  text t = make_text(NIL);
1247  list il = list_undefined;
1248 
1249  pips_assert("m is a module", entity_module_p(m));
1250 
1252 
1253  FOREACH(STATEMENT, is, il) {
1254  /* The previous declaration list is useless in Fortran, but the
1255  signature of functions designed for C or Fortran must be
1256  respected. */
1257  list pdl = NIL;
1260  strdup(statement_comments(is))));
1261  }
1263  gen_free_list(pdl);
1264  }
1265 
1266  return t;
1267 }
static sentence sentence_data_statement(statement is, list *ppdl)
Prettyprint the initializations field of code.
bool empty_comments_p(const char *)
Definition: statement.c:107
#define code_initializations(x)
Definition: ri.h:788
#define statement_comments(x)
Definition: ri.h:2456

References ADD_SENTENCE_TO_TEXT, code_initializations, empty_comments_p(), entity_initial, entity_module_p(), FOREACH, gen_free_list(), is_sentence_formatted, list_undefined, make_sentence(), make_text(), NIL, pips_assert, sentence_data_statement(), sequence_statements, STATEMENT, statement_comments, strdup(), and value_code.

Referenced by ensure_comment_consistency().

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

◆ text_loop()

text text_loop ( entity  module,
const char *  label,
int  margin,
loop  obj,
int  n,
list ppdl,
bool  is_recursive_p 
)

exported for conversion/look_for_nested_loops.c

small hack to show the initial label of the loop to name it...

quite ugly management of other prettyprints...

Parameters
moduleodule
labelabel
marginargin
objbj
ppdlpdl
is_recursive_ps_recursive_p

Definition at line 3264 of file misc.c.

3272 {
3273  text r = make_text(NIL);
3274  statement body = loop_body( obj ) ;
3275  entity the_label = loop_label(obj);
3276  const char* do_label = entity_local_name(the_label)+sizeof(LABEL_PREFIX) -1;
3277  bool structured_do = entity_empty_label_p(the_label);
3278  bool do_enddo_p = get_bool_property("PRETTYPRINT_DO_LABEL_AS_COMMENT");
3279 
3280  /* small hack to show the initial label of the loop to name it...
3281  */
3282  if(!structured_do && do_enddo_p)
3283  {
3285  strdup(concatenate("! INITIALLY: DO ", do_label, "\n", NULL))));
3286  }
3287 
3288  /* quite ugly management of other prettyprints...
3289  */
3290  switch(execution_tag(loop_execution(obj)) ) {
3292  MERGE_TEXTS(r, text_loop_default(module, label, margin, obj, n, ppdl, is_recursive_p));
3293  break ;
3294  case is_execution_parallel:
3295  if (pp_cmf_style_p()) {
3296  text aux_r;
3297  if((aux_r = text_loop_cmf(module, label, margin, obj, n, NIL, NIL))
3298  != text_undefined) {
3299  MERGE_TEXTS(r, aux_r);
3300  }
3301  }
3302  else if (pp_craft_style_p()) {
3303  text aux_r;
3304  if((aux_r = text_loop_craft(module, label, margin, obj, n, NIL, NIL))
3305  != text_undefined) {
3306  MERGE_TEXTS(r, aux_r);
3307  }
3308  }
3309  else if (pp_f90_style_p()) {
3310  instruction bi = statement_instruction(body); // body instruction
3311  bool success_p = false;
3312  if(instruction_assign_p(bi) ) {
3313  MERGE_TEXTS(r, text_loop_90(module, label, margin, obj, n));
3314  success_p = true;
3315  }
3316  else if(instruction_sequence_p(bi)) {
3318  if(gen_length(sl)==1) {
3319  statement ibs = STATEMENT(CAR(sl));
3321  if(instruction_assign_p(ibi) ) {
3322  MERGE_TEXTS(r, text_loop_90(module, label, margin, obj, n));
3323  success_p = true;
3324  }
3325  }
3326  }
3327  if(!success_p) {
3328  MERGE_TEXTS(r, text_loop_default(module, label, margin, obj, n, ppdl, is_recursive_p));
3329  }
3330  }
3331  else {
3332  MERGE_TEXTS(r, text_loop_default(module, label, margin, obj, n, ppdl, is_recursive_p));
3333  }
3334  break ;
3335  default:
3336  pips_internal_error("Unknown \"execution\" tag") ;
3337  }
3338  return r;
3339 }
text text_loop_cmf(entity module, const char *label, int margin, loop obj, int n, list lr, list lidx)
=====================================================================
Definition: cmfortran.c:66
text text_loop_craft(entity module, const char *label, int margin, loop obj, int n, list lr, list lidx)
=====================================================================
Definition: craft.c:92
bool instruction_assign_p(instruction i)
Test if an instruction is an assignment.
Definition: instruction.c:164
#define LABEL_PREFIX
Definition: naming-local.h:31
text text_loop_90(entity module, const char *label, int margin, loop obj, int n)
Generate range subscript for simple loop with only one assignment.
Definition: fortran90.c:77
#define pp_cmf_style_p()
Definition: misc.c:212
#define pp_craft_style_p()
Definition: misc.c:210
#define pp_f90_style_p()
Definition: misc.c:209
text text_loop_default(entity module, const char *label, int margin, loop obj, int n, list *ppdl, bool is_recursive_p)
exported for fortran90.c
Definition: misc.c:3118
bool entity_empty_label_p(entity e)
Definition: entity.c:666
#define execution_tag(x)
Definition: ri.h:1207
#define loop_body(x)
Definition: ri.h:1644
@ is_execution_parallel
Definition: ri.h:1190
@ is_execution_sequential
Definition: ri.h:1189

References ADD_SENTENCE_TO_TEXT, CAR, concatenate(), entity_empty_label_p(), entity_local_name(), execution_tag, gen_length(), get_bool_property(), instruction_assign_p(), instruction_sequence, instruction_sequence_p, is_execution_parallel, is_execution_sequential, is_sentence_formatted, LABEL_PREFIX, loop_body, loop_execution, loop_label, make_sentence(), make_text(), MERGE_TEXTS, module, NIL, pips_internal_error, pp_cmf_style_p, pp_craft_style_p, pp_f90_style_p, sequence_statements, STATEMENT, statement_instruction, strdup(), text_loop_90(), text_loop_cmf(), text_loop_craft(), text_loop_default(), and text_undefined.

Referenced by print_loops_list(), and text_instruction().

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

◆ text_loop_90()

text text_loop_90 ( entity  module,
const char *  label,
int  margin,
loop  obj,
int  n 
)

fortran90.c

fortran90.c

text_loop_90() only is called if the loop is parallel and if its body is a unique assignment statement or a list containing a unique assignment.

statement_ordering must be initialized too to avoid a prettyprinter warning

FI: Although new_s has been converted to text, it cannot always be freed. I do not know which part of new_s is reused in the result of text_statement() or somewhere else... Found with valgrind and validation case Prettyprint/aa01.tpips

No legal vector form has been found

Parameters
moduleodule
labelabel
marginargin
objbj

Definition at line 77 of file fortran90.c.

78 {
79  /* text_loop_90() only is called if the loop is parallel and if its
80  * body is a unique assignment statement or a list containing a
81  * unique assignment.
82  */
85  entity idx = loop_index( obj ) ;
86  range r = loop_range( obj ) ;
87 
88  expression lhs =
90  expression rhs =
94  text t = text_undefined;
95 
96  pips_assert("Loop obj is consistent", loop_consistent_p(obj));
97 
99 
100  new_lhs = expand_expression( lhs, idx, r ) ;
101  new_rhs = expand_expression( rhs, idx, r ) ;
102 
103  pips_assert("new_lhs is consistent", expression_consistent_p(new_lhs));
104  pips_assert("new_rhs is consistent", expression_consistent_p(new_rhs));
105 
106  set_free(vectors);
107 
108  if(!expression_undefined_p(new_lhs) && !expression_undefined_p(new_rhs)) {
109  statement new_s = make_assign_statement( new_lhs, new_rhs );
110 
111  statement_number(new_s) = statement_number(as);
112  /* statement_ordering must be initialized too to avoid a
113  prettyprinter warning */
116  list pdl = NIL;
117  t = text_statement(module, margin, new_s, &pdl);
118  gen_free_list(pdl);
119  /* FI: Although new_s has been converted to text, it cannot
120  always be freed. I do not know which part of new_s is
121  reused in the result of text_statement() or somewhere
122  else... Found with valgrind and validation case
123  Prettyprint/aa01.tpips */
124  //free_statement(new_s);
125  }
126  else {
127  /* No legal vector form has been found */
128  free_expression(new_lhs);
129  free_expression(new_rhs);
130  list pdl = NIL;
131  t = text_loop_default(module, label, margin, obj, n, &pdl, true);
132  gen_free_list(pdl);
133  }
134 
135  pips_assert("Loop obj still is consistent", loop_consistent_p(obj));
136 
137  return t;
138 }
bool expression_consistent_p(expression p)
Definition: ri.c:859
bool loop_consistent_p(loop p)
Definition: ri.c:1274
statement make_assign_statement(expression, expression)
Definition: statement.c:583
@ set_pointer
Definition: newgen_set.h:44
set set_make(set_type)
Create an empty set of any type but hash_private.
Definition: set.c:102
static statement body_to_assignment_statement(statement b)
The tests necessary to check the underlying assumptions have been performed in text_loop(): b is eith...
Definition: fortran90.c:61
#define instruction_call(x)
Definition: ri.h:1529

References body_to_assignment_statement(), call_arguments, CAR, CDR, expand_expression(), EXPRESSION, expression_consistent_p(), expression_undefined, expression_undefined_p, free_expression(), gen_free_list(), instruction_call, loop_body, loop_consistent_p(), loop_index, loop_range, make_assign_statement(), module, NIL, pips_assert, set_free(), set_make(), set_pointer, statement_comments, statement_instruction, statement_number, statement_ordering, text_loop_default(), text_statement(), text_undefined, and vectors.

Referenced by text_loop().

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

◆ text_loop_cmf()

text text_loop_cmf ( entity  module,
const char *  label,
int  margin,
loop  obj,
int  n,
list  lr,
list  lidx 
)

=====================================================================

Parameters
moduleodule
labelabel
marginargin
objbj
lrr
lidxidx

Definition at line 66 of file cmfortran.c.

73 {
74  text result_text = text_undefined;
75  instruction i;
76  entity idx;
77  range r;
78 
80  idx = loop_index(obj);
81  r = loop_range(obj);
82 
83  lr = gen_nconc(lr, CONS(RANGE, r, NIL));
84  lidx = gen_nconc(lidx, CONS(ENTITY, idx, NIL));
85 
86  if(!instruction_assign_p(i)) {
87  if(instruction_loop_p(i)) {
88  result_text = text_loop_cmf(module, label, margin,
89  instruction_loop(i), n, lr, lidx);
90  }
91  }
92  else {
93  list pc, lli, llr;
94  unformatted u;
95 
96  pc = CHAIN_SWORD(NIL, "FORALL(");
97  for(lli = lidx, llr = lr; !ENDP(lli); POP(lli), POP(llr)) {
98  pc = CHAIN_SWORD(pc, entity_local_name(ENTITY(CAR(lli))));
99  pc = CHAIN_SWORD(pc, " = ");
100  pc = gen_nconc(pc, words_cmf_loop_range(RANGE(CAR(llr))));
101  if(CDR(lli) != NIL)
102  pc = CHAIN_SWORD(pc, ", ");
103  }
104  pc = CHAIN_SWORD(pc, ") ");
105  pc = gen_nconc(pc, Words_Call(instruction_call(i), 0, true, true));
106  u = make_unformatted(strdup(label), n, margin, pc) ;
107  result_text = make_text(CONS(SENTENCE,
109  u),
110  NIL));
111  }
112  return(result_text);
113 }
cons * words_cmf_loop_range(range obj)
Prettyprinter for CM FORTRAN loops.
Definition: cmfortran.c:46
list Words_Call(call obj, int precedence, bool leftmost, bool is_a_subroutine)
Definition: misc.c:2597
#define instruction_loop(x)
Definition: ri.h:1520
#define RANGE(x)
RANGE.
Definition: ri.h:2257

References CAR, CDR, CHAIN_SWORD, CONS, ENDP, ENTITY, entity_local_name(), gen_nconc(), instruction_assign_p(), instruction_call, instruction_loop, instruction_loop_p, is_sentence_unformatted, loop_body, loop_index, loop_range, make_sentence(), make_text(), make_unformatted(), module, NIL, POP, RANGE, SENTENCE, statement_instruction, strdup(), text_undefined, Words_Call(), and words_cmf_loop_range().

Referenced by text_loop().

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

◆ text_loop_craft()

text text_loop_craft ( entity  module,
const char *  label,
int  margin,
loop  obj,
int  n,
list  lr,
list  lidx 
)

=====================================================================

Parameters
moduleodule
labelabel
marginargin
objbj
lrr
lidxidx

Definition at line 92 of file craft.c.

99 {
100  text result_text = make_text(NIL);
101  instruction i;
102  entity idx;
103  range r;
104 
106  idx = loop_index(obj);
107  r = loop_range(obj);
108 
109  lr = gen_nconc(lr, CONS(RANGE, r, NIL));
110  lidx = gen_nconc(lidx, CONS(ENTITY, idx, NIL));
111 
112  if(!instruction_assign_p(i)) {
113  if(instruction_loop_p(i)) {
114  result_text = text_loop_craft(module, label, margin,
115  instruction_loop(i), n, lr, lidx);
116  }
117  }
118  else {
119  list pc, lli, llr, args, new_lli = NIL;
120  unformatted u;
121  int c;
122  char *comment;
124  syntax lhs_sy;
125 
126  args = call_arguments(instruction_call(i));
127  if(!ENDP(args))
128  lhs_exp = copy_expression(EXPRESSION(CAR(args)));
129  else
130  user_error("text_loop_craft",
131  "Call to an assign with no argument\n");
132 
133  lhs_sy = expression_syntax(lhs_exp);
134  if(syntax_tag(lhs_sy) != is_syntax_reference)
135  user_error("text_loop_craft", "\n An lhs expression not a ref\n");
136  else {
137  lli = reference_indices(syntax_reference(lhs_sy));
138  for(; !ENDP(lli); POP(lli)) {
139  new_lli = gen_nconc(new_lli, CONS(EXPRESSION,
141  NIL));
142  }
143  reference_indices(syntax_reference(lhs_sy)) = new_lli;
144  }
145 
146  // BUG: missing overflow checks
147  comment = (char*) malloc(64);
148  char * x = comment;
149  x += sprintf(comment, "CDIR$ DOSHARED(");
150  for(lli = lidx; !ENDP(lli); POP(lli)) {
151  x += sprintf(x, "%s", entity_local_name(ENTITY(CAR(lli))));
152  if(CDR(lli) != NIL)
153  x += sprintf(x, ", ");
154  }
155  list pdl = NIL;
156  x += sprintf(x, ") ON %s\n", words_to_string(words_expression(lhs_exp, &pdl)));
157  gen_free_list(pdl);
159  comment));
160 
161  for(lli = lidx, llr = lr, c = 0; !ENDP(lli); POP(lli), POP(llr), c++) {
162  pc = CHAIN_SWORD(NIL, "DO " );
163  pc = CHAIN_SWORD(pc, entity_local_name(ENTITY(CAR(lli))));
164  pc = CHAIN_SWORD(pc, " = ");
165  pc = gen_nconc(pc, words_loop_range(RANGE(CAR(llr)), &pdl));
166  gen_free_list(pdl);
167  u = make_unformatted(strdup(label), n,
168  margin+c*INDENTATION, pc);
169  ADD_SENTENCE_TO_TEXT(result_text,
171  }
172  MERGE_TEXTS(result_text, text_statement(module, margin+c*INDENTATION,
173  loop_body(obj), &pdl));
174  gen_free_list(pdl);
175 
176  for(c = gen_length(lidx)-1; c > -1; c--) {
177  ADD_SENTENCE_TO_TEXT(result_text,
179  "ENDDO"));
180  }
181  }
182  return(result_text);
183 }
expression remove_modulo(expression exp)
=====================================================================
Definition: craft.c:83
void * malloc(YYSIZE_T)
#define user_error(fn,...)
Definition: misc-local.h:265
list words_loop_range(range obj, list *ppdl)
exported for craft
Definition: misc.c:434

References ADD_SENTENCE_TO_TEXT, call_arguments, CAR, CDR, CHAIN_SWORD, comment(), CONS, copy_expression(), ENDP, ENTITY, entity_local_name(), EXPRESSION, expression_syntax, expression_undefined, gen_free_list(), gen_length(), gen_nconc(), INDENTATION, instruction_assign_p(), instruction_call, instruction_loop, instruction_loop_p, is_sentence_formatted, is_sentence_unformatted, is_syntax_reference, loop_body, loop_index, loop_range, MAKE_ONE_WORD_SENTENCE, make_sentence(), make_text(), make_unformatted(), malloc(), MERGE_TEXTS, module, NIL, POP, RANGE, reference_indices, remove_modulo(), statement_instruction, strdup(), syntax_reference, syntax_tag, text_statement(), user_error, words_expression(), words_loop_range(), words_to_string(), and x.

Referenced by text_loop().

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

◆ text_loop_default()

text text_loop_default ( entity  module,
const char *  label,
int  margin,
loop  obj,
int  n,
list ppdl,
bool  is_recursive_p 
)

exported for fortran90.c

HPF directives before the loop if required (INDEPENDENT and NEW)

idem if Open MP directives are required

LOOP prologue.

builds the PRIVATE scalar declaration if required

of string

local_var is a global variable which is exploited later...

FI: I do not understand why the local declarations were not added right away. I hope my change (simplification) does not break something else that is not tested by our non-regression suite.

loop BODY

LOOP postlogue

Parameters
moduleodule
labelabel
marginargin
objbj
ppdlpdl
is_recursive_ps_recursive_p

Definition at line 3118 of file misc.c.

3124  {
3125  list pc = NIL;
3126  sentence first_sentence = sentence_undefined;
3127  unformatted u;
3128  text r = make_text(NIL);
3129  statement body = loop_body( obj );
3130  entity the_label = loop_label(obj);
3131  const char* do_label = entity_local_name(the_label) + sizeof(LABEL_PREFIX) -1;
3132  bool structured_do = entity_empty_label_p(the_label);
3133  bool doall_loop_p = false;
3134  bool hpf_prettyprint = pp_hpf_style_p();
3135  bool do_enddo_p = get_bool_property("PRETTYPRINT_DO_LABEL_AS_COMMENT");
3136  bool all_private = get_bool_property("PRETTYPRINT_ALL_PRIVATE_VARIABLES");
3137  bool braces_p = !one_liner_p(body) || prettyprint_all_c_braces_p;
3138 
3140  doall_loop_p = false;
3141  } else {
3142  doall_loop_p = pp_doall_style_p();
3143  }
3144 
3145  /* HPF directives before the loop if required (INDEPENDENT and NEW) */
3146  if (hpf_prettyprint)
3147  MERGE_TEXTS(r, text_hpf_directive(obj, margin));
3148  /* idem if Open MP directives are required */
3149  if (pp_omp_style_p())
3150  MERGE_TEXTS(r, text_omp_directive(obj, margin));
3151 
3152  /* LOOP prologue.
3153  */
3154  switch (get_prettyprint_language_tag()) {
3155  case is_language_fortran:
3156  case is_language_fortran95:
3157  pc = CHAIN_SWORD(NIL, (doall_loop_p) ? "DOALL " : "DO " );
3158  if (!structured_do && !doall_loop_p && !do_enddo_p) {
3159  pc = CHAIN_SWORD(pc, concatenate(do_label, " ", NULL));
3160  }
3161  break;
3162  case is_language_c:
3163  pc = CHAIN_SWORD(NIL, (doall_loop_p) ? "forall(" : "for(" );
3164  break;
3165  default:
3166  pips_internal_error("Language unknown !");
3167  break;
3168  }
3169 
3170  //pc = CHAIN_SWORD(pc, entity_local_name(loop_index(obj)));
3171  pc = CHAIN_SWORD(pc, entity_user_name(loop_index(obj)));
3172  pc = CHAIN_SWORD(pc, " = ");
3173 
3174  switch (get_prettyprint_language_tag()) {
3175  case is_language_fortran:
3176  case is_language_fortran95:
3177  pc = gen_nconc(pc, words_loop_range(loop_range(obj), ppdl));
3178  u = make_unformatted(strdup(label), n, margin, pc);
3179  ADD_SENTENCE_TO_TEXT(r, first_sentence =
3181  break;
3182  case is_language_c:
3183  pc = gen_nconc(pc, C_loop_range(loop_range(obj), loop_index(obj), ppdl));
3184  if (braces_p)
3185  pc = CHAIN_SWORD(pc," {");
3186  if ((label != NULL) && (label[0] != '\0')) {
3187  pips_debug(9, "the label %s need to be print for a for C loop", label);
3188  u = make_unformatted(strdup(label), 0, 0, NULL);
3189  ADD_SENTENCE_TO_TEXT(r, first_sentence =
3191  }
3192  u = make_unformatted(NULL, n, margin, pc);
3194  break;
3195  default:
3196  pips_internal_error("Language tag unknown!");
3197  break;
3198  }
3199 
3200  if(is_recursive_p) {
3201  /* builds the PRIVATE scalar declaration if required
3202  */
3203  if (!ENDP(loop_locals(obj)) && (doall_loop_p || all_private)
3204  && !hpf_prettyprint) {
3205  list /* of string */lp = loop_private_variables(obj, ppdl);
3206 
3207  // initialize the local variable text if needed
3208  if ((local_flg == false) && (lp)) {
3209  local_flg = true;
3210  local_var = make_text(NIL);
3211  }
3212 
3213  if (lp)
3214  /* local_var is a global variable which is exploited
3215  later... */
3216  /* FI: I do not understand why the local declarations were
3217  not added right away. I hope my change (simplification)
3218  does not break something else that is not tested by our
3219  non-regression suite. */
3220  if (!pp_omp_style_p()) {
3222  // ( local_var,
3223  ( r,
3225  make_unformatted(NULL, 0, margin+INDENTATION, lp)));
3226  }
3227  }
3228 
3229  /* loop BODY
3230  */
3232  margin+INDENTATION,
3233  body,
3234  !one_liner_p(body),
3235  !one_liner_p(body),
3236  ppdl));
3237 
3238  /* LOOP postlogue
3239  */
3240  switch (get_prettyprint_language_tag()) {
3241  case is_language_fortran:
3242  case is_language_fortran95:
3243  if (structured_do || doall_loop_p || do_enddo_p || pp_cray_style_p()
3244  || pp_craft_style_p() || pp_cmf_style_p()) {
3245  ADD_SENTENCE_TO_TEXT(r, MAKE_ONE_WORD_SENTENCE(margin,"ENDDO"));
3246  }
3247  break;
3248  case is_language_c:
3249  if (braces_p)
3251  break;
3252  default:
3253  pips_internal_error("Language unknown !");
3254  break;
3255  }
3256 
3257  attach_loop_to_sentence_up_to_end_of_text(first_sentence, r, obj);
3258  }
3259 
3260  return r;
3261 }
void attach_loop_to_sentence_up_to_end_of_text(sentence s, text t, loop l)
The user interface:
list C_loop_range(range obj, entity i, list *ppdl)
Output a Fortan-like do-loop range as a C-like for-loop index part.
Definition: misc.c:457
static text text_hpf_directive(loop l, int m)
Definition: misc.c:3066
#define pp_cray_style_p()
Definition: misc.c:211
#define pp_doall_style_p()
Definition: misc.c:213
static list loop_private_variables(loop obj, list *ppdl)
of string
Definition: misc.c:2906
static text local_var
Definition: misc.c:356
#define pp_hpf_style_p()
Definition: misc.c:208
static bool local_flg
Definition: misc.c:357
text text_omp_directive(loop l, int m)
Definition: misc.c:3084
#define pp_omp_style_p()
Definition: misc.c:215
static bool prettyprint_all_c_braces_p
This variable is used to print braces around all blocks including blocks with only one statement.
Definition: misc.c:197
text text_statement_enclosed(entity, int, statement, bool, bool, list *)

References ADD_SENTENCE_TO_TEXT, attach_loop_to_sentence_up_to_end_of_text(), C_loop_range(), CHAIN_SWORD, concatenate(), ENDP, entity_empty_label_p(), entity_local_name(), entity_user_name(), execution_sequential_p, gen_nconc(), get_bool_property(), get_prettyprint_language_tag(), INDENTATION, is_language_c, is_language_fortran, is_language_fortran95, is_sentence_unformatted, LABEL_PREFIX, local_flg, local_var, loop_body, loop_execution, loop_index, loop_label, loop_locals, loop_private_variables(), loop_range, MAKE_ONE_WORD_SENTENCE, make_sentence(), make_text(), make_unformatted(), MERGE_TEXTS, module, NIL, one_liner_p(), pips_debug, pips_internal_error, pp_cmf_style_p, pp_craft_style_p, pp_cray_style_p, pp_doall_style_p, pp_hpf_style_p, pp_omp_style_p, prettyprint_all_c_braces_p, sentence_undefined, strdup(), text_hpf_directive(), text_omp_directive(), text_statement_enclosed(), and words_loop_range().

Referenced by text_loop(), and text_loop_90().

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

◆ text_module()

◆ text_named_module()

◆ text_omp_directive()

text text_omp_directive ( loop  l,
int  m 
)

Definition at line 3084 of file misc.c.

3085 {
3086  list pdl = NIL; // pdl is useless in Fortran
3087  text t = text_undefined;
3088 
3089  switch(get_prettyprint_language_tag()) {
3090  case is_language_fortran:
3091  case is_language_fortran95:
3092  t = text_directive(l,
3093  m,
3094  "\n" OMP_DIRECTIVE,
3097  &pdl);
3098  break;
3099  case is_language_c:
3100  // text_directive function takes care of private variables
3101  // More should be done to take care of shared variables, reductions
3102  // and other specific omp clause like lastprivate, copyin ...
3103  t = text_directive(l,
3104  m,
3108  &pdl);
3109  break;
3110  default:
3111  pips_internal_error("Language unknown !");
3112  break;
3113  }
3114  return t;
3115 }
#define OMP_CONTINUATION
Definition: misc.c:3076
static text text_directive(loop obj, int margin, string basic_directive, string basic_continuation, string parallel, list *ppdl)
Definition: misc.c:3005
#define OMP_C_CONTINUATION
Definition: misc.c:3080
#define OMP_C_DIRECTIVE
Definition: misc.c:3079
#define OMP_PARALLELDO
Definition: misc.c:3077
#define OMP_C_PARALLELDO
Definition: misc.c:3081
#define OMP_DIRECTIVE
Definition: misc.c:3075

References get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, NIL, OMP_C_CONTINUATION, OMP_C_DIRECTIVE, OMP_C_PARALLELDO, OMP_CONTINUATION, OMP_DIRECTIVE, OMP_PARALLELDO, pips_internal_error, text_directive(), and text_undefined.

Referenced by text_loop_default().

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

◆ Text_Proper_Statement()

text Text_Proper_Statement ( entity  ,
int  ,
statement   
)

Referenced by ensure_comment_consistency().

+ Here is the caller graph for this function:

◆ Text_Statement()

text Text_Statement ( entity  ,
int  ,
statement   
)

◆ text_statement()

◆ Text_Statement_Enclosed()

text Text_Statement_Enclosed ( entity  ,
int  ,
statement  ,
bool  ,
bool   
)

Referenced by ensure_comment_consistency().

+ Here is the caller graph for this function:

◆ text_statement_enclosed()

text text_statement_enclosed ( entity  ,
int  ,
statement  ,
bool  ,
bool  ,
list  
)

◆ text_unstructured()

text text_unstructured ( entity  module,
const char *  label,
int  margin,
unstructured  u,
int  num,
list ppdl 
)

unstructured.c

build an arbitrary reverse trail of control nodes

decorate control nodes with labels when necessary

generate text with labels and goto's

Parameters
moduleodule
labelabel
marginargin
numum
ppdlpdl

Definition at line 55 of file unstructured.c.

61 {
62  text r = make_text(NIL);
64 
65  debug(2, "text_unstructured", "Begin for unstructured %p\n", u);
66 
67  ifdebug(3) {
68  list blocks = NIL;
69  control cexit = unstructured_exit(u) ;
70  control centry = unstructured_control(u) ;
71 
72  fprintf(stderr,"Unstructured %p (%p, %p)\n", u, centry, cexit) ;
73  CONTROL_MAP( n, {
75 
76  /*
77  fprintf(stderr, "\n%*sNode %p (%s)\n--\n", margin, "",
78  (unsigned int) n, control_to_label_name(n, labels)) ;
79  */
80  fprintf(stderr, "\n%*sNode %p (%s)\n--\n", margin, "",
82  ifdebug(9) {
83  list pdl = NIL;
84  print_text(stderr, text_statement(module,margin,st,&pdl));
85  gen_free_list(pdl);
86  }
87  fprintf(stderr, "--\n%*sPreds:", margin, "");
88  MAPL(ps,{
90  fprintf(stderr,"%p (%d,%d), ", CONTROL(CAR(ps)),
92  }, control_predecessors(n));
93  fprintf(stderr, "\n%*sSuccs:", margin, "") ;
94  MAPL(ss,{
96  fprintf(stderr,"%p (%d,%d), ", CONTROL(CAR(ss)),
98  }, control_successors(n));
99  fprintf(stderr, "\n\n") ;
100  }, centry , blocks) ;
102  }
103 
104  if (get_bool_property("PRETTYPRINT_UNSTRUCTURED_AS_A_GRAPH"))
105  {
107  (r, module, label, margin, u, num);
108  }
109  else {
110  list trail = NIL;
111 
112  if(get_bool_property("PRETTYPRINT_UNSTRUCTURED")) {
113  list pbeg = CHAIN_SWORD(NIL, "BEGIN UNSTRUCTURED");
115 
118  }
119 
120  /* build an arbitrary reverse trail of control nodes */
121  trail = unstructured_to_trail(u);
122  debug(3, "text_unstructured", "Trail length: %d\n", gen_length(trail));
123 
124  trail = gen_nreverse(trail);
125 
126  ifdebug(3)
127  dump_trail(trail);
128 
129  /* decorate control nodes with labels when necessary */
130  decorate_trail(module, trail, labels);
131 
132  ifdebug(3)
134 
135  /* generate text with labels and goto's */
136 
137  MERGE_TEXTS(r, text_trail(module, margin, trail, labels, ppdl));
138 
139  if(get_bool_property("PRETTYPRINT_UNSTRUCTURED")) {
140  list pend = CHAIN_SWORD(NIL, "END UNSTRUCTURED");
144  }
145  gen_free_list(trail);
146  }
147 
148  hash_table_free(labels) ;
149 
150  debug(2, "text_unstructured", "End for unstructured %p\n", u);
151 
152  return(r) ;
153 }
static int num
Definition: bourdoncle.c:137
static list blocks
lisp of loops
if(!(yy_init))
Definition: genread_lex.c:1029
#define CONTROL_MAP(ctl, code, c, list)
Macro to walk through all the controls reachable from a given control node of an unstructured.
hash_table hash_table_make(hash_key_type key_type, size_t size)
Definition: hash.c:294
void hash_table_free(hash_table htp)
this function deletes a hash table that is no longer useful.
Definition: hash.c:327
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189
@ hash_pointer
Definition: newgen_hash.h:32
static text text_trail(entity module, int margin, list trail, hash_table labels, list *ppdl)
Definition: unstructured.c:513
void dump_trail(list trail)
Definition: unstructured.c:263
void dump_control_to_label_name(hash_table h)
Definition: unstructured.c:500
list unstructured_to_trail(unstructured u)
Definition: unstructured.c:240
static void decorate_trail(entity module, list trail, hash_table labels)
Definition: unstructured.c:290
void output_a_graph_view_of_the_unstructured(text, entity, const char *, int, unstructured, int)
#define unstructured_control
After the modification in Newgen: unstructured = entry:control x exit:control we have create a macro ...
#define control_predecessors(x)
Definition: ri.h:943
#define control_successors(x)
Definition: ri.h:945
#define unstructured_exit(x)
Definition: ri.h:3006

References ADD_SENTENCE_TO_TEXT, blocks, CAR, CHAIN_SWORD, CONTROL, CONTROL_MAP, control_predecessors, control_statement, control_successors, debug(), decorate_trail(), dump_control_to_label_name(), dump_trail(), fprintf(), gen_free_list(), gen_length(), gen_nreverse(), get_bool_property(), get_comment_sentinel(), hash_pointer, hash_table_free(), hash_table_make(), ifdebug, is_sentence_unformatted, make_sentence(), make_text(), make_unformatted(), MAPL, MERGE_TEXTS, module, NIL, num, ORDERING_NUMBER, ORDERING_STATEMENT, output_a_graph_view_of_the_unstructured(), print_text(), statement_identification(), statement_ordering, strdup(), text_statement(), text_trail(), unstructured_control, unstructured_exit, and unstructured_to_trail().

Referenced by text_instruction().

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

◆ type_to_full_string_definition()

string type_to_full_string_definition ( type  t)

type.c

type.c

FI: I am not sure about the language used.

Definition at line 45 of file type.c.

46 {
47  debug_on("PRETTYPRINT_DEBUG_LEVEL");
48  list pdl = NIL;
49  string s = words_to_string(words_type(t, &pdl, false));
50  gen_free_list(pdl);
51  debug_off();
52  return s;
53 }

References debug_off, debug_on, gen_free_list(), NIL, words_to_string(), and words_type().

Referenced by adapt_reference_to_type(), add_sizeof_value(), filter_formal_context_according_to_actual_context(), find_kth_points_to_node_in_points_to_path(), intrinsic_call_to_points_to(), new_filter_formal_context_according_to_actual_context(), pips_user_value_name(), print_value_mappings(), type_compatible_super_cell(), type_compatible_with_points_to_cell_p(), and type_to_sizeof_value().

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

◆ unstructured_to_trail()

list unstructured_to_trail ( unstructured  u)

The exit node must be first (i.e. last) to reach the continuation of the unstructured, or never reached (e.g. because the program loops forever or stops in the unstructured).

Definition at line 240 of file unstructured.c.

241 {
242  list trail = NIL;
243  control centry = unstructured_control(u) ;
244  control cexit = unstructured_exit(u) ;
245 
246  trail = build_trail(trail, centry);
247 
248  /* The exit node *must* be first (i.e. last) to reach the continuation
249  * of the unstructured, or never reached (e.g. because the program loops
250  * forever or stops in the unstructured).
251  */
252  if(control_in_trail_p(trail, cexit)) {
253  if(cexit!=CONTROL(CAR(trail))) {
254  gen_remove(&trail, cexit);
255  trail = CONS(CONTROL, cexit, trail);
256  }
257  }
258 
259  return trail;
260 }
void gen_remove(list *cpp, const void *o)
remove all occurences of item o from list *cpp, which is thus modified.
Definition: list.c:685
static list build_trail(list l, control c)
Any heuristics can be used to build the trail, depth or width first, true or false branch first,...
Definition: unstructured.c:167
static bool control_in_trail_p(list l, control c)
OK, a hash table could be used, as Pierre used too...
Definition: unstructured.c:283

References build_trail(), CAR, CONS, CONTROL, control_in_trail_p(), gen_remove(), NIL, unstructured_control, and unstructured_exit.

Referenced by c_unstructured(), ensure_comment_consistency(), last_statement(), new_points_to_unstructured(), and text_unstructured().

+ Here is the call graph for this function:
+ Here is the caller 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.

◆ words_any_reference()

list words_any_reference ( reference  ,
list ,
const char *  *)(entity 
)

◆ Words_Any_Reference()

list Words_Any_Reference ( reference  ,
list  ,
const char *  *)(entity 
)

◆ words_basic()

list words_basic ( basic  obj,
list ppdl 
)

what about simple DOUBLE PRECISION, REAL, INTEGER...

This may happen in debugging statements

if(basic_int(obj)==4) { pc = CHAIN_SWORD(pc,"INTEGER"); } else {

FI: Use "bool" of stdbool.h instead of "int" but it leads to include issue for generated code; avoid stdbool.h and use "_Bool" directly but it leads to infinite loop from "_Bool" to "_Bool" because "_Bool" is declared as a typedef in anr999

should be a user error? Or simply bootstrap.c is not accurate?

ignore if it is signed or unsigned

The following code maybe redundant, because of tests in c_words_entity

This may occur in the parser when a variable is used before it is fully defined (see ptr in decl42.c)

FI: This space may not be always useful

Parameters
objbj
ppdlpdl

Definition at line 323 of file declarations.c.

324 {
325  list pc = NIL;
326 
327  if ( basic_undefined_p(obj) ) {
328  /* This may happen in debugging statements */
329  pc = CHAIN_SWORD(pc,"undefined");
330  } else {
331  switch ( basic_tag(obj) ) {
332  case is_basic_int: {
333  switch(get_prettyprint_language_tag()) {
334  case is_language_fortran:
336 /* if(basic_int(obj)==4) {
337  pc = CHAIN_SWORD(pc,"INTEGER");
338  } else { */
339  pc = CHAIN_SWORD(pc,"INTEGER*");
340  pc = CHAIN_IWORD(pc,basic_int(obj));
341 // }
342  break;
343  case is_language_c:
344  {
345  string pn;
346  switch (basic_int(obj)) {
347  // FC: if the numbering was nice, it could use an array...
348  case 1: pn = "PRETTYPRINT_C_CHAR_TYPE";
349  break;
350  case 2: pn = "PRETTYPRINT_C_SHORT_TYPE";
351  break;
352  case 4: pn = "PRETTYPRINT_C_INT_TYPE";
353  break;
354  case 6: pn = "PRETTYPRINT_C_LONG_TYPE";
355  break;
356  case 8: pn = "PRETTYPRINT_C_LONGLONG_TYPE";
357  break;
358  case 9: pn = "PRETTYPRINT_C_INT128_TYPE";
359  break;
360  case 11: pn = "PRETTYPRINT_C_UCHAR_TYPE";
361  break;
362  case 12: pn = "PRETTYPRINT_C_USHORT_TYPE";
363  break;
364  case 14: pn = "PRETTYPRINT_C_UINT_TYPE";
365  break;
366  case 16: pn = "PRETTYPRINT_C_ULONG_TYPE";
367  break;
368  case 18: pn = "PRETTYPRINT_C_ULONGLONG_TYPE";
369  break;
370  case 19: pn = "PRETTYPRINT_C_UINT128_TYPE";
371  break;
372  case 21: pn = "PRETTYPRINT_C_SCHAR_TYPE";
373  break;
374  case 22: pn = "PRETTYPRINT_C_SSHORT_TYPE";
375  break;
376  case 24: pn = "PRETTYPRINT_C_SINT_TYPE";
377  break;
378  case 26: pn = "PRETTYPRINT_C_SLONG_TYPE";
379  break;
380  case 28: pn = "PRETTYPRINT_C_SLONGLONG_TYPE";
381  break;
382  default:
383  pips_internal_error("Unexpected int number %d\n", basic_int(obj));
384  }
385  pc = CHAIN_SWORD(pc, get_string_property(pn));
386  break;
387  }
388  default:
389  pips_internal_error("Language unknown !");
390  break;
391  }
392  break;
393  }
394  case is_basic_float: {
395  switch(get_prettyprint_language_tag()) {
396  case is_language_fortran:
398  pc = CHAIN_SWORD(pc,"REAL*");
399  pc = CHAIN_IWORD(pc,basic_float(obj));
400  break;
401  case is_language_c:
402  switch ( basic_float(obj) ) {
403  case 4:
404  pc = CHAIN_SWORD(pc,"float");
405  break;
406  case 8:
407  pc = CHAIN_SWORD(pc,"double");
408  break;
409  case 16:
410  pc = CHAIN_SWORD(pc,"long double");
411  break;
412  }
413  break;
414  default:
415  pips_internal_error("Language unknown !");
416  break;
417  }
418  break;
419  }
420  case is_basic_logical: {
421  switch(get_prettyprint_language_tag()) {
422  case is_language_fortran:
423  pc = CHAIN_SWORD(pc,"LOGICAL*");
424  pc = CHAIN_IWORD(pc,basic_logical(obj));
425  break;
426  case is_language_c:
427  pc = CHAIN_SWORD(pc,"int"); /* FI: Use "bool" of stdbool.h instead
428  of "int" but it leads to
429  include issue for
430  generated code; avoid stdbool.h
431  and use "_Bool" directly
432  but it leads to infinite
433  loop from "_Bool" to
434  "_Bool" because "_Bool"
435  is declared as a typedef
436  in anr999 */
437  break;
439  pips_internal_error("Need to update F95 case");
440  break;
441  default:
442  pips_internal_error("Language unknown !");
443  break;
444  }
445  break;
446  }
447  case is_basic_overloaded: {
448  /* should be a user error? Or simply bootstrap.c is not accurate? */
449  switch(get_prettyprint_language_tag()) {
450  case is_language_fortran:
451  pc = CHAIN_SWORD(pc,"OVERLOADED");
452  break;
453  case is_language_c:
454  pc = CHAIN_SWORD(pc,"overloaded");
455  break;
457  pips_internal_error("Need to update F95 case");
458  break;
459  default:
460  pips_internal_error("Language unknown !");
461  break;
462  }
463  break;
464  }
465  case is_basic_complex: {
466  switch(get_prettyprint_language_tag()) {
467  case is_language_fortran:
469  pc = CHAIN_SWORD(pc,"COMPLEX*");
470  pc = CHAIN_IWORD(pc,basic_complex(obj));
471  break;
472  case is_language_c:
473  switch ( basic_complex(obj) ) {
474  case 8:
475  pc = CHAIN_SWORD(pc,"_Complex");
476  break;
477  case 9:
478  pc = CHAIN_SWORD(pc,"float _Complex");
479  break;
480  case 16:
481  pc = CHAIN_SWORD(pc,"double _Complex");
482  break;
483  case 32:
484  pc = CHAIN_SWORD(pc,"long double _Complex");
485  break;
486  default:
487  pips_internal_error("Unexpected complex size");
488  }
489  break;
490  default:
491  pips_internal_error("Language unknown !");
492  break;
493  }
494  break;
495  }
496  case is_basic_string: {
497  switch(get_prettyprint_language_tag()) {
498  case is_language_fortran:
499  pc = CHAIN_SWORD(pc,"CHARACTER*");
500  pc = gen_nconc( pc, words_value( basic_string(obj) ) );
501  break;
502  case is_language_c:
503  pc = CHAIN_SWORD(pc,"char *"); // FI: should it be char[]?
504  break;
506  pips_internal_error("Need to update F95 case");
507  break;
508  default:
509  pips_internal_error("Language unknown !");
510  break;
511  }
512  break;
513  }
514  case is_basic_bit: {
515  symbolic bs = basic_bit(obj);
516  int i = constant_int(symbolic_constant(bs));
517  pips_debug(7,"Bit field basic: %d\n",i);
518  pc = CHAIN_SWORD(pc,"int"); /* ignore if it is signed or unsigned */
519  break;
520  }
521  /* The following code maybe redundant, because of tests in c_words_entity*/
522  case is_basic_pointer: {
523  type t = basic_pointer(obj);
524  pips_debug(7,"Basic pointer\n");
525  if ( type_undefined_p(t) ) {
526  /* This may occur in the parser when a variable is used
527  before it is fully defined (see ptr in decl42.c) */
528  pc = CHAIN_SWORD(pc,"type_undefined *");
529  } else {
530  pc = gen_nconc( pc, words_type( t, ppdl, false ) );
531  pc = CHAIN_SWORD(pc," *");
532  }
533  break;
534  }
535  case is_basic_derived: {
536  entity ent = basic_derived(obj);
537  const char* name = entity_user_name( ent );
538  const char* lname = entity_local_name( ent );
539  type t = entity_type(ent);
540 
541  if ( strstr( lname, STRUCT_PREFIX DUMMY_STRUCT_PREFIX ) == NULL
542  && strstr( lname, UNION_PREFIX DUMMY_UNION_PREFIX ) == NULL
543  && strstr( lname, ENUM_PREFIX DUMMY_ENUM_PREFIX ) == NULL ) {
544  pc = gen_nconc( pc, words_type( t, ppdl, false ) );
545  pc = CHAIN_SWORD(pc," ");
546  pc = CHAIN_SWORD(pc,name);
547  pc = CHAIN_SWORD(pc," "); /* FI: This space may not be always useful */
548  } else {
549  pc = gen_nconc( pc, c_words_entity( t, NIL, ppdl ) );
550  }
551  break;
552  }
553  case is_basic_typedef: {
554  entity ent = basic_typedef(obj);
555  pc = CHAIN_SWORD(pc,entity_user_name(ent));
556  break;
557  }
558  default:
559  pips_internal_error("unexpected basic tag %d", basic_tag(obj));
560  }
561  }
562  return(pc);
563 }
static list words_value(value obj)
Definition: declarations.c:74
@ is_basic_derived
Definition: ri.h:579
@ is_basic_string
Definition: ri.h:576
@ is_basic_float
Definition: ri.h:572
@ is_basic_bit
Definition: ri.h:577
@ is_basic_pointer
Definition: ri.h:578
@ is_basic_overloaded
Definition: ri.h:574
@ is_basic_int
Definition: ri.h:571
@ is_basic_logical
Definition: ri.h:573
@ is_basic_typedef
Definition: ri.h:580
@ is_basic_complex
Definition: ri.h:575
#define basic_int(x)
Definition: ri.h:616
#define basic_tag(x)
Definition: ri.h:613
#define basic_undefined_p(x)
Definition: ri.h:557
#define basic_logical(x)
Definition: ri.h:622
#define basic_float(x)
Definition: ri.h:619
#define basic_complex(x)
Definition: ri.h:628
#define basic_string(x)
Definition: ri.h:631
#define CHAIN_IWORD(l, i)

References basic_bit, basic_complex, basic_derived, basic_float, basic_int, basic_logical, basic_pointer, basic_string, basic_tag, basic_typedef, basic_undefined_p, c_words_entity(), CHAIN_IWORD, CHAIN_SWORD, constant_int, DUMMY_ENUM_PREFIX, DUMMY_STRUCT_PREFIX, DUMMY_UNION_PREFIX, entity_local_name(), entity_type, entity_user_name(), ENUM_PREFIX, gen_nconc(), get_prettyprint_language_tag(), get_string_property(), is_basic_bit, is_basic_complex, is_basic_derived, is_basic_float, is_basic_int, is_basic_logical, is_basic_overloaded, is_basic_pointer, is_basic_string, is_basic_typedef, is_language_c, is_language_fortran, is_language_fortran95, lname(), NIL, pips_debug, pips_internal_error, STRUCT_PREFIX, symbolic_constant, type_undefined_p, UNION_PREFIX, words_type(), and words_value().

Referenced by basic_to_string(), find_or_create_allocatable_struct(), sentence_head(), sentence_variable(), and words_type().

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

◆ words_brace_expression()

list words_brace_expression ( expression  exp,
list ppdl 
)
Parameters
expxp
ppdlpdl

Definition at line 910 of file declarations.c.

911 {
912  list pc = NIL;
914  bool first = true;
915  bool space_p = get_bool_property("PRETTYPRINT_LISTS_WITH_SPACES");
916 
917  pc = CHAIN_SWORD(pc,"{");
918  MAP(EXPRESSION,e,
919  {
920  if (!first)
921  pc = CHAIN_SWORD(pc, space_p? ", " : ",");
922  if (c_brace_expression_p(e))
923  pc = gen_nconc(pc,words_brace_expression(e, ppdl));
924  else
925  pc = gen_nconc(pc,words_expression(e, ppdl));
926  first = false;
927  },args);
928  pc = CHAIN_SWORD(pc,"}");
929  return pc;
930 }
list words_brace_expression(expression exp, list *ppdl)
Definition: declarations.c:910
bool c_brace_expression_p(expression e)
Definition: declarations.c:898

References c_brace_expression_p(), call_arguments, CHAIN_SWORD, exp, EXPRESSION, expression_syntax, gen_nconc(), get_bool_property(), MAP, NIL, syntax_call, and words_expression().

Referenced by words_brace_op(), and words_variable_or_function().

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

◆ Words_Call()

list Words_Call ( call  obj,
int  precedence,
bool  leftmost,
bool  is_a_subroutine 
)
Parameters
objbj
precedencerecedence
leftmosteftmost
is_a_subroutines_a_subroutine

Definition at line 2597 of file misc.c.

2602 {
2603  list npdl = NIL;
2604  list pc = words_call(obj, precedence, leftmost, is_a_subroutine, &npdl);
2605  gen_free_list(npdl);
2606  return pc;
2607 }
list words_call(call obj, int precedence, bool leftmost, bool is_a_subroutine, list *ppdl)
exported for cmfortran.c
Definition: misc.c:2575

References gen_free_list(), NIL, and words_call().

Referenced by defs_elim_of_assign_call(), do_simdizer_init(), io_filter(), and text_loop_cmf().

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

◆ words_call()

list words_call ( call  obj,
int  precedence,
bool  leftmost,
bool  is_a_subroutine,
list ppdl 
)

exported for cmfortran.c

Parameters
objbj
precedencerecedence
leftmosteftmost
is_a_subroutines_a_subroutine
ppdlpdl

Definition at line 2575 of file misc.c.

2581 {
2582  list pc;
2583  entity f = call_function(obj);
2584  value i = entity_initial(f);
2585 
2586  if(value_intrinsic_p(i)) {
2587  int effective_precedence = (precedence_p||precedence<=1)?
2588  precedence : MAXIMAL_PRECEDENCE;
2589 
2590  pc = words_intrinsic_call(obj, effective_precedence, leftmost, ppdl);
2591  }
2592  else
2593  pc = words_genuine_regular_call(obj, is_a_subroutine, ppdl);
2594  return pc;
2595 }
static bool precedence_p
This variable is used to disable the precedence system and hence to prettyprint all parentheses,...
Definition: misc.c:194
static list words_intrinsic_call(call obj, int precedence, bool leftmost, list *ppdl)
Definition: misc.c:2525
#define MAXIMAL_PRECEDENCE
lint
Definition: misc.c:138
static list words_genuine_regular_call(call obj, bool is_a_subroutine, list *ppdl)
To deal with attachment on user module usage.
Definition: misc.c:1090
#define value_intrinsic_p(x)
Definition: ri.h:3074

References call_function, entity_initial, f(), MAXIMAL_PRECEDENCE, precedence_p, value_intrinsic_p, words_genuine_regular_call(), and words_intrinsic_call().

Referenced by text_instruction(), text_logical_if(), Words_Call(), words_subexpression(), and words_syntax().

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

◆ words_call_intrinsic()

list words_call_intrinsic ( call  ,
int  ,
bool  ,
list  
)

◆ words_cmf_loop_range()

cons* words_cmf_loop_range ( range  obj)

cmfortran.c

cmfortran.c

There are memory leaks here since a new expression is constructed. =====================================================================

expression_constant_p(range_increment(obj)) &&

Parameters
objbj

Definition at line 46 of file cmfortran.c.

48 {
49  cons *pc;
51 
52  pc = Words_Subexpression(range_lower(obj), 0, true);
53  pc = CHAIN_SWORD(pc,":");
54  pc = gen_nconc(pc, Words_Subexpression(range_upper(obj), 0, true));
55  if (/* expression_constant_p(range_increment(obj)) && */
56  strcmp( entity_local_name(call_function(c)), "1") == 0 )
57  return(pc);
58  pc = CHAIN_SWORD(pc,":");
60 
61  return(pc);
62 }
list Words_Subexpression(expression obj, int precedence, bool leftmost)
Definition: misc.c:2695
list Words_Expression(expression obj)
of string
Definition: misc.c:2616

References call_function, CHAIN_SWORD, entity_local_name(), expression_syntax, gen_nconc(), range_increment, range_lower, range_upper, syntax_call, Words_Expression(), and Words_Subexpression().

Referenced by text_loop_cmf().

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

◆ words_declaration()

list words_declaration ( entity  e,
bool  prettyprint_common_variable_dimensions_p,
list ppdl 
)

declarations.c

declarations.c

this is the case of g77 used after hpfc. thus I added a flag not to prettyprint again the dimensions of common variables. FC.

It is in the standard that dimensions cannot be declared twice in a single module. BC.

Parameters
prettyprint_common_variable_dimensions_prettyprint_common_variable_dimensions_p
ppdlpdl

Definition at line 277 of file declarations.c.

279  {
280  list pl = NIL;
281  bool space_p = get_bool_property("PRETTYPRINT_LISTS_WITH_SPACES");
282 
284 
285  if (type_variable_p(entity_type(e))) {
286  if (prettyprint_common_variable_dimensions_p || !(variable_in_common_p(e)
287  || variable_static_p(e))) {
290 
291  switch(get_prettyprint_language_tag()) {
292  case is_language_fortran:
294  pl = CHAIN_SWORD(pl, "(");
295  MAPL(pd,
296  {
297  pl = gen_nconc(pl, words_dimension(DIMENSION(CAR(pd)), ppdl));
298  if (CDR(pd) != NIL) pl = CHAIN_SWORD(pl, space_p? ", " : ",");
299  }, dims)
300  ;
301  pl = CHAIN_SWORD(pl, ")");
302  break;
303  case is_language_c:
304  MAPL(pd,
305  {
306  pl = CHAIN_SWORD(pl, "[");
307  pl = gen_nconc(pl, words_dimension(DIMENSION(CAR(pd)), ppdl));
308  pl = CHAIN_SWORD(pl, "]");
309  }, dims)
310  ;
311  break;
312  default:
313  pips_internal_error("Language unknown !");
314  }
315  }
316  }
317  }
319  return (pl);
320 }
void attach_declaration_to_words(list l, entity e)
Attach a declaration to all the words of the given list:
static list words_dimension(dimension obj, list *ppdl)
Definition: declarations.c:189
static hash_table pl
properties are stored in this hash table (string -> property) for fast accesses.
Definition: properties.c:783
bool variable_in_common_p(entity)
true if v is in a common.
Definition: variable.c:1570
bool variable_static_p(entity)
true if v appears in a SAVE statement, or in a DATA statement, or is declared static i C.
Definition: variable.c:1579

References attach_declaration_to_words(), CAR, CDR, CHAIN_SWORD, DIMENSION, entity_type, entity_user_name(), gen_nconc(), get_bool_property(), get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, MAPL, NIL, pips_internal_error, pl, type_variable, type_variable_p, variable_dimensions, variable_in_common_p(), variable_static_p(), and words_dimension().

Referenced by loop_private_variables(), sentence_area(), sentence_variable(), and text_entity_declaration().

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

◆ words_dimensions()

list words_dimensions ( list  dims,
list ppdl 
)
Parameters
dimsims
ppdlpdl

Definition at line 932 of file declarations.c.

933 {
934  list pc = NIL;
935  bool space_p = get_bool_property("PRETTYPRINT_LISTS_WITH_SPACES");
936 
937  switch(get_prettyprint_language_tag()) {
938  case is_language_fortran:
939  case is_language_fortran95: {
940  pc = CHAIN_SWORD(pc, "(");
941  string spacer = "";
942  FOREACH(dimension,d,dims) {
943  pc = CHAIN_SWORD(pc, spacer);
944  pc = gen_nconc(pc, words_dimension(d, ppdl));
945  spacer = space_p ? ", " : ",";
946  }
947  pc = CHAIN_SWORD(pc, ")");
948  break;
949  }
950  case is_language_c: {
951  FOREACH(dimension,d,dims) {
952  pc = CHAIN_SWORD(pc, "[");
953  pc = gen_nconc(pc, words_dimension(d, ppdl));
954  pc = CHAIN_SWORD(pc, "]");
955  }
956  break;
957  }
958  default:
959  pips_internal_error("Language unknown !");
960  break;
961  }
962  return pc;
963 }

References CHAIN_SWORD, FOREACH, gen_nconc(), get_bool_property(), get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, NIL, pips_internal_error, and words_dimension().

Referenced by generic_c_words_simplified_entity(), get_symbol_table(), and words_type().

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

◆ Words_Expression()

list Words_Expression ( expression  obj)

of string

Parameters
objbj

Definition at line 2616 of file misc.c.

2617 {
2618  return Words_Syntax(expression_syntax(obj));
2619 }
list Words_Syntax(syntax obj)
Definition: misc.c:2664

References expression_syntax, and Words_Syntax().

Referenced by can_terapixify_expression_p(), effect_words_reference(), eval_var(), reference_conversion_expression(), words_cmf_loop_range(), words_loop_list(), words_numerical_dimension(), and words_test_list().

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

◆ words_expression()

◆ words_goto_label()

list words_goto_label ( const char *  tlabel)

This function is useful only for parsed codes since gotos are removed by the controlizer.

of string

<<<<<< .working switch (get_prettyprint_language_tag()) { case is_language_fortran: case is_language_fortran95: pc = CHAIN_SWORD(pc, RETURN_FUNCTION_NAME); break; case is_language_c: pc = CHAIN_SWORD(pc, C_RETURN_FUNCTION_NAME); pc = CHAIN_SWORD(pc, ";"); break; default: pips_internal_error("Language unknown !"); break;

}

In C, a label cannot begin with a number so "l" is added for this case

In C, a label cannot begin with a number so "l" is added for this case

Parameters
tlabellabel

Definition at line 1917 of file misc.c.

1918 {
1919  list pc = NIL;
1920  if (strcmp(tlabel, RETURN_LABEL_NAME) == 0) {
1921  /*<<<<<<< .working
1922  switch (get_prettyprint_language_tag()) {
1923  case is_language_fortran:
1924  case is_language_fortran95:
1925  pc = CHAIN_SWORD(pc, RETURN_FUNCTION_NAME);
1926  break;
1927  case is_language_c:
1928  pc = CHAIN_SWORD(pc, C_RETURN_FUNCTION_NAME);
1929  pc = CHAIN_SWORD(pc, ";");
1930  break;
1931  default:
1932  pips_internal_error("Language unknown !");
1933  break;
1934  }
1935  =======*/
1936  switch (get_prettyprint_language_tag()) {
1937  case is_language_fortran:
1938  case is_language_fortran95:
1940  break;
1941  case is_language_c: {
1943 
1944  if(void_function_p(f)) {
1945  // FI: this hides the parsed code structure and is wrong
1946  // in C because a value may have to be returned;
1948  pc = CHAIN_SWORD(pc, ";");
1949  }
1950  else {
1952  pc = CHAIN_SWORD(pc, C_RETURN_FUNCTION_NAME" ");
1953  pc = CHAIN_SWORD(pc, entity_user_name(rv));
1954  pc = CHAIN_SWORD(pc, ";");
1955  }
1956  if(false) {
1957  // the gotos are maintained, but the final return must be printed out
1958  // FI: this would only work if the final return were printed
1959  // out for sure and with its label
1960  /* In C, a label cannot begin with a number so "l" is added
1961  for this case*/
1962  pc = CHAIN_SWORD(pc, strdup((isdigit(tlabel[0])?"goto l":"goto ")));
1963  pc = CHAIN_SWORD(pc, tlabel);
1965  }
1966  break;
1967  }
1968  default:
1969  pips_internal_error("Language unknown !");
1970  break;
1971  }
1972  //>>>>>>> .merge-right.r18859
1973  } else {
1974  switch (get_prettyprint_language_tag()) {
1975  case is_language_fortran:
1976  case is_language_fortran95:
1977  pc = CHAIN_SWORD(pc, strdup("GOTO "));
1978  pc = CHAIN_SWORD(pc, tlabel);
1979  break;
1980  case is_language_c:
1981  /* In C, a label cannot begin with a number so "l" is added
1982  for this case*/
1983  pc = CHAIN_SWORD(pc, strdup((isdigit(tlabel[0])?"goto l":"goto ")));
1984  pc = CHAIN_SWORD(pc, tlabel);
1986  break;
1987  default:
1988  pips_internal_error("Language unknown !");
1989  break;
1990  }
1991  }
1992  return pc;
1993 }
#define RETURN_LABEL_NAME
Definition: naming-local.h:106
#define RETURN_FUNCTION_NAME
#define C_RETURN_FUNCTION_NAME
bool void_function_p(entity m)
Check if m is a C void function or a Fortran subroutine.
Definition: module.c:538
entity function_to_return_value(entity m)
Returns the entity rv that carries the value returned by module m, when m is not a C void function or...
Definition: module.c:509

References C_CONTINUE_FUNCTION_NAME, C_RETURN_FUNCTION_NAME, CHAIN_SWORD, entity_user_name(), f(), function_to_return_value(), get_current_module_entity(), get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, NIL, pips_internal_error, RETURN_FUNCTION_NAME, RETURN_LABEL_NAME, strdup(), and void_function_p().

Referenced by sentence_goto_label(), and text_trail().

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

◆ words_loop_range()

list words_loop_range ( range  obj,
list ppdl 
)

exported for craft

expression_constant_p(range_increment(obj)) &&

Parameters
objbj
ppdlpdl

Definition at line 434 of file misc.c.

434  {
435  list pc;
437 
438  pc = words_subexpression(range_lower(obj), 0, true, ppdl);
439  pc = CHAIN_SWORD(pc,", ");
440  pc = gen_nconc(pc, words_subexpression(range_upper(obj), 0, true, ppdl));
441  if (/* expression_constant_p(range_increment(obj)) && */
442  strcmp( entity_local_name(call_function(c)), "1") == 0 )
443  return(pc);
444  pc = CHAIN_SWORD(pc,", ");
445  pc = gen_nconc(pc, words_expression(range_increment(obj), ppdl));
446 
447  return(pc);
448 }

References call_function, CHAIN_SWORD, entity_local_name(), expression_syntax, gen_nconc(), range_increment, range_lower, range_upper, syntax_call, words_expression(), and words_subexpression().

Referenced by text_loop_craft(), text_loop_default(), and words_implied_do().

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

◆ words_qualifiers()

list words_qualifiers ( list  obj)
Parameters
objbj

Definition at line 795 of file declarations.c.

796 {
797  return generic_words_qualifiers(obj, true, true);
798 }
static list generic_words_qualifiers(list obj, bool initial_p, bool late_p)
================C prettyprinter functions=================
Definition: declarations.c:704

References generic_words_qualifiers().

Referenced by c_text_related_entities(), generic_c_words_simplified_entity(), get_symbol_table(), print_qualifiers(), sentence_head(), words_dimension(), and words_type().

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

◆ words_range()

list words_range ( range  obj,
list ppdl 
)
Returns
a list of string

if undefined I print a star, why not!?

C does not include ranges, but the PIPS internal representation does. For instance, constant ranges can be useful to express effects or regions for intrinsics. To be discussed with Beatrice: e.g. memcpy(), strncp(). Especially when they are called with constant arguments.

Parameters
objbj
ppdlpdl

Definition at line 538 of file misc.c.

538  {
539  list pc = NIL;
540 
541  /* if undefined I print a star, why not!? */
543  pc = CONS(STRING, MAKE_SWORD("*"), NIL);
544  } else {
545  switch(get_prettyprint_language_tag()) {
546  case is_language_fortran: {
548 
549  pc = CHAIN_SWORD(pc,"(/ (I,I=");
550  pc = gen_nconc(pc, words_expression(range_lower(obj), ppdl));
551  pc = CHAIN_SWORD(pc,",");
552  pc = gen_nconc(pc, words_expression(range_upper(obj), ppdl));
553  if(strcmp(entity_local_name(call_function(c)), "1") != 0) {
554  pc = CHAIN_SWORD(pc,",");
555  pc = gen_nconc(pc, words_expression(range_increment(obj), ppdl));
556  }
557  pc = CHAIN_SWORD(pc,") /)") ;
558  break;
559  }
560  case is_language_fortran95: {
561  // Print the lower bound if != *
563  pc = gen_nconc(pc, words_expression(range_lower(obj), ppdl));
564  }
565 
566  // Print the upper bound if != *
567  pc = CHAIN_SWORD(pc,":");
569  pc = gen_nconc(pc, words_expression(range_upper(obj), ppdl));
570  }
571 
572  // Print the increment if != 1
574  if(strcmp(entity_local_name(call_function(c)), "1") != 0) {
575  pc = CHAIN_SWORD(pc,":");
576  pc = gen_nconc(pc, words_expression(range_increment(obj), ppdl));
577  }
578  break;
579  }
580  case is_language_c:
581  /* C does not include ranges, but the PIPS internal
582  representation does. For instance, constant ranges can be
583  useful to express effects or regions for intrinsics. To be
584  discussed with Beatrice: e.g. memcpy(), strncp(). Especially
585  when they are called with constant arguments. */
586 
587  // FI: we might still want a warning, but the compiler will
588  // choke anyway if this is used to prettyprint some C source code
589  // pips_internal_error("I don't know how to print a range in C !");
590 
591  // FI: copied from Fortran 95, but we may prefer to see the stars
592 
593  // Print the lower bound if != *
595  pc = gen_nconc(pc, words_expression(range_lower(obj), ppdl));
596  }
597 
598  // Print the upper bound if != *
599  pc = CHAIN_SWORD(pc,":");
601  pc = gen_nconc(pc, words_expression(range_upper(obj), ppdl));
602  }
603 
604  // Print the increment if != 1
606  if(strcmp(entity_local_name(call_function(c)), "1") != 0) {
607  pc = CHAIN_SWORD(pc,":");
608  pc = gen_nconc(pc, words_expression(range_increment(obj), ppdl));
609  }
610 
611  break;
612  default:
613  pips_internal_error("Language unknown !");
614  break;
615  }
616  }
617  return pc;
618 }
bool unbounded_expression_p(expression e)
Definition: expression.c:4329

References call_function, CHAIN_SWORD, CONS, entity_local_name(), expression_syntax, expression_undefined_p, gen_nconc(), get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, MAKE_SWORD, NIL, pips_internal_error, range_increment, range_lower, range_upper, STRING, syntax_call, unbounded_expression_p(), and words_expression().

Referenced by make_bounds(), and words_syntax().

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

◆ Words_Reference()

list Words_Reference ( reference  obj)
Parameters
objbj

Definition at line 786 of file misc.c.

787 {
789 }
list Words_Any_Reference(reference obj, list pdl, const char *(*enf)(entity))
Definition: misc.c:773

References entity_user_name(), NIL, and Words_Any_Reference().

Referenced by text_region_no_action(), and words_reduction().

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

◆ words_reference()

list words_reference ( reference  obj,
list ppdl 
)
Parameters
objbj
ppdlpdl

Definition at line 781 of file misc.c.

782 {
783  return words_any_reference(obj, ppdl, entity_user_name);
784 }
list words_any_reference(reference obj, list *ppdl, const char *(*enf)(entity))
exported for expression.c
Definition: misc.c:704

References entity_user_name(), and words_any_reference().

Referenced by adg_fprint_dataflow(), fprint_reference(), reference_to_string(), and words_syntax().

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

◆ Words_Regular_Call()

list Words_Regular_Call ( call  obj,
bool  is_a_subroutine 
)
Parameters
objbj
is_a_subroutines_a_subroutine

Definition at line 1081 of file misc.c.

1082 {
1083  list pdl = NIL;
1084  list pc = words_regular_call(obj, is_a_subroutine, &pdl);
1085  gen_free_list(pdl);
1086  return pc;
1087 }
list words_regular_call(call obj, bool is_a_subroutine, list *ppdl)
words_regular_call used for user subroutine and user function and intrinsics called like user functio...
Definition: misc.c:868

References gen_free_list(), NIL, and words_regular_call().

Referenced by get_sp_of_call_p().

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

◆ words_regular_call()

list words_regular_call ( call  obj,
bool  is_a_subroutine,
list ppdl 
)

words_regular_call used for user subroutine and user function and intrinsics called like user function such as MOD().

used also by library static_controlize

special cases for stdarg builtin macros

Special cases for stdio.h

else if (ENTITY__IO_GETC_P(f))

pc = CHAIN_SWORD(pc, "getc");

else if (ENTITY__IO_PUTC_P(f))

pc = CHAIN_SWORD(pc, "putc");

Special cases for Fortran intrinsics not available in C

the implied complex operator is hidden... [D]CMPLX_(x,y) -> (x,y)

The corresponding formal parameter cannot be checked by formal_label_replacement_p() because the called modules may not have been parsed yet.

Alternate return actual argument have been replaced by character strings by the parser.

pips_assert("ls has at least four characters", strlen(ls)>=4);

Get rid of initial and final quotes

free(ls1);

The actual label cannot always be used because it might have been eliminated as part of dead code by PIPS since it is not used with the STOP option.

The assertion may be wrong if this piece of code is used to print intermediate statements

words_expression cannot be called because of the C comma operator which require surrounding parentheses in this context. Be careful with unary minus.

alse

Parameters
objbj
is_a_subroutines_a_subroutine
ppdlpdl

Definition at line 868 of file misc.c.

869 {
870  list pc = NIL;
871 
872  entity f = call_function(obj);
873  value i = entity_initial(f);
874  type t = entity_type(f);
875  bool space_p = get_bool_property("PRETTYPRINT_LISTS_WITH_SPACES");
876 
877  if (call_arguments(obj) == NIL) {
878  if (type_statement_p(t))
879  return (CHAIN_SWORD(pc, entity_local_name(f)+sizeof(LABEL_PREFIX) -1));
880  if (value_constant_p(i) || value_symbolic_p(i)) {
881  switch (get_prettyprint_language_tag()) {
882  case is_language_fortran:
884  return (CHAIN_SWORD(pc, entity_user_name(f)));
885  break;
886  case is_language_c:
887  if (ENTITY_TRUE_P(f))
888  return (CHAIN_SWORD(pc, "true"));
889  if (ENTITY_FALSE_P(f))
890  return (CHAIN_SWORD(pc, "false"));
891  return (CHAIN_SWORD(pc, entity_user_name(f)));
892  break;
893  default:
894  pips_internal_error("Language unknown !");
895  break;
896  }
897  }
898  }
899 
901  bool function_p = type_void_p(functional_result(type_functional(calltype)));
902 
903  if (function_p) {
904  if (is_a_subroutine) {
905  switch (get_prettyprint_language_tag()) {
906  case is_language_fortran:
908  pc = CHAIN_SWORD(pc, "CALL ");
909  break;
910  case is_language_c:
911  pc = CHAIN_SWORD(pc, "");
912  break;
913  default:
914  pips_internal_error("Language unknown !");
915  break;
916  }
917  } else {
918  switch (get_prettyprint_language_tag()) {
919  case is_language_fortran:
920  pips_user_warning("subroutine '%s' used as a function.\n",
921  entity_name(f));
922  break;
923  case is_language_c:
924  // no warning in C
925  break;
927  pips_internal_error("Need to update F95 case");
928  break;
929  default:
930  pips_internal_error("Language unknown !");
931  break;
932  }
933  }
934  } else if (is_a_subroutine) {
935  switch (get_prettyprint_language_tag()) {
936  case is_language_fortran:
938  pips_user_warning("function '%s' used as a subroutine.\n",
939  entity_name(f));
940  pc = CHAIN_SWORD(pc, "CALL ");
941  break;
942  case is_language_c:
943  // no warning in C
944  pc = CHAIN_SWORD(pc, "");
945  break;
946  default:
947  pips_internal_error("Language unknown !");
948  break;
949  }
950  }
951 
952  /* special cases for stdarg builtin macros */
953  bool add_argument_count_p = false;
954  if (ENTITY_VA_END_P(f)) {
955  //pc = CHAIN_SWORD(pc, "va_end");
956  pc = CHAIN_SWORD(pc, "__builtin_va_end");
957  }
958  else if (ENTITY_VA_START_P(f)) {
959  //pc = CHAIN_SWORD(pc, "va_start");
960  pc = CHAIN_SWORD(pc, "__builtin_va_start");
961  }
962  else if (ENTITY_VA_COPY_P(f)) {
963  //pc = CHAIN_SWORD(pc, "va_copy");
964  pc = CHAIN_SWORD(pc, "__builtin_va_copy");
965  }
966 
967  /* Special cases for stdio.h */
968  /* else if (ENTITY__IO_GETC_P(f)) */
969 /* pc = CHAIN_SWORD(pc, "getc"); */
970 /* else if (ENTITY__IO_PUTC_P(f)) */
971 /* pc = CHAIN_SWORD(pc, "putc"); */
972  else if (ENTITY_ISOC99_SCANF_P(f))
974  else if (ENTITY_ISOC99_FSCANF_P(f))
976  else if (ENTITY_ISOC99_SSCANF_P(f))
978  else if (ENTITY_ISOC99_VFSCANF_P(f))
980  else if (ENTITY_ISOC99_VSCANF_P(f))
982  else if (ENTITY_ISOC99_VSSCANF_P(f))
984 
985  /* Special cases for Fortran intrinsics not available in C */
987  && !get_bool_property("PRETTYPRINT_INTERNAL_INTRINSICS")) {
988  add_argument_count_p = true;
990  }
992  && !get_bool_property("PRETTYPRINT_INTERNAL_INTRINSICS")) {
993  add_argument_count_p = true;
995  }
996 
997  /* the implied complex operator is hidden... [D]CMPLX_(x,y) -> (x,y)
998  */
1000  pc = CHAIN_SWORD(pc, entity_user_name(f));
1001 
1002 
1003  /* The corresponding formal parameter cannot be checked by
1004  formal_label_replacement_p() because the called modules may not have
1005  been parsed yet. */
1006 
1007  if(!ENDP(call_arguments(obj))) {
1008  list pa = list_undefined;
1009  pc = CHAIN_SWORD(pc, "(");
1010 
1011  if(add_argument_count_p) {
1012  int n = gen_length(call_arguments(obj));
1013  string narg;
1014  asprintf(&narg,"%d", n);
1015  pc = CHAIN_SWORD(pc, narg);
1016  pc = CHAIN_SWORD(pc, ", ");
1017  }
1018 
1019  for(pa = call_arguments(obj); !ENDP(pa); POP(pa)) {
1020  expression eap = EXPRESSION(CAR(pa));
1021  if(get_bool_property("PRETTYPRINT_REGENERATE_ALTERNATE_RETURNS")
1023  /* Alternate return actual argument have been replaced by
1024  character strings by the parser. */
1026  const char* ls = entity_local_name(cf);
1027  string ls1 = malloc(strlen(ls));
1028  /* pips_assert("ls has at least four characters", strlen(ls)>=4); */
1029 
1030  /* Get rid of initial and final quotes */
1031  ls1 = strncpy(ls1, ls+1, strlen(ls)-2);
1032  *(ls1+strlen(ls)-2) = '\000';
1033  pips_assert("eap must be a call to a constant string", expression_call_p(eap));
1034  if(strcmp(get_string_property("PARSER_SUBSTITUTE_ALTERNATE_RETURNS"), "STOP")!=0) {
1035  pc = CHAIN_SWORD(pc, ls1);
1036  /* free(ls1); */
1037  }
1038  else {
1039  /* The actual label cannot always be used because it might have been
1040  eliminated as part of dead code by PIPS since it is not used
1041  with the STOP option. */
1043  pc = CHAIN_SWORD(pc, ls1);
1044  }
1045  else {
1047 
1048  /* The assertion may be wrong if this piece of code is used to
1049  print intermediate statements */
1050  pips_assert("Label els1 has been defined although it is not used anymore",
1051  !entity_undefined_p(els1));
1052 
1053  pc = CHAIN_SWORD(pc, ls1);
1055  }
1056  }
1057  }
1058  else {
1059  /* words_expression cannot be called because of the C comma
1060  operator which require surrounding parentheses in this
1061  context. Be careful with unary minus. */
1064  true/*false*/,
1065  ppdl));
1066  }
1067  if (CDR(pa) != NIL)
1068  pc = CHAIN_SWORD(pc, space_p? ", ": ",");
1069  }
1070 
1071  pc = CHAIN_SWORD(pc, ")");
1072  }
1074  !is_a_subroutine || prettyprint_language_is_c_p()) {
1075  pc = CHAIN_SWORD(pc, "()");
1076  }
1077 
1078  return pc;
1079 }
const char * get_current_module_name(void)
Get the name of the current module.
Definition: static.c:121
void add_target_to_alternate_return_set(entity l)
Definition: misc.c:814
#define ISOC99_VFSCANF_USER_FUNCTION_NAME
#define ENTITY_ISOC99_VFSCANF_P(e)
#define ENTITY_IMPLIED_DCMPLX_P(e)
#define ISOC99_SSCANF_USER_FUNCTION_NAME
#define ENTITY_TRUE_P(e)
#define ENTITY_ISOC99_SSCANF_P(e)
#define ISOC99_VSCANF_USER_FUNCTION_NAME
#define PIPS_C_MAX_OPERATOR_NAME
#define ISOC99_VSSCANF_USER_FUNCTION_NAME
#define ISOC99_FSCANF_USER_FUNCTION_NAME
#define ENTITY_ISOC99_SCANF_P(e)
#define ENTITY_MAX_P(e)
#define ENTITY_VA_END_P(e)
Defined elsewhere: #define ENTITY_ADDRESS_OF_P(e) entity_an_operator_p(e, ADDRESS_OF)
#define ENTITY_VA_START_P(e)
#define PIPS_C_MIN_OPERATOR_NAME
PIPS run-time support for C code generation.
#define ENTITY_MIN_P(e)
#define ENTITY_ISOC99_FSCANF_P(e)
#define ENTITY_VA_COPY_P(e)
#define ASSIGN_OPERATOR_PRECEDENCE
Definition: ri-util-local.h:96
#define ENTITY_ISOC99_VSSCANF_P(e)
#define ENTITY_IMPLIED_CMPLX_P(e)
#define ENTITY_ISOC99_VSCANF_P(e)
#define ENTITY_FALSE_P(e)
#define ISOC99_SCANF_USER_FUNCTION_NAME
bool label_string_defined_in_current_module_p(string ls)
Definition: entity.c:407
type call_compatible_type(type)
returns the type necessary to generate or check a call to an object of type t.
Definition: type.c:3791
bool actual_label_replacement_p(expression)
Assumes that eap is a call.
Definition: variable.c:1811
entity find_label_entity(const char *, const char *)
util.c
Definition: util.c:43
#define value_constant_p(x)
Definition: ri.h:3071
#define value_symbolic_p(x)
Definition: ri.h:3068

References actual_label_replacement_p(), add_target_to_alternate_return_set(), asprintf, ASSIGN_OPERATOR_PRECEDENCE, call_arguments, call_compatible_type(), call_function, CAR, CDR, CHAIN_SWORD, ENDP, ENTITY_FALSE_P, ENTITY_IMPLIED_CMPLX_P, ENTITY_IMPLIED_DCMPLX_P, entity_initial, ENTITY_ISOC99_FSCANF_P, ENTITY_ISOC99_SCANF_P, ENTITY_ISOC99_SSCANF_P, ENTITY_ISOC99_VFSCANF_P, ENTITY_ISOC99_VSCANF_P, ENTITY_ISOC99_VSSCANF_P, entity_local_name(), ENTITY_MAX_P, ENTITY_MIN_P, entity_name, ENTITY_TRUE_P, entity_type, entity_undefined_p, entity_user_name(), ENTITY_VA_COPY_P, ENTITY_VA_END_P, ENTITY_VA_START_P, EXPRESSION, expression_call_p(), expression_syntax, f(), find_label_entity(), functional_result, gen_length(), gen_nconc(), get_bool_property(), get_current_module_name(), get_prettyprint_language_tag(), get_string_property(), is_language_c, is_language_fortran, is_language_fortran95, ISOC99_FSCANF_USER_FUNCTION_NAME, ISOC99_SCANF_USER_FUNCTION_NAME, ISOC99_SSCANF_USER_FUNCTION_NAME, ISOC99_VFSCANF_USER_FUNCTION_NAME, ISOC99_VSCANF_USER_FUNCTION_NAME, ISOC99_VSSCANF_USER_FUNCTION_NAME, LABEL_PREFIX, label_string_defined_in_current_module_p(), list_undefined, malloc(), NIL, pips_assert, PIPS_C_MAX_OPERATOR_NAME, PIPS_C_MIN_OPERATOR_NAME, pips_internal_error, pips_user_warning, POP, prettyprint_language_is_c_p(), syntax_call, type_functional, type_statement_p, type_void_p, value_constant_p, value_symbolic_p, and words_subexpression().

Referenced by words_call_intrinsic(), words_genuine_regular_call(), words_intrinsic_call(), and Words_Regular_Call().

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

◆ Words_Subexpression()

list Words_Subexpression ( expression  obj,
int  precedence,
bool  leftmost 
)
Parameters
objbj
precedencerecedence
leftmosteftmost

Definition at line 2695 of file misc.c.

2699 {
2700  list pdl = NIL;
2701  list pc = words_subexpression(obj, precedence, leftmost, &pdl);
2702  gen_free_list(pdl);
2703  return pc;
2704 }

References gen_free_list(), NIL, and words_subexpression().

Referenced by words_cmf_loop_range().

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

◆ words_subexpression()

list words_subexpression ( expression  obj,
int  precedence,
bool  leftmost,
list ppdl 
)

exported for cmfortran.c

Parameters
objbj
precedencerecedence
leftmosteftmost
ppdlpdl

Definition at line 2674 of file misc.c.

2679 {
2680  list pc;
2681 
2682  if ( expression_call_p(obj) )
2684  precedence, leftmost, false, ppdl);
2685  else if(expression_cast_p(obj)) {
2686  cast c = expression_cast(obj);
2687  pc = words_cast(c, precedence, ppdl);
2688  }
2689  else
2690  pc = words_syntax(expression_syntax(obj), ppdl);
2691 
2692  return pc;
2693 }
static list words_cast(cast obj, int precedence, list *ppdl)
bool expression_cast_p(expression e)
Definition: expression.c:450
cast expression_cast(expression e)
Definition: expression.c:455

References expression_call_p(), expression_cast(), expression_cast_p(), expression_syntax, syntax_call, words_call(), words_cast(), and words_syntax().

Referenced by C_loop_range(), ensure_comment_consistency(), eole_fmx_specific_op(), words_any_reference(), words_assign_op(), words_assign_substring_op(), words_comma_op(), words_conditional_op(), words_infix_binary_op(), words_infix_nary_op(), words_inverse_op(), words_loop_range(), words_nullary_op_c(), words_nullary_op_fortran(), words_postfix_unary_op(), words_prefix_unary_op(), words_regular_call(), Words_Subexpression(), words_substring_op(), words_unary_minus(), and words_variable_or_function().

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

◆ words_subscript_range()

list words_subscript_range ( range  obj,
list ppdl 
)

@description FI: array constructor R433, p.

37 in Fortran 90 standard, can be used anywhere in arithmetic expressions whereas the triplet notation is restricted to subscript expressions. The triplet notation is used to define array sections (see R619, p. 64).

Returns
a list of string corresponding to the range

if undefined I print a star, why not!?

Parameters
objbj
ppdlpdl

Definition at line 629 of file misc.c.

629  {
630  list pc = NIL;
631 
632  /* if undefined I print a star, why not!? */
634  pc = CONS(STRING, MAKE_SWORD("*"), NIL);
635  } else {
636  switch(get_prettyprint_language_tag()) {
637  case is_language_fortran: {
639 
640  pc = gen_nconc(pc, words_expression(range_lower(obj), ppdl));
641  pc = CHAIN_SWORD(pc,":");
642  pc = gen_nconc(pc, words_expression(range_upper(obj), ppdl));
643  if(strcmp(entity_local_name(call_function(c)), "1") != 0) {
644  pc = CHAIN_SWORD(pc,":");
645  pc = gen_nconc(pc, words_expression(range_increment(obj), ppdl));
646  }
647  break;
648  }
649  case is_language_fortran95: {
650  // Print the lower bound if != *
652  pc = gen_nconc(pc, words_expression(range_lower(obj), ppdl));
653  }
654 
655  // Print the upper bound if != *
656  pc = CHAIN_SWORD(pc,":");
658  pc = gen_nconc(pc, words_expression(range_upper(obj), ppdl));
659  }
660 
661  // Print the increment if != 1
663  if(strcmp(entity_local_name(call_function(c)), "1") != 0) {
664  pc = CHAIN_SWORD(pc,":");
665  pc = gen_nconc(pc, words_expression(range_increment(obj), ppdl));
666  }
667  break;
668  }
669  case is_language_c:
670  // T is no way to print range in C
671  // The notation with ":" has been chosen to simplify prettyprint
672  {
673  // Print the lower bound if != *
675  pc = gen_nconc(pc, words_expression(range_lower(obj), ppdl));
676  }
677 
678  // Print the upper bound if != *
679  pc = CHAIN_SWORD(pc,":");
681  pc = gen_nconc(pc, words_expression(range_upper(obj), ppdl));
682  }
683 
684  // Print the increment if != 1
686  if(strcmp(entity_local_name(call_function(c)), "1") != 0) {
687  pc = CHAIN_SWORD(pc,":");
688  pc = gen_nconc(pc, words_expression(range_increment(obj), ppdl));
689  }
690  break;
691  }
692  default:
693  pips_internal_error("Language unknown !");
694  break;
695  }
696  }
697  return pc;
698 }

References call_function, CHAIN_SWORD, CONS, entity_local_name(), expression_syntax, expression_undefined_p, gen_nconc(), get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, MAKE_SWORD, NIL, pips_internal_error, range_increment, range_lower, range_upper, STRING, syntax_call, unbounded_expression_p(), and words_expression().

Referenced by words_any_reference().

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

◆ Words_Syntax()

list Words_Syntax ( syntax  obj)
Parameters
objbj

Definition at line 2664 of file misc.c.

2665 {
2666  list npdl = NIL;
2667  list pc = words_syntax(obj, &npdl);
2668  gen_free_list(npdl);
2669  return pc;
2670 }

References gen_free_list(), NIL, and words_syntax().

Referenced by comp_regions_of_syntax(), Words_Expression(), and xml_Argument().

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

◆ words_syntax()

list words_syntax ( syntax  obj,
list ppdl 
)

exported for expression.c

FI->SG: I do not know if in_type_declaration is true, false or a formal parameter

Parameters
objbj
ppdlpdl

Definition at line 2623 of file misc.c.

2624 {
2625  list pc = NIL;
2626 
2627  switch (syntax_tag(obj)) {
2628  case is_syntax_reference :
2629  pc = words_reference(syntax_reference(obj), ppdl);
2630  break;
2631  case is_syntax_range:
2632  pc = words_range(syntax_range(obj), ppdl);
2633  break;
2634  case is_syntax_call:
2635  pc = words_call(syntax_call(obj), 0, true, false, ppdl);
2636  break;
2637  case is_syntax_cast:
2638  pc = words_cast(syntax_cast(obj), 0, ppdl);
2639  break;
2641  /* FI->SG: I do not know if in_type_declaration is true, false
2642  or a formal parameter */
2643  bool in_type_declaration = true;
2645  in_type_declaration, ppdl);
2646  break;
2647  }
2648  case is_syntax_subscript:
2649  pc = words_subscript(syntax_subscript(obj), ppdl);
2650  break;
2651  case is_syntax_application:
2652  pc = words_application(syntax_application(obj), ppdl);
2653  break;
2654  case is_syntax_va_arg:
2655  pc = words_va_arg(syntax_va_arg(obj), ppdl);
2656  break;
2657  default:
2658  pips_internal_error("unexpected tag");
2659  }
2660 
2661  return(pc);
2662 }
static list words_sizeofexpression(sizeofexpression obj, bool in_type_declaration, list *ppdl)
list words_range(range obj, list *ppdl)
Definition: misc.c:538
static list words_application(application a, list *ppdl)
static list words_subscript(subscript s, list *ppdl)
static list words_va_arg(list obj, list *ppdl)
Definition: misc.c:2558

References is_syntax_application, is_syntax_call, is_syntax_cast, is_syntax_range, is_syntax_reference, is_syntax_sizeofexpression, is_syntax_subscript, is_syntax_va_arg, NIL, pips_internal_error, syntax_application, syntax_call, syntax_cast, syntax_range, syntax_reference, syntax_sizeofexpression, syntax_subscript, syntax_tag, syntax_va_arg, words_application(), words_call(), words_cast(), words_range(), words_reference(), words_sizeofexpression(), words_subscript(), and words_va_arg().

Referenced by fprint_expression(), print_syntax(), words_assign_op(), words_expression(), words_subexpression(), and Words_Syntax().

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

◆ Words_Type()

list Words_Type ( type  obj)
Parameters
objbj

Definition at line 891 of file declarations.c.

892 {
893  list pdl = NIL;
894  list pc = words_type(obj, &pdl, false);
895  return pc;
896 }

References NIL, and words_type().

+ Here is the call graph for this function:

◆ words_type()

list words_type ( type  obj,
list ppdl,
bool  argument_p 
)

obj is the type to describe

pdl is a list of already/previously declared data structures (not 100 % sure)

argument_p: the type is used as an argument type in a function declaration; if an argument appears with the "unknown" type it is explicitly declared "int"

returns a list of strings, called "words".

The default type is int. It can be skipped in direct declarations, but not as type of an argument in a function declaration

Parameters
objbj
ppdlpdl
argument_prgument_p

Definition at line 821 of file declarations.c.

822 {
823  list pc = NIL;
824  switch (type_tag(obj))
825  {
826  case is_type_variable:
827  {
828  // FI: the qualifiers are dropped
829  variable var = type_variable(obj);
830  basic b = variable_basic(var);
831  list ql = variable_qualifiers(var);
832  list dl = variable_dimensions(var);
833  pc = words_basic(b, ppdl);
834  pc = gen_nconc(pc, words_dimensions(dl, ppdl));
835  pc = gen_nconc(words_qualifiers(ql), pc);
836  break;
837  }
838  case is_type_void:
839  {
840  list ql = type_void(obj);
841  pc = CHAIN_SWORD(pc,"void");
842  pc = gen_nconc(words_qualifiers(ql), pc);
843  break;
844  }
845  case is_type_unknown:
846  {
847  /* The default type is int. It can be skipped in direct
848  declarations, but not as type of an argument in a function
849  declaration */
850  if(argument_p)
851  pc = CHAIN_SWORD(pc,"int");
852  break;
853  }
854  case is_type_struct:
855  {
856  pc = CHAIN_SWORD(pc,"struct");
857  break;
858  }
859  case is_type_union:
860  {
861  pc = CHAIN_SWORD(pc,"union");
862  break;
863  }
864  case is_type_enum:
865  {
866  pc = CHAIN_SWORD(pc,"enum");
867  break;
868  }
869  case is_type_functional:
870  {
871  string_buffer result = string_buffer_make(true);
872  string rs = string_undefined;
873  dump_functional(type_functional(obj), result);
874  rs = string_buffer_to_string(result);
875  pc = gen_nconc(pc, CONS(STRING, rs, NIL));
876  string_buffer_free(&result);
877  break;
878  }
879  case is_type_varargs:
880  {
881  pc = CHAIN_SWORD(pc,"...");
882  break;
883  }
884  default:
885  pips_internal_error("unexpected tag %d", type_tag(obj));
886  }
887  pips_debug(8, "End: \"\%s\"\n", list_to_string(pc));
888  return pc;
889 }

References argument_p(), CHAIN_SWORD, CONS, dump_functional(), gen_nconc(), is_type_enum, is_type_functional, is_type_struct, is_type_union, is_type_unknown, is_type_varargs, is_type_variable, is_type_void, list_to_string(), NIL, pips_debug, pips_internal_error, STRING, string_buffer_free(), string_buffer_make(), string_buffer_to_string(), string_undefined, type_functional, type_tag, type_variable, type_void, variable_basic, variable_dimensions, variable_qualifiers, words_basic(), words_dimensions(), and words_qualifiers().

Referenced by ensure_comment_consistency(), generic_c_words_simplified_entity(), print_type(), string_of_type(), type_to_full_string_definition(), words_basic(), words_parameters(), Words_Type(), and words_va_arg().

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

Variable Documentation

◆ lib_ri_util_prettyprint_c_rcsid

char lib_ri_util_prettyprint_c_rcsid[]
extern

misc.c

Definition at line 29 of file misc.c.