PIPS
|
#include <stdio.h>
#include <string.h>
#include "genC.h"
#include "linear.h"
#include "properties.h"
#include "misc.h"
#include "pipsdbm.h"
#include "ri.h"
#include "effects.h"
#include "text.h"
#include "text-util.h"
#include "ri-util.h"
#include "prettyprint.h"
#include "control.h"
#include "icfg.h"
Go to the source code of this file.
Functions | |
void | icfg_set_indentation (int indent) |
caller More... | |
void | icfg_reset_indentation (void) |
void | icfg_error_handler (void) |
static void | append_marged_text (text t, int margin, const char *what1, const char *what2) |
static bool | statement_flt (statement s) |
STATEMENT. More... | |
static void | statement_rwt (statement s) |
static void | call_flt (call c) |
CALL. More... | |
static bool | loop_flt (loop __attribute__((unused)) l) |
LOOP. More... | |
static void | anyloop_rwt (const char *st_what, const char *st_end_what, const char *st_index, statement body) |
static void | loop_rwt (loop l) |
static void | forloop_rwt (forloop l) |
static void | while_rwt (whileloop w) |
static bool | instruction_flt (instruction i) |
INSTRUCTION. More... | |
static void | instruction_rwt (instruction i) |
static bool | range_flt (range __attribute__((unused)) r) |
RANGE functions to avoid the indentation when dealing with DO expressions. More... | |
static void | range_rwt (range __attribute__((unused)) r) |
static bool | is_elsif_test_p (test t) |
TEST functions to deal with the indentation of ELSIFs. More... | |
static bool | has_elsif_test_p (test t) |
This function tests if the ELSE clause of t is an ELIF. More... | |
static bool | test_flt (test t) |
static void | test_rwt (test l) |
static void | print_module_icfg (entity module) |
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)) |
bool | generic_print_icfg (const string module_name, bool with_ifs, bool with_loops, bool do_graph, text(*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)) |
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)) |
Variables | |
static int | icfg_indent = ICFG_DEFAULT_INDENTATION |
static bool | print_loops = false |
We store the text for each statement in a mapping during a code traversal in order to print it afterwards. More... | |
static bool | print_ifs = false |
static bool | do_reset_current_module_entity_on_decoration = false |
static bool | prettyprint_fortran_icfg_p = true |
static bool | prettyprint_C_icfg_p = false |
static text(* | module_decoration )(const string) = NULL |
static text(* | precise_decoration )(entity, entity, statement, call) = NULL |
static text(* | filter_decoration_call )(entity, statement, call) = NULL |
static text(* | filter_decoration_stmt )(entity, statement) = NULL |
static int | current_margin |
static list | verlist = NIL |
of vertex More... | |
static vertex | current_vertex = NULL |
to make graph daVinci More... | |
#define current_stmt_head | ( | ) | ((statement) gen_get_ancestor(statement_domain, gen_get_current_object())) |
We want to keep track of the current statement inside the recurse.
Definition at line 76 of file icfg_scan.c.
#define ICFG_DEFAULT_INDENTATION (4) |
Definition at line 82 of file icfg_scan.c.
#define some_text_p | ( | t | ) | (t!=text_undefined && text_sentences(t)!=NIL) |
Definition at line 73 of file icfg_scan.c.
#define st_DO prettyprint_fortran_icfg_p ? "do " : "for " |
Definition at line 55 of file icfg_scan.c.
#define st_DOWHILE prettyprint_fortran_icfg_p ? "do while " : "while " |
Definition at line 59 of file icfg_scan.c.
#define st_ELIF prettyprint_fortran_icfg_p ? "else if" : "} else if () {" |
Definition at line 66 of file icfg_scan.c.
#define st_ELSE prettyprint_fortran_icfg_p ? "else" : "} else {" |
Definition at line 67 of file icfg_scan.c.
#define st_ENDDO prettyprint_fortran_icfg_p ? "enddo" : "}" |
Definition at line 56 of file icfg_scan.c.
#define st_ENDDOWHILE prettyprint_fortran_icfg_p ? "enddo" : "}" |
Definition at line 60 of file icfg_scan.c.
#define st_ENDFOR "}" |
Definition at line 58 of file icfg_scan.c.
#define st_ENDIF prettyprint_fortran_icfg_p ? "endif" : "}" |
Definition at line 68 of file icfg_scan.c.
#define st_ENDWHILE prettyprint_fortran_icfg_p? "endwhile": "}" |
Definition at line 71 of file icfg_scan.c.
#define st_FOR "for " |
Definition at line 57 of file icfg_scan.c.
#define st_IF prettyprint_fortran_icfg_p ? "if" : "if () {" |
Definition at line 64 of file icfg_scan.c.
#define st_REPEAT prettyprint_fortran_icfg_p ? "repeat " : "do {" |
Definition at line 61 of file icfg_scan.c.
#define st_THEN prettyprint_fortran_icfg_p ? "then" : "" |
Definition at line 65 of file icfg_scan.c.
#define st_UNTIL prettyprint_fortran_icfg_p ? "until" : "} while ();" |
Definition at line 62 of file icfg_scan.c.
#define st_WHILE prettyprint_fortran_icfg_p? "while": "while () {" |
These last two strings are used for unstructured.
Definition at line 70 of file icfg_scan.c.
|
static |
Print the text inside do expressions (before the DO!)
Print the DO
Print the text inside the loop
Print the ENDDO
store it to the statement mapping
Definition at line 221 of file icfg_scan.c.
References append_marged_text(), asprintf, current_margin, current_stmt_head, free(), icfg_indent, make_text(), MERGE_TEXTS, NIL, pips_debug, prettyprint_fortran_icfg_p, print_loops, return(), some_text_p, string_undefined, and text_undefined.
Referenced by forloop_rwt(), loop_rwt(), and while_rwt().
|
static |
Definition at line 127 of file icfg_scan.c.
References ADD_SENTENCE_TO_TEXT, asprintf, buffer, is_sentence_formatted, and make_sentence().
Referenced by anyloop_rwt(), call_flt(), instruction_rwt(), print_module_icfg(), and test_rwt().
|
static |
CALL.
If this is a "real function" (defined in the code elsewhere)
hum... pushes the current entity...
append the callee' icfg
ppend_icfg_file (r, callee_name);
store it to the statement mapping
Definition at line 168 of file icfg_scan.c.
References append_marged_text(), call_function, CALL_MARK, current_margin, current_stmt_head, current_vertex, do_reset_current_module_entity_on_decoration, entity_initial, entity_name, filter_decoration_call, get_current_module_entity(), get_vertex_by_string(), MERGE_TEXTS, module_decoration, module_local_name(), pips_debug, precise_decoration, reset_current_module_entity(), safe_make_successor(), set_current_module_entity(), value_code_p, verlist, and vertex_undefined.
Referenced by print_module_icfg().
|
static |
Definition at line 290 of file icfg_scan.c.
References anyloop_rwt(), forloop_body, st_ENDFOR, and st_FOR.
Referenced by print_module_icfg().
bool generic_print_icfg | ( | const string | module_name, |
bool | with_ifs, | ||
bool | with_loops, | ||
bool | do_graph, | ||
text(*)(const string) | decoration | ||
) |
module_name | odule_name |
with_ifs | ith_ifs |
with_loops | ith_loops |
do_graph | o_graph |
Definition at line 713 of file icfg_scan.c.
References internal_print_icfg(), and module_name().
Referenced by print_icfg(), print_icfg_with_control(), and print_icfg_with_loops().
bool generic_print_icfg_filtered | ( | const string | module_name, |
bool | with_ifs, | ||
bool | with_loops, | ||
bool | do_graph, | ||
text(*)(entity, statement, call) | decoration_call, | ||
text(*)(entity, statement) | decoration_stmt | ||
) |
module_name | odule_name |
with_ifs | ith_ifs |
with_loops | ith_loops |
do_graph | o_graph |
Definition at line 735 of file icfg_scan.c.
References internal_print_icfg(), and module_name().
bool generic_print_icfg_precise | ( | const string | module_name, |
bool | with_ifs, | ||
bool | with_loops, | ||
bool | do_graph, | ||
text(*)(entity, entity, statement, call) | decoration | ||
) |
module_name | odule_name |
with_ifs | ith_ifs |
with_loops | ith_loops |
do_graph | o_graph |
Definition at line 724 of file icfg_scan.c.
References internal_print_icfg(), and module_name().
This function tests if the ELSE clause of t is an ELIF.
Definition at line 464 of file icfg_scan.c.
References instruction_test_p, pips_debug, statement_instruction, and test_false.
Referenced by test_rwt().
void icfg_error_handler | ( | void | ) |
Definition at line 122 of file icfg_scan.c.
Referenced by print_module_icfg().
void icfg_reset_indentation | ( | void | ) |
Definition at line 117 of file icfg_scan.c.
References ICFG_DEFAULT_INDENTATION, and icfg_indent.
Referenced by internal_print_icfg().
void icfg_set_indentation | ( | int | indent | ) |
caller
indent | ndent |
Definition at line 112 of file icfg_scan.c.
References icfg_indent.
Referenced by internal_print_icfg().
|
static |
INSTRUCTION.
Definition at line 307 of file icfg_scan.c.
References current_margin, icfg_indent, instruction_unstructured, instruction_unstructured_p, pips_debug, print_loops, and unstructured_while_p().
Referenced by print_module_icfg().
|
static |
store it to the statement mapping
SHARING! Every statement gets a pointer to the same precondition! I do not know if it's good or not but beware the bugs!!!
Print the WHILE
Print the text inside the unstructured (possibly the while body)
Print the ENDDWHILE
Definition at line 317 of file icfg_scan.c.
References append_marged_text(), control_statement, current_margin, current_stmt_head, FORWARD_CONTROL_MAP, gen_free_list(), icfg_indent, instruction_block, instruction_tag, instruction_unstructured, is_instruction_block, is_instruction_unstructured, make_text(), MAP, MERGE_TEXTS, NIL, pips_debug, print_loops, some_text_p, st_ENDWHILE, st_WHILE, STATEMENT, unstructured_control, and unstructured_while_p().
Referenced by print_module_icfg().
|
static |
Definition at line 668 of file icfg_scan.c.
References c_module_p(), debug_off, debug_on, do_reset_current_module_entity_on_decoration, entity_name, filter_decoration_call, filter_decoration_stmt, fortran_module_p(), get_int_property(), ICFG_DEBUG_LEVEL, ICFG_DOs, ICFG_DV, ICFG_IFs, icfg_reset_indentation(), icfg_set_indentation(), local_name_to_top_level_entity(), module_decoration, module_name(), pips_debug, precise_decoration, prettyprint_C_icfg_p, prettyprint_fortran_icfg_p, print_module_icfg(), and set_bool_property().
Referenced by generic_print_icfg(), generic_print_icfg_filtered(), and generic_print_icfg_precise().
TEST functions to deal with the indentation of ELSIFs.
This function tests if t is the exact content of and ELSE clause.
Determine if t is inside another test
Definition at line 422 of file icfg_scan.c.
References fprintf(), gen_get_ancestor_type, HASH_UNDEFINED_VALUE, ifdebug, pips_debug, print_statement(), statement_domain, test_domain, and test_false.
Referenced by test_flt(), and test_rwt().
|
static |
LOOP.
Definition at line 214 of file icfg_scan.c.
References current_margin, icfg_indent, pips_debug, and print_loops.
Referenced by print_module_icfg().
|
static |
Definition at line 285 of file icfg_scan.c.
References anyloop_rwt(), entity_user_name(), loop_body, loop_index, st_DO, and st_ENDDO.
Referenced by print_module_icfg().
|
static |
allocate the mapping
Definition at line 593 of file icfg_scan.c.
References append_marged_text(), call_domain, call_flt(), CALL_MARK, current_margin, current_vertex, db_get_memory_resource(), filter_decoration_call, forloop_domain, forloop_rwt(), gen_multi_recurse(), gen_null(), get_bool_property(), ICFG_DOs, ICFG_DV, icfg_error_handler(), ICFG_IFs, icfg_indent, instruction_domain, instruction_flt(), instruction_rwt(), loop_domain, loop_flt(), loop_rwt(), make_resource_from_starting_node(), make_text(), make_vertex(), MAP, MERGE_TEXTS, module, module_local_name(), module_name(), NIL, print_ifs, print_loops, range_domain, range_flt(), range_rwt(), reset_current_module_entity(), reset_hooks_register(), reset_hooks_unregister(), safe_add_vertex_to_list(), safe_free_vertex(), SENTENCE, sentence_to_string(), set_current_module_entity(), statement_domain, statement_flt(), statement_rwt(), test_domain, test_flt(), test_rwt(), text_sentences, verlist, vertex_successors, vertex_undefined, vertex_undefined_p, while_rwt(), and whileloop_domain.
Referenced by internal_print_icfg().
|
static |
RANGE functions to avoid the indentation when dealing with DO expressions.
Definition at line 399 of file icfg_scan.c.
References current_margin, current_stmt_head, icfg_indent, loop_range, print_loops, statement_loop(), and statement_loop_p().
Referenced by print_module_icfg().
|
static |
Definition at line 408 of file icfg_scan.c.
References current_margin, current_stmt_head, icfg_indent, loop_range, print_loops, statement_loop(), and statement_loop_p().
Referenced by print_module_icfg().
STATEMENT.
process the not call statement to print out filtered proper effects
Definition at line 140 of file icfg_scan.c.
References filter_decoration_stmt, get_current_module_entity(), make_text(), NIL, and pips_debug.
Referenced by print_module_icfg().
|
static |
Definition at line 159 of file icfg_scan.c.
References ifdebug, pips_debug, and print_text().
Referenced by print_module_icfg().
Definition at line 482 of file icfg_scan.c.
References current_margin, icfg_indent, is_elsif_test_p(), offset, pips_debug, and print_ifs.
Referenced by print_module_icfg().
|
static |
Print the IF.
If this is the IF of an ELIF, don't print it.
print things in the if expression
print then statements
Print the THEN
print else/elif statements
Print the ELSE / ELIF
Print the ENDIF.
If this is the ENDIF of an ELIF, don't print it
store it to the statement mapping
Definition at line 503 of file icfg_scan.c.
References append_marged_text(), copy_text(), current_margin, current_stmt_head, has_elsif_test_p(), icfg_indent, is_elsif_test_p(), make_text(), MERGE_TEXTS, NIL, offset, pips_debug, print_ifs, some_text_p, st_ELIF, st_ELSE, st_ENDIF, st_IF, st_THEN, test_false, test_true, and text_undefined.
Referenced by print_module_icfg().
|
static |
Definition at line 295 of file icfg_scan.c.
References anyloop_rwt(), evaluation_before_p, st_DOWHILE, st_ENDDOWHILE, st_REPEAT, st_UNTIL, whileloop_body, and whileloop_evaluation.
Referenced by print_module_icfg().
|
static |
Definition at line 105 of file icfg_scan.c.
Referenced by anyloop_rwt(), call_flt(), instruction_flt(), instruction_rwt(), loop_flt(), print_module_icfg(), range_flt(), range_rwt(), test_flt(), and test_rwt().
|
static |
to make graph daVinci
Definition at line 108 of file icfg_scan.c.
Referenced by call_flt(), and print_module_icfg().
Definition at line 95 of file icfg_scan.c.
Referenced by call_flt(), and internal_print_icfg().
|
static |
Definition at line 102 of file icfg_scan.c.
Referenced by call_flt(), internal_print_icfg(), and print_module_icfg().
Definition at line 103 of file icfg_scan.c.
Referenced by internal_print_icfg(), and statement_flt().
|
static |
Definition at line 83 of file icfg_scan.c.
Referenced by anyloop_rwt(), icfg_reset_indentation(), icfg_set_indentation(), instruction_flt(), instruction_rwt(), loop_flt(), print_module_icfg(), range_flt(), range_rwt(), test_flt(), and test_rwt().
Definition at line 99 of file icfg_scan.c.
Referenced by call_flt(), and internal_print_icfg().
|
static |
Definition at line 100 of file icfg_scan.c.
Referenced by call_flt(), and internal_print_icfg().
Definition at line 97 of file icfg_scan.c.
Referenced by internal_print_icfg().
Definition at line 96 of file icfg_scan.c.
Referenced by anyloop_rwt(), and internal_print_icfg().
Definition at line 94 of file icfg_scan.c.
Referenced by print_module_icfg(), test_flt(), and test_rwt().
We store the text for each statement in a mapping during a code traversal in order to print it afterwards.
static drivers
Definition at line 93 of file icfg_scan.c.
Referenced by anyloop_rwt(), instruction_flt(), instruction_rwt(), loop_flt(), print_module_icfg(), range_flt(), and range_rwt().
of vertex
Definition at line 107 of file icfg_scan.c.
Referenced by adg_pure_dfg(), adg_reverse_graph(), call_flt(), make_filtered_dg_or_dvdg(), my_dfg_reverse_graph(), and print_module_icfg().