PIPS
|
#include <stdio.h>
#include <ctype.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "resources.h"
#include "misc.h"
#include "ri-util.h"
#include "prettyprint.h"
#include "effects-util.h"
#include "text-util.h"
#include "dg.h"
#include "phrase_tools.h"
Go to the source code of this file.
Data Structures | |
struct | statement_checking_context |
struct | sequence_searching_context |
Functions | |
string | statement_type_as_string (statement stat) |
DEBUG FUNCTION: return a string representing the type of the statement (SEQUENCE, CALL, etc...) More... | |
void | debug_statement (const char *comments, statement stat, int debug_level) |
DEBUG FUNCTION: print debugging informations for a statement stat. More... | |
void | debug_control (const char *comments, control a_control, int debug_level) |
DEBUG FUNCTION: print debugging informations for a control a_control. More... | |
void | debug_unstructured (unstructured an_unstructured, int debug_level) |
DEBUG FUNCTION: print debugging informations for an unstructured an_unstructured. More... | |
void | short_debug_unstructured (unstructured an_unstructured, int debug_level) |
DEBUG FUNCTION: print debugging informations for an unstructured an_unstructured (short version) More... | |
entity | clone_variable_with_new_name (entity a_variable, const char *new_name, const char *module_name) |
This function build and return new variable from a variable a_variable, with name new_name. More... | |
entity | make_variable_from_name_and_entity (entity cloned_variable, const char *base_name, statement stat, const char *module_name) |
Build and return new entity obtained by cloning variable cloned_variable, with a name obtained by the concatenation of base_name and the statement ordering of statement stat. More... | |
statement | make_binary_call_statement (const char *operator_name, expression expression1, expression expression2, statement stat) |
Build and return new statement which is a binary call with the 2 expressions expression1 and expression2, with empty label, statement number and ordering of statement stat, and empty comments. More... | |
statement | make_assignement_statement (entity a_variable, expression an_expression, statement stat) |
Build and return new statement which is a assignement of variable a_variable with expression an_expression, with empty label, statement number and ordering of statement stat, and empty comments. More... | |
int | beautify_ordering (int an_ordering) |
Special function made for Ronan Keryell who likes a lot when a integer number is coded on 3 bits :-) More... | |
void | clean_statement_from_tags (const char *comment_portion, statement stat) |
static void | check_if_statement_contains_comment (statement s, void *a_context) |
list | get_statements_with_comments_containing (const char *comment_portion, statement stat) |
bool | statement_is_contained_in_a_sequence_p (statement root_statement, statement searched_stat) |
static void | search_sequence_containing (statement s, void *a_context) |
statement | sequence_statement_containing (statement root_statement, statement searched_stat) |
void | replace_in_sequence_statement_with (statement old_stat, statement new_stat, statement root_stat) |
Replace statement old_stat by statement new_stat, asserting that this statement is contained in a sequence. More... | |
list | references_for_regions (list l_regions) |
Return a list of references corresponding to a list of regions. More... | |
Special function made for Ronan Keryell who likes a lot when a integer number is coded on 3 bits :-)
an_ordering | n_ordering |
Definition at line 407 of file phrase_tools.c.
Referenced by debug_unstructured(), entry_state_variable_value_for_unstructured(), and make_transition_statement().
|
static |
ips_debug(5, "Searching comment: [%s] in [%s]\n", context->searched_string, comments);
Definition at line 459 of file phrase_tools.c.
References CONS, STATEMENT, statement_comments, statement_with_empty_comment_p(), and strdup().
Referenced by get_statements_with_comments_containing().
void clean_statement_from_tags | ( | const char * | comment_portion, |
statement | stat | ||
) |
comment_portion | omment_portion |
stat | tat |
Definition at line 414 of file phrase_tools.c.
References concatenate(), empty_comments, statement_comments, statement_with_empty_comment_p(), and strdup().
Referenced by remove_begin_tag(), and remove_end_tag().
entity clone_variable_with_new_name | ( | entity | a_variable, |
const char * | new_name, | ||
const char * | module_name | ||
) |
This function build and return new variable from a variable a_variable, with name new_name.
If an entity called new_name already exists, return NULL. New variable is added to declarations
Assert that module represent a value code
This entity does not exist, we can safely create it
new_variable = copy_entity (a_variable); entity_name(new_variable) = strdup(concatenate(module_name, MODULE_SEP_STRING, new_name, NULL));
ew_variable = find_or_create_scalar_entity (strdup(concatenate(module_name, MODULE_SEP_STRING, new_name, NULL)),module_name, is_basic_int);
This entity already exist, we return null
a_variable | _variable |
new_name | ew_name |
module_name | odule_name |
Definition at line 269 of file phrase_tools.c.
References a_variable, AddEntityToDeclarations(), concatenate(), copy_storage(), copy_type(), copy_value(), entity_domain, entity_initial, entity_storage, entity_type, entity_undefined, gen_find_tabulated(), make_entity, module, module_name(), module_name_to_entity(), MODULE_SEP_STRING, new_variable, pips_assert, strdup(), and value_code_p.
Referenced by make_variable_from_name_and_entity(), and new_local_image_variable().
DEBUG FUNCTION: print debugging informations for a control a_control.
comments | omments |
a_control | _control |
debug_level | ebug_level |
Definition at line 134 of file phrase_tools.c.
References control_predecessors, control_statement, control_successors, debug_statement(), gen_length(), and pips_debug.
Referenced by flatten_unstructured(), full_spaghettify_module(), and make_transition_statement().
DEBUG FUNCTION: print debugging informations for a statement stat.
comments | omments |
stat | tat |
debug_level | ebug_level |
Definition at line 111 of file phrase_tools.c.
References ifdebug, pips_debug, print_statement(), statement_comments, statement_domain_number, statement_number, statement_ordering, statement_type_as_string(), and statement_with_empty_comment_p().
Referenced by debug_control(), and full_spaghettify_statement().
void debug_unstructured | ( | unstructured | an_unstructured, |
int | debug_level | ||
) |
DEBUG FUNCTION: print debugging informations for an unstructured an_unstructured.
f (ordering > 65535) ordering = ordering >> 16;
f (ordering > 65535) ordering = ordering >> 16;
f (ordering > 65535) ordering = ordering >> 16;
an_unstructured | n_unstructured |
debug_level | ebug_level |
Definition at line 146 of file phrase_tools.c.
References asprintf, beautify_ordering(), concatenate(), CONTROL, CONTROL_MAP, control_predecessors, control_statement, control_successors, free(), gen_length(), gen_nth(), ifdebug, line, NIL, pips_debug, predecessors(), print_statement(), statement_ordering, strdup(), successors(), and unstructured_entry.
First, set searched_string (we remove format information)
Reset list
fdebug(5) { pips_debug(5, "Searching statements with comments: %s\n", context.searched_string);
pips_debug(5, "In statement:\n");
print_statement(stat); }
comment_portion | omment_portion |
stat | tat |
Definition at line 481 of file phrase_tools.c.
References check_if_statement_contains_comment(), gen_context_recurse, gen_true2(), NIL, statement_domain, and strdup().
Referenced by controlize_distribution(), identify_analyzed_statements_to_distribute(), and identify_statements_to_distribute().
statement make_assignement_statement | ( | entity | a_variable, |
expression | an_expression, | ||
statement | stat | ||
) |
Build and return new statement which is a assignement of variable a_variable with expression an_expression, with empty label, statement number and ordering of statement stat, and empty comments.
a_variable | _variable |
an_expression | n_expression |
stat | tat |
Definition at line 392 of file phrase_tools.c.
References a_variable, ASSIGN_OPERATOR_NAME, entity_to_expression(), and make_binary_call_statement().
Referenced by make_body_from_loop(), make_global_common_and_initialize(), and make_initialization_from_loop().
statement make_binary_call_statement | ( | const char * | operator_name, |
expression | expression1, | ||
expression | expression2, | ||
statement | stat | ||
) |
Build and return new statement which is a binary call with the 2 expressions expression1 and expression2, with empty label, statement number and ordering of statement stat, and empty comments.
operator_name | perator_name |
expression1 | xpression1 |
expression2 | xpression2 |
stat | tat |
Definition at line 354 of file phrase_tools.c.
References CONS, empty_comments, empty_extensions(), entity_empty_label(), entity_intrinsic(), EXPRESSION, is_instruction_call, make_call(), make_instruction(), make_statement(), make_synchronization_none(), NIL, statement_extensions, statement_number, STATEMENT_NUMBER_UNDEFINED, statement_ordering, and STATEMENT_ORDERING_UNDEFINED.
Referenced by make_array_communication_statement(), make_assignement_statement(), and make_communication_statement().
entity make_variable_from_name_and_entity | ( | entity | cloned_variable, |
const char * | base_name, | ||
statement | stat, | ||
const char * | module_name | ||
) |
Build and return new entity obtained by cloning variable cloned_variable, with a name obtained by the concatenation of base_name and the statement ordering of statement stat.
If such entity already exist, increment statement ordering to get first free name. We assume then that created entity's name is unique.
cloned_variable | loned_variable |
base_name | ase_name |
stat | tat |
module_name | odule_name |
Definition at line 325 of file phrase_tools.c.
References asprintf, clone_variable_with_new_name(), module_name(), statement_ordering, and variable_name().
Referenced by make_begin_variable(), make_end_variable(), make_increment_variable(), and make_index_variable().
Return a list of references corresponding to a list of regions.
l_regions | _regions |
Definition at line 603 of file phrase_tools.c.
References CONS, EFFECT, effect_any_reference, entity_local_name(), MAP, NIL, pips_debug, print_reference(), ref, REFERENCE, and reference_variable.
Referenced by create_module_with_statement(), and distribute_code().
void replace_in_sequence_statement_with | ( | statement | old_stat, |
statement | new_stat, | ||
statement | root_stat | ||
) |
Replace statement old_stat by statement new_stat, asserting that this statement is contained in a sequence.
en_insert_after (new_stat, old_stat, stats_list); gen_remove (&stats_list, old_stat);
old_stat | ld_stat |
new_stat | ew_stat |
root_stat | oot_stat |
Definition at line 554 of file phrase_tools.c.
References CONS, gen_nreverse(), ifdebug, instruction_sequence, MAP, NIL, pips_assert, pips_debug, print_statement(), sequence_statement_containing(), sequence_statements, STATEMENT, and statement_instruction.
Referenced by distribute_code().
|
static |
Definition at line 520 of file phrase_tools.c.
References instruction_sequence, instruction_tag, is_instruction_sequence, MAP, sequence_statements, STATEMENT, and statement_instruction.
Referenced by sequence_statement_containing().
root_statement | oot_statement |
searched_stat | earched_stat |
Definition at line 536 of file phrase_tools.c.
References gen_context_recurse, gen_true2(), search_sequence_containing(), and statement_domain.
Referenced by compute_distribution_context(), identify_statements_to_distribute(), replace_in_sequence_statement_with(), and statement_is_contained_in_a_sequence_p().
void short_debug_unstructured | ( | unstructured | an_unstructured, |
int | debug_level | ||
) |
DEBUG FUNCTION: print debugging informations for an unstructured an_unstructured (short version)
an_unstructured | n_unstructured |
debug_level | ebug_level |
Definition at line 213 of file phrase_tools.c.
References asprintf, concatenate(), CONTROL, CONTROL_MAP, control_predecessors, control_successors, free(), ifdebug, MAP, NIL, pips_debug, strdup(), unstructured_entry, and unstructured_exit.
Referenced by flatten_unstructured().
root_statement | oot_statement |
searched_stat | earched_stat |
Definition at line 507 of file phrase_tools.c.
References sequence_statement_containing().
Referenced by identify_statements_to_distribute().
DEBUG FUNCTION: return a string representing the type of the statement (SEQUENCE, CALL, etc...)
stat | tat |
Definition at line 65 of file phrase_tools.c.
References instruction_tag, is_instruction_call, is_instruction_forloop, is_instruction_goto, is_instruction_loop, is_instruction_sequence, is_instruction_test, is_instruction_unstructured, is_instruction_whileloop, statement_instruction, and strdup().
Referenced by debug_statement(), fsmize_statement(), and spaghettify_statement().