PIPS
|
detects a statement with no special effect... More...
Modules | |
Direct test of the instruction | |
type of statement | |
Block/sequence statement constructors | |
Direct statement accessors to | |
second level fields | |
Data Structures | |
struct | add_statement_declarations_t |
struct | entities_t |
struct | fswl |
structure used by find_statements_with_label_walker More... | |
struct | fswp |
used to pass parameters to find_statements_with_comment_walker More... | |
struct | sb |
struct | replace_statement_context |
Macros | |
#define | ERROR_PREFIX "!ERROR: " |
as name indicate, a comment is added. More... | |
#define | BUFSIZE 1024 |
#define | PIPS_DECLARATION_COMMENT "PIPS generated variable\n" |
#define | MAX_COMMENTERS 8 |
Typedefs | |
typedef string(* | generated_variable_commenter) (entity) |
commenters are function used to add comments to pips-created variables they are handled as a limited size stack all commenters are supposed to return allocated data More... | |
Functions | |
static bool | cannot_be_empty (bool *statement_is_empty) |
static bool | call_filter (call c, bool *statement_is_empty) |
bool | empty_code_p (statement s) |
statement.c More... | |
bool | empty_code_list_p (list l) |
bool | empty_comments_p (const char *s) |
bool | comments_equal_p (string c1, string c2) |
bool | statement_with_empty_comment_p (statement s) |
Return true if the statement has an empty statement: More... | |
bool | assignment_statement_p (statement s) |
Test if a statement is an assignment. More... | |
bool | assignment_block_or_statement_p (statement s) |
bool | return_statement_p (statement s) |
Test if a statement is a C or Fortran "return". More... | |
bool | exit_statement_p (statement s) |
bool | abort_statement_p (statement s) |
bool | fortran_return_statement_p (statement s) |
Test if a statement is a Fortran "return". More... | |
bool | C_return_statement_p (statement s) |
Test if a statement is a C "return". More... | |
bool | continue_statement_p (statement s) |
Test if a statement is a CONTINUE, that is the FORTRAN nop, the ";" in C or the "pass" in Python... More... | |
bool | forloop_statement_p (statement s) |
bool | declaration_statement_p (statement s) |
Had to be optimized according to Beatrice Creusillet. More... | |
bool | continue_statements_p (list sl) |
Check that all statements contained in statement list sl are a continue statements. More... | |
bool | stop_statement_p (statement s) |
Test if a statement is a Fortran STOP. More... | |
bool | format_statement_p (statement s) |
Test if a statement is a Fortran FORMAT. More... | |
bool | write_statement_p (statement s) |
bool | statement_less_p (statement st1, statement st2) |
bool | statement_possible_less_p (statement st1, statement st2) |
string | comments_dup (string comment) |
functions to generate statements More... | |
string | decls_text_dup (string dt) |
Duplicate statement decls_text. More... | |
statement | make_assign_statement (expression l, expression r) |
statement | make_return_statement (entity module) |
instruction | make_simple_Fortran_io_instruction (bool is_read_p, expression f, list io_list) |
Derived from the Fortran parser code. More... | |
statement | make_print_statement (string message) |
Make a Fortran print statement. More... | |
statement | make_C_print_statement (string message) |
statement | make_any_print_statement (string message) |
Generate a print of a constant character string on stderr for C or on stdout for Fortran. More... | |
statement | make_stop_statement (string message) |
This function returns a Fortran stop statement with an error message. More... | |
statement | make_exit_statement (int n, string errmess) |
This function returns a statement ending with a C exit statement. More... | |
statement | make_continue_statement (entity l) |
statement | make_plain_continue_statement () |
Make a simple continue statement to be used as a NOP or ";" in C. More... | |
statement | make_declarations_statement (list idl, int sn, string cs) |
Make a declaration(s) statement. More... | |
statement | make_declaration_statement (entity v, int sn, string cs) |
Make one declaration statement. More... | |
bool | declaration_statements_p (list sl) |
Check that all statements contained in statement list sl are declaration statements. More... | |
statement | add_initialization_information_to_declaration_statement (statement s, list iel) |
The initialization expression list is integrated into the internal representation as an argument list. More... | |
list | declaration_statement_to_initializations (statement s) |
statement | make_whileloop_statement (expression condition, statement body, int line_number, bool before) |
Build a while loop statement. More... | |
statement | make_loop_statement (entity i, expression low, expression up, expression inc, statement b) |
Build a loop statement. More... | |
statement | make_forloop_statement (expression init, expression cond, expression inc, statement body) |
statement | make_test_statement (expression cond, statement truebody, statement falsebody) |
statement | make_call_statement (string function_name, list args, entity l, string c) |
This function is limited to intrinsics calls... More... | |
statement | make_expression_statement (expression e) |
Build a statement from a given expression. More... | |
static void | update_number_to_statement (statement s) |
statement | apply_number_to_statement (hash_table nts, _int n) |
hash_table | build_number_to_statement (hash_table nts, statement s) |
hash_table | allocate_number_to_statement () |
statement | clear_labels (statement s) |
Get rid of all labels in controlized code before duplication. More... | |
void | clear_label (statement s) |
statement | st_make_nice_test (expression condition, list ltrue, list lfalse) |
statement | makeloopbody (loop l, statement s_old, bool inner_p) |
statement makeloopbody(l, s_old) make a statement for a loop body, using the fields of a previously existing statement More... | |
string | external_statement_identification (statement s) |
Does work neither with undefined statements nor with defined statements with undefined instructions. More... | |
string | statement_identification (statement s) |
Like external_statement_identification(), but with internal information, the hexadecimal address of the statement. More... | |
string | safe_statement_identification (statement s) |
static bool | gather_all_comments_of_a_statement_filter (statement s, string *all_comments) |
string | gather_all_comments_of_a_statement (statement s) |
Gather all the comments recursively found in the given statement and return them in a strduped string (NULL if no comment found). More... | |
char ** | find_first_statement_comment (statement s) |
Find the first non-empty comment of a statement, if any returns a pointer to the comment if found, pointer to a "string_undefined" otherwise. More... | |
static char ** | find_first_comment (statement s) |
Find the first comment of a statement, if any. More... | |
bool | try_to_put_a_comment_on_a_statement (statement s, string the_comments) |
Put a comment on a statement in a safe way. More... | |
void | put_a_comment_on_a_statement (statement s, string the_comments) |
Similar to try_to_put_a_comment_on_a_statement() but insert a CONTINUE to put the comment on it if there is only empty sequence(s) More... | |
void | append_comments_to_statement (statement s, string the_comments) |
Append a comment string (if non empty) to the comments of a statement, if the c. More... | |
void | insert_comments_to_statement (statement s, const char *the_comments) |
Insert a comment string (if non empty) at the beginning of the comments of a statement. More... | |
void | add_one_line_of_comment (statement s, string format,...) |
statement | add_comment_and_line_number (statement s, string sc, int sn) |
Since block cannot carry comments nor line numbers, they must be moved to an internal continue statement. More... | |
void | fix_sequence_statement_attributes (statement s) |
Since blocks are not represented in Fortran, they cannot carry a label. More... | |
void | fix_statement_attributes_if_sequence (statement s) |
Apply fix_sequence_statement_attributes() on the statement only if it really a sequence. More... | |
entity | statement_to_label (statement s) |
See if statement s is labelled and can be reached by a GO TO. More... | |
statement | add_label_to_statement (entity label, statement s, statement *labeled_statement) |
Add a label to a statement. More... | |
bool | statement_does_return (statement s) |
Returns false is no syntactic control path exits s (i.e. More... | |
bool | unstructured_does_return (unstructured u) |
void | gather_and_remove_all_format_statements_rewrite (statement s, list *all_formats) |
list | gather_and_remove_all_format_statements (statement s) |
Used to keep aside the FORMAT before many code transformation that could remove them either. More... | |
void | put_formats_at_module_beginning (statement s) |
Transfer all the FORMATs at the very beginning of a module: More... | |
void | put_formats_at_module_end (statement s) |
Transfer all the FORMATs at the very end of a module: More... | |
bool | figure_out_if_it_is_a_format (instruction i, bool *format_inside_statement_has_been_found) |
bool | format_inside_statement_p (statement s) |
int | statement_to_comment_length (statement stmt) |
Number of comment line directly attached to a statement. More... | |
static bool | down_counter (statement s) |
static void | up_counter (statement s) |
persistant_statement_to_int | statement_to_line_number (statement s) |
static void | generic_insert_statement (statement s, statement s1, bool before) |
insert statement s1 before or after statement s More... | |
void | insert_statement (statement s, statement s1, bool before) |
This is the normal entry point. More... | |
void | insert_statement_no_matter_what (statement s, statement s1, bool before) |
Break the IR consistency or, at the very least, do not insert new declarations at the usual place, i.e. More... | |
void | append_statement_to_block_statement (statement b, statement s) |
static string | default_generated_variable_commenter (__attribute__((unused)) entity e) |
void | push_generated_variable_commenter (string(*commenter)(entity)) |
void | pop_generated_variable_commenter () |
string | generated_variable_comment (entity e) |
static bool | add_declaration_to_declaration_statement_p (statement s, string c, entity nv) |
Check if declaration of variable nv can be added to the declaration list of statement s. More... | |
static statement | generic_add_declaration_statement (statement s, entity e, bool before_p) |
Add a new declaration statement. More... | |
statement | add_declaration_statement (statement s, entity e) |
statement | add_declaration_statement_at_beginning (statement s, entity e) |
statement | add_declaration_statement_here (statement block_statement, statement s, entity e, bool before_p) |
Add a new declaration statement (inspired by generic_add_declaration_statement) More... | |
void | fix_block_statement_declarations (statement s) |
s is assumed to be a block statement and its declarations field is assumed to be correct, but not necessarily the declaration statements within the block s. More... | |
statement | remove_declaration_statement (statement s, entity e) |
Declarations are not only lists of entities, but also statement to carry the line number, comments,... More... | |
statement | update_statement_instruction (statement s, instruction i) |
Replace the instruction in statement s by instruction i. More... | |
void | statement_replace_with_statement_list (statement as, statement rs, list sl) |
Assume that statement rs appears in statement as and replaced it by a statement list. More... | |
static bool | find_implicit_goto (statement s, list *tl) |
list | statement_to_implicit_target_labels (statement s) |
Look for labels appearing in END= or ERR= IO clauses and allocate a label list. More... | |
static bool | collect_labels (statement s, list *pll) |
list | statement_to_labels (statement s) |
Look for non-empty labels appearing directly or indirectly and allocate a label list. More... | |
static bool | undefined_statement_found_p (statement s, bool *p_undefined_p) |
bool | all_statements_defined_p (statement s) |
static bool | add_statement_declarations (statement s, add_statement_declarations_t *ctxt) |
Add the declarations of a statement to a list if not already here. More... | |
list | statement_to_declarations (void *s) |
Get a list of all variables declared recursively within a statement. More... | |
list | statements_to_declarations (list sl) |
Returns the declarations contained in a list of statement. More... | |
list | instruction_to_declarations (instruction i) |
Get a list of all variables declared recursively within an instruction. More... | |
static list | internal_statement_to_direct_declarations (statement st) |
No recursive descent. More... | |
static list | unstructured_to_direct_declarations (unstructured u) |
list | statements_to_direct_declarations (list sl) |
Returns the declarations contained directly in the declaration statements of a list of statements. More... | |
list | statement_to_direct_declarations (statement s) |
Returns the declarations contained directly in a statement s. More... | |
static bool | add_stat_referenced_entities (reference r, entities_t *vars) |
static bool | add_loop_index_entity (loop l, entities_t *vars) |
static bool | add_ref_entities_in_init (statement s, entities_t *vars) |
list | statement_to_referenced_entities (statement s) |
Get a list of all variables referenced recursively within a statement: More... | |
static bool | add_stat_called_user_entities (call c, entities_t *funcs) |
static bool | add_stat_called_in_inits (statement s, entities_t *funcs) |
list | statement_to_called_user_entities (statement s) |
Get a list of all user function called recursively within a statement: More... | |
static bool | first_reference_to_v_p (reference r) |
static bool | declarations_first_reference_to_v_p (statement st) |
reference | find_reference_to_variable (statement s, entity v) |
static bool | count_static_references_to_v_p (reference r) |
Count static references. More... | |
int | count_static_references_to_variable (statement s, entity v) |
static bool | count_references_to_v_p (reference r) |
static bool | declarations_count_references_to_v_p (statement st) |
static bool | count_element_references_to_v_p (reference r) |
This function checks reference to proper elements, not slices. More... | |
static bool | declarations_count_element_references_to_v_p (statement st) |
static bool | count_loop_in (loop __attribute__((unused)) l) |
static void | count_loop_out (loop __attribute__((unused)) l) |
int | count_references_to_variable (statement s, entity v) |
int | count_references_to_variable_element (statement s, entity v) |
static bool | statement_in_statement_walker (statement st, struct sb *sb) |
bool | statement_in_statement_p (statement s, statement st) |
bool | statement_in_statements_p (statement s, list l) |
static bool | replace_statement_walker (statement s, struct replace_statement_context *ctx) |
bool | statement_replace_in_root_statement (statement old_stat, statement new_stat, statement root_stat) |
replace old_stat by new_stat in root_stat this pass does not free old_stat similar to replace_in_sequence_statement_with() in phrase/phrase_tools.c but without the constraint that old_stat is in a sequence More... | |
Variables | |
static hash_table | number_to_statement = hash_table_undefined |
Mapping from statement number to statement. More... | |
static set | duplicate_numbers = set_undefined |
To keep track of duplicate numbers. More... | |
static int | current_line = -1 |
Poor attempt at associating physical line numbers to statement. More... | |
static persistant_statement_to_int | stmt_to_line = persistant_statement_to_int_undefined |
static generated_variable_commenter | generated_variable_commenters [MAX_COMMENTERS] |
static size_t | nb_commenters =1 |
static reference | first_reference_to_v = reference_undefined |
Return first reference found. More... | |
static entity | variable_searched = entity_undefined |
static int | reference_count = -1 |
static int | loop_depth |
Estimate count of dynamic references. More... | |
get_statement_depth and its auxilary functions | |
static bool | is_substatement = false |
bool | statement_substatement_walker (statement some, statement s) |
bool | statement_substatement_p (statement s, statement root) |
search a statement inside a statement More... | |
int | get_statement_depth (statement s, statement root) |
computes the block-depth of a statement NOT INTENDED to generate entity name declared at particular block level : The block scope depends on the number of different blocks at the same depth ! More... | |
statement finders | |
static bool | find_statements_with_label_walker (statement s, struct fswl *p) |
helper to find statement with a particular label as label should be unique, the function stops once a statement is found More... | |
statement | find_statement_from_label (statement s, entity label) |
find a statement in s with entity label More... | |
statement | find_statement_from_label_name (statement s, const char *module_name, const char *label_name) |
bool | statement_with_pragma_p (statement s) |
Test if a statement has some pragma. More... | |
list | statement_pragmas (statement s) |
get the list of pragma of a statement s More... | |
extension | get_extension_from_statement_with_pragma (statement s, const char *seed) |
Get the extension of a statement with pragma beginning with a prefix. More... | |
static bool | find_statements_with_pragma_walker (statement s, struct fswp *p) |
list | find_statements_with_pragma (statement s, const char *begin) |
Get a list of statements with pragma begining with a prefix. More... | |
static bool | look_for_user_call (call c, bool *user_call_p) |
bool | statement_contains_user_call_p (statement s) |
static bool | look_for_control_effects (call c, bool *control_effect_p) |
bool | statement_may_have_control_effects_p (statement s) |
static bool | look_for_exiting_intrinsic_calls (call c, bool *control_effect_p) |
bool | statement_may_contain_exiting_intrinsic_call_p (statement s) |
statement | normalize_statement (statement s) |
Make (a bit more) sure that s is gen_defined_p in spite of poor decision for empty fields and that strdup can be used on the string fields. More... | |
detects a statement with no special effect...
Look if at least one statement of a list of statements is in another one.
Look if a statement is another one.
Check if a statement s contains a call to a user-defined function or to an intrinsic with control effects.
Check if a statement s contains a call to a user-defined function.
Make sure that s and all its substatements are defined.
Return true only if there is a FORMAT inside the statement:
This may be useful because PIPS does not contain a control effect analysis and because a user-defined function can hide a control effect such as exit(), abort() or STOP.
s | is the potentially inside statement |
st | is the outside statement |
s
is inside st
l | is the list of statements |
st | is the outside statement |
l
is inside st
#define BUFSIZE 1024 |
Definition at line 1938 of file statement.c.
#define ERROR_PREFIX "!ERROR: " |
as name indicate, a comment is added.
Definition at line 1937 of file statement.c.
#define MAX_COMMENTERS 8 |
Definition at line 2603 of file statement.c.
#define PIPS_DECLARATION_COMMENT "PIPS generated variable\n" |
Definition at line 2595 of file statement.c.
commenters are function used to add comments to pips-created variables they are handled as a limited size stack all commenters are supposed to return allocated data
Definition at line 2609 of file statement.c.
Definition at line 182 of file statement.c.
References abort_instruction_p(), and statement_instruction.
Since block cannot carry comments nor line numbers, they must be moved to an internal continue statement.
A prettier version could be to make a new block containing the continue and then the old block. Comments might be better located.
A continue statement must be inserted as first block statement
sc | c |
sn | n |
Definition at line 1980 of file statement.c.
References CONS, entity_undefined, free(), instruction_sequence, make_continue_statement(), sequence_statements, STATEMENT, statement_block_p, statement_comments, statement_instruction, statement_number, and string_undefined_p.
Referenced by MakeForloop().
Definition at line 2790 of file statement.c.
References generic_add_declaration_statement().
Referenced by add_induction_var_to_local_declarations(), copy_write_statement_with_cumulated_regions(), fix_block_statement_declarations(), freia_compile(), GenericAddLocalEntityToDeclarations(), make_send_receive_conversion(), outliner_patch_parameters(), regions_to_loops(), and spire_distributed_unstructured_to_structured().
Definition at line 2795 of file statement.c.
References generic_add_declaration_statement().
Referenced by cluster_stage_spire_generation(), and initilization().
statement add_declaration_statement_here | ( | statement | block_statement, |
statement | s, | ||
entity | e, | ||
bool | before_p | ||
) |
Add a new declaration statement (inspired by generic_add_declaration_statement)
A new declaration statement is generated to declare e. This statement is inserted before or after the statements s in statement block_statement. s must be a statement directly (no recursively) present in statement block_statement
Declarations are not only lists of entities at the block level and in the symbol table, but also declaration statement to carry the line number, comments, and the declarations local to the declaration statement. This function is low-level and does not maintain the consistency of the PIPS internal representation.
block_statement | must be a sequence that contain statement s strictly the same pointer than s and not a copy. |
s | Statement after or before which declaration is inserted |
e | Variable to declare. The declaration of e at block_statement level is not checked. The existence of a previous declaration statement for e is not checked either. The caller is responsible for the consistency management between the declaration statements in block_statement and the list of declaration at block_statement level. |
before_p | declaration add before s if before_p==true |
For the time being, a declaration statement is a continue statement. Beware that the possible dependencies between the new declaration and existing declarations are not checked. WARNING : block_statement is modify by side effect
Look for the statement s: it is pointed to by pl
Do we have previous declarations to skip?
SG: if CAR(pl) has same comment and same type as ds, merge them
SG: otherwise, insert ds
The new declaration is inserted before sl
pips_debug(8, "Statement after declaration insertion:\n");
print_statement(block_statement);
}
block_statement | lock_statement |
before_p | efore_p |
Definition at line 2839 of file statement.c.
References add_declaration_to_declaration_statement_p(), CAR, CDR, comment(), CONS, declaration_statement_p(), ENDP, ENTITY, free_statement(), gen_nconc(), generated_variable_comment(), instruction_block, list_undefined, make_declaration_statement(), NIL, pips_assert, pips_internal_error, pl, POP, STATEMENT, statement_block(), statement_block_p, statement_declarations, statement_instruction, statement_number, STATEMENT_NUMBER_UNDEFINED, and statement_undefined.
Referenced by replicate_declaration().
Check if declaration of variable nv can be added to the declaration list of statement s.
This is considered legal if:
This function impacts the layout of the declarations and hence the prettyprint. Any modification is likely to disturb the validation.
This function is not safe. Statement s must be a declaration statement with a non-empty declaration list.
The code could be shortened by using a big logical expression, but this would not improve readability or debugability.
Definition at line 2657 of file statement.c.
References basic_equal_p(), basic_undefined_p, CAR, comments_equal_p(), ENTITY, entity_basic(), entity_qualifiers(), entity_storage, NIL, qualifiers_equal_p(), ram_section, statement_comments, statement_declarations, storage_ram, and storage_ram_p.
Referenced by add_declaration_statement_here(), and generic_add_declaration_statement().
The initialization expression list is integrated into the internal representation as an argument list.
For the time being, I am cheating because its a list of integer and not a list of expressions.
iel | el |
Definition at line 1119 of file statement.c.
References call_arguments, declaration_statement_p(), ENDP, instruction_call, pips_assert, and statement_instruction.
Referenced by add_prettyprint_control_list_to_declaration_statement().
Add a label to a statement.
If the statement cannot accept a label (it is a sequence or it has already a label...), add a CONTINUE in front of the statement to carry it.
s | with the new |
label | if it was possible to add it directly, or a new statement sequence with the new |
label | added to a CONTINUE followed by the old statement |
s. | |
label | is the label to add to the statement |
s | is the statement to be labelled |
labeled_statement | is a pointer to a statement. It is initialized by the function to the statement that really get the label on. It is useful when we need to track it, for exemple for "goto" generation in the parser. |
The caller is responsible to avoid garbage collecting on
s | if a new statements are allocated in this fonction since it is included in the return statement. |
Test with statement_to_label to deal with a label inside an instruction block:
Add a continue as a label landing pad since a statement can not have more than 1 label and a sequence cannot have a label:
label | abel |
labeled_statement | abeled_statement |
Definition at line 2158 of file statement.c.
References entity_undefined, gen_statement_cons(), instruction_sequence_p, make_block_statement(), make_continue_statement(), NIL, statement_instruction, statement_label, statement_to_label(), and unlabelled_statement_p().
Referenced by MakeLabeledStatement().
|
static |
Definition at line 3399 of file statement.c.
References CONS, entities_t::lents, loop_index, entities_t::sents, set_add_element(), and set_belong_p().
Referenced by statement_to_referenced_entities().
format | ormat |
Definition at line 1940 of file statement.c.
References buffer, BUFSIZE, concatenate(), error, ERROR_PREFIX, fprintf(), free(), pips_internal_error, statement_comments, strdup(), and string_undefined_p.
Referenced by arguments_are_something(), check_format(), check_io_list(), check_spec(), check_this_loop(), check_this_test(), check_this_whileloop(), is_integer_specifier(), is_label_integer_string_specifier(), is_label_specifier(), is_string_specifier(), is_unit_specifier(), is_varibale_array_element_specifier(), statement_with_at_most_one_expression_integer(), statement_with_at_most_one_integer_or_character(), statement_without_argument(), type_this_entity_if_needed(), type_this_expression(), type_this_instruction(), typing_arguments_of_user_function(), typing_assign_substring(), typing_buffer_inout(), typing_function_argument_type_to_return_type(), typing_implied_do(), typing_of_assign(), and typing_substring().
|
static |
Definition at line 3410 of file statement.c.
References add_stat_referenced_entities(), entity_initial, FOREACH, gen_context_recurse, gen_null2(), init, reference_domain, statement_declarations, value_expression, and value_expression_p.
Referenced by statement_to_referenced_entities().
|
static |
Definition at line 3462 of file statement.c.
References add_stat_called_user_entities(), call_domain, entity_initial, FOREACH, gen_context_recurse, gen_null2(), init, statement_declarations, value_expression, and value_expression_p.
Referenced by statement_to_called_user_entities().
|
static |
FI: I do not know what should be done for pointers to function, assuming they can be called.
Definition at line 3447 of file statement.c.
References call_function, CONS, entity_initial, f(), entities_t::lents, entities_t::sents, set_add_element(), set_belong_p(), and value_code_p.
Referenced by add_stat_called_in_inits(), and statement_to_called_user_entities().
|
static |
Definition at line 3387 of file statement.c.
References CONS, entities_t::lents, reference_variable, entities_t::sents, set_add_element(), and set_belong_p().
Referenced by add_ref_entities_in_init(), and statement_to_referenced_entities().
|
static |
Add the declarations of a statement to a list if not already here.
This function is indeed to be used by statement_to_declarations() and instruction_to_declarations() but not by its own.
no declaration in a declaration!
Definition at line 3235 of file statement.c.
References add_statement_declarations_t::cache, CONS, declaration_statement_p(), ENTITY, FOREACH, set_add_element(), set_belong_p(), statement_declarations, and add_statement_declarations_t::statement_to_all_included_declarations.
Referenced by statement_to_declarations().
Definition at line 3213 of file statement.c.
References gen_context_recurse, gen_null2(), statement_domain, and undefined_statement_found_p().
Referenced by statement_to_transformer(), and statement_to_transformer_list().
hash_table allocate_number_to_statement | ( | void | ) |
let's assume that 50 statements is a good approximation of a module size.
Definition at line 1540 of file statement.c.
References hash_int, hash_table_make(), hash_table_undefined, and nts.
Referenced by get_any_comp_regions_text(), get_continuation_condition_text(), get_semantic_text(), and print_code_or_source_comp().
Append a comment string (if non empty) to the comments of a statement, if the c.
the_comments | is strdup'ed in this function. |
Nothing to add...
There is no comment yet:
the_comments | he_comments |
Definition at line 1889 of file statement.c.
References concatenate(), empty_comments, empty_comments_p(), find_first_statement_comment(), free(), put_a_comment_on_a_statement(), and strdup().
Referenced by region_to_loop_nest().
Definition at line 2586 of file statement.c.
References CONS, gen_nconc(), NIL, pips_assert, sequence_statements, STATEMENT, statement_block(), statement_block_p, and statement_sequence().
Referenced by MakeForloopWithIndexDeclaration().
statement apply_number_to_statement | ( | hash_table | nts, |
_int | n | ||
) |
This function used to be inline in prettyprinting functions for user views. It was assumed that all statements produced by the parser had a defined statement number. In order to keep a nice statement numbering scheme, GO TO statements are not (always) numbered. So n hasa to be tested.
nts | ts |
Definition at line 1495 of file statement.c.
References hash_get(), HASH_UNDEFINED_VALUE, nts, STATEMENT_NUMBER_UNDEFINED, and statement_undefined.
Referenced by semantic_to_text(), and text_complexity().
Definition at line 142 of file statement.c.
References assignment_block_p(), assignment_statement_p(), instruction_tag, is_instruction_block, is_instruction_call, is_instruction_goto, is_instruction_loop, is_instruction_test, is_instruction_unstructured, is_instruction_whileloop, pips_internal_error, and statement_instruction.
Test if a statement is an assignment.
Definition at line 135 of file statement.c.
References instruction_assign_p(), and statement_instruction.
Referenced by adg_get_write_entity_vertices(), adg_only_call_WR_dependence(), assignment_block_or_statement_p(), assignment_block_p(), atomize_cse_this_statement_expressions(), call_instruction_to_communications(), do_reduction_detection(), do_reduction_propagation(), expr_left_side_of_assign_statement(), find_receiver_cluster(), fs_filter(), generate_receive_from_statement(), generate_send_from_statement(), get_reference_assignments(), increase_number_of_use_by_1(), loop_nest_to_local_variables(), make_send_receive_conversion(), perfectly_nested_loop_p(), re_do_it(), sa_do_it(), search_copy_communication(), statement_phi_function_p(), terapix_loop_optimizer(), terapix_optimize_accumulator(), terapixify_loops(), and wp65_conform_p().
hash_table build_number_to_statement | ( | hash_table | nts, |
statement | s | ||
) |
Eliminate duplicate and hence meaningless numbers
nts is updated by side effect on number_to_statement
nts | ts |
Definition at line 1516 of file statement.c.
References duplicate_numbers, gen_recurse, gen_true(), hash_del(), hash_table_undefined, nts, number_to_statement, pips_assert, set_free(), set_int, set_make(), SET_MAP, set_undefined, set_undefined_p, statement_domain, statement_undefined_p, and update_number_to_statement().
Referenced by get_any_comp_regions_text(), get_continuation_condition_text(), get_semantic_text(), and print_code_or_source_comp().
Test if a statement is a C "return".
Definition at line 194 of file statement.c.
References C_return_instruction_p(), and statement_instruction.
Definition at line 76 of file statement.c.
References call_function, cannot_be_empty(), ENTITY_CONTINUE_P, and ENTITY_RETURN_P.
Referenced by empty_code_p().
Definition at line 70 of file statement.c.
References gen_recurse_stop().
Referenced by call_filter().
void clear_label | ( | statement | s | ) |
Definition at line 1568 of file statement.c.
References entity_empty_label(), format_statement_p(), instruction_loop, instruction_loop_p, label_local_name(), loop_label, statement_instruction, statement_label, and user_error.
Referenced by clear_labels(), and code_generation().
Get rid of all labels in controlized code before duplication.
All labels have become useless and they cannot be freely duplicated.
One caveat: FORMAT statements!
Definition at line 1560 of file statement.c.
References clean_up_sequences(), clear_label(), gen_recurse, gen_true(), and statement_domain.
Referenced by do_loop_unroll_with_epilogue(), do_loop_unroll_with_prologue(), and full_loop_unroll().
Definition at line 3154 of file statement.c.
References CONS, ENTITY, entity_empty_label_p(), and statement_label.
Referenced by statement_to_labels().
functions to generate statements
Duplicate statement comments
comment | is the comment to duplicate |
Not allocated, just the same:
comment | omment |
Definition at line 557 of file statement.c.
References comment(), strdup(), and string_undefined_p.
Referenced by copy_statement_attributes().
c1 | 1 |
c2 | 2 |
Definition at line 116 of file statement.c.
References empty_comments_p(), and same_string_p.
Referenced by add_declaration_to_declaration_statement_p(), and prepare_context().
Test if a statement is a CONTINUE, that is the FORTRAN nop, the ";" in C or the "pass" in Python...
according to the language.
Definition at line 203 of file statement.c.
References instruction_continue_p(), and statement_instruction.
Referenced by assignment_block_p(), compact_list(), continue_statements_p(), empty_statement_or_continue_p(), empty_statement_or_continue_without_comment_p(), empty_statement_or_labelless_continue_p(), get_first_inner_perfectly_nested_loop(), inline_statement_crawler(), IsolatedStatement(), iteration_domain_from_statement(), LinkInstToCurrentBlock(), loop_nest_to_wp65_code(), perfectly_nested_loop_p(), safe_print_statement(), sequence_call(), sequence_loop(), statement_does_return(), statement_to_label(), terapix_optimize_accumulator(), text_block_else(), text_test(), undefined_statement_list_p(), unstructured_consistency_p(), unstructured_to_flow_insensitive_transformer(), and xml_statement_from_sequence().
Check that all statements contained in statement list sl are a continue statements.
sl | l |
Definition at line 246 of file statement.c.
References continue_statement_p(), FOREACH, and STATEMENT.
This function checks reference to proper elements, not slices.
10: arbitrary value for references nested in at least one loop
Definition at line 3613 of file statement.c.
References entity_type, gen_length(), loop_depth, reference_count, reference_indices, reference_variable, type_depth(), ultimate_type(), and variable_searched.
Referenced by count_references_to_variable_element(), and declarations_count_element_references_to_v_p().
|
static |
Definition at line 3644 of file statement.c.
References loop_depth.
Referenced by count_references_to_variable(), and count_references_to_variable_element().
|
static |
Definition at line 3650 of file statement.c.
References loop_depth.
Referenced by count_references_to_variable(), and count_references_to_variable_element().
10: arbitrary value for references nested in at least one loop
Definition at line 3584 of file statement.c.
References loop_depth, reference_count, reference_variable, and variable_searched.
Referenced by count_references_to_variable(), and declarations_count_references_to_v_p().
Definition at line 3655 of file statement.c.
References count_loop_in(), count_loop_out(), count_references_to_v_p(), declarations_count_references_to_v_p(), entity_undefined, gen_multi_recurse(), gen_null(), loop_depth, loop_domain, reference_count, reference_domain, statement_domain, and variable_searched.
Definition at line 3666 of file statement.c.
References count_element_references_to_v_p(), count_loop_in(), count_loop_out(), declarations_count_element_references_to_v_p(), entity_undefined, gen_multi_recurse(), gen_null(), loop_depth, loop_domain, reference_count, reference_domain, statement_domain, and variable_searched.
Count static references.
Definition at line 3561 of file statement.c.
References reference_count, reference_variable, and variable_searched.
Referenced by count_static_references_to_variable().
Definition at line 3571 of file statement.c.
References count_static_references_to_v_p(), entity_undefined, gen_null(), gen_recurse, reference_count, reference_domain, and variable_searched.
Had to be optimized according to Beatrice Creusillet.
We assume that false is returned most of the time. String operations are avoided (almost) as much as possible.
For the time being a declaration statement is a call to continue with non-empty declarations.
FI: This could be fixed by adding + declaration in the instruction domainn
Initial implementation. It would have been better to check !ENDP() first.
ENDP(statement_declarations(s));
Definition at line 224 of file statement.c.
References call_function, ENDP, entity_continue_p(), f(), instruction_call, instruction_call_p, statement_declarations, and statement_instruction.
Referenced by add_declaration_statement_here(), add_initialization_information_to_declaration_statement(), add_pragma_to_sequence(), add_statement_declarations(), BDSC(), bdsc_code_instrumentation(), compute_private_entity_list(), copy_write_statement(), create_block_if_needed(), declaration_statement_add_call_to_callees(), declaration_statement_to_initializations(), declaration_statements_p(), declarations_count_element_references_to_v_p(), declarations_count_references_to_v_p(), declarations_first_reference_to_v_p(), dependencies_filter(), depth_of_parallel_perfect_loop_nest(), depth_of_perfect_loop_nest(), do_isolate_statement(), do_redundant_load_store_elimination(), do_remove_redundant_communications_in_anyloop(), do_scalar_renaming_in_graph(), do_simplify_constant_address_expression_in_decl(), do_slightly_rename_entities(), do_split_decl_block_statements(), do_terapix_warmup(), DoInvariantsStatements(), gather_call_sites_in_block(), gen_omp_parallel(), generic_add_declaration_statement(), generic_insert_statement(), GenericAddLocalEntityToDeclarations(), inline_split_declarations(), insert_statement(), insert_statements_after_declarations(), internal_statement_to_direct_declarations(), IsolatedStatement(), live_in_paths_of_statement(), make_declaration_replication(), make_mpi_conversion(), memorize_precondition_for_summary_precondition(), move_declaration_control_node_declarations_to_statement(), mpi_initialize(), partial_eval_statement(), perfectly_nested_loop_index_at_depth(), perfectly_nested_loop_to_body_at_depth(), pragma_nonscop(), pragma_scop(), prepare_context(), process_true_call_stat(), rebuild_topological_sort(), remove_declaration_statement(), remove_unread_variable(), RemoveLocalEntityFromDeclarations(), rename_statement_declarations(), sequence_proper_declarations_rename_in_place(), sequence_to_post_pv(), simdize_simple_statements(), split_initializations_in_statement(), split_update_operator_statement_walker(), statement_purge_declarations_walker(), statement_to_points_to(), statement_to_post_pv(), statement_to_postcondition(), statement_to_transformer(), statement_to_transformer_list(), static_controlize_statement(), store_declarations_references(), store_local_array_declaration(), and taskify_statement().
Definition at line 1128 of file statement.c.
References call_arguments, declaration_statement_p(), instruction_call, pips_assert, and statement_instruction.
Check that all statements contained in statement list sl are declaration statements.
sl | l |
Definition at line 1099 of file statement.c.
References declaration_statement_p(), FOREACH, and STATEMENT.
Definition at line 3628 of file statement.c.
References count_element_references_to_v_p(), declaration_statement_p(), ENTITY, entity_initial, FOREACH, gen_null(), gen_recurse, reference_domain, statement_declarations, and value_undefined_p.
Referenced by count_references_to_variable_element().
Definition at line 3595 of file statement.c.
References count_references_to_v_p(), declaration_statement_p(), ENTITY, entity_initial, FOREACH, gen_null(), gen_recurse, reference_domain, statement_declarations, and value_undefined_p.
Referenced by count_references_to_variable().
Definition at line 3515 of file statement.c.
References declaration_statement_p(), ENTITY, entity_initial, first_reference_to_v, first_reference_to_v_p(), FOREACH, gen_null(), gen_recurse, reference_domain, reference_undefined_p, statement_declarations, and value_undefined_p.
Referenced by find_reference_to_variable().
Duplicate statement decls_text.
dt | is the decls_text to duplicate |
Not allocated, just the same:
dt | t |
Definition at line 574 of file statement.c.
References strdup().
Referenced by copy_statement_attributes().
|
static |
Definition at line 2597 of file statement.c.
References PIPS_DECLARATION_COMMENT, and strdup().
Is it printable on one line?
Must be an unlabelled CONTINUE
Definition at line 2409 of file statement.c.
References current_line, empty_statement_or_labelless_continue_p(), extend_persistant_statement_to_int(), instruction_sequence_p, statement_instruction, statement_to_comment_length(), and stmt_to_line.
Referenced by statement_to_line_number().
Definition at line 99 of file statement.c.
References empty_code_p(), MAP, and STATEMENT.
statement.c
Definition at line 86 of file statement.c.
References call_domain, call_filter(), gen_context_recurse, gen_null2(), pips_debug, and statement_undefined_p.
Referenced by empty_code_list_p(), hpf_compile_sequential_loop(), io_efficient_compile(), and number_of_non_empty_statements().
bool empty_comments_p | ( | const char * | s | ) |
Could be replaced by a macro. See macro empty_comments
Definition at line 107 of file statement.c.
References pips_assert, and string_undefined_p.
Referenced by append_comments_to_statement(), clean_up_sequences_rewrite(), clear_annotated_loop_nest(), comments_equal_p(), delay_communications_call(), empty_statement_or_continue_without_comment_p(), ensure_comment_consistency(), find_first_statement_comment(), find_unroll_pragma_and_fully_unroll(), fix_sequence_statement_attributes(), flush_expression_comment(), flush_statement_comment(), forloop_test(), gather_all_comments_of_a_statement_filter(), insert_comments_to_statement(), is_distributed_comments(), is_distributed_receive_comments(), is_distributed_send_comments(), loop_test(), nop_statement_p(), normalize_statement(), number_of_use_greater_1(), parallelize_annotated_loop_nest(), put_a_comment_on_a_statement(), set_comment_of_statement(), statement_with_empty_comment_p(), step_directive_print(), text_block_elseif(), text_block_if(), text_initializations(), text_test(), update_number_of_use(), and whileloop_test().
Definition at line 177 of file statement.c.
References exit_instruction_p(), and statement_instruction.
Does work neither with undefined statements nor with defined statements with undefined instructions.
Returns a statement identity, its number and the breakdown of its ordering, as well as information about the instruction.
Definition at line 1671 of file statement.c.
References asprintf, buffer, call_function, entity_undefined, entity_undefined_p, instruction_call, instruction_identification(), module_local_name(), ORDERING_NUMBER, ORDERING_STATEMENT, pips_assert, same_string_p, statement_instruction, statement_number, and statement_ordering.
bool figure_out_if_it_is_a_format | ( | instruction | i, |
bool * | format_inside_statement_has_been_found | ||
) |
Useless to go on further:
format_inside_statement_has_been_found | ormat_inside_statement_has_been_found |
Definition at line 2343 of file statement.c.
References gen_recurse_stop(), and instruction_format_p().
Referenced by format_inside_statement_p().
|
static |
Find the first comment of a statement, if any.
returns a pointer to the comment if found, NULL otherwise
Unfortunately empty_comments may be used to decorate a statement although this makes the statement !gen_defined_p(). empty_comments is also used as a return value to signal that non statement legally carrying a comment has been found.
The whole comment business should be cleaned up.
let's hope the parser generates an empty string as comment rather than empty_comments which is defined as empty_string
We've found it!
No comment found:
comment carrying statement:
Definition at line 1801 of file statement.c.
References comment(), empty_comments, find_first_statement_comment(), FOREACH, STATEMENT, statement_block(), statement_block_p, and statement_comments.
Referenced by insert_comments_to_statement().
char** find_first_statement_comment | ( | statement | s | ) |
Find the first non-empty comment of a statement, if any returns a pointer to the comment if found, pointer to a "string_undefined" otherwise.
We've found it!
No comment found:
Ok, plain statement:
Definition at line 1772 of file statement.c.
References comment(), empty_comments, empty_comments_p(), find_first_statement_comment(), FOREACH, STATEMENT, statement_block(), statement_block_p, and statement_comments.
Referenced by append_comments_to_statement(), find_first_comment(), find_first_statement_comment(), and parallelize_annotated_loop_nest().
Next Expression
No need to go down in call statements
Definition at line 3107 of file statement.c.
References call_arguments, call_function, CAR, CDR, CONS, ENDP, ENTITY, ENTITY_CLOSE_P, entity_label_p(), entity_local_name(), ENTITY_OPEN_P, ENTITY_READ_P, ENTITY_WRITE_P, EXPRESSION, expression_call_p(), expression_syntax, f(), instruction_call, list_undefined, pips_assert, statement_call_p(), statement_instruction, and syntax_call.
Referenced by statement_to_implicit_target_labels().
Definition at line 3543 of file statement.c.
References copy_reference(), declarations_first_reference_to_v_p(), entity_undefined, first_reference_to_v, first_reference_to_v_p(), gen_multi_recurse(), gen_null2(), reference_domain, reference_undefined, statement_domain, and variable_searched.
find a statement in s with entity label
s | statement to search into |
label | label of the searched statement |
label | abel |
Definition at line 3810 of file statement.c.
References find_statements_with_label_walker(), gen_context_recurse, gen_null2(), fswl::st, statement_domain, and statement_undefined.
Referenced by find_statement_from_label_name().
statement find_statement_from_label_name | ( | statement | s, |
const char * | module_name, | ||
const char * | label_name | ||
) |
module_name | odule_name |
label_name | abel_name |
Definition at line 3816 of file statement.c.
References entity_undefined_p, find_label_entity(), find_statement_from_label(), module_name(), and statement_undefined.
Referenced by group_constants(), isolate_statement(), outline(), outliner(), and solve_hardware_constraints().
helper to find statement with a particular label as label should be unique, the function stops once a statement is found
s | statement to inspect |
p | struct containing the list to fill and the label to search |
Definition at line 3791 of file statement.c.
References gen_recurse_stop(), fswl::key, loop_label, same_entity_p(), fswl::st, statement_label, statement_loop(), and statement_loop_p().
Referenced by find_statement_from_label().
Get a list of statements with pragma begining with a prefix.
s | is the statement to start to recurse |
begin | is the prefix a pragma has to begin with to be selected |
begin | egin |
Definition at line 3912 of file statement.c.
References fswp::begin, find_statements_with_pragma_walker(), gen_context_recurse, gen_nreverse(), gen_null2(), fswp::l, NIL, and statement_domain.
Referenced by do_statement_insertion(), loop_expansion(), and outline().
Definition at line 3893 of file statement.c.
References fswp::begin, CONS, gen_recurse_stop(), get_extension_from_statement_with_pragma(), fswp::l, and STATEMENT.
Referenced by find_statements_with_pragma().
Definition at line 3498 of file statement.c.
References first_reference_to_v, reference_undefined_p, reference_variable, and variable_searched.
Referenced by declarations_first_reference_to_v_p(), and find_reference_to_variable().
void fix_block_statement_declarations | ( | statement | s | ) |
s is assumed to be a block statement and its declarations field is assumed to be correct, but not necessarily the declaration statements within the block s.
This function checks that no variable is declared by a declaration statement within the block but not declared at the block level. Also, if a variable is declared at the block level but not by a declaration statement, a new declaration statement is added.
Definition at line 2930 of file statement.c.
References add_declaration_statement(), ENDP, ENTITY, FOREACH, gen_copy_seq(), gen_free_list(), gen_list_and_not(), gen_once_p(), pips_assert, statement_block(), statement_block_p, statement_declarations, and statements_to_direct_declarations().
Referenced by controlize_sequence().
void fix_sequence_statement_attributes | ( | statement | s | ) |
Since blocks are not represented in Fortran, they cannot carry a label.
A continue could be added by the prettyprinter but it was decided not to support this facility. For debugging, it's better to have a transparent prettyprinter and no ghost statement with no ordering and no number.
Insert a CONTINUE and move the label, comment and statement number if any from the statement to the CONTINUE, if label there is.
The statement block has no label and no comment: just do nothing.
FI: why don't you try to keep them on the first statement, just in case it has empty slots?
There are some informations we need to keep: just add a CONTINUE to keep them:
This the label of a RETURN, do not forward it:
FI: at least in for loop to while loop conversion, the extensions is moved down to the while loop. I'm not sure this is the best source code location to fix the problem. I do not know if the extensions have been reused directly and so do not need to be freed here or not. In fact, it is copied below and could be freed.
Definition at line 2016 of file statement.c.
References CONS, empty_comments, empty_comments_p(), entity_empty_label(), entity_local_name(), free_extensions(), instruction_block, instruction_block_p, LABEL_PREFIX, make_continue_statement(), make_extensions(), NIL, pips_assert, RETURN_LABEL_NAME, STATEMENT, statement_comments, statement_extensions, statement_instruction, statement_label, statement_number, STATEMENT_NUMBER_UNDEFINED, and unlabelled_statement_p().
Referenced by clean_statement(), do_loop_unroll_with_epilogue(), do_loop_unroll_with_prologue(), fix_statement_attributes_if_sequence(), full_loop_unroll(), hpfc_translate_call_with_distributed_args(), io_filter(), loop_rewrite(), transform_a_for_loop_into_a_while_loop(), and transform_a_for_loop_statement_into_a_while_loop().
void fix_statement_attributes_if_sequence | ( | statement | s | ) |
Apply fix_sequence_statement_attributes() on the statement only if it really a sequence.
Definition at line 2078 of file statement.c.
References fix_sequence_statement_attributes(), instruction_sequence_p, instruction_undefined_p, and statement_instruction.
Referenced by controlize_forloop(), inline_expression_call(), MakeStatementLike(), rice_loop(), and test_rewrite().
Definition at line 209 of file statement.c.
References instruction_forloop_p, and statement_instruction.
Referenced by transform_a_for_loop_statement_into_a_while_loop().
Definition at line 2360 of file statement.c.
References figure_out_if_it_is_a_format(), gen_context_recurse, gen_null2(), and instruction_domain.
Referenced by remove_all_unreachable_controls_of_an_unstructured(), and remove_unreachable_following_control().
Test if a statement is a Fortran FORMAT.
Definition at line 273 of file statement.c.
References instruction_format_p(), and statement_instruction.
Referenced by clear_label(), and statement_to_label().
Test if a statement is a Fortran "return".
Definition at line 188 of file statement.c.
References fortran_return_instruction_p(), and statement_instruction.
Referenced by statement_remove_useless_label().
Gather all the comments recursively found in the given statement and return them in a strduped string (NULL if no comment found).
Do not forget to free the string returned later when no longer used.
Definition at line 1760 of file statement.c.
References empty_comments, gather_all_comments_of_a_statement_filter(), gen_context_recurse, gen_null2(), and statement_domain.
Referenced by fuse_2_control_nodes().
Definition at line 1740 of file statement.c.
References concatenate(), empty_comments_p(), free(), statement_comments, and strdup().
Referenced by gather_all_comments_of_a_statement().
Used to keep aside the FORMAT before many code transformation that could remove them either.
It just return a list of all the FORMAT statement and replace them with NOP.
Definition at line 2298 of file statement.c.
References gather_and_remove_all_format_statements_rewrite(), gen_context_recurse, gen_nreverse(), gen_true2(), NIL, and statement_domain.
Referenced by put_formats_at_module_beginning(), and put_formats_at_module_end().
Put the instruction with the statement attributes in new_format.
Replace the old FORMAT with a NOP:
all_formats | ll_formats |
Definition at line 2270 of file statement.c.
References CONS, empty_comments, empty_extensions(), entity_empty_label(), instruction_format_p(), instruction_to_statement(), make_instruction_block(), NIL, STATEMENT, statement_comments, statement_extensions, statement_instruction, statement_label, statement_number, STATEMENT_NUMBER_UNDEFINED, statement_ordering, and STATEMENT_ORDERING_UNDEFINED.
Referenced by gather_and_remove_all_format_statements().
Definition at line 2629 of file statement.c.
References generated_variable_commenters, and nb_commenters.
Referenced by add_declaration_statement_here(), and generic_add_declaration_statement().
Add a new declaration statement.
Declarations are not only lists of entities at the block level and in the symbol table, but also declaration statement to carry the line number, comments, and the declarations local to the declaration statement. This function is low-level and does not maintain the consistency of the PIPS internal representation.
s | Statement s must be a sequence. A new declaration statement is generated to declare e. This statement is inserted after the existing declaration statements in s, or, if no declaration statement is present, at the beginning of the sequence in s. |
e | Variable to declare. The declaration of e at s level is not checked. The existence of a previous declaration statement for e is not checked either. The caller is responsible for the consistency management between the declaration statements in s and the list of declaration at s level. |
For the time being, a declaration statement is a continue statement. Beware that the possible dependencies between the new declaration and existing declarations are not checked.
Look for the last declaration: it is pointed to by pl
Do we have previous declarations to skip?
SG: if CAR(pl) has same comment and same type as ds, merge them
SG: otherwise, insert ds
The new declaration is inserted before sl
pips_debug(8, "Statement after declaration insertion:\n");
print_statement(s);
}
Definition at line 2711 of file statement.c.
References add_declaration_to_declaration_statement_p(), CAR, CDR, comment(), CONS, declaration_statement_p(), ENDP, ENTITY, free_statement(), gen_nconc(), generated_variable_comment(), instruction_block, list_undefined, make_declaration_statement(), NIL, pips_assert, pips_internal_error, pl, POP, STATEMENT, statement_block(), statement_block_p, statement_declarations, statement_instruction, and STATEMENT_NUMBER_UNDEFINED.
Referenced by add_declaration_statement(), and add_declaration_statement_at_beginning().
insert statement s1 before or after statement s
If statement s is a sequence, simply insert s1 at the beginning or at the end of the sequence s.
If not, create a new statement s2 with s's fields and update s as a sequence with no comments and undefined number and ordering. The sequence is either "s1;s2" if "before" is true or "s2;s1" else.
ATTENTION !!! : this version is not for unstructured case and this is not asserted.
s cannot be a declaration statement, because the insertion scheme used would modify its scope. Also s1 cannot be a declaration if s is not a sequence. And if s is a sequence add_declaration_statement() should be used instead to insert the new declaration at the best possible place.
no duplication
Definition at line 2494 of file statement.c.
References CAR, CDR, CONS, declaration_statement_p(), empty_extensions(), ENDP, entity_empty_label(), gen_nconc(), instruction_block, instruction_sequence_p, instruction_undefined, make_instruction_sequence(), make_sequence(), make_statement(), make_synchronization_none(), NIL, POP, s1, STATEMENT, statement_comments, statement_declarations, statement_decls_text, statement_extensions, statement_instruction, statement_label, statement_number, STATEMENT_NUMBER_UNDEFINED, statement_ordering, STATEMENT_ORDERING_UNDEFINED, string_undefined, and update_statement_instruction().
Referenced by insert_statement(), and insert_statement_no_matter_what().
Get the extension of a statement with pragma beginning with a prefix.
s | is the statement to work on |
seed | is the prefix a pragma has to begin with to be selected |
seed | eed |
Definition at line 3871 of file statement.c.
References EXTENSION, extension_pragma, extensions_extension, FOREACH, pragma_string, pragma_string_p, and statement_extensions.
Referenced by find_statements_with_pragma_walker(), and if_conv_statement().
computes the block-depth of a statement NOT INTENDED to generate entity name declared at particular block level : The block scope depends on the number of different blocks at the same depth !
s | statement we compute the depth of |
root | outer statement containing s |
root | oot |
Definition at line 3725 of file statement.c.
References FOREACH, forloop_body, get_statement_depth(), instruction_block, instruction_forloop, instruction_loop, instruction_tag, instruction_test, instruction_whileloop, is_instruction_forloop, is_instruction_loop, is_instruction_sequence, is_instruction_test, is_instruction_unstructured, is_instruction_whileloop, loop_body, pips_internal_error, STATEMENT, statement_instruction, statement_substatement_p(), test_false, test_true, and whileloop_body.
Referenced by get_statement_depth().
void insert_comments_to_statement | ( | statement | s, |
const char * | the_comments | ||
) |
Insert a comment string (if non empty) at the beginning of the comments of a statement.
the_comments | is strdup'ed in this function. |
Nothing to add...
There are no comments yet:
the_comments | he_comments |
Definition at line 1916 of file statement.c.
References concatenate(), empty_comments, empty_comments_p(), find_first_comment(), free(), put_a_comment_on_a_statement(), and strdup().
Referenced by copy_from_statement(), copy_to_statement(), copy_write_statement_with_cumulated_regions(), deal_with_pending_comment(), fuse_2_control_nodes(), generate_all_liveness_but(), generate_dynamic_liveness_for_primary(), generate_dynamic_liveness_management(), generate_io_statements_for_shared_arrays(), generate_remapping_code(), generate_remapping_include(), GENERATION(), gpu_ify_statement(), hpf_compile_loop(), inline_statement_crawler(), insert_impact_description_as_comment(), isolate_code_portion(), make_layout_statement(), make_shared_statement(), MakeLabeledStatement(), prepend_comment(), remapping_compile(), remapping_stats(), st_one_message(), transfert_statement(), and update_runtime_for_remapping().
This is the normal entry point.
See previous function for comments.
insert statement s1 before or after statement s
If statement s is a sequence, simply insert s1 at the beginning or at the end of the sequence s.
If not, create a new statement s2 with s's fields and update s as a sequence with no comments and undefined number and ordering. The sequence is either "s1;s2" if "before" is true or "s2;s1" else.
ATTENTION !!! : this version is not for unstructured case and this is not asserted.
s cannot be a declaration statement, because the insertion scheme used would modify its scope. Also s1 cannot be a declaration if s is not a sequence. And if s is a sequence add_declaration_statement() should be used instead to insert the new declaration at the best possible place.
s1 | 1 |
before | efore |
Definition at line 2570 of file statement.c.
References declaration_statement_p(), generic_insert_statement(), pips_assert, and s1.
Referenced by abc_instrumentation_insert_before_statement(), add_counter(), add_pragma(), atomize_statement(), bottom_up_abc_insert_before_statement(), compile_barrier(), compile_body(), compile_omp(), compile_reduction(), compile_regions(), compute_region(), copy_n_reference(), copy_n_statement(), copy_write_statement_with_cumulated_regions(), ctx_generate_new_statement_cluster_dependant(), delay_communications_intraprocedurally(), do_add_pragma(), do_delay_communications_interprocedurally(), do_expression_reduction(), do_group_constants_terapix(), do_isolate_statement(), do_loop_expansion(), do_loop_expansion_init(), do_remove_redundant_communications_in_anyloop(), do_scalar_renaming_in_successors(), do_solve_hardware_constraints_on_volume(), do_split_structure(), do_split_structure_return_hook(), do_split_structure_return_hook_walker(), do_terapix_argument_handler(), dowhile_to_while_walker(), finalization(), FixCReturnStatements(), for_to_do_loop_conversion(), freia_allocate_new_images_if_needed(), generate_call_construct_begin_construct_end(), generate_call_flush(), generate_call_get_workchunk_loopbounds(), generate_call_init_regionArray(), generate_call_set_regionarray(), generate_call_stepalltoall(), generate_loop_workchunk(), generate_starpu_pragma(), GenericAddLocalEntityToDeclarations(), initilization(), inline_expression(), inline_expression_call(), inline_split_declarations(), inline_statement_crawler(), insert_endscop_in_sequence(), insert_statement_in_block(), insert_statements_after_declarations(), interprocedural_abc_insert_before_statement(), make_bottom_up_abc_tests(), make_interprocedural_abc_tests(), make_loadsave_statement(), make_mpi_conversion(), MakeForloop(), MakeSwitchStatement(), MakeWhileLoop(), new_local_image_variable(), openmp_task_generation(), outliner_file(), outliner_patch_parameters(), prepend_call(), process_true_call_stat(), put_formats_at_module_beginning(), put_formats_at_module_end(), reductions_rewrite(), region_to_statement(), sequence_working_false(), sesamify(), simd_loop_unroll(), simplify_subscript(), spire_distributed_unstructured_to_structured(), spire_shared_unstructured_to_structured(), step_compile_analysed_module(), terapix_loop_optimizer(), top_down_abc_array(), top_down_abc_insert_before_statement(), transfert_loop(), two_addresses_code_generator(), verify_array_element(), verify_array_variable(), and verify_scalar_variable().
Break the IR consistency or, at the very least, do not insert new declarations at the usual place, i.e.
at the end of the already existing declarations.
s1 | 1 |
before | efore |
Definition at line 2581 of file statement.c.
References generic_insert_statement(), and s1.
Referenced by do_split_decl_block_statements(), if_conversion_init(), make_mpi_conversion(), and simdize_simple_statements().
list instruction_to_declarations | ( | instruction | i | ) |
Get a list of all variables declared recursively within an instruction.
Definition at line 3279 of file statement.c.
References statement_to_declarations().
Referenced by statement_flatten_declarations().
No recursive descent.
Definition at line 3308 of file statement.c.
References declaration_statement_p(), gen_copy_seq(), NIL, statement_declarations, statement_unstructured(), statement_unstructured_p(), and unstructured_to_direct_declarations().
Referenced by statement_to_direct_declarations(), statements_to_direct_declarations(), and unstructured_to_direct_declarations().
Definition at line 3946 of file statement.c.
References call_function, ENTITY_ABORT_SYSTEM_P, ENTITY_ASSERT_FAIL_SYSTEM_P, ENTITY_ASSERT_SYSTEM_P, ENTITY_C_RETURN_P, ENTITY_EXIT_SYSTEM_P, entity_initial, ENTITY_RETURN_P, f(), value_code_p, and value_intrinsic_p.
Referenced by statement_may_have_control_effects_p().
Definition at line 4002 of file statement.c.
References call_function, ENTITY_ABORT_SYSTEM_P, ENTITY_ASSERT_FAIL_SYSTEM_P, ENTITY_ASSERT_SYSTEM_P, ENTITY_C_RETURN_P, ENTITY_EXIT_SYSTEM_P, entity_initial, ENTITY_RETURN_P, f(), and value_intrinsic_p.
Referenced by statement_may_contain_exiting_intrinsic_call_p().
Definition at line 3920 of file statement.c.
References call_function, entity_initial, f(), user_call_p(), and value_code_p.
Referenced by statement_contains_user_call_p().
Generate a print of a constant character string on stderr for C or on stdout for Fortran.
This is not clever as the format of the message is language dependent: simple quotes are used as delimiters in Fortran and double quotes in C. Should message be language independent and the delimiters added in this function instead? I did not do it to avoid yet another strdup() when strdup is used to generate "message", but this is questionable.
This is not clever as this function could easily be generalized with a vararg to generate more general print statements.
message | essage |
Definition at line 893 of file statement.c.
References fortran_module_p(), get_current_module_entity(), make_C_print_statement(), make_print_statement(), and statement_undefined.
Referenced by make_bottom_up_abc_tests().
statement make_assign_statement | ( | expression | l, |
expression | r | ||
) |
Definition at line 583 of file statement.c.
References instruction_to_statement(), and make_assign_instruction().
Referenced by add_index_out_effect_proc(), alloc_instrumentation(), array_indices_communication(), assign_tmp_to_exp(), atom_cse_expression(), atomize_this_expression(), atomizer_of_external(), bound_to_statement(), comEngine_generate_procCode(), compile_reduction(), cstr_args_check(), define_node_processor_id(), do_atomize_call(), do_brace_expression_to_statements(), do_clone_statement(), do_expression_reduction(), do_group_constants_terapix(), do_loop_expansion(), do_loop_to_while_loop(), do_loop_unroll_with_epilogue(), do_loop_unroll_with_prologue(), do_scalar_renaming_in_successors(), do_solve_hardware_constraints_on_volume(), do_symbolic_tiling(), do_terapix_argument_handler(), full_loop_unroll(), gen(), generate_all_liveness_but(), generate_c1_alpha(), generate_copy_loop_nest(), generate_dynamic_liveness_for_primary(), generate_full_copy(), generate_get_value_locally(), generate_parallel_body(), generate_remapping_guard(), generate_update_values_on_computer_and_nodes(), hpfc_add_2(), hpfc_add_n(), hpfc_buffer_packing(), hpfc_compute_lid(), icm_loop_rwt(), initialization_list_to_statements(), initialize_array_variable(), initialize_scalar_variable(), inline_expression_call(), inline_return_crawler(), inline_split_declarations(), insert_flag_before_call_site(), insert_test_before_caller(), loop_header(), loop_inc(), loop_normalize_of_loop(), loop_rewrite(), make_abc_count_statement(), make_fields_assignment_instruction(), make_increment_statement(), make_lInitStats(), make_loadsave_statement(), make_loop_nest_for_overlap(), make_lSwitchStats(), make_read_loopbody(), make_read_write_fifo_stat(), make_scanning_over_tiles(), make_send_receive_conversion(), make_set_rc_statement(), make_statement_copy_i(), make_step_inc_statement(), make_temporary_scalar_entity(), make_toggle_inc_statement(), make_toggle_init_statement(), make_transStat(), make_write_loopbody(), MakeAssignedOrComputedGotoInst(), move_declaration_control_node_declarations_to_statement(), mpic_make_mpi_comm_rank(), mpic_make_mpi_comm_size(), mpic_make_mpi_finalize(), mpic_make_mpi_init(), mpic_make_mpi_irecv(), mpic_make_mpi_isend(), mpic_make_mpi_recv(), mpic_make_mpi_send(), new_local_image_variable(), outliner_patch_parameters(), Pvecteur_to_assign_statement(), reference_conversion_computation(), rename_statement_declarations(), set_array_status_to_target(), set_live_status(), simd_atomize_this_expression(), simd_loop_unroll(), simplify_subscript(), split_initializations_in_statement(), systeme_to_loop_nest(), text_loop_90(), Tiling_buffer_allocation(), two_addresses_code_generator(), unsugared_loop_header(), unsugared_loop_inc(), verify_array_element(), verify_array_variable(), and verify_scalar_variable().
MakeConstant() generates a Fortran constant... Does not seem to matter for strings...
stderr has not yet been encountered by the parser... Should it be defined by bootstrap.c or by the C parser no matter what?
message | essage |
Definition at line 852 of file statement.c.
References CONS, empty_comments, entity_to_expression(), entity_undefined, entity_undefined_p, EXPRESSION, expression_undefined, FindEntity(), FPRINTF_FUNCTION_NAME, is_basic_string, make_call_expression(), make_call_statement(), make_stderr_variable(), MakeConstant(), NIL, statement_undefined, STDERR_NAME, and TOP_LEVEL_MODULE_NAME.
Referenced by make_any_print_statement(), and make_exit_statement().
This function is limited to intrinsics calls...
A full function name or an entity could be passed as first argument. comments, default empty_comments (was: "" (was: string_undefined))
pips_debug(8, "cs is call to %s\n", function_name);
safe_print_statement(cs);
}
function_name | unction_name |
args | rgs |
c | A full function name or an entity could be passed as first argument. label, default entity_undefined |
Definition at line 1274 of file statement.c.
References empty_extensions(), entity_empty_label(), entity_intrinsic(), entity_undefined, is_instruction_call, make_call(), make_instruction(), make_statement(), make_synchronization_none(), NIL, STATEMENT_NUMBER_UNDEFINED, and STATEMENT_ORDERING_UNDEFINED.
Referenced by array_bound_check_display(), build_call_STEP_init_regionArray(), call_STEP_subroutine(), call_STEP_subroutine2(), call_STEP_subroutine3(), edge_cost_polynome(), make_C_print_statement(), make_c_stop_statement(), make_com_loopbody(), make_continue_statement(), make_exit_statement(), make_increment_statement(), make_return_statement(), make_stop_statement(), MakeDataStatement(), mpi_finalize(), and task_time_polynome().
Definition at line 953 of file statement.c.
References CONTINUE_FUNCTION_NAME, empty_comments, make_call_statement(), and NIL.
Referenced by __attribute__(), add_comment_and_line_number(), add_label_to_statement(), bound_generation(), build_call_STEP_WaitAll(), com_call(), controlize(), do_loop_unroll_with_prologue(), fix_sequence_statement_attributes(), full_loop_unroll(), full_spaghettify_module(), gen_omp_taskwait(), generate_guarded_statement(), generate_io_collect_or_update(), generate_update_values_on_computer_and_nodes(), GenericAddLocalEntityToDeclarations(), gfc2pips_code2instruction(), gfc2pips_code2instruction_(), hpf_compile_loop(), hpf_compile_parallel_loop(), hpf_compile_sequential_loop(), hpfc_broadcast_if_necessary(), hpfc_buffer_initialization(), hpfc_lazy_buffer_packing(), init_label(), inline_expression_call(), insert_endscop_after_stmt(), insert_endscop_before_stmt(), insert_endscop_in_sequence(), loop_normalize_of_loop(), make_communication_statement(), make_condition_from_forloop(), make_condition_from_loop(), make_condition_from_test(), make_condition_from_whileloop(), make_exit_from_forloop(), make_exit_from_loop(), make_exit_from_test(), make_exit_from_whileloop(), make_movements_loop_body_wp65(), make_plain_continue_statement(), make_scalar_communication_module(), make_scanning_over_one_tile(), make_scanning_over_tiles(), make_start_ru_module(), make_transition_statement(), make_undefined_list(), MakeAssignInst(), MakeCaseStatement(), MakeDefaultStatement(), MakeEntry(), MakeGotoStatement(), MakeNewLabelledStatement(), Overlap_Analysis(), put_a_comment_on_a_statement(), recover_structured_while(), st_make_nice_test(), take_out_the_entry_node_of_the_unstructured(), and update_statement_instruction().
Make one declaration statement.
sn | n |
cs | s |
Definition at line 1091 of file statement.c.
References CONS, ENTITY, make_declarations_statement(), and NIL.
Referenced by add_declaration_statement_here(), and generic_add_declaration_statement().
Make a declaration(s) statement.
To preserve declaration lines and comments, declaration statements are used
idl | is a sorted list of variables that is copied and modified for insertion in the declaration. The order is preserved. No sharing is created between idl and s. |
sn | is the statement number |
cs | is the comment string associated to the declaration |
Note that additional information is dangerously hidden later as arguments to the call to CONTINUE.
Note also that this function is closely linked to the C parser but is unfortunately used by transformations/registers.c in a much simpler form.
If a place holder variable has been inserted by the C parser, it may be uselss. If several place holder variables have been inserted, they certainly are useless.
Do not create sharing with the caller
Remove useless place holder entities if any
Build the list of derived entities defined.
A derived entity is defined if its fields or elements appear in "l". Otherwise, it is simply referenced in the definition of another derived entity. Or it is simply "mentioned" as in "struct s;". Such statements can move around and do not really require strong dependences. See our 2015 LCPC paper.
list defined_l = NIL;
if(derived_entity_p(e)) {
type dt = entity_type(e);
list fl = NIL;
if(type_struct_p(dt))
fl = type_struct(dt);
else if(type_union_p(dt))
fl = type_union(dt);
else if(type_enum_p(dt))
fl = type_enum(dt);
else
pips_internal_error("Unexpected type for a derived entity.\n");
if(!ENDP(fl)) {// The derived type may not yet be fully defined
entity f = ENTITY(CAR(fl));
if(gen_in_list_p(f, l))
defined_l = CONS(ENTITY, e, defined_l);
}
}
}
Remove field entities from the declaration list and make sure that each derived entity is declared at most once, and really declared
&& (!derived_entity_p(e) || gen_in_list_p(e, defined_l))) // Declare only defined derived entities and all other kinds of entities
gen_free_list(defined_l);
if(ENDP(dl)) {
if(!ENDP(l)) {
/* Must be a case such as "struct s;" *\/
entity de = ENTITY(CAR(l));
if(derived_entity_p(de)) {
entity ph = make_place_holder_variable(de);
dl = CONS(ENTITY, ph, NIL);
}
}
else
pips_internal_error("Empty declaration_list.\n");
}
idl | dl |
sn | n |
cs | s |
Definition at line 990 of file statement.c.
References CDR, CONS, ENDP, ENTITY, entity_field_p(), FOREACH, gen_copy_seq(), gen_in_list_p(), gen_length(), gen_nreverse(), make_plain_continue_statement(), NIL, place_holder_variable_p(), statement_comments, statement_declarations, and statement_number.
Referenced by make_declaration_statement().
This function returns a statement ending with a C exit statement.
A "fprintf(stderr, errmess);" is generated before "exit(n);" if errmess is not empty and a sequence statement ending wih exit() is returned.
There must be a nicer vararg function... make_statement_from_statement_varargs_list(s2, s1, NULL)
errmess | rrmess |
Definition at line 926 of file statement.c.
References CONS, empty_comments, entity_undefined, EXIT_FUNCTION_NAME, EXPRESSION, int_to_expression(), make_block_statement(), make_C_print_statement(), make_call_statement(), NIL, s1, STATEMENT, and statement_undefined.
Referenced by emit_message_and_stop().
statement make_expression_statement | ( | expression | e | ) |
Build a statement from a given expression.
Definition at line 1308 of file statement.c.
References instruction_to_statement(), and make_instruction_expression().
Referenced by for_to_while_loop_conversion(), set_entity_initial(), and task_time_polynome().
statement make_forloop_statement | ( | expression | init, |
expression | cond, | ||
expression | inc, | ||
statement | body | ||
) |
init | nit |
cond | ond |
inc | nc |
body | ody |
Definition at line 1220 of file statement.c.
References empty_extensions(), entity_empty_label(), forloop_consistent_p(), ifdebug, init, make_forloop(), make_instruction_forloop(), make_statement(), make_synchronization_none(), NIL, pips_assert, statement_consistent_p(), STATEMENT_NUMBER_UNDEFINED, STATEMENT_ORDERING_UNDEFINED, and string_undefined.
Referenced by make_send_receive_conversion().
statement make_loop_statement | ( | entity | i, |
expression | low, | ||
expression | up, | ||
expression | inc, | ||
statement | b | ||
) |
Build a loop statement.
i | index of the loop |
low | lower bound of the loop (an int expression) |
up | upper bound of the loop (an int expression) |
inc | increment step of the loop (an int expression) |
b | body of the loop |
Loop range is created
low | ow |
up | p |
inc | nc |
Definition at line 1181 of file statement.c.
References empty_extensions(), entity_empty_label(), ifdebug, make_execution_sequential(), make_instruction_loop(), make_loop(), make_range(), make_statement(), make_synchronization_none(), NIL, pips_assert, range_consistent_p(), statement_consistent_p(), STATEMENT_NUMBER_UNDEFINED, STATEMENT_ORDERING_UNDEFINED, and string_undefined.
Referenced by make_send_receive_conversion().
statement make_plain_continue_statement | ( | void | ) |
Make a simple continue statement to be used as a NOP or ";" in C.
Definition at line 964 of file statement.c.
References entity_empty_label(), and make_continue_statement().
Referenced by add_pragma_to_sequence(), clean_up_sequences_rewrite(), compile_body(), compile_omp(), compile_regions(), control_graph(), controlize_forloop(), controlize_list(), controlize_list_1(), controlize_loop(), controlize_repeatloop(), controlize_test(), controlize_whileloop(), find_exit_control_node(), find_or_create_exit_control_node(), forloop_test(), get_statement_pragma_init(), get_statement_pragma_register(), get_statement_pragma_shutdown(), hcfg(), insert_optional_pragma(), loop_test(), make_declarations_statement(), region_to_statement(), step_compile_generated_module(), unsugared_forloop_test(), unsugared_loop_test(), unsugared_whileloop_header(), unsugared_whileloop_test(), and whileloop_test().
Make a Fortran print statement.
This function has been moved from alias_check.c and uses a Fortran only function. alias_check was designed from Fortran.
message | essage |
Definition at line 835 of file statement.c.
References CONS, EXPRESSION, instruction_to_statement(), instruction_undefined, LIST_DIRECTED_FORMAT_NAME, make_simple_Fortran_io_instruction(), MakeCharacterConstantExpression(), MakeSimpleIoInst2(), and NIL.
Referenced by insert_test_before_statement(), make_any_print_statement(), make_bottom_up_abc_tests(), make_interprocedural_abc_tests(), top_down_abc_array(), verify_array_element(), verify_array_variable(), and verify_scalar_variable().
module | odule |
Definition at line 779 of file statement.c.
References c_module_p(), C_RETURN_FUNCTION_NAME, empty_comments, entity_local_name(), entity_undefined_p, FindEntity(), LABEL_PREFIX, make_call_statement(), make_label(), module, module_name(), NIL, RETURN_FUNCTION_NAME, and RETURN_LABEL_NAME.
Referenced by ensure_comment_consistency(), make_scalar_communication_module(), make_start_ru_module(), make_wait_ru_module(), module_to_wp65_modules(), and outliner_file().
instruction make_simple_Fortran_io_instruction | ( | bool | is_read_p, |
expression | f, | ||
list | io_list | ||
) |
Derived from the Fortran parser code.
Should be generalized to generate C code...
is_read_p | s_read_p |
io_list | o_list |
Definition at line 807 of file statement.c.
References CONS, CreateIntrinsic(), entity_intrinsic(), EXPRESSION, f(), gen_nconc(), LIST_DIRECTED_FORMAT_NAME, make_call(), make_instruction_call(), MakeCharacterConstantExpression(), MakeNullaryCall(), READ_FUNCTION_NAME, and WRITE_FUNCTION_NAME.
Referenced by make_print_statement(), and MakeSimpleIoInst2().
This function returns a Fortran stop statement with an error message.
message | essage |
Definition at line 908 of file statement.c.
References CONS, empty_comments, entity_undefined, EXPRESSION, is_basic_string, make_call_expression(), make_call_statement(), MakeConstant(), NIL, and STOP_FUNCTION_NAME.
Referenced by emit_message_and_stop(), insert_test_before_statement(), make_interprocedural_abc_tests(), top_down_abc_array(), verify_array_element(), verify_array_variable(), and verify_scalar_variable().
statement make_test_statement | ( | expression | cond, |
statement | truebody, | ||
statement | falsebody | ||
) |
cond | ond |
truebody | ruebody |
falsebody | alsebody |
Definition at line 1248 of file statement.c.
References empty_extensions(), entity_empty_label(), ifdebug, make_instruction_test(), make_statement(), make_synchronization_none(), make_test(), NIL, pips_assert, statement_consistent_p(), STATEMENT_NUMBER_UNDEFINED, STATEMENT_ORDERING_UNDEFINED, string_undefined, and test_consistent_p().
Referenced by array_scalar_access_to_bank_communication(), ctx_generate_new_statement_cluster_dependant(), and test_working_false().
statement make_whileloop_statement | ( | expression | condition, |
statement | body, | ||
int | line_number, | ||
bool | before | ||
) |
Build a while loop statement.
If before is true, build a while (condition) body;
else build a do body; while (condition);
line_number | is used to specify a source-line number to the statement |
condition | ondition |
body | ody |
line_number | ine_number |
before | efore |
Definition at line 1150 of file statement.c.
References empty_extensions(), entity_empty_label(), make_evaluation_after(), make_evaluation_before(), make_instruction_whileloop(), make_statement(), make_synchronization_none(), make_whileloop(), NIL, STATEMENT_ORDERING_UNDEFINED, and string_undefined.
Referenced by for_to_while_loop_conversion(), make_send_receive_conversion(), MakeWhileLoop(), and recover_structured_while().
statement makeloopbody(l, s_old) make a statement for a loop body, using the fields of a previously existing statement
Preserving the labels may be sometimes a good thing (hyperplane or tiling transformation, outermostloop) or a bad thing for innermost loops, sometimes replicated loops
FI: the name of this function is not well chosen.
s_old | _old |
inner_p | nner_p |
Definition at line 1641 of file statement.c.
References CONS, empty_comments, empty_extensions(), entity_empty_label(), is_instruction_loop, make_instruction(), make_instruction_block(), make_statement(), make_synchronization_none(), NIL, STATEMENT, statement_comments, statement_extensions, statement_label, statement_number, STATEMENT_NUMBER_UNDEFINED, statement_ordering, and STATEMENT_ORDERING_UNDEFINED.
Referenced by code_generation().
Make (a bit more) sure that s is gen_defined_p in spite of poor decision for empty fields and that strdup can be used on the string fields.
Definition at line 4035 of file statement.c.
References empty_comments_p(), statement_comments, statement_decls_text, strdup(), and string_undefined_p.
Referenced by controlize_forloop(), controlize_list(), controlize_loop(), controlize_test(), and controlize_whileloop().
void pop_generated_variable_commenter | ( | void | ) |
Definition at line 2623 of file statement.c.
References nb_commenters, and pips_assert.
Referenced by add_induction_var_to_local_declarations(), copy_write_statement_with_cumulated_regions(), freia_compiler(), initilization(), make_send_receive_conversion(), outliner_patch_parameters(), outliner_scan(), replicate_declaration(), and simdizer().
Definition at line 2616 of file statement.c.
References commenter(), generated_variable_commenters, MAX_COMMENTERS, nb_commenters, and pips_assert.
Referenced by add_induction_var_to_local_declarations(), copy_write_statement_with_cumulated_regions(), freia_compiler(), initilization(), make_send_receive_conversion(), outliner_patch_parameters(), outliner_scan(), replicate_declaration(), and simdizer().
Similar to try_to_put_a_comment_on_a_statement() but insert a CONTINUE to put the comment on it if there is only empty sequence(s)
The comment should have been malloc()'ed before.
Nothing to add...
It failed because it is an empty sequence. So add a CONTINUE to attach the statement on it:
the_comments | he_comments |
Definition at line 1863 of file statement.c.
References CONS, empty_comments_p(), entity_empty_label(), instruction_sequence, make_continue_statement(), sequence_statements, STATEMENT, statement_comments, statement_instruction, and try_to_put_a_comment_on_a_statement().
Referenced by append_comments_to_statement(), build_call_STEP_WaitAll(), compile_body(), compile_regions(), compute_region(), cstr_args_check(), insert_comments_to_statement(), and region_to_statement().
void put_formats_at_module_beginning | ( | statement | s | ) |
Transfer all the FORMATs at the very beginning of a module:
Pick up all the FORMATs of the module:
And put them at the very beginning of the module:
Definition at line 2311 of file statement.c.
References f(), FOREACH, gather_and_remove_all_format_statements(), gen_nreverse(), ifdebug, insert_statement(), pips_assert, STATEMENT, and statement_consistent_p().
Referenced by unspaghettify_or_restructure_statement().
void put_formats_at_module_end | ( | statement | s | ) |
Transfer all the FORMATs at the very end of a module:
Pick up all the FORMATs of the module:
And put them at the very beginning of the module:
Definition at line 2328 of file statement.c.
References f(), FOREACH, gather_and_remove_all_format_statements(), ifdebug, insert_statement(), pips_assert, STATEMENT, and statement_consistent_p().
Referenced by unspaghettify_or_restructure_statement().
Declarations are not only lists of entities, but also statement to carry the line number, comments,...
For the time begin, a declaration statement is a continue statement.
Look for the last declaration: it is pointed to by pl
pips_debug(8, "Statement after declaration insertion:\n");
print_statement(s);
}
Definition at line 2966 of file statement.c.
References CAR, CDR, current, declaration_statement_p(), ENDP, ENTITY, entity_name, free(), list_undefined, pips_debug, pips_internal_error, POP, STATEMENT, statement_block(), statement_block_p, and statement_declarations.
Referenced by RemoveEntityFromCompilationUnit().
|
static |
Definition at line 4111 of file statement.c.
References _intFMT, CONS, control_statement, forloop_body, replace_statement_context::found_p, gen_nreverse(), gen_recurse_stop(), ifdebug, instruction_call_p, instruction_expression_p, instruction_forloop, instruction_forloop_p, instruction_goto, instruction_goto_p, instruction_loop, instruction_loop_p, instruction_multitest, instruction_multitest_p, instruction_sequence, instruction_sequence_p, instruction_tag, instruction_test, instruction_test_p, instruction_unstructured, instruction_unstructured_p, instruction_whileloop, instruction_whileloop_p, loop_body, MAP, multitest_body, replace_statement_context::new_stat, NIL, replace_statement_context::old_stat, pips_debug, pips_internal_error, sequence_statements, STATEMENT, statement_instruction, statement_number, test_false, test_true, unstructured_entry, unstructured_exit, and whileloop_body.
Referenced by statement_replace_in_root_statement().
Test if a statement is a C or Fortran "return".
Definition at line 172 of file statement.c.
References return_instruction_p(), and statement_instruction.
Referenced by add_shutdown_pragma_to_return(), do_add_pragma(), do_redundant_load_store_elimination(), do_split_decl_block_statements(), do_split_structure_return_hook_walker(), ensure_comment_consistency(), gen_omp_parallel(), initial_code_abc_statement_rwt(), inline_return_crawler(), inline_return_remover(), instruction_to_wp65_code(), make_mpi_conversion(), mpi_initialize(), pips_code_abc_statement_rwt(), pragma_nonscop(), pragma_scop(), rebuild_topological_sort(), statement_does_return(), statements_conflict_p(), statements_conflict_relaxed_p(), take_out_the_exit_node_if_not_a_continue(), taskify_statement(), update_statement_instruction(), wp65_conform_p(), and xml_statement_from_sequence().
Definition at line 1726 of file statement.c.
References instruction_undefined_p, statement_identification(), statement_instruction, and statement_undefined_p.
Referenced by print_and_check_control_node(), print_control_node(), print_control_node_uns(), print_control_node_unss_sem(), print_control_nodes(), print_control_nodes_without_check(), process_unreachable_node(), step_analyse_CHAINS_DG(), step_print_effect_path(), and step_translate_and_map_step_regions().
statement st_make_nice_test | ( | expression | condition, |
list | ltrue, | ||
list | lfalse | ||
) |
condition | ondition |
ltrue | true |
lfalse | false |
Definition at line 1585 of file statement.c.
References entity_intrinsic(), entity_undefined, instruction_to_statement(), is_instruction_test, make_continue_statement(), make_instruction(), make_statement_from_statement_list(), make_test(), MakeUnaryCall(), NOT_OPERATOR_NAME, and statement_undefined.
Referenced by build_third_comb(), generate_c1_alpha(), generate_optional_if(), generate_parallel_body(), generate_update_distributed_value_from_host(), generate_update_values_on_computer_and_nodes(), generate_update_values_on_nodes(), st_get_value_for_all(), st_get_value_for_computer(), st_send_to_computer_if_necessary(), and st_send_to_host_and_nodes().
Definition at line 3939 of file statement.c.
References call_domain, gen_context_recurse, gen_null2(), look_for_user_call(), and user_call_p().
Referenced by costly_task(), static_controlize_statement(), and taskify_statement().
Returns false is no syntactic control path exits s (i.e.
even if true is returned there might be no control path). Subroutines and functions are assumed to always return to keep the analysis intraprocedural. See the continuation library for more advanced precondition-based analyses.
true is a safe default value.
The function name is misleading: a RETURN statement does not return... It should be called "statement_does_continue()"
the third condition is due to a bug/feature of unspaghettify
No precise answer, unless you can prove the loop executes at least one iteration.
returns = statement_does_return(instruction_goto(i));
Definition at line 2195 of file statement.c.
References CAR, continue_statement_p(), debug(), entity_return_label_p(), instruction_sequence, instruction_tag, instruction_test, instruction_unstructured, is_instruction_call, is_instruction_expression, is_instruction_forloop, is_instruction_goto, is_instruction_loop, is_instruction_sequence, is_instruction_test, is_instruction_unstructured, is_instruction_whileloop, MAPL, pips_internal_error, return_statement_p(), sequence_statements, STATEMENT, statement_does_return(), statement_identification(), statement_instruction, statement_label, stop_statement_p(), test_false, test_true, test_undefined, and unstructured_does_return().
Referenced by c_unstructured(), decorate_trail(), statement_does_return(), and text_trail().
Like external_statement_identification(), but with internal information, the hexadecimal address of the statement.
Allocate a new string.
Definition at line 1700 of file statement.c.
References asprintf, buffer, call_function, entity_undefined, entity_undefined_p, instruction_call, instruction_identification(), module_local_name(), ORDERING_NUMBER, ORDERING_STATEMENT, pips_assert, same_string_p, statement_instruction, statement_number, and statement_ordering.
Referenced by build_trail(), clean_up_sequences_rewrite(), compact_list(), control_to_ancestor(), control_to_label_name(), copy_n_statement(), dag_or_cycle_to_flow_sensitive_postconditions_or_transformers(), dag_to_flow_sensitive_preconditions(), decorate_trail(), dump_control_to_label_name(), dump_trail(), ensure_comment_consistency(), genref_statement(), get_control_precondition(), node_to_path_transformer_or_postcondition(), pipsdbm_write_statement_function(), print_control_postcondition_map(), print_cycle_head_to_fixpoint(), print_ordering_to_statement(), print_statement_temporary_precondition(), process_ready_node(), process_unreachable_node(), ready_to_be_processed_p(), remove_useless_continue_or_empty_code_in_unstructured(), safe_print_statement(), safe_statement_identification(), set_control_to_label(), statement_does_return(), statement_to_label(), store_control_fix_point(), store_control_postcondition(), text_trail(), text_unstructured(), unreachable_node_to_transformer(), unstructured_to_flow_sensitive_postconditions_or_transformers(), update_control_postcondition(), update_cycle_temporary_precondition(), and update_statement_temporary_precondition().
st | t |
Definition at line 4076 of file statement.c.
References sb::found_p, gen_context_recurse, gen_null2(), sb::searched_statement, statement_domain, and statement_in_statement_walker().
Referenced by some_conflicts_between(), and statement_in_statements_p().
pips_debug(7,"considering statement:\n");
print_statement(st);
}
Definition at line 4052 of file statement.c.
References sb::found_p, gen_recurse_stop(), and sb::searched_statement.
Referenced by statement_in_statement_p().
Definition at line 4097 of file statement.c.
References FOREACH, STATEMENT, and statement_in_statement_p().
st1 | t1 |
st2 | t2 |
Definition at line 288 of file statement.c.
References abort, fprintf(), ORDERING_NUMBER, ORDERING_STATEMENT, statement_number, and statement_ordering.
Definition at line 4022 of file statement.c.
References call_domain, gen_context_recurse, gen_null2(), and look_for_exiting_intrinsic_calls().
Preserve branch targets, without checking if they are useful or not because it can be done by another pass
These statements may hide a non-terminating loop. I assume that do loops always terminate. They also always have a memory write effect for the index, which may not be true for the other kinds of loops. Unstructured could be tested to see if they have a syntactical control cycle or not.
Definition at line 3978 of file statement.c.
References call_domain, entity_empty_label_p(), gen_context_recurse, gen_null2(), look_for_control_effects(), statement_forloop_p(), statement_label, statement_unstructured_p(), and statement_whileloop_p().
st1 | t1 |
st2 | t2 |
Definition at line 306 of file statement.c.
References ORDERING_NUMBER, ORDERING_STATEMENT, and statement_ordering.
Referenced by TestCoupleOfReferences(), and TestDiVariables().
get the list of pragma of a statement s
s | the statement to work on |
Definition at line 3851 of file statement.c.
References CONS, EXTENSION, extension_pragma, extension_pragma_p, extensions_extension, extensions_undefined_p, FOREACH, gen_nreverse(), NIL, PRAGMA, and statement_extensions.
Referenced by make_task_mapping().
bool statement_replace_in_root_statement | ( | statement | old_stat, |
statement | new_stat, | ||
statement | root_stat | ||
) |
replace old_stat by new_stat in root_stat this pass does not free old_stat similar to replace_in_sequence_statement_with() in phrase/phrase_tools.c but without the constraint that old_stat is in a sequence
old_stat | statement to be replaced |
new_stat | statement that will replace old_stat |
root_stat | statement where old_stat is searched to be replaced |
old_stat | ld_stat |
new_stat | ew_stat |
root_stat | oot_stat |
Definition at line 4235 of file statement.c.
References replace_statement_context::found_p, gen_context_recurse, gen_null2(), replace_statement_context::new_stat, replace_statement_context::old_stat, pips_debug, pips_user_warning, replace_statement_walker(), and statement_domain.
Referenced by make_send_receive_conversion().
Assume that statement rs appears in statement as and replaced it by a statement list.
pips_debug(8, "Ancestor statement before substitution:\n");
print_statement(as);
}
pips_debug(8, "Ancestor statement after substitution:\n");
print_statement(as);
}
as | s |
rs | s |
sl | l |
Definition at line 3081 of file statement.c.
References gen_substitute_chunk_by_list(), instruction_block, pips_internal_error, statement_block(), statement_block_p, and statement_instruction.
search a statement inside a statement
s | searched statement |
root | where to start searching from |
NL: What is the difference with statement_in_statement_p? statement_in_statement_p certainly be better to keep, no global variable and use of gen_recurse_stop to stop the recursion
root | oot |
Definition at line 3702 of file statement.c.
References gen_context_recurse, gen_null2(), is_substatement, statement_domain, and statement_substatement_walker().
Referenced by get_statement_depth().
some | ome |
Definition at line 3683 of file statement.c.
References is_substatement.
Referenced by statement_substatement_p().
Get a list of all user function called recursively within a statement:
Definition at line 3478 of file statement.c.
References add_stat_called_in_inits(), add_stat_called_user_entities(), call_domain, gen_context_multi_recurse(), gen_nreverse(), gen_null2(), entities_t::lents, NIL, entities_t::sents, set_free(), set_make(), set_pointer, and statement_domain.
Referenced by loop_fully_unrollable_p(), and update_unstructured_declarations().
Number of comment line directly attached to a statement.
Should be zero for sequences.
Is it allowed? Should be the empty string...
stmt | tmt |
Definition at line 2375 of file statement.c.
References statement_comments, and string_undefined_p.
Referenced by down_counter().
list statement_to_declarations | ( | void * | s | ) |
Get a list of all variables declared recursively within a statement.
It works for any newgen type, not only statements. Warning: the list must be freed !
Definition at line 3253 of file statement.c.
References add_statement_declarations(), add_statement_declarations_t::cache, call_domain, gen_context_multi_recurse(), gen_false2(), gen_null2(), NIL, set_free(), set_make(), set_pointer, statement_domain, and add_statement_declarations_t::statement_to_all_included_declarations.
Referenced by cusq_ctxt_init(), guard_expanded_statement_if_needed(), instruction_to_declarations(), merge_on_outer(), module_to_all_declarations(), outliner_statements_referenced_entities(), statements_to_declarations(), and update_unstructured_declarations().
Returns the declarations contained directly in a statement s.
s | any kind of statement |
No recursive descent in loops or tests or sequences because only variables of the current scope are returned. Recursive descent in unstructured statements because their statements are in the same scope as the statements in list sl
Definition at line 3366 of file statement.c.
References internal_statement_to_direct_declarations(), NIL, statement_block(), statement_block_p, and statements_to_direct_declarations().
Referenced by clean_up_sequences_rewrite(), and copy_write_statement_with_cumulated_regions().
Look for labels appearing in END= or ERR= IO clauses and allocate a label list.
Label List
Definition at line 3145 of file statement.c.
References find_implicit_goto(), gen_context_recurse, gen_null2(), NIL, and statement_domain.
Referenced by fuse_sequences_in_unstructured().
See if statement s is labelled and can be reached by a GO TO.
You cannot jump onto a non-executable statement
The initial statement may be an unlabelled CONTINUE...
Definition at line 2090 of file statement.c.
References CAR, continue_statement_p(), control_statement, debug(), entity_empty_label(), entity_empty_label_p(), entity_local_name(), format_statement_p(), instruction_sequence, instruction_tag, instruction_unstructured, is_instruction_call, is_instruction_expression, is_instruction_forloop, is_instruction_goto, is_instruction_loop, is_instruction_sequence, is_instruction_test, is_instruction_unstructured, is_instruction_whileloop, MAPL, pips_internal_error, sequence_statements, STATEMENT, statement_identification(), statement_instruction, statement_label, statement_to_label(), and unstructured_control.
Referenced by add_label_to_statement(), fuse_2_control_nodes(), fuse_sequences_in_unstructured(), set_control_to_label(), statement_to_label(), and text_trail().
Look for non-empty labels appearing directly or indirectly and allocate a label list.
The code is assumed correct. Usage of labels, for instance in Fortran IOs, are not checked. Only the statement label field is checked.
Label List
To have labels in order of appearance
Definition at line 3169 of file statement.c.
References collect_labels(), gen_context_recurse, gen_nreverse(), gen_null2(), NIL, and statement_domain.
Referenced by FixCInternalLabels().
persistant_statement_to_int statement_to_line_number | ( | statement | s | ) |
Definition at line 2460 of file statement.c.
References current_line, down_counter(), gen_multi_recurse(), make_persistant_statement_to_int(), persistant_statement_to_int_undefined, statement_domain, stmt_to_line, and up_counter().
Referenced by make_filtered_dg_or_dvdg(), and prettyprint_dependence_graph().
Get a list of all variables referenced recursively within a statement:
Definition at line 3428 of file statement.c.
References add_loop_index_entity(), add_ref_entities_in_init(), add_stat_referenced_entities(), gen_context_multi_recurse(), gen_nreverse(), gen_null2(), entities_t::lents, loop_domain, NIL, reference_domain, entities_t::sents, set_free(), set_make(), set_pointer, and statement_domain.
Referenced by redeclaration_enter_statement(), and update_unstructured_declarations().
Return true if the statement has an empty statement:
Definition at line 126 of file statement.c.
References empty_comments_p(), and statement_comments.
Referenced by check_if_statement_contains_comment(), clean_statement_from_tags(), clean_up_sequences_rewrite(), debug_statement(), fsmize_statement(), get_externalized_and_analyzed_function_name(), get_function_name_by_searching_tag(), rename_statement_declarations(), spaghettify_statement(), take_out_the_entry_node_of_the_unstructured(), text_block_else(), and update_statement_instruction().
Test if a statement has some pragma.
s | is the statement to test |
Definition at line 3836 of file statement.c.
References EXTENSION, extension_pragma_p, extensions_extension, FOREACH, and statement_extensions.
Referenced by is_SCOP_rich(), make_task_mapping(), pragma_nonscop(), and statement_with_pragma_p_inv().
Returns the declarations contained in a list of statement.
sl | l |
Definition at line 3265 of file statement.c.
References CDR, ENDP, FOREACH, gen_last(), NIL, STATEMENT, and statement_to_declarations().
Referenced by outliner(), outliner_scan(), statements_localize_declarations(), and update_referenced_entities().
Returns the declarations contained directly in the declaration statements of a list of statements.
sl | List of statements |
sl | l |
Definition at line 3334 of file statement.c.
References CONS, ENTITY, FOREACH, gen_in_list_p(), gen_nconc(), gen_nreverse(), internal_statement_to_direct_declarations(), NIL, and STATEMENT.
Referenced by fix_block_statement_declarations(), MakeBlock(), MakeForloopWithIndexDeclaration(), and statement_to_direct_declarations().
Test if a statement is a Fortran STOP.
Definition at line 263 of file statement.c.
References instruction_stop_p(), and statement_instruction.
Referenced by abc_bound_violation_stop_statement_p(), initial_code_abc_statement_rwt(), interprocedural_abc_statement_rwt(), MakeAssignedOrComputedGotoInst(), pips_code_abc_statement_rwt(), statement_does_return(), and wp65_conform_p().
Put a comment on a statement in a safe way.
That is it find the first non-block statement to attach it or insert a CONTINUE and put the statement on it. You should free the old one...
The comment should have been malloc()'ed before.
Return true on success, false else.
We are not allowed to put a comment on a sequence, find the first non sequence statement if any:
Ok, we succeed to put the comment:
Hmm, no good statement found to attach a comment:
Ok, it is a plain statement, we can put a comment on it:
the_comments | he_comments |
Definition at line 1831 of file statement.c.
References instruction_sequence, instruction_sequence_p, MAP, sequence_statements, STATEMENT, statement_comments, statement_instruction, and try_to_put_a_comment_on_a_statement().
Referenced by put_a_comment_on_a_statement(), and try_to_put_a_comment_on_a_statement().
The recursive descent in s is fatal when there is a problem.
print_statement(s);
You probably want a breakpoint here...
Definition at line 3187 of file statement.c.
References abort, fprintf(), ifdebug, ORDERING_NUMBER, ORDERING_STATEMENT, pips_debug, statement_number, statement_ordering, and statement_undefined_p.
Referenced by all_statements_defined_p().
bool unstructured_does_return | ( | unstructured | u | ) |
Definition at line 2254 of file statement.c.
References exit, FORWARD_CONTROL_MAP, gen_free_list(), NIL, unstructured_control, and unstructured_exit.
Referenced by statement_does_return().
|
static |
Definition at line 3288 of file statement.c.
References blocks, c_in, CONTROL_MAP, control_statement, gen_free_list(), gen_nconc(), internal_statement_to_direct_declarations(), NIL, and unstructured_control.
Referenced by internal_statement_to_direct_declarations().
|
static |
There must be an ENDDO here
There must be an ENDIF here
I doubt it's a real good way to detect synthetic IFs
What could be done for ELSE and ELSEIF?
An else stack should be built. Use DEFINE_LOCAL_STACK(name, type) DEFINE_LOCAL_STACK(else_stack, statement) Note that it should be pushed and poped in the down_counter() function
Definition at line 2433 of file statement.c.
References current_line, entity_empty_label_p(), instruction_loop, instruction_loop_p, instruction_test_p, loop_label, statement_instruction, statement_number, and STATEMENT_NUMBER_UNDEFINED.
Referenced by statement_to_line_number().
|
static |
Definition at line 1479 of file statement.c.
References duplicate_numbers, hash_get(), hash_put(), HASH_UNDEFINED_VALUE, number_to_statement, set_add_element(), statement_number, and STATEMENT_NUMBER_UNDEFINED.
Referenced by build_number_to_statement().
statement update_statement_instruction | ( | statement | s, |
instruction | i | ||
) |
Replace the instruction in statement s by instruction i.
Free the old instruction.
If the new instruction is a sequence, add a CONTINUE to carry the label and/or the comments. The statement number and ordering are set to undefined.
Else if the new instruction is not a sequence, the statement number and the ordering are also set to undefined because the connexion with the parsed line is lost and the ordering most likely obsolete. If the parsed statement number is still meaningfull, the caller must take care of it.
If the initial instruction has been re-used, do not forget to dereference it before calling this function:
statement_instruction(s) = instruction_undefined;
Be careful with the label and the comments too: they may have been reused.
ATTENTION !!! : this version is not for unstructured case
reset numbering and ordering
try hard to keep comments and label when relevant
G:note the special return-label case
add the CONTINUE statement before the sequence instruction i
SG: if the old statement had declarations, they are removed maybe we should regenerate the new one if any to keep global coherency ?
Definition at line 3039 of file statement.c.
References empty_comments, empty_extensions(), entity_empty_label(), entity_return_label_p(), free_extensions(), free_instruction(), gen_free_list(), instruction_sequence_p, instruction_to_statement(), make_continue_statement(), make_instruction_sequence(), make_sequence(), make_statement_list, NIL, return_statement_p(), statement_comments, statement_declarations, statement_extensions, statement_instruction, statement_label, statement_number, STATEMENT_NUMBER_UNDEFINED, statement_ordering, STATEMENT_ORDERING_UNDEFINED, statement_with_empty_comment_p(), and unlabelled_statement_p().
Referenced by compact_phi_functions(), create_block_if_needed(), delay_communications_call(), do_loop_to_for_loop(), do_loop_to_while_loop(), do_redundant_load_store_elimination(), do_symbolic_tiling(), dowhile_to_while_walker(), fs_filter(), gen_flat_mpi(), generic_insert_statement(), guard_expanded_statement(), icm_loop_rwt(), if_conv_init_statement(), inline_return_crawler(), inline_return_remover(), inline_statement_crawler(), insert_rwt(), loop_expansion(), process_true_call_stat(), process_true_stat(), and terapixify_loop_purge().
Definition at line 281 of file statement.c.
References native_instruction_p(), statement_instruction, and WRITE_FUNCTION_NAME.
|
static |
Poor attempt at associating physical line numbers to statement.
Lines used for declarations are counted elsewhere: see module_to_declaration_length()
It is assumed that each statement fits on one physical line, excepts sequences which require 0 line. Non statement such as ENDIF, ELSE, ENDDO,... must be taken care of too.
Definition at line 2405 of file statement.c.
Referenced by down_counter(), safe_copy_line_interval(), safe_read_nth_line(), statement_to_line_number(), and up_counter().
|
static |
To keep track of duplicate numbers.
Definition at line 1477 of file statement.c.
Referenced by build_number_to_statement(), and update_number_to_statement().
|
static |
Return first reference found.
Definition at line 3495 of file statement.c.
Referenced by declarations_first_reference_to_v_p(), find_reference_to_variable(), and first_reference_to_v_p().
|
static |
Definition at line 2611 of file statement.c.
Referenced by generated_variable_comment(), and push_generated_variable_commenter().
Definition at line 3681 of file statement.c.
Referenced by statement_substatement_p(), and statement_substatement_walker().
|
static |
Estimate count of dynamic references.
Definition at line 3581 of file statement.c.
Referenced by count_element_references_to_v_p(), count_loop_in(), count_loop_out(), count_references_to_v_p(), count_references_to_variable(), and count_references_to_variable_element().
|
static |
Definition at line 2614 of file statement.c.
Referenced by generated_variable_comment(), pop_generated_variable_commenter(), and push_generated_variable_commenter().
|
static |
Mapping from statement number to statement.
Warning: STATEMENT_NUMBER_UNDEFINED may be equal to HASH_ENTRY_FREE_FOR_PUT
Two statements in the same piece of code may have the same number because:
A statement may be not numbered because:
Definition at line 1475 of file statement.c.
Referenced by build_number_to_statement(), and update_number_to_statement().
|
static |
Definition at line 3558 of file statement.c.
Referenced by count_element_references_to_v_p(), count_references_to_v_p(), count_references_to_variable(), count_references_to_variable_element(), count_static_references_to_v_p(), and count_static_references_to_variable().
|
static |
Definition at line 2406 of file statement.c.
Referenced by down_counter(), and statement_to_line_number().
|
static |
Definition at line 3496 of file statement.c.
Referenced by count_element_references_to_v_p(), count_references_to_v_p(), count_references_to_variable(), count_references_to_variable_element(), count_static_references_to_v_p(), count_static_references_to_variable(), find_reference_to_variable(), and first_reference_to_v_p().