25 #include "pips_config.h"
65 debug(2,
"text_unstructured",
"Begin for unstructured %p\n", u);
72 fprintf(stderr,
"Unstructured %p (%p, %p)\n", u, centry, cexit) ;
80 fprintf(stderr,
"\n%*sNode %p (%s)\n--\n", margin,
"",
87 fprintf(stderr,
"--\n%*sPreds:", margin,
"");
93 fprintf(stderr,
"\n%*sSuccs:", margin,
"") ;
122 debug(3,
"text_unstructured",
"Trail length: %d\n",
gen_length(trail));
150 debug(2,
"text_unstructured",
"End for unstructured %p\n", u);
179 debug(3,
"build_trail",
"Skipping IO check %s",
182 debug(3,
"build_trail",
"False Successor: %s",
186 debug(3,
"build_trail",
"True Successor: %s",
194 debug(3,
"build_trail",
"for %s with %d successors\n",
201 debug(3,
"build_trail",
"Successor %d: %s",
208 debug(3,
"build_trail",
"Add to trail %s",
232 debug(3,
"build_trail",
"Already in trail %s",
266 fprintf(stderr,
"[dump_trail] trail is empty\n");
269 fprintf(stderr,
"[dump_trail] begin\n");
274 fprintf(stderr,
"[dump_trail] end\n");
296 for(cc=trail; !
ENDP(cc);
POP(cc)) {
300 debug(3,
"decorate_trail",
"Processing statement %s with %d successors\n",
321 pips_assert(
"The successor is not a check io statement",
350 debug(3,
"decorate_trail",
"Successor 1 %s",
352 debug(3,
"decorate_trail",
"Successor 2 %s",
425 pips_assert(
"At least one control should appear in trail", c==c1 || c==c2);
463 pips_debug(3,
"Associates label %s to stmt %s\n",
468 debug(3,
"set_control_to_label",
"Retrieves label %s for stmt %s\n",
486 debug(3,
"control_to_label_name",
"Retrieves no label for stmt %s\n",
491 debug(3,
"control_to_label_name",
"Retrieves label %s for stmt %s\n",
504 fprintf(stderr,
"[dump_control_to_label_name] Begin\n");
506 fprintf(stderr,
"Label %s -> %s", (
char *) l,
510 fprintf(stderr,
"[dump_control_to_label_name] %d labels, end\n", i);
519 for (cc = trail; !
ENDP(cc);
POP(cc)) {
549 "Label %s generated for stmt %s\n",
578 pips_assert(
"The successor is not a check io statement",
620 bool no_endif =
false;
661 if (tsucc == succ1) {
662 if (tsucc == succ2) {
689 if (tsucc == succ2) {
unformatted make_unformatted(string a1, intptr_t a2, intptr_t a3, list a4)
sentence make_sentence(enum sentence_utype tag, void *val)
static list blocks
lisp of loops
bool empty_global_label_p(const char *gln)
const char * local_name(const char *s)
Does not take care of block scopes and returns a pointer.
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_chunk_undefined
#define CONTROL_MAP(ctl, code, c, list)
Macro to walk through all the controls reachable from a given control node of an unstructured.
#define ENDP(l)
Test if a list is empty.
list gen_nreverse(list cp)
reverse a list in place
void gen_remove(list *cpp, const void *o)
remove all occurences of item o from list *cpp, which is thus modified.
#define POP(l)
Modify a list pointer to point on the next element of the list.
#define NIL
The empty list (nil in Lisp)
size_t gen_length(const list l)
#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
#define CDR(pcons)
Get the list less its first element.
void * gen_find_eq(const void *item, const list seq)
#define MAPL(_map_list_cp, _code, _l)
Apply some code on the addresses of all the elements of a list.
bool check_io_statement_p(statement)
entity statement_to_label(statement)
See if statement s is labelled and can be reached by a GO TO.
string statement_identification(statement)
Like external_statement_identification(), but with internal information, the hexadecimal address of t...
bool statement_does_return(statement)
Returns false is no syntactic control path exits s (i.e.
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.
void hash_table_free(hash_table htp)
this function deletes a hash table that is no longer useful.
enum language_utype get_prettyprint_language_tag()
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
#define pips_internal_error
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
#define MODULE_SEP_STRING
#define HASH_MAP(k, v, code, ht)
#define HASH_UNDEFINED_VALUE
value returned by hash_get() when the key is not found; could also be called HASH_KEY_NOT_FOUND,...
#define string_undefined_p(s)
string get_comment_sentinel()
Start a single line comment.
list words_goto_label(const char *tlabel)
This function is useful only for parsed codes since gotos are removed by the controlizer.
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...
list words_expression(expression obj, list *ppdl)
This one is exported.
text init_text_statement(entity module, int margin, statement obj)
exported for unstructured.c
text C_comment_to_text(int margin, string comment)
Special handling for C comments with each line indented according to the context.
sentence sentence_goto_label(entity __attribute__((unused)) module, const char *label, int margin, const char *tlabel, int n)
exported for unstructured.c
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,...
static text text_trail(entity module, int margin, list trail, hash_table labels, list *ppdl)
static bool appears_first_in_trail(list l, control c1, control c2)
returns true if c1 is encountered before c2 in trail, or if c1 == c2 is encountered in trail,...
void dump_trail(list trail)
static bool control_in_trail_p(list l, control c)
OK, a hash table could be used, as Pierre used too...
void dump_control_to_label_name(hash_table h)
text text_unstructured(entity module, const char *label, int margin, unstructured u, int num, list *ppdl)
unstructured.c
static void set_control_to_label(entity m, control c, hash_table h)
set_control_to_label allocates label for the control node c in the module m.
static string control_to_label_name(control c, hash_table h)
list unstructured_to_trail(unstructured u)
static void decorate_trail(entity module, list trail, hash_table labels)
text text_statement(entity, int, statement, list *)
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 *)
#define ORDERING_NUMBER(o)
#define ORDERING_STATEMENT(o)
#define unstructured_control
After the modification in Newgen: unstructured = entry:control x exit:control we have create a macro ...
#define GENERATED_LABEL_MODULE_NAME
char * new_label_local_name(entity module)
const char * module_local_name(entity e)
Returns the module local user name.
const char * label_local_name(entity e)
END_EOLE.
#define control_undefined
#define control_predecessors(x)
#define statement_ordering(x)
#define CONTROL(x)
CONTROL.
#define statement_label(x)
#define entity_undefined_p(x)
#define control_successors(x)
#define unstructured_exit(x)
#define test_condition(x)
#define statement_instruction(x)
#define statement_comments(x)
#define instruction_test_p(x)
#define control_statement(x)
#define instruction_test(x)
#define statement_number(x)
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
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.
The structure used to build lists in NewGen.
#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)
#define sentence_undefined
#define unformatted_undefined
#define sentence_unformatted(x)
#define unformatted_label(x)
@ is_sentence_unformatted