25 #include "pips_config.h"
55 #define st_DO prettyprint_fortran_icfg_p ? "do " : "for "
56 #define st_ENDDO prettyprint_fortran_icfg_p ? "enddo" : "}"
59 #define st_DOWHILE prettyprint_fortran_icfg_p ? "do while " : "while "
60 #define st_ENDDOWHILE prettyprint_fortran_icfg_p ? "enddo" : "}"
61 #define st_REPEAT prettyprint_fortran_icfg_p ? "repeat " : "do {"
62 #define st_UNTIL prettyprint_fortran_icfg_p ? "until" : "} while ();"
64 #define st_IF prettyprint_fortran_icfg_p ? "if" : "if () {"
65 #define st_THEN prettyprint_fortran_icfg_p ? "then" : ""
66 #define st_ELIF prettyprint_fortran_icfg_p ? "else if" : "} else if () {"
67 #define st_ELSE prettyprint_fortran_icfg_p ? "else" : "} else {"
68 #define st_ENDIF prettyprint_fortran_icfg_p ? "endif" : "}"
70 #define st_WHILE prettyprint_fortran_icfg_p? "while": "while () {"
71 #define st_ENDWHILE prettyprint_fortran_icfg_p? "endwhile": "}"
73 #define some_text_p(t) (t!=text_undefined && text_sentences(t)!=NIL)
76 #define current_stmt_head() \
77 ((statement) gen_get_ancestor(statement_domain, gen_get_current_object()))
82 #define ICFG_DEFAULT_INDENTATION (4)
150 t = (*filter_decoration_stmt)(e_caller, s);
155 store_statement_icfg(s, t);
223 const char* st_end_what,
224 const char* st_index,
230 bool text_in_do_p, text_in_loop_p;
239 inside_the_loop = (
text) load_statement_icfg (body);
252 if ((text_in_loop_p || text_in_do_p) &&
print_loops)
258 asprintf(&st_end,
"(%s) {", st_index);
274 if ((text_in_loop_p || text_in_do_p) &&
print_loops)
320 bool text_in_unstructured_p =
false;
328 pips_debug (5,
"dealing with a block, appending texts\n");
344 bool while_p =
false;
346 pips_debug (5,
"dealing with an unstructured, appending texts\n");
357 MERGE_TEXTS(inside_the_unstructured, load_statement_icfg (st));
362 text_in_unstructured_p =
some_text_p(inside_the_unstructured);
368 if(text_in_unstructured_p) {
375 if(text_in_unstructured_p) {
382 if (text_in_unstructured_p &&
print_loops && while_p)
424 bool elsif_p =
false;
456 elsif_p = (ptf == ts);
466 bool has_elsif_p =
false;
468 pips_debug (3,
">>>has_elsif_test_p begins for test=%p\n", t);
475 pips_debug (3,
"has_elsif_p = %d\n", has_elsif_p);
476 pips_debug (3,
">>>has_elsif_test_p ends for test=%p\n", t);
478 return (has_elsif_p);
484 bool is_elsif_p =
false;
486 pips_debug (3,
">>>Test_flt begins for test=%p\n", t);
493 pips_debug( 4,
"is_elsif_p = %d\n", is_elsif_p);
494 pips_debug( 4,
"current_margin increased: %d -> %d\n",
498 pips_debug (3,
">>>Test_flt ends for test=%p\n", t);
509 bool something_to_print;
511 bool is_elsif_p =
false;
512 bool has_elsif_p =
false;
516 pips_debug (3,
">>>Test_rwt begins for test=%p\n", l);
532 pips_debug( 4,
"is_elsif_p = %d\n", is_elsif_p);
533 pips_debug( 4,
"current_margin decreased: %d -> %d\n",
542 if (something_to_print &&
print_ifs && !is_elsif_p)
565 else_margin -= (has_elsif_p && !is_elsif_p ?
icfg_indent : 0);
581 if (something_to_print &&
print_ifs && !is_elsif_p) {
588 pips_debug (3,
">>>Test_rwt ends for test=%p\n", l);
631 if (strstr(one_line,
CALL_MARK) == NULL) {
674 text (*deco1)(
const string),
718 text (*decoration)(
const string))
721 true, decoration, NULL, NULL, NULL);
732 true, NULL, decoration, NULL, NULL);
744 false, NULL, NULL, decoration_call, decoration_stmt);
float a2sf[2] __attribute__((aligned(16)))
USER generates a user error (i.e., non fatal) by printing the given MSG according to the FMT.
int get_int_property(const string)
vertex make_vertex(vertex_label a1, list a2)
text copy_text(text p)
TEXT.
sentence make_sentence(enum sentence_utype tag, void *val)
struct _newgen_struct_entity_ * entity
bool unstructured_while_p(unstructured u)
Test if an unstructured is found to be like a structured while-loop.
struct _newgen_struct_statement_ * statement
const char * module_name(const char *s)
Return the module part of an entity name.
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
#define gen_get_ancestor_type(i, o)
#define vertex_successors(x)
#define vertex_undefined_p(x)
#define FORWARD_CONTROL_MAP(ctl, code, c, list)
Walk through all the controls forward-reachable from a given control node of an unstructured.
void reset_current_module_entity(void)
Reset the current module entity.
entity set_current_module_entity(entity)
static.c
entity get_current_module_entity(void)
Get the entity of the current module.
void gen_multi_recurse(void *o,...)
Multi recursion visitor function.
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
#define NIL
The empty list (nil in Lisp)
void gen_free_list(list l)
free the spine of the list
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
loop statement_loop(statement)
Get the loop of a statement.
bool statement_loop_p(statement)
list safe_make_successor(vertex, vertex, list)
bool make_resource_from_starting_node(const char *, string, string, vertex, list, bool)
void safe_free_vertex(vertex, list)
util.c
vertex get_vertex_by_string(const char *, list)
list safe_add_vertex_to_list(vertex, list)
static void test_rwt(test l)
static bool loop_flt(loop __attribute__((unused)) l)
LOOP.
#define ICFG_DEFAULT_INDENTATION
static void anyloop_rwt(const char *st_what, const char *st_end_what, const char *st_index, statement body)
#define current_stmt_head()
We want to keep track of the current statement inside the recurse.
static text(* filter_decoration_call)(entity, statement, call)
static void forloop_rwt(forloop l)
static text(* precise_decoration)(entity, entity, statement, call)
static bool prettyprint_C_icfg_p
static text(* module_decoration)(const string)
bool generic_print_icfg_precise(const string module_name, bool with_ifs, bool with_loops, bool do_graph, text(*decoration)(entity, entity, statement, call))
static void append_marged_text(text t, int margin, const char *what1, const char *what2)
static bool internal_print_icfg(const string module_name, bool with_ifs, bool with_loops, bool do_graph, bool do_reset, text(*deco1)(const string), text(*deco2)(entity, entity, statement, call), text(*deco3)(entity, statement, call), text(*deco4)(entity, statement))
static vertex current_vertex
to make graph daVinci
void icfg_reset_indentation(void)
static void range_rwt(range __attribute__((unused)) r)
static void loop_rwt(loop l)
void icfg_error_handler(void)
static void instruction_rwt(instruction i)
static bool do_reset_current_module_entity_on_decoration
void icfg_set_indentation(int indent)
caller
static int current_margin
static void call_flt(call c)
CALL.
bool generic_print_icfg(const string module_name, bool with_ifs, bool with_loops, bool do_graph, text(*decoration)(const string))
static bool has_elsif_test_p(test t)
This function tests if the ELSE clause of t is an ELIF.
static bool is_elsif_test_p(test t)
TEST functions to deal with the indentation of ELSIFs.
static void statement_rwt(statement s)
#define st_WHILE
These last two strings are used for unstructured.
static void print_module_icfg(entity module)
static bool print_loops
We store the text for each statement in a mapping during a code traversal in order to print it afterw...
static bool instruction_flt(instruction i)
INSTRUCTION.
static bool range_flt(range __attribute__((unused)) r)
RANGE functions to avoid the indentation when dealing with DO expressions.
static text(* filter_decoration_stmt)(entity, statement)
static void while_rwt(whileloop w)
static bool test_flt(test t)
bool generic_print_icfg_filtered(const string module_name, bool with_ifs, bool with_loops, bool do_graph, text(*decoration_call)(entity, statement, call), text(*decoration_stmt)(entity, statement))
static bool statement_flt(statement s)
STATEMENT.
static bool prettyprint_fortran_icfg_p
static list verlist
of vertex
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
void reset_hooks_unregister(reset_func_t)
remove registered cleanup hook.
void reset_hooks_register(reset_func_t)
reset_hooks.c
#define GENERIC_LOCAL_MAPPING(name, result, type)
to allow mappings local to a file.
#define HASH_UNDEFINED_VALUE
value returned by hash_get() when the key is not found; could also be called HASH_KEY_NOT_FOUND,...
void print_statement(statement)
Print a statement on stderr.
void set_bool_property(const char *, bool)
#define unstructured_control
After the modification in Newgen: unstructured = entry:control x exit:control we have create a macro ...
#define is_instruction_block
soft block->sequence transition
#define instruction_block(i)
const char * entity_user_name(entity e)
Since entity_local_name may contain PIPS special characters such as prefixes (label,...
entity local_name_to_top_level_entity(const char *n)
This function try to find a top-level entity from a local name.
bool c_module_p(entity m)
Test if a module "m" is written in C.
const char * module_local_name(entity e)
Returns the module local user name.
bool fortran_module_p(entity m)
Test if a module is in Fortran.
struct _newgen_struct_test_ * test
#define forloop_domain
newgen_extensions_domain_defined
#define test_domain
newgen_entity_domain_defined
#define loop_domain
newgen_language_domain_defined
#define whileloop_evaluation(x)
#define statement_domain
newgen_sizeofexpression_domain_defined
#define instruction_domain
newgen_functional_domain_defined
#define call_domain
newgen_callees_domain_defined
@ is_instruction_unstructured
#define instruction_tag(x)
struct _newgen_struct_call_ * call
#define instruction_unstructured_p(x)
#define whileloop_body(x)
#define whileloop_domain
newgen_variable_domain_defined
#define statement_instruction(x)
#define instruction_test_p(x)
#define control_statement(x)
#define range_domain
newgen_ram_domain_defined
#define evaluation_before_p(x)
#define instruction_unstructured(x)
#define STATEMENT(x)
STATEMENT.
#define entity_initial(x)
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
The structure used to build lists in NewGen.
#define MERGE_TEXTS(r, t)
#define ADD_SENTENCE_TO_TEXT(t, p)
string sentence_to_string(sentence sen)
SG: moved here from icfdg.
void print_text(FILE *fd, text t)
struct _newgen_struct_text_ * text
#define SENTENCE(x)
newgen_unformatted_domain_defined
#define text_sentences(x)