25 #include "pips_config.h"
138 #define MAXIMAL_PRECEDENCE 100
139 #define MINIMAL_ARITHMETIC_PRECEDENCE 19
143 #define PRETTYPRINT_UNSTRUCTURED_BEGIN_MARKER "\200Unstructured"
144 #define PRETTYPRINT_UNSTRUCTURED_END_MARKER "\201Unstructured End"
145 #define PRETTYPRINT_UNSTRUCTURED_ITEM_MARKER "\202Unstructured Item"
146 #define PRETTYPRINT_UNSTRUCTURED_SUCC_MARKER "\203Unstructured Successor ->"
147 #define PRETTYPRINT_UNREACHABLE_EXIT_MARKER "\204Unstructured Unreachable"
208 #define pp_hpf_style_p() pp_style_p("hpf")
209 #define pp_f90_style_p() pp_style_p("f90")
210 #define pp_craft_style_p() pp_style_p("craft")
211 #define pp_cray_style_p() pp_style_p("cray")
212 #define pp_cmf_style_p() pp_style_p("cmf")
213 #define pp_doall_style_p() pp_style_p("doall")
214 #define pp_do_style_p() pp_style_p("do")
215 #define pp_omp_style_p() pp_style_p("omp")
488 bool references_unsigned_entity_p =
false;
493 if( references_unsigned_entity_p ) {
707 string begin_attachment;
904 if (is_a_subroutine) {
934 }
else if (is_a_subroutine) {
953 bool add_argument_count_p =
false;
988 add_argument_count_p =
true;
993 add_argument_count_p =
true;
1011 if(add_argument_count_p) {
1027 string ls1 =
malloc(strlen(ls));
1031 ls1 = strncpy(ls1, ls+1, strlen(ls)-2);
1032 *(ls1+strlen(ls)-2) =
'\000';
1050 pips_assert(
"Label els1 has been defined although it is not used anymore",
1165 pips_internal_error(
"this should not happen: a constructor is represnetd as a cas on brace expression\n");
1180 if (prec < precedence || (!
precedence_p && precedence > 0)) {
1253 const char* result = name;
1323 pips_assert (
"reduction clause has at least two arguments", nb_arg > 1);
1341 bool parentheses_p=
true;
1354 pc =
CHAIN_SWORD(pc,
"_f77_intrinsics_pause_(0)");
1380 parentheses_p =
false;
1475 while (pio !=
NIL) {
1574 int precedence,
bool leftmost,
list * ppdl)
1578 list pio_write = pcio;
1579 bool good_fmt =
false;
1580 bool good_unit =
false;
1581 bool iolist_reached =
false;
1582 bool complex_io_control_list =
false;
1594 while((pio_write !=
NIL) && (!iolist_reached)) {
1615 pio_write =
CDR(
CDR(pio_write));
1631 pio_write =
CDR(
CDR(pio_write));
1634 iolist_reached =
true;
1635 pio_write =
CDR(pio_write);
1637 complex_io_control_list =
true;
1638 pio_write =
CDR(
CDR(pio_write));
1642 if(good_fmt && good_unit &&
same_string_p(called,
"WRITE")) {
1645 if(pio_write !=
NIL)
1654 }
else if(good_fmt && good_unit &&
same_string_p(called,
"READ")) {
1657 if(pio_write !=
NIL)
1676 }
else if(!complex_io_control_list) {
1733 list pio_write = pcio;
1741 while ( ( pio_write !=
NIL ) ) {
1752 pio_write =
CDR(pio_write);
1759 pio_write =
CDR(pio_write);
1822 if(prec < precedence || (!
precedence_p && precedence>0)) {
1850 if(prec < precedence || (!
precedence_p && precedence>0)) {
1866 if ( prec < precedence || !leftmost || (!
precedence_p && precedence>0))
1878 if ( prec < precedence || !leftmost || (!
precedence_p && precedence>0))
1902 if ( prec < precedence)
1908 if ( prec < precedence)
2068 static struct special_operator_prettyprint {
2070 const char * op_prettyprint;
2071 } tab_operator_prettyprint[] = {
2077 const char* op_name;
2082 while (tab_operator_prettyprint[i].name) {
2083 if (!strcmp(tab_operator_prettyprint[i].name,op_name))
2084 return tab_operator_prettyprint[i].op_prettyprint;
2123 if ( prec < precedence )
2130 for(; args; args=
CDR(args)) {
2162 if ( prec < precedence )
2233 if(prec < precedence || (!
precedence_p && precedence>0)) {
2244 if(strcmp(fun,
"+")==0 || strcmp(fun,
"-")==0) {
2245 pips_assert(
"left and right subexpressions are defined",
2249 char lc = *(l+strlen(l)-1);
2275 if(prec < precedence || (!
precedence_p && precedence>0)) {
2448 #define CAST_OPERATOR_PRECEDENCE (23)
2533 return d->
f(obj, precedence, leftmost, ppdl);
2579 bool is_a_subroutine,
2587 int effective_precedence = (
precedence_p||precedence<=1)?
2601 bool is_a_subroutine)
2604 list pc =
words_call(obj, precedence, leftmost, is_a_subroutine, &npdl);
2643 bool in_type_declaration =
true;
2645 in_type_declaration, ppdl);
2684 precedence, leftmost,
false, ppdl);
2804 pips_assert(
"Legal label required", strlen(tlabel)!=0);
2842 "Blocks cannot carry a label\n",
2850 bool flg_marker =
mark_block(&bm_beg, &bm_end, n, margin);
2853 if (flg_marker ==
true)
2876 for (; objs !=
NIL; objs =
CDR(objs)) {
2893 if (flg_marker ==
true)
2910 some_before =
false;
2930 }
else if (omp_private) {
2933 private =
"PRIVATE(";
2936 private =
"private(";
2948 private =
"PRIVATE ";
2957 "current prettyprinter options.\n");
2975 if (hpf_private || omp_private)
2993 int len = strlen(
prefix), i;
2997 for (i=len; margin-->0;) {
2998 result[i++] =
' '; result[i]=
'\0';
3007 string basic_directive,
3008 string basic_continuation,
3011 string dir =
marged(basic_directive, margin), cont =
3012 marged(basic_continuation, margin);
3061 #define HPF_SENTINEL "!HPF$"
3062 #define HPF_DIRECTIVE HPF_SENTINEL " "
3063 #define HPF_CONTINUATION HPF_SENTINEL "x"
3064 #define HPF_INDEPENDENT "INDEPENDENT"
3074 #define OMP_SENTINEL "!$OMP"
3075 #define OMP_DIRECTIVE OMP_SENTINEL " "
3076 #define OMP_CONTINUATION OMP_SENTINEL "x"
3077 #define OMP_PARALLELDO "PARALLEL DO "
3078 #define OMP_C_SENTINEL "#pragma omp"
3079 #define OMP_C_DIRECTIVE OMP_C_SENTINEL " "
3080 #define OMP_C_CONTINUATION OMP_C_SENTINEL "x"
3081 #define OMP_C_PARALLELDO "parallel for "
3124 bool is_recursive_p) {
3133 bool doall_loop_p =
false;
3140 doall_loop_p =
false;
3146 if (hpf_prettyprint)
3158 if (!structured_do && !doall_loop_p && !do_enddo_p) {
3186 if ((label != NULL) && (label[0] !=
'\0')) {
3187 pips_debug(9,
"the label %s need to be print for a for C loop", label);
3200 if(is_recursive_p) {
3204 && !hpf_prettyprint) {
3271 bool is_recursive_p)
3282 if(!structured_do && do_enddo_p)
3311 bool success_p =
false;
3347 bool is_recursive_p) {
3364 if(!structured_do && do_enddo_p) {
3377 if(!structured_do && !do_enddo_p) {
3387 if(is_recursive_p) {
3408 if(is_recursive_p) {
3425 if(is_recursive_p) {
3441 if(is_recursive_p) {
3477 r = (*text_statement_hook)(
module, margin, obj );
3510 bool is_recursive_p) {
3536 if(is_recursive_p) {
3552 if(is_recursive_p) {
3565 fprintf(stderr,
"logical_if=================================\n");
3567 fprintf(stderr,
"==============================\n");
3574 bool no_else_p =
true;
3595 bool inner_else_p = inner_test_p?
3597 bool dangling_else_p = inner_test_p && outer_else_p && !inner_else_p;
3599 return dangling_else_p;
3609 bool is_recursive_p) {
3613 bool one_liner_true_statement_p =
one_liner_p(tb);
3617 !one_liner_true_statement_p
3643 if(is_recursive_p) {
3656 fprintf(stderr,
"if=================================\n");
3658 fprintf(stderr,
"==============================\n");
3707 fprintf(stderr,
"else=================================\n");
3709 fprintf(stderr,
"==============================\n");
3773 fprintf(stderr,
"elseif=================================\n");
3775 fprintf(stderr,
"==============================\n");
3801 bool is_recursive_p)
3808 if(is_recursive_p) {
3851 fprintf(stderr,
"text_block_if=================================\n");
3853 fprintf(stderr,
"==============================\n");
3919 bool is_recursive_p) {
3950 fprintf(stderr,
"text_test=================================\n");
3952 fprintf(stderr,
"==============================\n");
3972 bool is_recursive_p) {
4014 pips_debug(5,
"useless Fortran CONTINUE not printed\n");
4034 0,
true,
true, ppdl),
4095 bool is_C_comment=
true;
4101 if(cc==
' '|| cc==
'\t' || cc==
'\n')
4126 goto slash_star_star;
4148 goto slash_star_star;
4156 end :
return is_C_comment;
4172 int e_margin = r_margin;
4175 if(strcmp(c,
"\n")==0)
4179 for(;*
cp!=
'\0';
cp++) {
4186 else if(strlen(cl)>0){
4260 }
while (le != NULL);
4288 const char *b=s,*e=s;
4290 while(*e && *e!=delim) ++e;
4318 char * patterns [] = { NULL, NULL, NULL, NULL, NULL, NULL };
4319 char prefix[3]= { 0,0,0 };
4341 bool comment_ok =
false;
4343 while(*iter && isspace(*iter)) iter++;
4345 for(
char **piter=&patterns[0];*piter;piter++) {
4346 if((comment_ok=(strncmp(iter,*piter,strlen(*piter))==0)))
4368 return strdup(i_comments);
4381 comments =
strdup(i_comments);
4384 comments =
strdup(i_comments);
4430 bool drop_continue_p,
4432 bool is_recursive_p,
4441 bool braces_added =
false;
4442 int nmargin = imargin;
4459 braces_added =
true;
4485 " contains declarations\n");
4493 " contains %d declarations in its statements\n",
4505 " contains no declaration statements\n");
4512 if(!braces_p && !braces_added) {
4513 braces_added =
true;
4520 pips_assert(
"declarations are carried by continue statements",
4542 pips_debug(2,
"Begin for statement %s with braces_p=%d\n",
4544 pips_debug(9,
"statement_comments: --%s--\n",
4551 pips_debug(1,
"I unexpectedly bumped into dead code?\n");
4559 if (pragma_before_label_in_C)
4569 pips_assert(
"Statement with return label must be a return statement",
4618 && (braces_p || drop_continue_p)
4630 else if(strcmp(cs,
"\n")==0) {
4696 !braces_p && !braces_added &&
ENDP(dl)) {
4704 else if(!
ENDP(dl)) {
4711 if (pragma_before_label_in_C)
4755 "Block number=%d, Block label=\"%s\", block comment=\"%s\"\n",
4760 " numberless and commentless.\n");
4765 fprintf(stderr,
"text_statement_enclosed=================================\n");
4767 fprintf(stderr,
"==============================\n");
4813 bool drop_continue_p,
4817 module, imargin,
stmt, braces_p, drop_continue_p, ppdl,
true,
true);
4824 bool drop_continue_p)
4873 module, margin,
stmt,
true,
true, &npdl,
false,
false);
4960 pips_assert(
"Last statement is either undefined or a call to return",
4974 last_statement_found = ls;
4984 return s == last_statement_found;
5024 pips_user_warning(
"A C source code is prettyprinted without using definitions placed in its compilation unit.\nThe resulting source code may not be meaningfull.\n");
5056 debug_on(
"PRETTYPRINT_DEBUG_LEVEL");
5075 if(strcmp(s,
"") == 0
5178 text text_graph(), text_control() ;
5179 string control_slabel() ;
5236 bool exit_node_has_been_displayed =
false;
5247 if (c == exit_control)
5248 exit_node_has_been_displayed =
true;
5254 return exit_node_has_been_displayed;
5264 bool exit_node_has_been_displayed =
false;
5275 exit_node_has_been_displayed =
5286 if (! exit_node_has_been_displayed) {
5343 bool in_type_declaration,
5350 pips_user_warning(
"generating FORTRAN 2008 function call defined in the the module ISO_C_BINDING\n");
5374 *ppdl =
gen_once((
void *) te, *ppdl);
5403 "Fortran, aborting");
5406 pips_assert(
"We don't know how to prettyprint a subscript in Fortran95 "
5407 "and it's not an allocatable",
5497 bool is_recursive_p)
5523 if(is_recursive_p) {
float a2sf[2] __attribute__((aligned(16)))
USER generates a user error (i.e., non fatal) by printing the given MSG according to the FMT.
void user_log(const char *format,...)
expression copy_expression(expression p)
EXPRESSION.
call copy_call(call p)
CALL.
void free_expression(expression p)
unformatted make_unformatted(string a1, intptr_t a2, intptr_t a3, list a4)
sentence make_sentence_unformatted(unformatted _field_)
sentence make_sentence(enum sentence_utype tag, void *val)
struct _newgen_struct_entity_ * entity
void const char const char const int
sentence attach_head_to_sentence(sentence s, entity module)
Attach the PROGRAM/FUNCTION head:
void attach_decoration_to_text(text t)
Attach a decoration:
void attach_reference_to_word_list(string begin_word, string end_word, reference r)
Attach a module usage (CALL or function call):
void attach_regular_call_to_word(string word, call c)
Attach a reference:
void attach_statement_information_to_text(text t, statement s)
Attach some statement information to text:
void attach_loop_to_sentence_up_to_end_of_text(sentence s, text t, loop l)
The user interface:
struct _newgen_struct_statement_ * statement
text text_loop_cmf(entity module, const char *label, int margin, loop obj, int n, list lr, list lidx)
=====================================================================
text text_loop_craft(entity module, const char *label, int margin, loop obj, int n, list lr, list lidx)
=====================================================================
text text_initializations(entity m)
text text_declaration(entity module)
exported for hpfc.
#define ret(why, what)
true if not a remapping for old.
bool compilation_unit_p(const char *module_name)
The names of PIPS entities carry information about their nature.
bool empty_string_p(const char *s)
char * get_string_property(const char *)
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
static void comment(string_buffer code, spoc_hardware_type hw, dagvtx v, int stage, int side, bool flip)
statement make_block_statement(list)
Make a block statement from a list of statement.
#define CONTROL_MAP(ctl, code, c, list)
Macro to walk through all the controls reachable from a given control node of an unstructured.
const char * get_current_module_name(void)
Get the name of the current module.
entity get_current_module_entity(void)
Get the entity of the current module.
bool instruction_assign_p(instruction i)
Test if an instruction is an assignment.
bool instruction_continue_p(instruction i)
Test if an instruction is a CONTINUE, that is the FORTRAN nop, the ";" in C or the "pass" in Python....
bool return_instruction_p(instruction i)
Test if an instruction is a C or Fortran "return".
list loop_private_variables_as_entites(loop obj, bool local, bool index)
Get the variables local or private to a loop.
#define ENDP(l)
Test if a list is empty.
#define list_undefined_p(c)
Return if a list is undefined.
list gen_nreverse(list cp)
reverse a list in place
#define POP(l)
Modify a list pointer to point on the next element of the list.
#define NIL
The empty list (nil in Lisp)
list gen_once(const void *vo, list l)
Prepend an item to a list only if it is not already in the list.
list gen_copy_seq(list l)
Copy a list structure.
size_t gen_length(const list l)
void gen_free_string_list(list ls)
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
#define CAR(pcons)
Get the value of the first element of a list.
void gen_free_list(list l)
free the spine of the list
list gen_last(list l)
Return the last element of a list.
bool gen_in_list_p(const void *vo, const list lx)
tell whether vo belongs to lx
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
#define CDR(pcons)
Get the list less its first element.
#define MAPL(_map_list_cp, _code, _l)
Apply some code on the addresses of all the elements of a list.
list gen_copy_string_list(list ls)
of string
#define list_undefined
Undefined list definition :-)
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
statement effective_test_true(test)
returns the effective true branch of a test by skipping a possible sequence of one element.
list statement_block(statement)
Get the list of block statements of a statement sequence.
test statement_test(statement)
Get the test of a statement.
call statement_call(statement)
Get the call of a statement.
unstructured statement_unstructured(statement stat)
Get the unstructured of a statement.
bool unlabelled_statement_p(statement)
bool statement_test_p(statement)
bool statement_call_p(statement)
bool nop_statement_p(statement)
bool empty_statement_p(statement)
Test if a statement is empty.
bool statement_sequence_p(statement)
Statement classes induced from instruction type.
bool statement_unstructured_p(statement)
string statement_identification(statement)
Like external_statement_identification(), but with internal information, the hexadecimal address of t...
bool return_statement_p(statement)
Test if a statement is a C or Fortran "return".
bool statement_with_pragma_p(statement)
Test if a statement has some pragma.
list statement_to_direct_declarations(statement)
Returns the declarations contained directly in a statement s.
bool continue_statement_p(statement)
Test if a statement is a CONTINUE, that is the FORTRAN nop, the ";" in C or the "pass" in Python....
statement make_return_statement(entity)
list declaration_statement_to_initializations(statement)
bool empty_comments_p(const char *)
bool statement_with_empty_comment_p(statement)
Return true if the statement has an empty statement:
bool declaration_statement_p(statement)
Had to be optimized according to Beatrice Creusillet.
static GtkWidget * lines[HELP_LINES]
static Value eval(Pvecteur pv, Value val, Variable var)
hash_table hash_table_make(hash_key_type key_type, size_t size)
void * hash_get(const hash_table htp, const void *key)
this function retrieves in the hash table pointed to by htp the couple whose key is equal to key.
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.
bool prettyprint_language_is_fortran95_p()
void set_prettyprint_language_from_property(enum language_utype native)
set the prettyprint language according to the property PRETTYPRINT_LANGUAGE @description If the prope...
language get_prettyprint_language()
please avoid using this function directly, use predicate instead (see below)
bool prettyprint_language_is_c_p()
enum language_utype get_prettyprint_language_tag()
bool prettyprint_language_is_fortran_p()
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
#define pips_user_warning
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
#define pips_internal_error
#define RETURN_LABEL_NAME
#define LIST_DIRECTED_FORMAT_NAME
#define STATEMENT_ORDERING_UNDEFINED
mapping.h inclusion
string gen_strndup0(string, size_t)
Like strdup() but copy at most n characters.
string concatenate(const char *,...)
Return the concatenation of the given strings.
#define HASH_UNDEFINED_VALUE
value returned by hash_get() when the key is not found; could also be called HASH_KEY_NOT_FOUND,...
#define hash_table_undefined_p(h)
#define hash_table_undefined
Value of an undefined hash_table.
#define same_string_p(s1, s2)
#define SET_FOREACH(type_name, the_item, the_set)
enumerate set elements in their internal order.
#define string_undefined_p(s)
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
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,...
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.
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 ful...
list words_declaration(entity e, bool prettyprint_common_variable_dimensions_p, list *ppdl)
some compilers don't like dimensions that are declared twice.
sentence sentence_head(entity e, list *ppdl)
We have no way to distinguish between the SUBROUTINE and PROGRAM They two have almost the same proper...
list words_type(type obj, list *ppdl, bool argument_p)
obj is the type to describe
list c_words_entity(type t, list name, list *ppdl)
list words_brace_expression(expression exp, list *ppdl)
string close_extensions(extensions es, bool nl)
string extensions_to_string(extensions es, bool nl)
return a new allocated string with the string representation of the extensions.
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.
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.
#define CAST_OPERATOR_PRECEDENCE
static text text_hpf_directive(loop l, int m)
static bool pp_style_p(string s)
static sentence sentence_tail(entity e)
list Words_Any_Reference(reference obj, list pdl, const char *(*enf)(entity))
static list words_assign_substring_op(call obj, int __attribute__((unused)) precedence, bool __attribute__((unused)) leftmost, list *ppdl)
static text text_block(entity module, const char *label, int margin, list objs, int n, list *ppdl)
Build the text of a code block (a list of statements)
static list words_brace_op(call obj, int precedence __attribute__((unused)), bool leftmost __attribute__((unused)), list *ppdl)
#define pp_cray_style_p()
static list words_nullary_op_c(call obj, int precedence __attribute__((unused)), bool leftmost __attribute__((unused)), list *ppdl)
static list words_sizeofexpression(sizeofexpression obj, bool in_type_declaration, list *ppdl)
static bool precedence_p
This variable is used to disable the precedence system and hence to prettyprint all parentheses,...
static text text_directive(loop obj, int margin, string basic_directive, string basic_continuation, string parallel, list *ppdl)
static struct intrinsic_handler tab_intrinsic_handler[]
static hash_table intrinsic_handlers
static list words_omp_red(call obj, int precedence __attribute__((unused)), bool leftmost __attribute__((unused)), list *ppdl)
list eole_fms_specific_op(call obj, int precedence, bool leftmost, list *ppdl)
MULTIPLY-SUB operator.
static text text_block_elseif(entity module, const char *label, int margin, test obj, int n, list *ppdl)
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,...
list words_subscript_range(range obj, list *ppdl)
@description FI: array constructor R433, p.
char lib_ri_util_prettyprint_c_rcsid[]
misc.c
list words_subexpression(expression obj, int precedence, bool leftmost, list *ppdl)
exported for cmfortran.c
static list words_nullary_op_fortran(call obj, int precedence, bool __attribute__((unused)) leftmost, list *ppdl)
static list eole_fmx_specific_op(call obj, int __attribute__((unused)) precedence, bool __attribute__((unused)) leftmost, bool isadd, list *ppdl)
static list words_io_inst(call obj, int precedence, bool leftmost, list *ppdl)
#define PRETTYPRINT_UNREACHABLE_EXIT_MARKER
string get_comment_sentinel()
Start a single line comment.
static bool test_with_no_else_clause_p(test t)
static list words_cast(cast obj, int precedence, list *ppdl)
#define pp_doall_style_p()
static list words_intrinsic_call(call obj, int precedence, bool leftmost, list *ppdl)
list words_goto_label(const char *tlabel)
This function is useful only for parsed codes since gotos are removed by the controlizer.
void set_alternate_return_set()
list words_any_reference(reference obj, list *ppdl, const char *(*enf)(entity))
exported for expression.c
void reset_prettyprinter_head_hook()
#define pp_craft_style_p()
list Words_Subexpression(expression obj, int precedence, bool leftmost)
#define MAXIMAL_PRECEDENCE
lint
list words_call_intrinsic(call obj, int __attribute__((unused)) precedence, bool __attribute__((unused)) leftmost, list *ppdl)
#define PRETTYPRINT_UNSTRUCTURED_SUCC_MARKER
text empty_text(entity __attribute__((unused)) e, int __attribute__((unused)) m, statement __attribute__((unused)) s)
string get_comment_continuation()
Start a single line comment with continuation (blank spaces)
list words_syntax(syntax obj, list *ppdl)
exported for expression.c
#define PRETTYPRINT_UNSTRUCTURED_ITEM_MARKER
void reset_alternate_return_set()
static void init_intrinsic_handlers()
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
static string marged(string prefix, int margin)
returns a formatted text for the HPF independent and new directive well, no continuations and so,...
bool gcc_if_block_braces_required_p(test obj)
#define OMP_C_CONTINUATION
unsigned int get_prettyprint_indentation()
static list words_infix_binary_op(call obj, int precedence, bool leftmost, list *ppdl)
static text text_io_block_if(entity module, const char *label, int margin, test obj, int n, list *ppdl)
void close_prettyprint()
because some prettyprint functions may be used for debug, so the last hook set by somebody may have s...
static list loop_private_variables(loop obj, list *ppdl)
of string
list Words_Call(call obj, int precedence, bool leftmost, bool is_a_subroutine)
static const char * get_special_prettyprint_for_operator(call obj)
Check if the given operator is associated with a special prettyprint.
static list words_substring_op(call obj, int __attribute__((unused)) precedence, bool __attribute__((unused)) leftmost, list *ppdl)
static text text_logical_if(entity __attribute__((unused)) module, const char *label, int margin, test obj, int n, list *ppdl, bool is_recursive_p)
static sentence sentence_goto(entity module, const char *label, int margin, statement obj, int n)
static text text_test(entity module, const char *label, int margin, test obj, int n, list *ppdl, bool is_recursive_p)
static list set_of_labels_required_for_alternate_returns
Management of alternate returns.
static list words_unbounded_dimension(call __attribute__((unused)) obj, int __attribute__((unused)) precedence, bool __attribute__((unused)) leftmost, list __attribute__((unused)) *ppdl)
static list words_infix_nary_op(call obj, int precedence, bool leftmost, list *ppdl)
Extension of "words_infix_binary_op" function for nary operators used in the EOLE project - (since "n...
static string ensure_comment_consistency(const char *i_comments, language l)
return a formatted comment, that takes care of adding the relevant // or C depending on output langua...
#define PRETTYPRINT_UNSTRUCTURED_BEGIN_MARKER
Define the markers used in the raw unstructured output when the PRETTYPRINT_UNSTRUCTURED_AS_A_GRAPH p...
list words_range(range obj, list *ppdl)
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...
static list words_list_directed(call __attribute__((unused)) obj, int __attribute__((unused)) precedence, bool __attribute__((unused)) leftmost, list __attribute__((unused)) *ppdl)
static text text_block_if(entity module, const char *label, int margin, test obj, int n, list *ppdl, bool is_recursive_p)
Prettyprint the condition, the true and, possibly, the false branch.
list words_call(call obj, int precedence, bool leftmost, bool is_a_subroutine, list *ppdl)
exported for cmfortran.c
static list words_application(application a, list *ppdl)
bool C_comment_p(string c)
In case the input code is not C code, non-standard comments have to be detected.
static string(* head_hook)(entity)
hook for adding something in the head.
static text text_block_else(entity module, const char *label __attribute__((unused)), int margin, statement stmt, int n __attribute__((unused)), list *ppdl)
static list words_assign_op(call obj, int precedence, bool __attribute__((unused)) leftmost, list *ppdl)
static list words_prefix_unary_op(call obj, int precedence, bool __attribute__((unused)) leftmost, list *ppdl)
void set_prettyprinter_head_hook(string(*f)(entity))
static text text_block_ifthen(entity module, const char *label, int margin, test obj, int n, list *ppdl, bool is_recursive_p)
Prettyprint if clause of a test.
static text text_whileloop(entity module, const char *label, int margin, whileloop obj, int n, list *ppdl, bool is_recursive_p)
static text insert_locals(text r)
This function either appends the declaration to the text given as a parameter or return a new text wi...
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
static bool prettyprint_gcc_c_braces_p
This variable is used to gracefuly print braces around if / else blocks to avoid gcc warnings.
text C_any_comment_to_text(int r_margin, string c)
In case comments are not formatted according to C rules, e.g.
text generate_alternate_return_targets()
static list words_subscript(subscript s, list *ppdl)
text text_omp_directive(loop l, int m)
static list words_genuine_regular_call(call obj, bool is_a_subroutine, list *ppdl)
To deal with attachment on user module usage.
static int words_intrinsic_precedence(call)
#define PRETTYPRINT_UNSTRUCTURED_END_MARKER
static list words_inverse_op(call obj, int precedence, bool __attribute__((unused)) leftmost, list *ppdl)
WARNING : the floating point division is used wether b is an int or not ! (1.0/b) – in fact b should ...
static list words_comma_op(call obj, int precedence, bool __attribute__((unused)) leftmost, list *ppdl)
Nga Nguyen : this case is added for comma expression in C, but I am not sure about its precedence => ...
static list words_va_arg(list obj, list *ppdl)
list Words_Regular_Call(call obj, bool is_a_subroutine)
list Words_Syntax(syntax obj)
static list cstrsplit(const char *s, char delim)
Split string into a list of strings according to a separator, delim.
list words_expression(expression obj, list *ppdl)
This one is exported.
static text text_instruction(entity module, const char *label, int margin, instruction obj, int n, list *ppdl, bool is_recursive_p)
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...
list Words_Expression(expression obj)
of string
list words_loop_range(range obj, list *ppdl)
exported for craft
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 mu...
static list words_conditional_op(call obj, int precedence, bool __attribute__((unused)) leftmost, list *ppdl)
text init_text_statement(entity module, int margin, statement obj)
exported for unstructured.c
void init_prettyprint(text(*hook)(entity, int, statement))
checks that the prettyprint hook was actually reset...
static bool test_with_dangling_else_p(test t)
Some code shared by text_block_if and text_block_ifthen.
static int intrinsic_precedence(const char *)
static text(* text_statement_hook)(entity, int, statement)
#define MINIMAL_ARITHMETIC_PRECEDENCE
text C_comment_to_text(int margin, string comment)
Special handling for C comments with each line indented according to the context.
static list words_nullary_op(call obj, int precedence, bool __attribute__((unused)) leftmost, list *ppdl)
static const char * renamed_op_handling(const char *name)
static list words_unary_minus(call obj, int precedence, bool leftmost, list *ppdl)
static text text_forloop(entity module, const char *label, int margin, forloop obj, int n, list *ppdl, bool is_recursive_p)
static bool mark_block(unformatted *t_beg, unformatted *t_end, int n, int margin)
This function returns true if BLOCK boundary markers are required.
list Words_Reference(reference obj)
list words_reference(reference obj, list *ppdl)
sentence sentence_goto_label(entity __attribute__((unused)) module, const char *label, int margin, const char *tlabel, int n)
exported for unstructured.c
static list words_io_control(list *iol, int __attribute__((unused)) precedence, bool __attribute__((unused)) leftmost, list *ppdl)
static bool prettyprint_all_c_braces_p
This variable is used to print braces around all blocks including blocks with only one statement.
static list words_stat_io_inst(call obj, int __attribute__((unused)) precedence, bool __attribute__((unused)) leftmost, list *ppdl)
Implemented for ALLOCATE(), but is applicable for every call to function that take STAT= parameter.
static list words_implied_do(call obj, int __attribute__((unused)) precedence, bool __attribute__((unused)) leftmost, list *ppdl)
void add_target_to_alternate_return_set(entity l)
text C_standard_comment_to_text(int margin, string comment)
static list words_postfix_unary_op(call obj, int precedence, bool __attribute__((unused)) leftmost, list *ppdl)
text generic_text_statement_enclosed(entity, int, statement, bool, bool, list *, bool, bool)
text text_named_module(entity, entity, statement)
text Text_Statement(entity, int, statement)
text text_module(entity, statement)
statement find_last_statement(statement)
list initialize_previously_declared_entities(entity)
text text_statement(entity, int, statement, list *)
text text_unstructured(entity, const char *, int, unstructured, int, list *)
unstructured.c
string proper_statement_to_string(statement)
void add_control_node_identifier_to_text(text, control)
void output_a_graph_view_of_the_unstructured(text, entity, const char *, int, unstructured, int)
text text_statement_enclosed(entity, int, statement, bool, bool, list *)
bool last_statement_p(statement)
void reset_last_statement(void)
text Text_Proper_Statement(entity, int, statement)
text Text_Statement_Enclosed(entity, int, statement, bool, bool)
void output_a_graph_view_of_the_unstructured_successors(text, entity, int, control)
list unstructured_to_trail(unstructured)
void insure_return_as_last_statement(entity, statement *)
bool output_a_graph_view_of_the_unstructured_from_a_control(text, entity, int, control, control)
void set_last_statement(statement)
#define PRETTYPRINT_PARALLEL
static const char * prefix
#define UNBOUNDED_DIMENSION_NAME
#define C_STATEMENT_END_STRING
#define BITWISE_OR_OPERATOR_NAME
#define POWER_OPERATOR_NAME
#define ISOC99_VFSCANF_USER_FUNCTION_NAME
#define POST_DECREMENT_OPERATOR_NAME
#define PRINT_FUNCTION_NAME
#define ENTITY_DIVIDE_P(e)
#define BITWISE_XOR_OPERATOR_NAME
#define C_LESS_OR_EQUAL_OPERATOR_NAME
#define ENTITY_ALLOCATABLE_BOUND_P(e)
#define instruction_block_p(i)
#define ENTITY_ISOC99_VFSCANF_P(e)
#define READ_FUNCTION_NAME
#define C_AND_OPERATOR_NAME
#define GREATER_THAN_OPERATOR_NAME
#define ENDFILE_FUNCTION_NAME
#define C_GREATER_OR_EQUAL_OPERATOR_NAME
#define BITWISE_OR_UPDATE_OPERATOR_NAME
#define SUBSTRING_FUNCTION_NAME
#define EOLE_FMA_OPERATOR_NAME
These operators are used within the optimize transformation in order to manipulate operators such as ...
#define C_CONTINUE_FUNCTION_NAME
#define ENTITY_ASSIGN_P(e)
#define C_GREATER_THAN_OPERATOR_NAME
#define C_MODULO_OPERATOR_NAME
#define MINUS_OPERATOR_NAME
#define LESS_THAN_OPERATOR_NAME
#define ENTITY_IMPLIED_DCMPLX_P(e)
#define EQUIV_OPERATOR_NAME
#define DIVIDE_UPDATE_OPERATOR_NAME
#define ISOC99_SSCANF_USER_FUNCTION_NAME
#define COMMA_OPERATOR_NAME
#define MODULO_UPDATE_OPERATOR_NAME
#define POINT_TO_OPERATOR_NAME
#define PLUS_OPERATOR_NAME
#define ORDERING_NUMBER(o)
#define ENTITY_ISOC99_SSCANF_P(e)
#define ORDERING_STATEMENT(o)
#define EQUAL_OPERATOR_NAME
#define ISOC99_VSCANF_USER_FUNCTION_NAME
#define statement_block_p(stat)
#define RETURN_FUNCTION_NAME
#define BACKSPACE_FUNCTION_NAME
#define DEREFERENCING_OPERATOR_NAME
#define PIPS_C_MAX_OPERATOR_NAME
#define FIELD_OPERATOR_NAME
#define NON_EQUIV_OPERATOR_NAME
#define C_NON_EQUAL_OPERATOR_NAME
#define LEFT_SHIFT_UPDATE_OPERATOR_NAME
#define IMS_OPERATOR_NAME
#define ISOC99_VSSCANF_USER_FUNCTION_NAME
#define ISOC99_FSCANF_USER_FUNCTION_NAME
#define REWIND_FUNCTION_NAME
#define STATEMENT_NUMBER_UNDEFINED
default values
#define MULTIPLY_UPDATE_OPERATOR_NAME
#define ENTITY_ISOC99_SCANF_P(e)
#define OPEN_FUNCTION_NAME
#define END_FUNCTION_NAME
#define INVERSE_OPERATOR_NAME
#define LEFT_SHIFT_OPERATOR_NAME
#define CONDITIONAL_OPERATOR_NAME
#define unstructured_control
After the modification in Newgen: unstructured = entry:control x exit:control we have create a macro ...
#define C_RETURN_FUNCTION_NAME
#define AND_OPERATOR_NAME
FI: intrinsics are defined at a third place after bootstrap and effects! I guess the name should be d...
#define MINUS_UPDATE_OPERATOR_NAME
#define EOLE_FMS_OPERATOR_NAME
#define C_NOT_OPERATOR_NAME
#define OMP_FOR_FUNCTION_NAME
#define is_instruction_block
soft block->sequence transition
#define CONTINUE_FUNCTION_NAME
#define ALLOCATE_FUNCTION_NAME
F95.
#define ADDRESS_OF_OPERATOR_NAME
#define ENTITY_VA_END_P(e)
Defined elsewhere: #define ENTITY_ADDRESS_OF_P(e) entity_an_operator_p(e, ADDRESS_OF)
#define PRE_DECREMENT_OPERATOR_NAME
#define ENTITY_VA_START_P(e)
#define OMP_OMP_FUNCTION_NAME
#define OMP_PARALLEL_FUNCTION_NAME
#define DIVIDE_OPERATOR_NAME
#define WRITE_FUNCTION_NAME
#define CLOSE_FUNCTION_NAME
#define UNARY_MINUS_OPERATOR_NAME
#define BITWISE_XOR_UPDATE_OPERATOR_NAME
#define CONCATENATION_FUNCTION_NAME
#define EOLE_PROD_OPERATOR_NAME
#define PIPS_C_MIN_OPERATOR_NAME
PIPS run-time support for C code generation.
#define IMA_OPERATOR_NAME
Integer Multiply Add and Sub, FC 27/10/2005 for FI.
#define UNARY_PLUS_OPERATOR_NAME
#define RIGHT_SHIFT_UPDATE_OPERATOR_NAME
#define C_LESS_THAN_OPERATOR_NAME
#define BITWISE_NOT_OPERATOR_NAME
#define ENTITY_ISOC99_FSCANF_P(e)
#define GREATER_OR_EQUAL_OPERATOR_NAME
#define STOP_FUNCTION_NAME
#define PRE_INCREMENT_OPERATOR_NAME
#define EOLE_SUM_OPERATOR_NAME
#define ENTITY_VA_COPY_P(e)
#define POST_INCREMENT_OPERATOR_NAME
#define ASSIGN_OPERATOR_PRECEDENCE
#define ENTITY_ISOC99_VSSCANF_P(e)
#define ENTITY_IMPLIED_CMPLX_P(e)
#define PLUS_UPDATE_OPERATOR_NAME
#define ENTITY_ISOC99_VSCANF_P(e)
#define instruction_block(i)
#define PAUSE_FUNCTION_NAME
#define FORMAT_FUNCTION_NAME
#define IO_LIST_STRING_NAME
#define ENTITY_FALSE_P(e)
#define MINUS_C_OPERATOR_NAME
#define MULTIPLY_OPERATOR_NAME
#define BITWISE_AND_UPDATE_OPERATOR_NAME
#define LESS_OR_EQUAL_OPERATOR_NAME
#define C_OR_OPERATOR_NAME
#define BITWISE_AND_OPERATOR_NAME
#define OMP_REDUCTION_FUNCTION_NAME
#define RIGHT_SHIFT_OPERATOR_NAME
#define DEALLOCATE_FUNCTION_NAME
#define INQUIRE_FUNCTION_NAME
#define NOT_OPERATOR_NAME
#define IMPLIED_DO_FUNCTION_NAME
#define ISOC99_SCANF_USER_FUNCTION_NAME
#define ASSIGN_SUBSTRING_FUNCTION_NAME
#define NON_EQUAL_OPERATOR_NAME
#define C_EQUAL_OPERATOR_NAME
#define ASSIGN_OPERATOR_NAME
#define PLUS_C_OPERATOR_NAME
bool expression_allocatable_data_access_p(expression e)
Check if an expression is a reference to an allocatable array.
const char * entity_user_name(entity e)
Since entity_local_name may contain PIPS special characters such as prefixes (label,...
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...
bool entity_return_label_p(entity e)
char * new_label_local_name(entity module)
bool label_string_defined_in_current_module_p(string ls)
bool c_module_p(entity m)
Test if a module "m" is written in C.
code entity_code(entity e)
bool entity_main_module_p(entity e)
static int init
Maximal value set for Fortran 77.
void print_entities(list l)
bool entity_blockdata_p(entity e)
bool entity_empty_label_p(entity e)
bool io_entity_p(entity e)
Several implicit entities are declared to define the implicit effects of IO statements.
bool fortran_module_p(entity m)
Test if a module is in Fortran.
bool entity_f95module_p(entity e)
entity CreateIntrinsic(string name)
this function does not create an intrinsic function because they must all be created beforehand by th...
void reset_label_counter()
set get_referenced_entities(void *elem)
retrieves the set of entities used in elem beware that this entities may be formal parameters,...
const char * label_local_name(entity e)
END_EOLE.
bool positive_expression_p(expression e)
Use constants and type information to decide if the value of sigma(e) is always positive,...
bool negative_expression_p(expression e)
Use constants and type information to decide if the value of sigma(e) is always negative,...
bool expression_one_p(expression exp)
bool expression_call_p(expression e)
bool expression_cast_p(expression e)
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
cast expression_cast(expression e)
bool brace_expression_p(expression e)
Return bool indicating if expression e is a brace expression.
expression make_op_exp(char *op_name, expression exp1, expression exp2)
================================================================
bool unbounded_expression_p(expression e)
expression call_to_expression(call c)
Build an expression that call a function or procedure.
bool empty_extensions_p(extensions es)
sentence get_header_comments(entity module)
Get the header comments (before PROGRAM, FUNCTION,...) from the text declaration:
bool static_module_p(entity e)
Check if the given module entity is a static module.
bool void_function_p(entity m)
Check if m is a C void function or a Fortran subroutine.
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...
sentence get_declaration_comments(entity module)
Get all the declaration comments, that are comments from the PROGRAM, FUNCTION,...
basic basic_of_expression(expression)
basic basic_of_expression(expression exp): Makes a basic of the same basic as the expression "exp".
type call_compatible_type(type)
returns the type necessary to generate or check a call to an object of type t.
bool actual_label_replacement_p(expression)
Assumes that eap is a call.
list type_supporting_entities(list, type)
bool unsigned_type_p(type)
Predicates on types.
bool derived_type_p(type)
Returns true if t is of type struct, union or enum.
bool call_contains_alternate_returns_p(call)
entity find_label_entity(const char *, const char *)
util.c
basic expression_basic(expression)
#define type_functional_p(x)
#define syntax_reference_p(x)
#define functional_result(x)
#define instruction_sequence_p(x)
#define loop_execution(x)
#define syntax_reference(x)
#define forloop_initialization(x)
#define instruction_loop_p(x)
#define reference_variable(x)
#define SIZEOFEXPRESSION(x)
SIZEOFEXPRESSION.
#define sizeofexpression_type(x)
#define value_intrinsic_p(x)
#define forloop_increment(x)
#define instruction_loop(x)
#define statement_ordering(x)
#define sizeofexpression_expression(x)
#define type_functional(x)
#define instruction_goto(x)
#define syntax_application(x)
#define whileloop_evaluation(x)
#define type_statement_p(x)
#define code_declarations(x)
#define CONTROL(x)
CONTROL.
@ is_syntax_sizeofexpression
#define range_increment(x)
#define value_constant_p(x)
#define language_fortran95_p(x)
#define EXPRESSION(x)
EXPRESSION.
#define cast_expression(x)
#define application_arguments(x)
#define instruction_forloop_p(x)
#define subscript_indices(x)
#define instruction_undefined
#define statement_label(x)
#define entity_undefined_p(x)
#define expression_undefined
@ is_instruction_unstructured
@ is_instruction_whileloop
@ is_instruction_expression
#define instruction_tag(x)
#define whileloop_label(x)
#define execution_sequential_p(x)
#define value_symbolic_p(x)
#define sequence_statements(x)
#define reference_indices(x)
#define statement_extensions(x)
#define syntax_sizeofexpression(x)
#define instruction_sequence(x)
#define sizeofexpression_type_p(x)
#define instruction_forloop(x)
#define control_successors(x)
#define unstructured_exit(x)
#define instruction_unstructured_p(x)
#define instruction_call_p(x)
#define instruction_expression(x)
#define expression_undefined_p(x)
#define test_condition(x)
#define subscript_array(x)
#define instruction_whileloop(x)
#define application_function(x)
#define whileloop_body(x)
#define code_decls_text(x)
#define statement_declarations(x)
#define statement_instruction(x)
#define statement_comments(x)
#define instruction_whileloop_p(x)
#define instruction_call(x)
#define syntax_subscript(x)
#define forloop_condition(x)
@ is_execution_sequential
#define instruction_test_p(x)
#define call_arguments(x)
#define control_statement(x)
#define instruction_test(x)
#define statement_undefined_p(x)
#define whileloop_condition(x)
#define syntax_range_p(x)
#define basic_string_p(x)
#define statement_number(x)
#define instruction_goto_p(x)
#define expression_syntax(x)
#define language_fortran_p(x)
#define execution_parallel_p(x)
#define evaluation_before_p(x)
#define instruction_unstructured(x)
#define variable_basic(x)
#define statement_undefined
#define instruction_expression_p(x)
#define STATEMENT(x)
STATEMENT.
#define entity_initial(x)
Pvecteur cp
pointeur sur l'egalite ou l'inegalite courante
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
static int line
FLEX_SCANNER.
char * strndup(char const *s, size_t n)
A replacement function, for systems that lack strndup.
FI: I do not understand why the type is duplicated at the set level.
The structure used to build lists in NewGen.
for intrinsic registration
list(* f)(call, int, bool, list *)
precedence needed here According to the Precedence of Operators Arithmetic > Character > Relational >...
#define CHAIN_SWORD(l, s)
#define MERGE_TEXTS(r, t)
#define MAKE_ONE_WORD_SENTENCE(m, s)
#define ADD_SENTENCE_TO_TEXT(t, p)
void print_text(FILE *fd, text t)
void close_current_line(string, text, string)
void add_one_unformated_printf_to_text(text, string,...)
string words_join(list, const char *)
void add_to_current_line(string, const char *, string, text)
string text_to_string_nl(text)
#define sentence_undefined
#define unformatted_undefined
struct _newgen_struct_text_ * text
#define SENTENCE(x)
newgen_unformatted_domain_defined
#define text_sentences(x)
@ is_sentence_unformatted
#define exp
Avoid some warnings from "gcc -Wshadow".
entity module_entity_to_compilation_unit_entity(entity m)
Retrieve the compilation unit containing a module definition.