PandA-2024.02
|
This struct specifies the field bloc (basic block). More...
#include <tree_basic_block.hpp>
Public Types | |
enum | { GETID =(list_of_phi) = 0 } |
visitor enum More... | |
Public Member Functions | |
bloc (unsigned int _number) | |
constructor More... | |
virtual | ~bloc () |
Destructor. More... | |
void | add_pred (const unsigned int &a) |
Add a value to list of pred. More... | |
void | add_succ (const unsigned int &a) |
Add a value to list of succ. More... | |
void | AddPhi (const tree_nodeRef phi) |
Add a value to list of phi node. More... | |
void | PushFront (const tree_nodeRef statement, const application_managerRef AppM) |
Add a statement in front of list of statements. More... | |
void | PushBack (const tree_nodeRef statement, const application_managerRef AppM) |
Add a statement as last non controlling statement. More... | |
void | Replace (const tree_nodeRef old_stmt, const tree_nodeRef new_stmt, const bool move_virtuals, const application_managerRef AppM) |
Replace a statement with another one. More... | |
void | PushBefore (const tree_nodeRef new_stmt, const tree_nodeRef existing_stmt, const application_managerRef AppM) |
Add a statement before a specified one. More... | |
void | PushAfter (const tree_nodeRef new_stmt, const tree_nodeRef existing_stmt, const application_managerRef AppM) |
Add a statement after a specified one. More... | |
void | ReorderLUTs () |
ReorderLUTs reorders the LUT statements to fix the def-use relations. More... | |
void | RemoveStmt (const tree_nodeRef statement, const application_managerRef AppM) |
Remove a statement. More... | |
void | RemovePhi (const tree_nodeRef phi) |
Remove a phi. More... | |
void | SetSSAUsesComputed () |
Set that uses of ssa have been computed. More... | |
const std::list< tree_nodeRef > & | CGetPhiList () const |
Return the list of phi. More... | |
const std::list< tree_nodeRef > & | CGetStmtList () const |
Return the list of stmt. More... | |
size_t | CGetNumberRemovedPhi () const |
Return the number of removed phi. More... | |
virtual void | visit (tree_node_visitor *const v) const |
virtual function used to traverse the tree_node data structure. More... | |
Data Fields | |
std::vector< unsigned int > | list_of_pred |
list_of_pred is the list of predecessors. More... | |
std::vector< unsigned int > | list_of_succ |
list_of_succ is the list of successors. More... | |
const unsigned int | number |
number is the index of the basic block. More... | |
unsigned int | loop_id |
loop identifier coming from GCC More... | |
CustomOrderedSet< unsigned int > | live_in |
Live_In of the basic block. More... | |
CustomOrderedSet< unsigned int > | live_out |
Live_Out of the basic block. More... | |
unsigned int | hpl |
store the relation between the phi defs inserted in the live_out set and phi uses More... | |
unsigned int | true_edge |
in case the last statement is a gimple_cond associated with an if statement this member contains the basic block reference to the then statements. More... | |
unsigned int | false_edge |
in case the last statement is a gimple_cond associated with an if statement this member contains the basic block reference to the else statements. More... | |
ScheduleRef | schedule |
The reference to the schedule. More... | |
Static Public Attributes | |
static const unsigned int | ENTRY_BLOCK_ID = BB_ENTRY |
constant identifying the entry basic block More... | |
static const unsigned int | EXIT_BLOCK_ID = BB_EXIT |
constant identifying the exit basic block More... | |
Private Member Functions | |
void | update_new_stmt (const application_managerRef &AppM, const tree_nodeRef &new_stmt) |
void | manageCallGraph (const application_managerRef &AppM, const tree_nodeRef &statement) |
bool | check_function_call (const tree_nodeRef &statement, gimple_assign *ga, unsigned int &called_function_id) |
Private Attributes | |
CustomUnorderedSet< unsigned int > | already_visited |
Already visited tree node (used to avoid infinite recursion) More... | |
std::list< tree_nodeRef > | list_of_phi |
list_of_phi is a list of eventual phi node presents in the basic block. More... | |
std::list< tree_nodeRef > | list_of_stmt |
list_of_stmt is the list of statements stored in the basic block. More... | |
size_t | removed_phi |
Number of removed phi. More... | |
bool | updated_ssa_uses |
consistency of ssa uses More... | |
Friends | |
class | use_counting |
This struct specifies the field bloc (basic block).
The tree walker structure of this node is: #(TOK_BLOC TOK_NUMBER (pred)+ (succ)+ (phi)* (stmt)*)
Definition at line 84 of file tree_basic_block.hpp.
anonymous enum |
|
explicit |
constructor
Definition at line 62 of file tree_basic_block.cpp.
References ~bloc().
|
virtualdefault |
|
inline |
Add a value to list of pred.
a | is a pred. |
Definition at line 158 of file tree_basic_block.hpp.
|
inline |
Add a value to list of succ.
a | is a succ. |
Definition at line 167 of file tree_basic_block.hpp.
References AddPhi(), FrontendFlowStep::AppM, CGetNumberRemovedPhi(), CGetPhiList(), CGetStmtList(), phi, PushAfter(), PushBack(), PushBefore(), PushFront(), RemovePhi(), RemoveStmt(), ReorderLUTs(), Replace(), and SetSSAUsesComputed().
void bloc::AddPhi | ( | const tree_nodeRef | phi | ) |
Add a value to list of phi node.
a | is a NODE_ID. |
Definition at line 500 of file tree_basic_block.cpp.
References list_of_phi, and update_new_stmt().
Referenced by add_succ().
size_t bloc::CGetNumberRemovedPhi | ( | ) | const |
Return the number of removed phi.
Definition at line 536 of file tree_basic_block.cpp.
References removed_phi.
Referenced by add_succ().
const std::list< tree_nodeRef > & bloc::CGetPhiList | ( | ) | const |
Return the list of phi.
Definition at line 495 of file tree_basic_block.cpp.
References list_of_phi.
Referenced by add_succ(), and raw_writer::write_when_not_null_point_to().
const std::list< tree_nodeRef > & bloc::CGetStmtList | ( | ) | const |
Return the list of stmt.
Definition at line 282 of file tree_basic_block.cpp.
References list_of_stmt.
Referenced by add_succ(), and raw_writer::write_when_not_null_point_to().
|
private |
Definition at line 78 of file tree_basic_block.cpp.
References GET_CONST_NODE, GET_INDEX_CONST_NODE, GET_INDEX_NODE, GET_NODE, and gimple_assign::op1.
Referenced by manageCallGraph(), and RemoveStmt().
|
private |
Definition at line 199 of file tree_basic_block.cpp.
References CallGraphManager::addCallPointAndExpand(), already_visited, check_function_call(), FunctionEdgeInfo::direct_call, GET_INDEX_CONST_NODE, GET_INDEX_NODE, GET_NODE, THROW_ASSERT, and tree_node::ToString().
Referenced by update_new_stmt().
void bloc::PushAfter | ( | const tree_nodeRef | new_stmt, |
const tree_nodeRef | existing_stmt, | ||
const application_managerRef | AppM | ||
) |
Add a statement after a specified one.
new_stmt | is the statement to be added |
existing_stmt | is the statement after which new_stmt has to be added |
Definition at line 306 of file tree_basic_block.cpp.
References ENTRY_BLOCK_ID, GET_NODE, tree_node::index, list_of_stmt, number, THROW_ASSERT, tree_node::ToString(), and update_new_stmt().
Referenced by add_succ().
void bloc::PushBack | ( | const tree_nodeRef | statement, |
const application_managerRef | AppM | ||
) |
Add a statement as last non controlling statement.
statement | is the statement to be added |
Definition at line 340 of file tree_basic_block.cpp.
References GET_NODE, tree_helper::LastStatement(), list_of_stmt, number, THROW_ASSERT, tree_node::ToString(), and update_new_stmt().
Referenced by add_succ(), and Replace().
void bloc::PushBefore | ( | const tree_nodeRef | new_stmt, |
const tree_nodeRef | existing_stmt, | ||
const application_managerRef | AppM | ||
) |
Add a statement before a specified one.
new_stmt | is the statement to be added |
existing_stmt | is the statement before which new_stmt has to be added |
Definition at line 287 of file tree_basic_block.cpp.
References ENTRY_BLOCK_ID, GET_NODE, tree_node::index, list_of_stmt, number, STR, THROW_ASSERT, tree_node::ToString(), and update_new_stmt().
Referenced by add_succ(), and Replace().
void bloc::PushFront | ( | const tree_nodeRef | statement, |
const application_managerRef | AppM | ||
) |
Add a statement in front of list of statements.
statement | is the statement to be added |
Definition at line 325 of file tree_basic_block.cpp.
References GET_NODE, list_of_stmt, THROW_ASSERT, tree_node::ToString(), and update_new_stmt().
Referenced by add_succ().
void bloc::RemovePhi | ( | const tree_nodeRef | phi | ) |
Remove a phi.
phi | is the phi to be removed |
Definition at line 506 of file tree_basic_block.cpp.
References tree_helper::ComputeSsaUses(), counter, GET_NODE, tree_node::index, list_of_phi, removed_phi, THROW_ASSERT, tree_node::ToString(), and updated_ssa_uses.
Referenced by add_succ().
void bloc::RemoveStmt | ( | const tree_nodeRef | statement, |
const application_managerRef | AppM | ||
) |
Remove a statement.
statement | is the statement to be removed |
Definition at line 424 of file tree_basic_block.cpp.
References BUILTIN_WAIT_CALL, check_function_call(), tree_helper::ComputeSsaUses(), counter, GET_INDEX_NODE, GET_NODE, tree_node::index, list_of_stmt, number, tree_helper::print_function_name(), STR, THROW_ASSERT, tree_node::ToString(), and updated_ssa_uses.
Referenced by add_succ(), and Replace().
void bloc::ReorderLUTs | ( | ) |
ReorderLUTs reorders the LUT statements to fix the def-use relations.
add back
Definition at line 110 of file tree_basic_block.cpp.
References tree_helper::ComputeSsaUses(), GET_NODE, list_of_phi, list_of_stmt, number, phi, schedule, and Schedule::UpdateTime().
Referenced by add_succ().
void bloc::Replace | ( | const tree_nodeRef | old_stmt, |
const tree_nodeRef | new_stmt, | ||
const bool | move_virtuals, | ||
const application_managerRef | AppM | ||
) |
Replace a statement with another one.
old_stmt | is the old statement to be removed |
new_stmt | is the new statement to be added |
move_virtuals | specifies if memdef and vdef have to be transferred |
Definition at line 364 of file tree_basic_block.cpp.
References GET_NODE, tree_node::index, list_of_stmt, PushBack(), PushBefore(), RemoveStmt(), STR, and THROW_ASSERT.
Referenced by add_succ().
void bloc::SetSSAUsesComputed | ( | ) |
Set that uses of ssa have been computed.
Definition at line 541 of file tree_basic_block.cpp.
References THROW_ASSERT, and updated_ssa_uses.
Referenced by add_succ().
|
private |
This check is necessary since during parsing of statement list statement has not yet been filled
Definition at line 222 of file tree_basic_block.cpp.
References tree_helper::ComputeSsaUses(), counter, GET_NODE, tree_node::index, manageCallGraph(), number, schedule, THROW_ASSERT, updated_ssa_uses, and Schedule::UpdateTime().
Referenced by AddPhi(), PushAfter(), PushBack(), PushBefore(), and PushFront().
|
virtual |
virtual function used to traverse the tree_node data structure.
v | is a reference to the tree_node visitor class |
live in and out not visited by design
Definition at line 69 of file tree_basic_block.cpp.
References ALL_VISIT, list_of_phi, list_of_stmt, and SEQ_VISIT_MEMBER.
|
friend |
Definition at line 87 of file tree_basic_block.hpp.
|
private |
Already visited tree node (used to avoid infinite recursion)
Definition at line 90 of file tree_basic_block.hpp.
Referenced by manageCallGraph().
|
static |
constant identifying the entry basic block
Definition at line 250 of file tree_basic_block.hpp.
Referenced by short_circuit_taf::check_merging_candidate(), convertUsesToDFSOrdered(), FunctionCallOpt::detect_loops(), OrderedInstructions::dominates(), PhiOpt::IdentifyPattern(), Bit_Value::Initialize(), tree_manipulation::InlineFunctionCall(), BasicBlocksCfgComputation::InternalExec(), remove_clobber_ga::InternalExec(), eSSA::InternalExec(), simple_code_motion::InternalExec(), short_circuit_taf::InternalExec(), dead_code_elimination::InternalExec(), CSE::InternalExec(), multi_way_if::InternalExec(), PhiOpt::InternalExec(), soft_float_cg_ext::InternalExec(), tree_helper::is_a_nop_function_decl(), rebuild_initialization2::look_for_ROMs(), PushAfter(), PushBefore(), tree_node_dup::tree_node_dup(), virtual_phi_nodes_split::virtual_split_phi(), raw_writer::write_when_not_null_point_to(), and FunctionFrontendFlowStep::WriteBBGraphDot().
|
static |
constant identifying the exit basic block
Definition at line 253 of file tree_basic_block.hpp.
Referenced by PhiOpt::ChainOptimization(), FunctionCallOpt::detect_loops(), evaluateBranch(), PhiOpt::IdentifyPattern(), Bit_Value::Initialize(), tree_manipulation::InlineFunctionCall(), BasicBlocksCfgComputation::InternalExec(), remove_clobber_ga::InternalExec(), eSSA::InternalExec(), RemoveEndingIf::InternalExec(), simple_code_motion::InternalExec(), short_circuit_taf::InternalExec(), dead_code_elimination::InternalExec(), CSE::InternalExec(), multi_way_if::InternalExec(), operations_cfg_computation::InternalExec(), PhiOpt::InternalExec(), tree_helper::is_a_nop_function_decl(), rebuild_initialization2::look_for_ROMs(), tree_node_dup::tree_node_dup(), raw_writer::write_when_not_null_point_to(), FunctionFrontendFlowStep::WriteBBGraphDot(), EdgeCWriter::writeRoutineInstructions(), and CWriter::writeRoutineInstructions().
unsigned int bloc::false_edge |
in case the last statement is a gimple_cond associated with an if statement this member contains the basic block reference to the else statements.
Definition at line 139 of file tree_basic_block.hpp.
Referenced by raw_writer::write_when_not_null_point_to().
unsigned int bloc::hpl |
store the relation between the phi defs inserted in the live_out set and phi uses
flag for header of reducible parallelizable loop
Definition at line 131 of file tree_basic_block.hpp.
Referenced by raw_writer::write_when_not_null_point_to().
|
private |
list_of_phi is a list of eventual phi node presents in the basic block.
Definition at line 93 of file tree_basic_block.hpp.
Referenced by AddPhi(), CGetPhiList(), RemovePhi(), ReorderLUTs(), and visit().
std::vector<unsigned int> bloc::list_of_pred |
list_of_pred is the list of predecessors.
Definition at line 110 of file tree_basic_block.hpp.
Referenced by raw_writer::write_when_not_null_point_to().
|
private |
list_of_stmt is the list of statements stored in the basic block.
Definition at line 96 of file tree_basic_block.hpp.
Referenced by CGetStmtList(), PushAfter(), PushBack(), PushBefore(), PushFront(), RemoveStmt(), ReorderLUTs(), Replace(), and visit().
std::vector<unsigned int> bloc::list_of_succ |
list_of_succ is the list of successors.
Definition at line 113 of file tree_basic_block.hpp.
Referenced by raw_writer::write_when_not_null_point_to().
CustomOrderedSet<unsigned int> bloc::live_in |
Live_In of the basic block.
Definition at line 122 of file tree_basic_block.hpp.
CustomOrderedSet<unsigned int> bloc::live_out |
Live_Out of the basic block.
Definition at line 125 of file tree_basic_block.hpp.
unsigned int bloc::loop_id |
loop identifier coming from GCC
Definition at line 119 of file tree_basic_block.hpp.
Referenced by raw_writer::write_when_not_null_point_to().
const unsigned int bloc::number |
number is the index of the basic block.
Definition at line 116 of file tree_basic_block.hpp.
Referenced by PushAfter(), PushBack(), PushBefore(), RemoveStmt(), ReorderLUTs(), update_new_stmt(), and raw_writer::write_when_not_null_point_to().
|
private |
Number of removed phi.
Definition at line 99 of file tree_basic_block.hpp.
Referenced by CGetNumberRemovedPhi(), and RemovePhi().
ScheduleRef bloc::schedule |
The reference to the schedule.
Definition at line 142 of file tree_basic_block.hpp.
Referenced by ReorderLUTs(), and update_new_stmt().
unsigned int bloc::true_edge |
in case the last statement is a gimple_cond associated with an if statement this member contains the basic block reference to the then statements.
Definition at line 135 of file tree_basic_block.hpp.
Referenced by raw_writer::write_when_not_null_point_to().
|
private |
consistency of ssa uses
Definition at line 102 of file tree_basic_block.hpp.
Referenced by RemovePhi(), RemoveStmt(), SetSSAUsesComputed(), and update_new_stmt().