StmtList Class ReferenceModification History: 97-09-24.0015 evansl WHAT: Added: 1) private _move_block_either 96-11-13.2120 evansl WHAT: Added: 1) ins_DO_END_after 2) ins_WHILE_after A class for Fortran Statement Lists.
More...
#include <StmtList.h>
Inheritance diagram for StmtList:
[legend]List of all members.
|
Public Member Functions |
| | StmtList () |
| | StmtList (const StmtList &stmts) |
| StmtList & | operator= (const StmtList &stmts) |
| void | convert (BinRep &stmts, ExprTable &etable, Symtab &symtab, const NamelistDict &namelists, const FormatDB &formats, const char *initial_stmt) |
| | Convert a list of statements.
|
| virtual StmtList * | clone () const |
| virtual Listable * | listable_clone () const |
| | Needed for Listable class.
|
| virtual | ~StmtList () |
| BinRep * | overflow_ref () const |
| | Return the FLOW_ENTRY statement.
|
| const Statement & | first () const |
| Statement & | first () |
| | Return the FLOW_EXIT statement.
|
| const Statement & | last () const |
| Statement & | last () |
| const Statement * | find_ref (const char *stmt_tag) const |
| Statement * | find_ref (const char *stmt_tag) |
| | Search for a statement using the statement tag, such as "S1", "S2", "ST30", etc.
|
| Iterator< Statement > | iterate_entry_points () const |
| | Returns an iterator which loops through all entry points in the StmtList.
|
| virtual void | ins_before (Statement *new_stmt, Statement *ref_stmt) |
| | Insert new_stmt after ref_stmt.
|
| virtual void | ins_after (Statement *new_stmt, Statement *ref_stmt) |
| | Insert new_stmt after ref_stmt.
|
| virtual void | ins_first (Statement *stmt) |
| | Insert stmt first in StmtList.
|
| virtual void | ins_last (Statement *stmt) |
| | Insert stmt last in StmtList.
|
| virtual void | ins (Statement *new_stmt, int loc) |
| | Insert new_stmt at location loc, where 0 <= loc <= entries().
|
| void | ins_before (List< Statement > *stmts, Statement *ref_stmt) |
| | Insert the statement block, stmts, before ref_stmt and then delete stmts.
|
| void | ins_after (List< Statement > *stmts, Statement *ref_stmt) |
| | Insert the statement block, stmts, after ref_stmt and then delete stmts.
|
| Statement & | ins_IF_ELSE_after (Expression *cond_exp, Statement *ref_stmt=0, Statement *last_of_then_clause=0, Statement *last=0) |
| | Insert a block IF-ELSE-ENDIF around a (possibly empty) set of statements with the conditional expression cond_exp and return the IfStmt.
|
| Statement & | ins_IF_after (Expression *cond_exp, Statement *ref_stmt=0, Statement *last=0) |
| | Same as ins_IF_ELSE_after(), except no ELSE part is inserted.
|
| Statement & | ins_ELSEIF_after (Expression *cond_expr, Statement *if_stmt, Statement *last_of_then_clause=0) |
| | No additional ENDIF is added.
|
| Statement & | ins_ELSE_after (Statement *if_stmt, Statement *last_of_then_clause=0) |
| | No additional ENDIF is added.
|
| Statement & | ins_DO_after (Expression *index_exp, Expression *init_exp, Expression *limit_exp, Expression *step_exp, Statement *ref_stmt=0, Statement *last=0) |
| | Insert a DO block around a set of statements with the specifications given by index_exp, init_exp, limit_exp and step_exp.
|
| Statement & | ins_WHILE_after (Expression *cond_exp, Statement *ref_stmt=0, Statement *last=0) |
| | Insert a WHILE block around a set of statements with the specifications given by cond_exp.
|
| Statement & | ins_DO_END_after (Statement *do_stmt, Statement *ref_stmt=0, Statement *last=0) |
| | Insert a DO..ENDDO block around a set of statements with the specifications given by do_stmt(either DoStmt or WhileStmt).
|
| Statement & | ins_BLOCK_after (Statement *ref_stmt=0, Statement *last=0) |
| | Insert a BLOCK_ENTRY/EXIT around a set of statements.
|
| void | move_block_before (Statement &first_stmt, Statement &last_stmt, Statement *ref_stmt=0) |
| | Move all statements from first_stmt to last_stmt, inclusive, to before ref_stmt.
|
| void | move_block_after (Statement &first_stmt, Statement &last_stmt, Statement *ref_stmt=0) |
| | Move all statements from first_stmt to last_stmt, inclusive, to after ref_stmt (or beginging if !ref).
|
| void | move_before (Statement &stmt, Statement *ref_stmt=0) |
| | Move statement to before ref_stmt.
|
| void | move_after (Statement &stmt, Statement *ref_stmt=0) |
| | Move statement to after ref_stmt.
|
| virtual void | del (Statement &s) |
| | Delete a single statement.
|
| virtual void | del (RefSet< Statement > &stmt_list) |
| | Delete a set of statements.
|
| void | del (Statement &first_stmt, Statement &last_stmt) |
| | Delete the block delimited by first_stmt and last_stmt.
|
| virtual void | clear () |
| | Delete the entire StmtList.
|
| List< Statement > * | copy (const Statement &first_stmt, const Statement &last_stmt, RE_LABEL relabel=RELABEL) const |
| | Return a copied list of statements between first_stmt and last_stmt, inclusive.
|
| List< Statement > * | grab (Statement &first_stmt, Statement &last_stmt, RE_LABEL relabel=RELABEL) |
| | Remove and return the statements between first_stmt and last_stmt, inclusive.
|
| virtual Statement * | grab (Statement &el) |
| | The equivalent of calling grab( , RELABEL) on a single statement block.
|
| virtual Statement * | grab (int loc) |
| | Grab the locth statement.
|
| virtual void | modify (Statement &el, Statement *replacement) |
| | Replace 'el' with 'replacement'. 'el' is deleted.
|
| virtual void | modify (int loc, Statement *replacement) |
| | Replace the locth statement with replacement.
|
| virtual Statement * | modify_and_grab (Statement &el, Statement *replacement) |
| | Replace 'el' with 'replacement'. 'el' is returned.
|
| Boolean | contains_DO (Statement &st) |
| | Checks whether there is an inner DO in the given DO loop "st".
|
| int | number_of_stmts_in_DO (Statement &st) |
| | Returns the number of statements in the loop, excluding ENDDO, BLOCK_ENTRY, BLOCK_EXIT, FLOW_ENTRY, FLOW_EXIT, ENDIF, IMPLIED_GOTO, and LABEL stmts.
|
| Iterator< Statement > | stmts_of_type (STMT_TYPE type) const |
| | Return a list of all statements of the given type The list will be in textual order of statements.
|
| Iterator< Statement > | stmts_of_type (STMT_TYPE type1, STMT_TYPE type2, STMT_TYPE type3=UNDEFINED_STMT, STMT_TYPE type4=UNDEFINED_STMT, STMT_TYPE type5=UNDEFINED_STMT) const |
| | Return a list of all statements of any of the given types (up to five types may be specified for this method) The list will be in textual order of statements.
|
| Iterator< Statement > | iterate_loop_body (const Statement *do_stmt) const |
| | Return a list of statement pointers to each statement in a DO loop, including the DO and ENDDO statements.
|
| Iterator< Statement > | iterator (const Statement &first_stmt, const Statement &last_stmt) const |
| | Return an iterator for first_stmt to last_stmt, inclusive.
|
| Iterator< Statement > | iterator () const |
| | Return an iterator for the entire StmtList.
|
| const LabelDB & | labels () const |
| LabelDB & | labels () |
| | Return a reference to the label database.
|
| void | relabel (const int value, const int new_value) |
| | Change the label of statement within the StmtList from value to new_value.
|
| char * | new_tag () |
| | Return a new statement tag.
|
| void | retag (const char *old_tag, const char *new_tag) |
| | Change the statement tag of old_tag into new tag;.
|
| int | new_label (int target=0) const |
| | Return a new value for a LABEL statement.
|
| void | split_elseif (Statement &s) |
| | Change the program from ELSEIF to ELSE;IF.
|
| void | build_all_refs () |
| | Call build_refs() to create the in/out/act _refs sets for each Statement in the ProgramUnit.
|
| void | create_directives () |
| | Create the pre- & post- directives from the assertions.
|
| void | remove_directives () |
| | Remove all pre- & post- directives.
|
| void | create_assertions () |
| | Remove all pre- & post- directives and create Directive statements.
|
| void | create_flow_graph () |
| | Erase the old flow graph and rebuild it.
|
| void | delete_flow_graph () |
| | Erase the old flow graph.
|
| void | exchange_convert (VDL &vdl) |
| | Convert the Statement list into the exchange format.
|
| void | display (ostream &o) const |
| void | write (ostream &o) const |
| virtual void | print (ostream &o) const |
| | Methods to be used in conjuntion with ProgramUnit's display and write.
|
| virtual int | structures_OK () const |
| | StmtList consistant and correct?
|
Protected Member Functions |
| Statement * | _last_ref () const |
| | < For friend use only: equiv to last_ref, but not returning const
|
Friends |
| class | ProgramUnit |
| class | Program |
| class | Directive |
| class | StopStmt |
| class | ReturnStmt |
Classes |
| class | ElseIf_or_Else_Stmt |
Detailed Description
Modification History: 97-09-24.0015 evansl WHAT: Added: 1) private _move_block_either 96-11-13.2120 evansl WHAT: Added: 1) ins_DO_END_after 2) ins_WHILE_after A class for Fortran Statement Lists.
Base General utility routines - See also:
- StmtList.h
StmtList.cc
StmtList.h
This class contains the list of statements found in a ProgramUnit as well as all manipulation methods associated with statements. Access to the structure is strictly controlled to ensure that consistency is maintained.
This class is derived from the List<Statement> class but has many additional methods which allow Fortran-specific manipulations. The methods defined here guarantee the syntactic correctness of the Fortran code at the conclusion of the method. Incorrect syntax will result in a run-time error. These methods also guarantee the correctness of the flow-graph.
The new statement to be inserted MUST have been created on the heap and MUST NOT already be part of another structure. If the statement is used elsewhere, use the clone method to create a new statement such as,
pgm.stmts().ins_before(old_stmt->clone(), ref_stmt);
where old_stmt->clone() will make a copy of old_stmt to be inserted.
The reference statement in any of these functions may be 0. If it is, and the function inserts a new statement after the reference statement, the new statement will be inserted at the beginning. Otherwise, if the function inserts a new statement before the reference statement, the new statement will be inserted at the end.
When inserting a single statement, that statement is not allowed to be part of a multiple statement construct, like an IF, ENDIF, DO, ENDDO, etc. statement, as that would result in incorrect syntax.
When inserting a block of statements the block must be completely well formed, i.e. all IF's, DO's, ENDDO's, etc. must contain the matching ENDTHEN/ELSE/ENDIF/DO/ENDDO, etc.
When deleting single statements, if the statement is ANY part of a block (such as IF, ELSE, ENDIF, DO, ENDDO, etc.) then that statement and all related parts are deleted out from around the inner statements. E.g., if the statement is an ELSE, then the related IF, ENDTHEN, ELSE, and END statements are all deleted, but all the statements within the THEN and ELSE clause are left intact!
If you want to delete all the inner statements as well, use block del().
When deleting a block of statements, the block must be well formed with respect to any block statements.
- Note:
- When a statement/set of related block-delimiting statements are deleted, they are deallocated completely from memory. If you wish to keep a copy of a statement that you are deleting, you must FIRST make a copy, then delete the original.
Currently, delete routines automatically deletes label statements. It is an error to delete a label which is the target of an existing statement.
Definition at line 128 of file StmtList.h.
Constructor & Destructor Documentation
| StmtList::StmtList |
( |
const StmtList & |
stmts |
) |
|
|
Member Function Documentation
| Statement * StmtList::_last_ref |
( |
|
) |
const [inline, protected] |
|
|
|
Convert a list of statements.
Put the results in StmtList in their correct order. A complete Expression table, Symbol table and format list are required. This procedure works in two passes, the first doing the translation and building up a Dictionary relating statement tags to pointers to the statement object. In this pass, all fields which should be pointers to other statements are set to DummyStatements with the tag of the statement to be linked. The second pass removes these dummy statements and replaces them with actual pointers.
... cout << initial_stmt << endl << flush; ... Remove any FLOW_ENTRY or FLOW_EXIT statements that may be in the list. ... First remove any existing flow graph
... This dictionary will be used to determine which statement corresponds ... to the \'next\' field of a given statement when the statements are ... ordered.
... first pass: convert all statements
... Add tag to dictionary (even flow entry and exit tags ... are needed for conversion pass)
... Second pass: ... order the statements and determine the largest value ... used as the integral suffix to statement tags and build the ... label database.
... determine maximum tag number
... If label statement, insert entry into label database
... This must have been the last statement
... Third pass: ... call setptrs on all statements to convert StmtPtrs ... to pointers to actual statements (had to do this as a third pass ... because as the list is built, successor statements wouldn't be on ... the list until this pass).
... This must have been the last statement
... statements, if there are statements. If there are not, ... then add them (this will be necessary, for instance, ... for BLOCK DATA program units)
... Fix up any pointers in the program blocks.
... Set lead, matching_if and matching_endif fields
Definition at line 386 of file StmtList.cc.
References Statement::build_refs(), clear(), Statement::convert(), delete_flow_graph(), ELSE_STMT, ELSEIF_STMT, ENDIF_STMT, Dictionary< T >::find_ref(), List< Statement >::first_ref(), FLOW_ENTRY_STMT, FLOW_EXIT_STMT, get_tag_num(), IMPLIED_GOTO_STMT, Dictionary< T >::ins(), ins_first(), ins_last(), List< T >::ins_last(), LABEL_STMT, List< Statement >::last_ref(), make_statement(), new_tag(), NextEntry::next_ref(), Statement::prev_ref(), BinRep::put_set(), Statement::stmt_class(), and BinRep::to_string().
Referenced by ProgramUnit::create_program_unit(). |
| StmtList * StmtList::clone |
( |
|
) |
const [virtual] |
|
| Listable * StmtList::listable_clone |
( |
void |
|
) |
const [virtual] |
|
| BinRep * StmtList::overflow_ref |
( |
|
) |
const |
|
|
|
Return the FLOW_ENTRY statement.
Definition at line 206 of file StmtList.cc. |
| const Statement * StmtList::find_ref |
( |
const char * |
stmt_tag |
) |
const [inline] |
|
|
|
Definition at line 584 of file StmtList.h.
References Dictionary< T >::find_ref().
Referenced by IPCPProcData::add_constant_set(), IPCPProcData::add_maymods(), coalese_loop_pu(), normalize_loop_pu(), peel_first_loop_pu(), peel_last_loop_pu(), preroll_loop_pu(), reverse_loop_pu(), strip_horiz_loop_pu(), strip_vert_loop_pu(), and unroll_loop_pu(). |
| Statement * StmtList::find_ref |
( |
const char * |
stmt_tag |
) |
[inline] |
|
|
|
Search for a statement using the statement tag, such as "S1", "S2", "ST30", etc.
Return a pointer to the statement with this tag (return 0 if not found)
Definition at line 592 of file StmtList.h.
References Dictionary< T >::find_ref(). |
|
|
Returns an iterator which loops through all entry points in the StmtList.
Currently this means that the statements it will loop through are either FlowEntryStmt's or EntryStmt's. If you desire to place code after each entry point in a statement list, use this iterator and insert after each statement it iterates through. In case you need more information about where to expect what kinds of statements using this iterator: Usually the iterator returned will iterate through only EntryStmt's, and they will follow lexical order. That means that if there is a PROGRAM, SUBROUTINE or FUNCTION statement, that will be the first entry returned. There is only one exception to this rule. It is legal Fortran to have a main program (i.e. a PROGRAM_PU_TYPE ProgramUnit) which has no PROGRAM statement. In this case, there will be no EntryStmt, and this iterator will iterate simply through the FlowEntryStmt.
Definition at line 2993 of file StmtList.cc.
References ENTRY_STMT, FLOW_ENTRY_STMT, stmts_of_type(), and Iterator< T >::valid().
Referenced by ProgramUnit::create_program_unit(), main(), process(), and InlineObject::remap_arg_names(). |
|
|
Insert new_stmt after ref_stmt.
... If label statement, insert entry into label database
... WARNING: this is a private member access!
Definition at line 1261 of file StmtList.cc.
References BaseMapRoot::clear(), Iterator< T >::current(), Statement::fix_flow(), List< T >::ins_before(), LABEL_STMT, List< Statement >::last_ref(), redundant_flow_ins(), and Iterator< T >::valid().
Referenced by add_dummy_global_assignments_at_calls(), ins_last(), SSAProgramUnit::insert_phi_stmt(), main(), and move_block_before(). |
|
|
Insert new_stmt after ref_stmt.
... If label statement, insert entry into label database
... WARNING: this is a private member access!
Definition at line 1299 of file StmtList.cc.
References Statement::build_refs(), RefSet< T >::clear(), ENDDO_STMT, List< T >::ins_after(), LABEL_STMT, Statement::modify_succ(), and redundant_flow_ins().
Referenced by add_dummy_eta_assignments_after_loops(), ProgramUnit::create_program_unit(), ins(), ins_first(), SSAProgramUnit::insert_phi_stmt(), main(), modify(), modify_and_grab(), move_saved_vars(), operator=(), and process(). |
| void StmtList::ins_first |
( |
Statement * |
stmt |
) |
[virtual] |
|
| void StmtList::ins_last |
( |
Statement * |
stmt |
) |
[virtual] |
|
| void StmtList::ins |
( |
Statement * |
new_stmt, |
|
|
int |
loc |
|
) |
[virtual] |
|
|
|
Insert a block IF-ELSE-ENDIF around a (possibly empty) set of statements with the conditional expression cond_exp and return the IfStmt.
The THEN block encloses all statements from the statement lexically following ref_stmt to last_of_then_clause (an empty THEN block is inserted if last_of_then_clause == 0 and if ref_stmt == 0 then the THEN block begins with the first statement) The ELSE-ENDIF part of the block encloses all statements from the next of last_of_then_clause (if it exists) to last (an empty ELSE_ENDIF part is inserted if last == 0). - Parameters:
-
| cond_exp |
conditional expr. of if-stmt |
| ref_stmt |
IF after this stmt |
| last_of_then_clause |
ELSE after this stmt |
|
|
|
Same as ins_IF_ELSE_after(), except no ELSE part is inserted.
- Parameters:
-
| cond_exp |
conditional expr of if-stmt |
| ref_stmt |
IF after this stmt |
|
|
|
No additional ENDIF is added.
Add an ELSEIF clause to an IF-STMT and return the ElseIfStmt. If the last_of_then_clause is not used, the ELSEIF block is inserted immediately before the ENDIF of the existing IF block. The last_of_then_clause can be specified to place the ELSEIF around existing code, however it must point to a statement which is not part of the IF structure (i.e., not IMPLIED_GOTO, ENDIF, ELSEIF, etc....). - Parameters:
-
| cond_expr |
conditional expr of elseif-stmt |
| if_stmt |
IF statement to augment |
|
|
|
No additional ENDIF is added.
Add an ELSE clause to an IF-STMT and return the ElseStmt. Inserts an ELSE block immediately before the ENDIF of an existing IF block by default, but last_of_then_clause can be specified as defined above. - Parameters:
-
| if_stmt |
IF statement to augment |
|
|
|
Insert a DO block around a set of statements with the specifications given by index_exp, init_exp, limit_exp and step_exp.
It will enclose all statements from the successor of ref_stmt to last (an empty DO loop is inserted if last == 0). - Parameters:
-
| index_exp |
DO stmt specifications |
| ref_stmt |
DO after this stmt |
|
|
|
Insert a WHILE block around a set of statements with the specifications given by cond_exp.
It will enclose all statements from the successor of ref_stmt to last (an empty DO loop is inserted if last == 0). - Parameters:
-
| cond_exp |
conditional_expression |
| ref_stmt |
WHILE after this stmt |
|
|
|
Insert a DO..ENDDO block around a set of statements with the specifications given by do_stmt(either DoStmt or WhileStmt).
It will enclose all statements from the successor of ref_stmt to last (an empty DO loop is inserted if last == 0). - Parameters:
-
| do_stmt |
conditional_expression |
| ref_stmt |
DO after this stmt |
|
|
|
Insert a BLOCK_ENTRY/EXIT around a set of statements.
It will enclose all statements from the successor of ref_stmt to last (an empty BLOCK is inserted if last == 0). - Parameters:
-
| ref_stmt |
DO after this stmt |
|
|
|
Move all statements from first_stmt to last_stmt, inclusive, to before ref_stmt.
The block must be well formed. As always, if ref_stmt == 0, the block is inserted at the end of the statement list
Definition at line 1946 of file StmtList.cc.
References DONT_RELABEL, grab(), and ins_before(). |
|
|
Move all statements from first_stmt to last_stmt, inclusive, to after ref_stmt (or beginging if !ref).
The block must be well formed. |
|
|
Move statement to before ref_stmt.
The statement may not be DO, ENDDO, IF, ENDIF, or any other type of multi-line control structure statement. |
|
|
Move statement to after ref_stmt.
stmt may not be any type of multi-line control structure statement. |
| void StmtList::del |
( |
Statement & |
s |
) |
[virtual] |
|
|
|
Delete a single statement.
... delete WHILE and matching ENDDO
... delete DO and matching ENDDO
... can not delete an ENDIF_STMT or an IMPLIED_GOTO_STMT by itself ... it must be deleted by removing it's controling statement.
... Delete only the ELSE statement and fix up the links.
... don't need to reset block structure if this was done correctly
... Delete the entire IF-ELSEIF-ELSE-ENDIF and IMPLIED_GOTOs
... Will be set to the final end_if
... Continue following the _follow pointers ... This annoying case statement could be replaced by ... protected virtual follow methods
... end_if is now the ENDIF_STMT
... traverse if structure using if_stmt, deleting all parts ... (including IMPLIED_GOTO stmts).
... part to be deleted
... next part to be deleted
... delete IMPLIED_GOTO
... don't need to reset block structure if this was done correctly
... Fall through into default case
... Don't need to reset block structure
Reimplemented from List< Statement >.
Definition at line 2067 of file StmtList.cc.
References LabelDB::_grab_ref(), Statement::_tag, BLOCK_ENTRY_STMT, BLOCK_EXIT_STMT, Iterator< T >::current(), List< T >::del(), Dictionary< T >::del(), Statement::del_flow(), DO_STMT, ELSE_STMT, ELSEIF_STMT, ENDDO_STMT, ENDIF_STMT, Statement::follow_ref(), IF_STMT, IMPLIED_GOTO_STMT, RefSet< T >::ins(), LABEL_STMT, Statement::next_ref(), Statement::pred(), Listable::prev_ref(), Statement::prev_ref(), Statement::stmt_class(), RefSet< T >::valid(), Iterator< T >::valid(), and WHILE_STMT.
Referenced by SSAProgramUnit::convert_to_standard(), del(), modify(), remove_dummy_assignments(), split_multiple_entries(), and TranslateObject::translate_GSA_symbol_refs(). |
|
|
Delete a set of statements.
... Deleting this statement will also delete its _follow, ... so mark that statement as already deleted.
... It's hard to tell if we have already deleted this because ... of another deletion, so we will be careful.
... Don't do anything yet. We will take care of LABEL stmts ... in a second pass.
... A single statement so go ahead and delete it.
... After all of the GOTO's have been removed we can safely remove the ... LABELS which were the targets of the GOTO's
Definition at line 1986 of file StmtList.cc.
References LabelDB::_grab_ref(), BLOCK_ENTRY_STMT, BLOCK_EXIT_STMT, Iterator< T >::current(), Iterator< T >::current_valid(), del(), DO_STMT, ELSE_STMT, ELSEIF_STMT, ENDDO_STMT, ENDIF_STMT, Listable::fingerprint_ok(), Statement::follow_ref(), IF_STMT, IMPLIED_GOTO_STMT, LABEL_STMT, labels(), Iterator< T >::reset(), Statement::stmt_class(), Iterator< T >::valid(), Statement::value(), and WHILE_STMT. |
|
|
Delete the block delimited by first_stmt and last_stmt.
... check if block is well-formed
Definition at line 2307 of file StmtList.cc.
References LabelDB::_grab_ref(), Statement::_tag, Iterator< T >::current(), Iterator< T >::current_valid(), List< T >::del(), Dictionary< T >::del(), RefSet< T >::del(), Statement::del_flow(), Statement::fix_flow(), RefSet< T >::ins(), iterator(), LABEL_STMT, RefSet< T >::member(), Statement::stmt_class(), Iterator< T >::valid(), and Statement::value(). |
| void StmtList::clear |
( |
|
) |
[virtual] |
|
|
|
Return a copied list of statements between first_stmt and last_stmt, inclusive.
All labels within the block are renumbered and, for all GOTO_type statements within the block, any targets which refer to labels within the block are changed to the new labels. |
|
|
Remove and return the statements between first_stmt and last_stmt, inclusive.
All labels within the block are renumbered and, for all GOTO_type statements within the block, any targets which refer to labels within the block are changed to the new labels. The removed block must be well-formed.
Referenced by grab(), modify_and_grab(), and move_block_before(). |
| Statement * StmtList::grab |
( |
int |
loc |
) |
[virtual] |
|
| void StmtList::modify |
( |
int |
loc, |
|
|
Statement * |
replacement |
|
) |
[virtual] |
|
| int StmtList::number_of_stmts_in_DO |
( |
Statement & |
st |
) |
|
|
|
|
Returns the number of statements in the loop, excluding ENDDO, BLOCK_ENTRY, BLOCK_EXIT, FLOW_ENTRY, FLOW_EXIT, ENDIF, IMPLIED_GOTO, and LABEL stmts.
... Count the DO headers, but not the END_DOs
Definition at line 2945 of file StmtList.cc.
References BLOCK_ENTRY_STMT, BLOCK_EXIT_STMT, DO_STMT, ELSE_STMT, ENDDO_STMT, ENDIF_STMT, ENTRY_STMT, FLOW_ENTRY_STMT, FLOW_EXIT_STMT, IMPLIED_GOTO_STMT, iterate_loop_body(), LABEL_STMT, and Iterator< T >::valid(). |
|
|
Return a list of all statements of any of the given types (up to five types may be specified for this method) The list will be in textual order of statements.
|
|
|
Return an iterator for first_stmt to last_stmt, inclusive.
Definition at line 3009 of file StmtList.cc.
Referenced by _find_call_sites(), _ipcp_build_jump_functions(), _ipcp_propagate_constants(), DDgraphTester::add(), DDgraphTester::add_dditerator(), add_dummy_eta_assignments_after_loops(), ProgramUnit::clean_workspace(), Program::compute_call_lists(), SSAProgramUnit::convert_to_SSA(), SSAProgramUnit::convert_to_standard(), generate_maymods(), main(), remove_maymod_assertions(), DDgraphTester::show_arcs(), split_multiple_entries(), SSAFullRangeDict::touch(), GSAFullRangeDict::touch(), TranslateObject::translate_GSA_symbol_refs(), and InlineObject::translate_symbol_refs(). |
|
|
Return an iterator for the entire StmtList.
Definition at line 600 of file StmtList.h.
References List< Statement >::first_ref(), and List< Statement >::last_ref().
Referenced by build_all_refs(), create_assertions(), create_directives(), create_flow_graph(), del(), delete_flow_graph(), display(), exchange_convert(), remove_directives(), and split_elseif(). |
| const LabelDB & StmtList::labels |
( |
|
) |
const [inline] |
|
| LabelDB & StmtList::labels |
( |
|
) |
[inline] |
|
|
|
Return a reference to the label database.
Definition at line 612 of file StmtList.h. |
| void StmtList::relabel |
( |
const int |
value, |
|
|
const int |
new_value |
|
) |
|
|
|
|
Change the label of statement within the StmtList from value to new_value.
Find existing label statement in data base
WARNING: this is a private member access!
Insert new label into database (failing if it is a duplicate)
Definition at line 3211 of file StmtList.cc.
References LabelDB::_grab_ref(), and LabelStmt::_value. |
| char * StmtList::new_tag |
( |
|
) |
|
|
| void StmtList::retag |
( |
const char * |
old_tag, |
|
|
const char * |
new_tag |
|
) |
|
|
| int StmtList::new_label |
( |
int |
target = 0 |
) |
const |
|
|
|
Return a new value for a LABEL statement.
|
| void StmtList::split_elseif |
( |
Statement & |
s |
) |
|
|
|
|
Change the program from ELSEIF to ELSE;IF.
... What is the outermost ENDIF at the end of this block.
... What is the outmost IF at the begining of this block.
... What is the IF compoment immediately prior to the ELSEIF.
... do not delete predecessor
Definition at line 3331 of file StmtList.cc.
References ImpliedGotoStmt::_follow, ElseStmt::_follow, IfStmt::_follow, Statement::_tag, IfStmt::build_refs(), RefSet< T >::clear(), Iterator< T >::current(), List< T >::del(), Dictionary< T >::del(), ELSEIF_STMT, ENDIF_STMT, IfStmt::expr(), Statement::fix_flow(), Statement::follow_ref(), IF_STMT, Dictionary< T >::ins(), List< T >::ins_after(), List< T >::ins_before(), iterator(), Statement::lead_ref(), Statement::matching_if_ref(), Statement::modify_pred(), Statement::modify_succ(), new_tag(), Statement::prev_ref(), Iterator< T >::reset(), Statement::stmt_class(), and Iterator< T >::valid(). |
| void StmtList::build_all_refs |
( |
|
) |
|
|
| void StmtList::create_directives |
( |
|
) |
|
|
| void StmtList::remove_directives |
( |
|
) |
|
|
| void StmtList::create_assertions |
( |
|
) |
|
|
|
|
Remove all pre- & post- directives and create Directive statements.
Definition at line 3296 of file StmtList.cc.
References List< T >::clear(), Iterator< T >::current(), List< T >::entries(), List< Statement >::first_ref(), iterator(), List< Statement >::last_ref(), Statement::next_ref(), parse_directives(), Statement::post_directives(), Statement::pre_directives(), Statement::prev_ref(), and Iterator< T >::valid().
Referenced by Program::read(). |
| void StmtList::create_flow_graph |
( |
|
) |
|
|
| void StmtList::delete_flow_graph |
( |
|
) |
|
|
| void StmtList::exchange_convert |
( |
VDL & |
vdl |
) |
|
|
|
|
Convert the Statement list into the exchange format.
Definition at line 3396 of file StmtList.cc.
References Iterator< T >::current(), Statement::exchange_convert(), List< Statement >::first_ref(), Set< T >::ins(), List< T >::ins_last(), iterator(), List< Statement >::last_ref(), BinRep::put_set(), BinRep::put_string(), BinRep::put_tuple(), BinRep::to_set(), and Iterator< T >::valid().
Referenced by ProgramUnit::exchange(). |
| void StmtList::display |
( |
ostream & |
o |
) |
const |
|
| void StmtList::write |
( |
ostream & |
o |
) |
const |
|
| void StmtList::print |
( |
ostream & |
o |
) |
const [virtual] |
|
| int StmtList::structures_OK |
( |
|
) |
const [virtual] |
|
Friends And Related Function Documentation
The documentation for this class was generated from the following files:
|