PandA-2024.02
|
This class manages the tree structures extracted from the raw file. More...
#include <tree_manager.hpp>
Public Member Functions | |
void | RecursiveReplaceTreeNode (tree_nodeRef &tn, const tree_nodeRef old_node, const tree_nodeRef &new_node, const tree_nodeRef &stmt, bool definition) |
Replace the occurrences of tree node old_node with new_node in statement identified by tn. More... | |
tree_manager (const ParameterConstRef &Param) | |
This is the constructor of the tree_manager which initializes the vector of functions. More... | |
~tree_manager () | |
unsigned int | get_implementation_node (unsigned int decl_node) const |
Return the index of function_decl node that implements the declaration node. More... | |
void | AddTreeNode (const unsigned int i, const tree_nodeRef &curr) |
Add to the tree manager the current node. More... | |
tree_nodeRef | GetTreeReindex (const unsigned int i) |
Return a tree_reindex wrapping the i-th tree_node. More... | |
const tree_nodeRef | CGetTreeReindex (const unsigned int i) const |
Return a tree_reindex wrapping the i-th tree_node. More... | |
tree_nodeRef | GetTreeNode (const unsigned int index) const |
Return the index-th tree_node (modifiable version) More... | |
const tree_nodeRef | get_tree_node_const (unsigned int i) const |
Return the reference to the i-th tree_node Constant version of get_tree_node. More... | |
const tree_nodeConstRef | CGetTreeNode (const unsigned int i) const |
bool | is_tree_node (unsigned int i) const |
Return true if there exists a tree node associated with the given id, false otherwise. More... | |
void | create_tree_node (const unsigned int node_id, enum kind tree_node_type, std::map< TreeVocabularyTokenTypes_TokenEnum, std::string > &tree_node_schema) |
Factory method. More... | |
unsigned int | find (enum kind tree_node_type, const std::map< TreeVocabularyTokenTypes_TokenEnum, std::string > &tree_node_schema) |
if there exist return the node id of a tree node compatible with the tree_node_schema and of type tree_node_type. More... | |
unsigned int | new_tree_node_id (const unsigned int ask=0) |
Return a new node id in the intermediate representation. More... | |
unsigned int | get_next_available_tree_node_id () const |
return the next available tree node id. More... | |
void | add_function (unsigned int index, tree_nodeRef curr) |
Add to the function_decl_nodes the current node. More... | |
unsigned long | get_function_decl_node_n () const |
Return the number of function_decl_node. More... | |
const CustomUnorderedSet< unsigned int > | GetAllFunctions () const |
Returns all the functions in the tree_manager. More... | |
unsigned int | find_sc_main_node () const |
Determine the index node of "sc_main" function in tree_node vector. More... | |
unsigned int | function_index (const std::string &function_name) const |
Return the index of a function given its name. More... | |
tree_nodeRef | GetFunction (const std::string &function_name) const |
Return the index of a function given its name. More... | |
unsigned int | function_index_mngl (const std::string &function_name) const |
Return the index of a function given its mangled name. More... | |
void | print (std::ostream &os) const |
Function that prints the class tree_manager. More... | |
void | PrintGimple (std::ostream &os, const bool use_uid) const |
Function that prints the bodies of function in gimple format. More... | |
void | collapse_into (const unsigned int &funID, CustomUnorderedMapUnstable< unsigned int, unsigned int > &stmt_to_bloc, const tree_nodeRef &tn, CustomUnorderedSet< unsigned int > &removed_nodes, const application_managerRef AppM) |
Collapse operations chains into the examinated node. More... | |
void | add_parallel_loop () |
increment the number a parallel loop More... | |
unsigned int | get_n_pl () const |
return the number of parallel loops More... | |
void | merge_tree_managers (const tree_managerRef &source_tree_manager) |
merge two tree manager: this with TM_source More... | |
void | add_goto () |
Increment the number of added gotos. More... | |
unsigned int | get_added_goto () const |
Return the number of added gotos. More... | |
void | increment_removed_pointer_plus () |
Increment the number of removed pointer plus. More... | |
unsigned int | get_removed_pointer_plus () const |
Return the number of removed pointer plus. More... | |
void | increment_removable_pointer_plus () |
Increment the number of removable pointer plus. More... | |
unsigned int | get_removable_pointer_plus () const |
Return the number of not removed pointer plus. More... | |
void | increment_unremoved_pointer_plus () |
Increment the number of not removed pointer plus. More... | |
unsigned int | get_unremoved_pointer_plus () const |
Return the number of not removed pointer plus. More... | |
unsigned int | find_identifier_nodeID (const std::string &str) const |
Return the nodeID of the identifier_node representing string str. More... | |
void | add_identifier_node (unsigned int nodeID, const std::string &str) |
Add an identifier_node to the corresponding unique table. More... | |
void | add_identifier_node (unsigned int nodeID, const bool &op) |
unsigned int | get_next_vers () |
Return the next unused version number for ssa variables. More... | |
void | ReplaceTreeNode (const tree_nodeRef &stmt, const tree_nodeRef &old_node, const tree_nodeRef &new_node) |
Replace the occurrences of tree node old_node with new_node in statement identified by tn. More... | |
tree_nodeRef | CreateUniqueIntegerCst (integer_cst_t value, const tree_nodeConstRef &type) |
memoization of integer constants More... | |
tree_nodeRef | CreateUniqueRealCst (long double value, const tree_nodeConstRef &type) |
memoization of integer constants More... | |
bool | is_CPP () const |
is_CPP return true in case we have at least one CPP source code More... | |
bool | is_top_function (const function_decl *fd) const |
is_top_function checks if a function is one of the application top functions. More... | |
bool | check_ssa_uses (unsigned int fun_id) const |
check_ssa_uses check if the uses of a ssa are correct More... | |
Private Member Functions | |
bool | check_for_decl (const tree_nodeRef &tn, const tree_managerRef &TM, std::string &symbol_name, std::string &symbol_scope, unsigned int node_id, const CustomUnorderedMap< unsigned int, std::string > &global_type_unql_symbol_table) |
check for decl_node and return true if not suitable for symbol table or otherwise its symbol_name and symbol_scope. More... | |
bool | check_for_type (const tree_nodeRef &tn, const tree_managerRef &TM, std::string &symbol_name, std::string &symbol_scope, const CustomUnorderedMapUnstable< std::string, unsigned int > &global_type_symbol_table, unsigned int node_id) |
check for type and return true if not suitable for symbol table or otherwise its symbol_name and symbol_scope. More... | |
void | erase_usage_info (const tree_nodeRef &tn, const tree_nodeRef &stmt) |
Erase the information about variable usage (remove stmt from use_stmts attribute) in ssa variables recursively contained in node tn. More... | |
void | insert_usage_info (const tree_nodeRef &tn, const tree_nodeRef &stmt) |
Insert the information about variable usage (insert stmt in use_stmts attribute) in ssa variables recursively contained in node tn. More... | |
tree_nodeRef | create_unique_const (const std::string &val, const tree_nodeConstRef &type) |
Private Attributes | |
CustomUnorderedMapUnstable< std::string, unsigned int > | find_cache |
cache for tree_manager::find More... | |
OrderedMapStd< unsigned int, tree_nodeRef > | tree_nodes |
Variable containing set of tree_nodes. More... | |
std::map< unsigned int, tree_nodeRef > | function_decl_nodes |
Variable containing set of function_declaration with their index node. More... | |
std::deque< tree_nodeRef > | stack |
list of examining statements during collapse_into recursion More... | |
CustomUnorderedSet< tree_nodeRef > | already_visited |
set of already examined addr_expr used to avoid circular recursion More... | |
unsigned int | n_pl |
the number of parallel loops More... | |
unsigned int | added_goto |
the number of added goto More... | |
unsigned int | removed_pointer_plus |
the number of removed pointer_plus More... | |
unsigned int | removable_pointer_plus |
the number of removable pointer_plus More... | |
unsigned int | unremoved_pointer_plus |
the number of unremoved pointer_plus More... | |
int | debug_level |
The debug level. More... | |
unsigned int | last_node_id |
last node_id used More... | |
CustomUnorderedMapUnstable< std::string, unsigned int > | identifiers_unique_table |
this table stores all identifier_nodes with their nodeID. More... | |
CustomUnorderedMap< std::pair< std::string, unsigned int >, tree_nodeRef > | unique_cst_map |
const ParameterConstRef | Param |
Set of parameters. More... | |
CustomUnorderedMap< ssa_name *, tree_nodeRef > | uses_erase_temp |
Map containing temporary information for ssa_name uses deletion. More... | |
unsigned int | next_vers |
Next version number for ssa variables. More... | |
unsigned int | collapse_into_counter |
Index of current call of collapse_into_counter. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const tree_manager &s) |
Friend definition of the << operator. More... | |
std::ostream & | operator<< (std::ostream &os, const tree_managerRef &s) |
Friend definition of the << operator. More... | |
This class manages the tree structures extracted from the raw file.
Definition at line 84 of file tree_manager.hpp.
|
explicit |
This is the constructor of the tree_manager which initializes the vector of functions.
Autoheader include.
Param | is the set of input parameters |
Header include Parameter include parser/compiler include Tree include Wrapper include
Definition at line 87 of file tree_manager.cpp.
References ~tree_manager().
|
default |
void tree_manager::add_function | ( | unsigned int | index, |
tree_nodeRef | curr | ||
) |
Add to the function_decl_nodes the current node.
index | is the index of the node |
curr | is the added element |
Definition at line 340 of file tree_manager.cpp.
References function_decl_nodes, and index.
Referenced by tree_manipulation::create_function_decl().
void tree_manager::add_goto | ( | ) |
Increment the number of added gotos.
Definition at line 2740 of file tree_manager.cpp.
References added_goto.
Referenced by tree_manipulation::create_goto().
|
inline |
Add an identifier_node to the corresponding unique table.
nodeID | is the node id. |
str | is the string. |
Definition at line 457 of file tree_manager.hpp.
References check_ssa_uses(), CreateUniqueIntegerCst(), CreateUniqueRealCst(), get_next_vers(), is_CPP(), is_top_function(), ReplaceTreeNode(), str, test_panda::type, and symmetry::value.
Referenced by find_identifier_nodeID(), and handler::visit().
void tree_manager::add_identifier_node | ( | unsigned int | nodeID, |
const bool & | op | ||
) |
void tree_manager::add_parallel_loop | ( | ) |
increment the number a parallel loop
Definition at line 1808 of file tree_manager.cpp.
References n_pl.
void tree_manager::AddTreeNode | ( | const unsigned int | i, |
const tree_nodeRef & | curr | ||
) |
Add to the tree manager the current node.
i | position in the tree_vector. Note that the raw file start from 1 |
curr | is the added element |
Definition at line 118 of file tree_manager.cpp.
References last_node_id, STR, THROW_ASSERT, and tree_nodes.
Referenced by tree_node_factory::create_tree_node().
const tree_nodeConstRef tree_manager::CGetTreeNode | ( | const unsigned int | i | ) | const |
Definition at line 162 of file tree_manager.cpp.
References last_node_id, STR, THROW_ASSERT, and tree_nodes.
Referenced by memory::add_internal_symbol(), CallGraphManager::AddCallPoint(), CallGraphManager::AddFunctionAndCallPoint(), mux_connection_binding::address_precision(), AllocationInformation::can_implement_set(), Schedule::CanBeMoved(), BehavioralHelper::CanBeMoved(), BehavioralHelper::CanBeSpeculated(), AllocationInformation::CanImplementSetNotEmpty(), CreateAddressTranslation::ComputeAddress(), create_tree_node(), mux_connection_binding::determine_connection(), Schedule::EvaluateCondsMerging(), tree_helper::extract_array_indexes(), AllocationInformation::get_attribute_of_fu_per_op(), Schedule::get_cstep(), Schedule::get_cstep_end(), AllocationInformation::get_cycles(), AllocationInformation::get_execution_time(), AllocationInformation::get_initiation_time(), tree_helper::get_multi_way_if_pos(), BehavioralHelper::get_parameters(), tree_helper::get_pointed_type(), AllocationInformation::get_stage_period(), tree_helper::get_var_alignment(), Schedule::GetEndingTime(), BehavioralHelper::GetMangledFunctionName(), BehavioralHelper::GetParameters(), BehavioralHelper::GetParameterTypes(), AllocationInformation::GetStatementArea(), tree_helper::GetUnqualified(), StorageValueInformation::Initialize(), multi_way_if::Initialize(), MultipleEntryIfReduction::Initialize(), PhiOpt::Initialize(), cdfc_module_binding::initialize_connection_relation(), tree_manipulation::InlineFunctionCall(), SDCCodeMotion::InternalExec(), SwitchFix::InternalExec(), CondExprRestructuring::InternalExec(), MultipleEntryIfReduction::InternalExec(), lut_transformation::InternalExec(), BehavioralHelper::is_a_component_ref(), BehavioralHelper::is_a_constant(), BehavioralHelper::is_a_mem_ref(), BehavioralHelper::is_an_addr_expr(), tree_helper::is_an_addr_expr(), BehavioralHelper::is_an_array_ref(), BehavioralHelper::is_an_indirect_ref(), tree_helper::is_builtin_channel(), tree_helper::is_channel(), tree_helper::is_clock(), BehavioralHelper::is_empty_return(), tree_helper::is_event(), tree_helper::is_in_port(), tree_helper::is_inout_port(), tree_helper::is_module(), AllocationInformation::is_operation_bounded(), AllocationInformation::is_operation_PI_registered(), tree_helper::is_out_port(), tree_helper::is_packed_access(), tree_helper::is_port(), tree_helper::is_SC_BIND_PROXY_NIL(), tree_helper::is_signal(), AllocationInformation::is_vertex_bounded_with(), CallGraphManager::IsCallPoint(), rebuild_initialization2::look_for_ROMs(), AllocationInformation::max_number_of_resources(), AllocationInformation::min_number_of_resources(), Bit_Value_opt::optimize(), BehavioralHelper::print_attributes(), BehavioralHelper::print_forward_declaration(), BehavioralHelper::print_phinode_res(), BehavioralHelper::print_type_declaration(), BehavioralHelper::PrintNode(), BehavioralHelper::PrintVarDeclaration(), BehavioralHelper::PrintVariable(), CallGraphManager::RemoveCallPoint(), ResolvePointerAlias(), dead_code_eliminationIPA::signature_opt(), vcd_trace_head::update(), Schedule::UpdateTime(), BasicBlocksProfilingCWriter::WriteGlobalDeclarations(), HLSCWriter::WriteHeader(), DiscrepancyAnalysisCWriter::writePostInstructionInfo(), and DiscrepancyAnalysisCWriter::writePreInstructionInfo().
const tree_nodeRef tree_manager::CGetTreeReindex | ( | const unsigned int | i | ) | const |
Return a tree_reindex wrapping the i-th tree_node.
i | is the index of the tree_node. |
Definition at line 139 of file tree_manager.cpp.
References last_node_id, STR, THROW_ASSERT, and tree_nodes.
Referenced by mux_connection_binding::add_conversion(), memory::add_internal_symbol(), operations_graph_constructor::AddOperation(), mux_connection_binding::address_precision(), memory::compute_next_base_address(), CreateAddressTranslation::ComputeAddress(), tree_manipulation::CreateAddrExpr(), tree_manipulation::CreateGimpleAssignAddrExpr(), DiscrepancyAnalysisCWriter::DeclareLocalVariables(), CWriter::DeclareLocalVariables(), CWriter::DeclareVariable(), TestbenchGeneration::generate_init_file(), tree_helper::get_array_data_bitsize(), tree_helper::get_array_dimensions(), tree_helper::get_array_num_elements(), tree_helper::get_base_index(), HLS_manager::get_constant_string(), BehavioralHelper::get_definition(), tree_helper::get_field_idx(), tree_helper::get_formal_ith(), memory::get_last_address(), tree_helper::get_parameter_types(), BehavioralHelper::get_pointed_type(), BehavioralHelper::get_size(), tree_helper::get_type_index(), tree_helper::get_type_name(), tree_helper::GetElements(), BehavioralHelper::GetElements(), GetFunction(), BehavioralHelper::GetFunctionReturnType(), AllocationInformation::GetNodeTypePrec(), tree_helper::GetRealType(), compute_implicit_calls::InternalExec(), MultipleEntryIfReduction::InternalExec(), tree_helper::is_a_complex(), tree_helper::is_a_function(), tree_helper::is_a_misaligned_vector(), tree_helper::is_a_pointer(), tree_helper::is_a_struct(), tree_helper::is_a_variable(), tree_helper::is_a_vector(), tree_helper::is_a_void(), tree_helper::is_an_array(), tree_helper::is_an_enum(), tree_helper::is_an_union(), tree_helper::is_bool(), tree_helper::is_builtin_channel(), tree_helper::is_const_type(), tree_helper::is_constant(), tree_helper::is_extern(), tree_helper::is_fully_resolved(), tree_helper::is_function_pointer_type(), tree_helper::is_function_type(), tree_helper::is_int(), BehavioralHelper::is_named_pointer(), tree_helper::is_natural(), tree_helper::is_packed(), tree_helper::is_real(), tree_helper::is_scalar(), tree_helper::is_static(), tree_helper::is_system(), tree_helper::is_unsigned(), tree_helper::is_volatile(), tree_helper::IsAligned(), tree_helper::IsInLibbambu(), BehavioralHelper::IsLoad(), BehavioralHelper::IsLut(), BehavioralHelper::IsStore(), rebuild_initialization2::look_for_ROMs(), tree_helper::name_function(), mux_connection_binding::object_bitsize(), Bit_Value_opt::optimize(), FunctionCallTypeCleanup::ParametersTypeCleanup(), BehavioralHelper::print_type(), tree_helper::print_type(), BehavioralHelper::print_type_declaration(), TestbenchGeneration::print_var_init(), tree_helper::PrintType(), BehavioralHelper::PrintVarDeclaration(), ResolvePointerAlias(), InterfaceInfer::setReadInterface(), InterfaceInfer::setWriteInterface(), CWriter::WriteBuiltinWaitCall(), EdgeCWriter::writeRoutineInstructions_rec(), and CWriter::writeRoutineInstructions_rec().
|
private |
check for decl_node and return true if not suitable for symbol table or otherwise its symbol_name and symbol_scope.
tn | is the tree node to be examinated |
TM | is a refcount to this TODO: could be removed? |
symbol_name | is where symbol name will be stored |
symobl_scope | is where symbol scope will be stored |
node_id | is the index of the tree node |
check for name
check for memory_tag, parm_decl, result_decl
check for scope
declaration with type_node local to a function are not considered
Definition at line 2475 of file tree_manager.cpp.
References function_decl::builtin_flag, debug_level, DEBUG_LEVEL_PARANOIC, FIRST_TOKEN, GET_INDEX_NODE, tree_node::get_kind(), GET_NODE, tree_helper::get_type_name(), srcp::include_name, INDENT_DBG_MEX, decl_node::mngl, decl_node::name, tree_helper::return_qualifier_prefix(), decl_node::scpe, starts_with(), function_decl::static_flag, STR, THROW_ASSERT, and test_panda::type.
Referenced by merge_tree_managers().
|
private |
check for type and return true if not suitable for symbol table or otherwise its symbol_name and symbol_scope.
integer_type and real_type have some duplication
Definition at line 2620 of file tree_manager.cpp.
References debug_level, DEBUG_LEVEL_PARANOIC, FIRST_TOKEN, GET_INDEX_NODE, tree_node::get_kind(), GET_NODE, tree_helper::get_type_name(), PRINT_DBG_MEX, tree_helper::return_qualifier_prefix(), STR, THROW_ASSERT, and test_panda::type.
Referenced by merge_tree_managers().
bool tree_manager::check_ssa_uses | ( | unsigned int | fun_id | ) | const |
check_ssa_uses check if the uses of a ssa are correct
Definition at line 2886 of file tree_manager.cpp.
References tree_helper::ComputeSsaUses(), GET_INDEX_CONST_NODE, tree_node::get_kind(), GET_NODE, get_tree_node_const(), phi, sl, and THROW_ERROR.
Referenced by add_identifier_node().
void tree_manager::collapse_into | ( | const unsigned int & | funID, |
CustomUnorderedMapUnstable< unsigned int, unsigned int > & | stmt_to_bloc, | ||
const tree_nodeRef & | tn, | ||
CustomUnorderedSet< unsigned int > & | removed_nodes, | ||
const application_managerRef | AppM | ||
) |
Collapse operations chains into the examinated node.
funID | is the index of the function |
stmt_to_block | maps each statement to its bloc |
tn | is the top tree node of the tree to be collapsed |
removed_nodes | is the set of nodes removed during collapsing |
If there is a conversion to a not built-in type, type has to be declared; but if no variable survives, type will be not declared by the backend
If there is a conversion to a not built-in type, type has to be declared; but if no variable survives, type will be not declared by the backend
FIXME: If right part is a subtree, it should be completly duplicated; For the moment we just stop the collapsing
Update uses of right operand
Definition at line 401 of file tree_manager.cpp.
References test_panda::arg, test_panda::args, BUILTIN_SRCP, CASE_BINARY_EXPRESSION, CASE_CPP_NODES, CASE_FAKE_NODES, CASE_PRAGMA_NODES, CASE_QUATERNARY_EXPRESSION, CASE_TERNARY_EXPRESSION, CASE_TYPE_NODES, CASE_UNARY_EXPRESSION, collapse_into_counter, create_tree_node(), debug_level, DEBUG_LEVEL_PARANOIC, erase_usage_info(), GET_INDEX_CONST_NODE, GET_INDEX_NODE, tree_node::get_kind(), tree_node::get_kind_text(), get_next_vers(), GET_NODE, get_tree_node_const(), GetTreeReindex(), tree_helper::HasToBeDeclared(), INDENT_DBG_MEX, insert_usage_info(), new_tree_node_id(), Param, PrintGimple(), RecursiveReplaceTreeNode(), sl, STR, THROW_ASSERT, THROW_ERROR, TOK, TOK_OP0, TOK_OP1, TOK_SCPE, TOK_SRCP, TOK_TYPE, TOK_VAR, TOK_VERS, TOK_VOLATILE, top(), and tree_node::ToString().
void tree_manager::create_tree_node | ( | const unsigned int | node_id, |
enum kind | tree_node_type, | ||
std::map< TreeVocabularyTokenTypes_TokenEnum, std::string > & | tree_node_schema | ||
) |
Factory method.
It creates a tree_node of type equal tree_node_type by using a relation (tree_node_schema) between tree node fields and their values.
node_id | is the node id of the created object. |
tree_node_type | is the type of the node added to the tree_manager expressed as a treeVocabularyTokenTypes. |
tree_node_schema | expresses the value of the field of the tree node created. For example the following code: std::map<int, std::string> identifier_schema; int identifier_node_id = TM->get_tree_node_n(); identifier_schema[TOK(TOK_STRG)]= "my_identifier"; TM->create_tree_node(identifier_node_id, TOK(TOK_IDENTIFIER_NODE), identifier_schema); will add an identifier node to the tree_manager TM. |
Definition at line 314 of file tree_manager.cpp.
References CGetTreeNode(), tree_node_factory::create_tree_node(), DEBUG_LEVEL_PARANOIC, GET_FUNCTION_DEBUG_LEVEL, INDENT_DBG_MEX, Param, and STR.
Referenced by dead_code_elimination::add_gimple_nop(), PhiOpt::ApplyIfMerge(), PhiOpt::ApplyIfRemove(), PhiOpt::ApplyMultiMerge(), PhiOpt::ApplyMultiRemove(), collapse_into(), tree_manipulation::create_binary_operation(), tree_manipulation::create_extract_bit_expr(), tree_manipulation::create_function_decl(), tree_manipulation::create_gimple_call(), tree_manipulation::create_gimple_cond(), tree_manipulation::create_gimple_modify_stmt(), tree_manipulation::create_gimple_return(), tree_manipulation::create_goto(), tree_manipulation::create_identifier_node(), tree_manipulation::create_label(), tree_manipulation::create_lut_expr(), PragmaAnalysis::create_map_pragma(), PragmaAnalysis::create_omp_pragma(), tree_manipulation::create_parm_decl(), tree_manipulation::create_phi_node(), tree_manipulation::create_quaternary_operation(), tree_manipulation::create_result_decl(), tree_manipulation::create_ssa_name(), tree_manipulation::create_ternary_operation(), tree_manipulation::create_translation_unit_decl(), tree_manipulation::create_unary_operation(), create_unique_const(), tree_manipulation::create_var_decl(), tree_manipulation::CreateAddrExpr(), tree_manipulation::CreateAndExpr(), tree_manipulation::CreateCallExpr(), tree_manipulation::CreateEqExpr(), tree_manipulation::CreateIntegerCst(), tree_manipulation::CreateNopExpr(), tree_manipulation::CreateNotExpr(), tree_manipulation::CreateOrExpr(), tree_manipulation::CreateUnsigned(), tree_manipulation::CreateVectorBooleanType(), PragmaAnalysis::Exec(), tree_manipulation::GetBitsizeType(), tree_manipulation::GetBooleanType(), tree_manipulation::GetCustomIntegerType(), tree_manipulation::GetFunctionType(), tree_manipulation::GetPointerType(), tree_manipulation::GetSignedIntegerType(), tree_manipulation::GetSizeType(), tree_manipulation::GetUnsignedIntegerType(), tree_manipulation::GetUnsignedLongLongType(), tree_manipulation::GetVoidType(), SwitchFix::InternalExec(), rebuild_initialization::InternalExec(), operations_cfg_computation::InternalExec(), dead_code_elimination::kill_uses(), dead_code_elimination::kill_vdef(), rebuild_initialization2::look_for_ROMs(), multi_way_if::MergeCondCond(), multi_way_if::MergeCondMulti(), multi_way_if::MergeMultiCond(), and multi_way_if::MergeMultiMulti().
|
private |
Definition at line 2780 of file tree_manager.cpp.
References create_tree_node(), GetTreeReindex(), tree_node::index, tree_helper::IsRealType(), key, new_tree_node_id(), STR, TOK, TOK_TYPE, TOK_VALR, TOK_VALUE, TOK_VALX, and unique_cst_map.
Referenced by CreateUniqueIntegerCst(), and CreateUniqueRealCst().
tree_nodeRef tree_manager::CreateUniqueIntegerCst | ( | integer_cst_t | value, |
const tree_nodeConstRef & | type | ||
) |
memoization of integer constants
value | is the integer value |
type_index | is the type of the integer constant |
Definition at line 2808 of file tree_manager.cpp.
References create_unique_const(), tree_helper::IsSignedIntegerType(), tree_helper::Size(), STR, and THROW_ASSERT.
Referenced by add_identifier_node(), IR_lowering::array_ref_lowering(), Bit_Value_opt::constrainSSA(), tree_manipulation::CreateAndExpr(), lut_transformation::CreateBitSelectionNodeOrCast(), tree_manipulation::CreateEqExpr(), tree_manipulation::CreateNotExpr(), tree_manipulation::CreateOrExpr(), tree_manipulation::CreateVectorBooleanType(), IR_lowering::division_by_a_constant(), IR_lowering::expand_MC(), IR_lowering::expand_mult_const(), IR_lowering::expand_mult_highpart(), IR_lowering::expand_sdiv_pow2(), IR_lowering::expand_smod_pow2(), tree_manipulation::ExtractCondition(), tree_manipulation::GetBooleanType(), tree_manipulation::GetCustomIntegerType(), tree_manipulation::GetFunctionType(), tree_manipulation::GetPointerType(), tree_manipulation::GetSignedIntegerType(), tree_manipulation::GetSizeType(), tree_manipulation::GetUnsignedIntegerType(), tree_manipulation::GetUnsignedLongLongType(), SwitchFix::InternalExec(), rebuild_initialization::InternalExec(), compute_implicit_calls::InternalExec(), CondExprRestructuring::InternalExec(), IR_lowering::InternalExec(), dead_code_elimination::kill_uses(), rebuild_initialization2::look_for_ROMs(), Bit_Value_opt::optimize(), lut_transformation::ProcessBasicBlock(), compute_implicit_calls::replace_with_memcpy(), compute_implicit_calls::replace_with_memset(), InterfaceInfer::setReadInterface(), and InterfaceInfer::setWriteInterface().
tree_nodeRef tree_manager::CreateUniqueRealCst | ( | long double | value, |
const tree_nodeConstRef & | type | ||
) |
memoization of integer constants
value | is the real value |
type_index | is the type of the real constant |
Definition at line 2823 of file tree_manager.cpp.
References create_unique_const(), test_panda::type, and symmetry::value.
Referenced by add_identifier_node(), dead_code_elimination::kill_uses(), and Bit_Value_opt::optimize().
|
private |
Erase the information about variable usage (remove stmt from use_stmts attribute) in ssa variables recursively contained in node tn.
tn | is the node from which the recursion begin. |
stmt | is the statement that is removed from the usage vector of ssa variables. |
Definition at line 1375 of file tree_manager.cpp.
References test_panda::arg, test_panda::args, CASE_BINARY_EXPRESSION, CASE_CPP_NODES, CASE_FAKE_NODES, CASE_PRAGMA_NODES, CASE_QUATERNARY_EXPRESSION, CASE_TERNARY_EXPRESSION, CASE_TYPE_NODES, CASE_UNARY_EXPRESSION, debug_level, DEBUG_LEVEL_PARANOIC, GET_INDEX_NODE, tree_node::get_kind(), GET_NODE, INDENT_DBG_MEX, STR, THROW_ASSERT, and THROW_ERROR.
Referenced by collapse_into().
unsigned int tree_manager::find | ( | enum kind | tree_node_type, |
const std::map< TreeVocabularyTokenTypes_TokenEnum, std::string > & | tree_node_schema | ||
) |
if there exist return the node id of a tree node compatible with the tree_node_schema and of type tree_node_type.
tree_node_type | is the type of the node added to the tree_manager expressed as a treeVocabularyTokenTypes. |
tree_node_schema | expresses the value of the field of the tree node created. |
check if the corresponding tree node has been already created or not
Definition at line 350 of file tree_manager.cpp.
References tree_node_finder::check(), find_cache, find_identifier_nodeID(), tree_node::GetString(), key, STOK, STOK2, THROW_ERROR, TOK, TOK_OPERATOR, TOK_STRG, and tree_nodes.
Referenced by tree_manipulation::create_function_decl(), tree_manipulation::create_goto(), tree_manipulation::create_identifier_node(), tree_manipulation::create_label(), tree_manipulation::create_translation_unit_decl(), tree_manipulation::CreateUnsigned(), tree_manipulation::CreateVectorBooleanType(), HDLFunctionDeclFix::Exec(), tree_manipulation::GetBitsizeType(), tree_manipulation::GetBooleanType(), tree_manipulation::GetCustomIntegerType(), tree_manipulation::GetPointerType(), tree_manipulation::GetSignedIntegerType(), tree_manipulation::GetSizeType(), tree_manipulation::GetUnsignedIntegerType(), tree_manipulation::GetUnsignedLongLongType(), and tree_manipulation::GetVoidType().
unsigned int tree_manager::find_identifier_nodeID | ( | const std::string & | str | ) | const |
Return the nodeID of the identifier_node representing string str.
In case there is not that identifier_node it returns 0.
str | is the identifier we are looking for. |
Definition at line 2686 of file tree_manager.cpp.
References add_identifier_node(), ASSERT_PARAMETER, identifiers_unique_table, STOK, THROW_ASSERT, and TOK_OPERATOR.
Referenced by CWriter::create_new_identifier(), find(), and merge_tree_managers().
unsigned int tree_manager::find_sc_main_node | ( | ) | const |
Determine the index node of "sc_main" function in tree_node vector.
Definition at line 178 of file tree_manager.cpp.
References function_index().
unsigned int tree_manager::function_index | ( | const std::string & | function_name | ) | const |
Return the index of a function given its name.
function_name | is the name of the function |
Definition at line 183 of file tree_manager.cpp.
References GetFunction().
Referenced by find_sc_main_node().
unsigned int tree_manager::function_index_mngl | ( | const std::string & | function_name | ) | const |
Return the index of a function given its mangled name.
tm | is the tree_manager |
function_name | is the mangled name of the function |
Definition at line 241 of file tree_manager.cpp.
References function_decl_nodes, tree_node::get_kind(), GET_NODE, and tree_helper::print_function_name().
unsigned int tree_manager::get_added_goto | ( | ) | const |
Return the number of added gotos.
Definition at line 2745 of file tree_manager.cpp.
References added_goto.
unsigned long tree_manager::get_function_decl_node_n | ( | ) | const |
Return the number of function_decl_node.
Definition at line 345 of file tree_manager.cpp.
References function_decl_nodes.
unsigned int tree_manager::get_implementation_node | ( | unsigned int | decl_node | ) | const |
Return the index of function_decl node that implements the declaration node.
decl_node | is the index of the declaration node |
Definition at line 103 of file tree_manager.cpp.
References decl_node, get_tree_node_const(), STR, and THROW_ASSERT.
Referenced by CallGraphManager::AddFunctionAndCallPoint(), CallGraphManager::call_graph_computation_recursive(), and tree_helper::PrintType().
unsigned int tree_manager::get_n_pl | ( | ) | const |
return the number of parallel loops
Definition at line 1813 of file tree_manager.cpp.
References n_pl.
unsigned int tree_manager::get_next_available_tree_node_id | ( | ) | const |
return the next available tree node id.
Definition at line 335 of file tree_manager.cpp.
References last_node_id.
Referenced by tree_manipulation::create_function_decl(), CWriter::Initialize(), and merge_tree_managers().
unsigned int tree_manager::get_next_vers | ( | ) |
Return the next unused version number for ssa variables.
Definition at line 2716 of file tree_manager.cpp.
References DEBUG_LEVEL_PARANOIC, GET_FUNCTION_DEBUG_LEVEL, tree_node::get_kind(), INDENT_DBG_MEX, next_vers, Param, STR, and tree_nodes.
Referenced by add_identifier_node(), collapse_into(), and tree_manipulation::create_ssa_name().
unsigned int tree_manager::get_removable_pointer_plus | ( | ) | const |
Return the number of not removed pointer plus.
Definition at line 2765 of file tree_manager.cpp.
References removable_pointer_plus.
unsigned int tree_manager::get_removed_pointer_plus | ( | ) | const |
Return the number of removed pointer plus.
Definition at line 2755 of file tree_manager.cpp.
References removed_pointer_plus.
const tree_nodeRef tree_manager::get_tree_node_const | ( | unsigned int | i | ) | const |
Return the reference to the i-th tree_node Constant version of get_tree_node.
i | is the index of the tree_node of the considered function. |
Definition at line 153 of file tree_manager.cpp.
References last_node_id, STR, THROW_ASSERT, and tree_nodes.
Referenced by operations_graph_constructor::AddOperation(), CallGraphBuiltinCall::buildTypeToDeclaration(), CallGraphManager::call_graph_computation_recursive(), AllocationInformation::can_be_asynchronous_ram(), Schedule::CanBeMoved(), check_ssa_uses(), collapse_into(), CreateAddressTranslation::ComputeAddress(), Schedule::ComputeCriticalPath(), mux_connection_binding::connect_to_registers(), tree_manipulation::create_goto(), tree_manipulation::create_label(), PragmaAnalysis::create_map_pragma(), PragmaAnalysis::create_omp_pragma(), mux_connection_binding::create_single_conn(), Schedule::EvaluateCondsMerging(), Schedule::EvaluateMultiWayIfsMerging(), HDLFunctionDeclFix::Exec(), PragmaAnalysis::Exec(), mux_connection_binding::extract_parm_decl(), tree_helper::get_array_dim_and_bitsize(), BehavioralHelper::get_array_ref_array(), BehavioralHelper::get_array_ref_index(), tree_helper::get_array_var(), tree_helper::get_asm_string(), BehavioralHelper::get_attributes(), PragmaAnalysis::get_call_parameter(), BehavioralHelper::get_component_ref_field(), BehavioralHelper::get_component_ref_record(), fsm_controller::get_guard_value(), get_implementation_node(), BehavioralHelper::get_indirect_ref_var(), BehavioralHelper::get_intermediate_var(), BehavioralHelper::get_label_name(), BehavioralHelper::get_mem_ref_base(), BehavioralHelper::get_mem_ref_offset(), liveness::get_op_where_defined(), BehavioralHelper::get_operand_from_unary_expr(), Schedule::GetBBEndingTime(), tree_helper::GetFunctionSize(), BehavioralHelper::GetInit(), Schedule::GetReadyTime(), BehavioralHelper::GetVarFromSsa(), BehavioralHelper::has_bit_field(), RemoveEndingIf::Initialize(), SDCCodeMotion::InternalExec(), SwitchFix::InternalExec(), remove_clobber_ga::InternalExec(), call_expr_fix::InternalExec(), rebuild_initialization::InternalExec(), NI_SSA_liveness::InternalExec(), BlockFix::InternalExec(), compute_implicit_calls::InternalExec(), commutative_expr_restructuring::InternalExec(), virtual_phi_nodes_split::InternalExec(), operations_cfg_computation::InternalExec(), IR_lowering::InternalExec(), cdfc_module_binding::InternalExec(), BehavioralHelper::is_a_imagpart_expr(), BehavioralHelper::is_a_realpart_expr(), BehavioralHelper::is_a_result_decl(), tree_helper::is_concat_bit_ior_expr(), BehavioralHelper::is_operating_system_function(), tree_helper::is_parameter(), HLS_manager::is_reading_writing_function(), tree_helper::is_simple_pointer_plus_test(), tree_helper::is_ssa_name(), BehavioralHelper::is_va_start_call(), BehavioralHelper::is_var_args(), tree_helper::is_virtual(), mux_connection_binding::isConstantObj(), BehavioralHelper::IsDefaultSsaName(), rebuild_initialization2::look_for_ROMs(), multi_way_if::MergeCondMulti(), multi_way_if::MergeMultiCond(), multi_way_if::MergeMultiMulti(), Bit_Value_opt::optimize(), EdgeCWriter::writeRoutineInstructions_rec(), and CWriter::writeRoutineInstructions_rec().
unsigned int tree_manager::get_unremoved_pointer_plus | ( | ) | const |
Return the number of not removed pointer plus.
Definition at line 2775 of file tree_manager.cpp.
References unremoved_pointer_plus.
const CustomUnorderedSet< unsigned int > tree_manager::GetAllFunctions | ( | ) | const |
Returns all the functions in the tree_manager.
Definition at line 2705 of file tree_manager.cpp.
References function_decl_nodes.
Referenced by HDLFunctionDeclFix::Exec(), and PragmaAnalysis::Exec().
tree_nodeRef tree_manager::GetFunction | ( | const std::string & | function_name | ) | const |
Return the index of a function given its name.
tm | is the tree_manager |
function_name | is the name of the function |
Definition at line 189 of file tree_manager.cpp.
References CGetTreeReindex(), cxa_demangle(), function_decl_nodes, GET_CONST_NODE, tree_node::get_kind(), GET_NODE, is_CPP(), and tree_helper::print_function_name().
Referenced by tree_manipulation::CloneFunction(), HLS_step::ComputeRelationships(), tree_manipulation::create_function_decl(), CreateAddressTranslation::Exec(), function_index(), compute_implicit_calls::InternalExec(), compute_implicit_calls::replace_with_memcpy(), compute_implicit_calls::replace_with_memset(), DiscrepancyAnalysisCWriter::WriteExtraInitCode(), HLSCWriter::WriteFile(), HLSCWriter::WriteMainTestbench(), and DiscrepancyAnalysisCWriter::WriteMainTestbench().
tree_nodeRef tree_manager::GetTreeNode | ( | const unsigned int | index | ) | const |
Return the index-th tree_node (modifiable version)
index | is the index of the tree node to be returned |
Definition at line 147 of file tree_manager.cpp.
References STR, THROW_ASSERT, and tree_nodes.
Referenced by PhiOpt::ApplyIfRemove(), tree_manipulation::CreateGimpleAssign(), mux_connection_binding::determine_connection(), HDLVarDeclFix::InternalExec(), CallGraphBuiltinCall::InternalExec(), rebuild_initialization::InternalExec(), VarDeclFix::InternalExec(), MultipleEntryIfReduction::InternalExec(), operations_cfg_computation::InternalExec(), IR_lowering::InternalExec(), rebuild_initialization2::look_for_ROMs(), DiscrepancyAnalysisCWriter::WriteFunctionDeclaration(), and DiscrepancyAnalysisCWriter::WriteFunctionImplementation().
tree_nodeRef tree_manager::GetTreeReindex | ( | const unsigned int | i | ) |
Return a tree_reindex wrapping the i-th tree_node.
i | is the index of the tree_node. |
Definition at line 129 of file tree_manager.cpp.
References last_node_id, STR, THROW_ASSERT, and tree_nodes.
Referenced by dead_code_elimination::add_gimple_nop(), gimple_phi::AddDefEdge(), PhiOpt::ApplyIfMerge(), PhiOpt::ApplyIfRemove(), PhiOpt::ApplyMultiMerge(), PhiOpt::ApplyMultiRemove(), tree_manipulation::CloneFunction(), collapse_into(), tree_manipulation::create_binary_operation(), tree_manipulation::create_extract_bit_expr(), tree_manipulation::create_function_decl(), tree_manipulation::create_gimple_call(), tree_manipulation::create_gimple_cond(), tree_manipulation::create_gimple_modify_stmt(), tree_manipulation::create_gimple_return(), tree_manipulation::create_goto(), tree_manipulation::create_identifier_node(), tree_manipulation::create_label(), tree_manipulation::create_lut_expr(), tree_manipulation::create_parm_decl(), tree_manipulation::create_phi_node(), tree_manipulation::create_quaternary_operation(), tree_manipulation::create_result_decl(), tree_manipulation::create_ssa_name(), tree_manipulation::create_ternary_operation(), tree_manipulation::create_translation_unit_decl(), tree_manipulation::create_unary_operation(), create_unique_const(), tree_manipulation::create_var_decl(), tree_manipulation::CreateAndExpr(), tree_manipulation::CreateCallExpr(), tree_manipulation::CreateEqExpr(), tree_manipulation::CreateGimpleAssign(), tree_manipulation::CreateIntegerCst(), tree_manipulation::CreateNopExpr(), tree_manipulation::CreateNotExpr(), tree_manipulation::CreateOrExpr(), tree_manipulation::CreateUnsigned(), tree_manipulation::CreateVectorBooleanType(), Schedule::EvaluateCondsMerging(), tree_manipulation::GetBitsizeType(), tree_manipulation::GetBooleanType(), tree_manipulation::GetCustomIntegerType(), tree_manipulation::GetFunctionType(), tree_manipulation::GetPointerType(), tree_manipulation::GetSignedIntegerType(), tree_manipulation::GetSizeType(), tree_manipulation::GetUnsignedIntegerType(), tree_manipulation::GetUnsignedLongLongType(), tree_manipulation::GetVoidType(), SDCCodeMotion::InternalExec(), SwitchFix::InternalExec(), remove_clobber_ga::InternalExec(), rebuild_initialization::InternalExec(), MultipleEntryIfReduction::InternalExec(), operations_cfg_computation::InternalExec(), IR_lowering::InternalExec(), dead_code_elimination::kill_uses(), dead_code_elimination::kill_vdef(), rebuild_initialization2::look_for_ROMs(), multi_way_if::MergeCondCond(), multi_way_if::MergeCondMulti(), multi_way_if::MergeMultiCond(), multi_way_if::MergeMultiMulti(), new_tree_node_id(), Bit_Value_opt::optimize(), gimple_phi::RemoveDefEdge(), gimple_phi::ReplaceDefEdge(), dead_code_eliminationIPA::signature_opt(), and VarNode::updateIR().
void tree_manager::increment_removable_pointer_plus | ( | ) |
Increment the number of removable pointer plus.
Definition at line 2760 of file tree_manager.cpp.
References removable_pointer_plus.
void tree_manager::increment_removed_pointer_plus | ( | ) |
Increment the number of removed pointer plus.
Definition at line 2750 of file tree_manager.cpp.
References removed_pointer_plus.
void tree_manager::increment_unremoved_pointer_plus | ( | ) |
Increment the number of not removed pointer plus.
Definition at line 2770 of file tree_manager.cpp.
References unremoved_pointer_plus.
|
private |
Insert the information about variable usage (insert stmt in use_stmts attribute) in ssa variables recursively contained in node tn.
tn | is the node from which the recursion begin. |
stmt | is the statement that is inserted in the usage vector of ssa variables. |
Definition at line 1596 of file tree_manager.cpp.
References test_panda::arg, test_panda::args, CASE_BINARY_EXPRESSION, CASE_CPP_NODES, CASE_FAKE_NODES, CASE_PRAGMA_NODES, CASE_QUATERNARY_EXPRESSION, CASE_TERNARY_EXPRESSION, CASE_TYPE_NODES, CASE_UNARY_EXPRESSION, debug_level, DEBUG_LEVEL_PARANOIC, GET_INDEX_NODE, tree_node::get_kind(), GET_NODE, INDENT_DBG_MEX, STR, THROW_ASSERT, and THROW_ERROR.
Referenced by collapse_into().
bool tree_manager::is_CPP | ( | ) | const |
is_CPP return true in case we have at least one CPP source code
Definition at line 2839 of file tree_manager.cpp.
References Param.
Referenced by add_identifier_node(), and GetFunction().
bool tree_manager::is_top_function | ( | const function_decl * | fd | ) | const |
is_top_function checks if a function is one of the application top functions.
fd | is the function decl |
Definition at line 2846 of file tree_manager.cpp.
References tree_node::get_kind(), GET_NODE, decl_node::name, and Param.
Referenced by add_identifier_node(), and tree_helper::print_function_name().
bool tree_manager::is_tree_node | ( | unsigned int | i | ) | const |
Return true if there exists a tree node associated with the given id, false otherwise.
i | is the index of the tree_node to be checked |
Definition at line 171 of file tree_manager.cpp.
References tree_nodes.
void tree_manager::merge_tree_managers | ( | const tree_managerRef & | source_tree_manager | ) |
merge two tree manager: this with TM_source
TM_source | is one of the tree_manager. |
a declaration is uniquely identified by the name and by the scope in case the decl_node has a mangle the associated identifier_node is unique a decl_node without name is not added to the symbol table a decl_node local to a function_decl (scpe is a function_decl) is not added to the symbol table a decl_node local to a type_node without name is not added to the symbol table a static decl_node is not added to the symbol table memory_tag, parm_decl, result_decl are not added to the symbol table declaration with type_node local to a function are not considered the key of the declaration symbol table is structured as "name--scope" the value of the declaration symbol table is the nodeID of the tree_node in the tree_manager
a type_node without name is not added to the symbol table a type_node local to a function_decl is not added to the symbol table the key of the type symbol table is structured as "name" the value of the type symbol table is the nodeID of the tree_node in the tree_manager
this table is used to give a name to unqualified record or union
global static variable and function become global so we need some sort of uniquification
build the symbol tables of tree_node inheriting from type_node and then from decl_node; decl_nodes have to be examinated later since they have to be examinated after the record/union types???
give a name to unql where possible
check for decl_node
check for static
check for function_decl undefined
source static function declaration used to correctly rename declaration and definition of a function
the key is the old index while the values is the new index
At the moment the reverse of remap; it is filled only with function_decl without body
For each static function in source_tree_manager the index of the tree node (in source_tree_manager) of its forward declaration
For each static function in TM?source the index of the tree node (in source_tree_manager) of its implementation
set of nodes that will be added to the current tree manager (this)
FIXME: during one of the analysis of the tree nodes of source_tree_manager, new nodes can be inserted; if source_tree_manager->tree_nodes is a undirected_map, the insertion of a new node can invalidate the iterators because of rehash; for this reason we temporary copy the unordered_map in map
remap tree_node from source_tree_manager to this tree_manager first remap the types and then decl
check for decl_node
overwrite gst_it->second
overwrite gst_it->second
overwrite gst_it->second
overwrite gst_it->second
remap tree_node from source_tree_manager to this tree_manager
check for decl_node
check for static
Management of forward declaration of static function
Implementation node
If this is the implementation already remaps so that also forward declaration can be remapped on the same node
If we have already encountered forward declaration, remap it on the same node
Forward declaration
Check if we have already encountered function implementation, remap this on the same node
CHECK: reference to source_tree_manager tree_node in tree_reindex
static function or var_decl with a conflicting name so we fix the name... and we fix in the source tree_manager
CHECK: reference to source_tree_manager tree_node in tree_reindex
The following statements force ti_source.first to overwrite gst_it->second
If the symbol is in reverse_remap, it means that is a function_decl without body coming from other; it has not to be remapped
already performed
tree node visitor
compute the vertexes reached from all function_decl of source_tree_manager
Definition at line 1818 of file tree_manager.cpp.
References check_for_decl(), check_for_type(), counter, tree_node_index_factory::create_tree_node(), debug_level, DEBUG_LEVEL_PARANOIC, find_identifier_nodeID(), FIRST_TOKEN, GET_INDEX_NODE, tree_node::get_kind(), get_next_available_tree_node_id(), INDENT_DBG_MEX, new_tree_node_id(), Param, STR, THROW_ASSERT, TOK, TOK_STRG, and tree_nodes.
Referenced by CompilerWrapper::FillTreeManager().
unsigned int tree_manager::new_tree_node_id | ( | const unsigned int | ask = 0 | ) |
Return a new node id in the intermediate representation.
ask | is the requested id; if it is not used will be returned otherwise a new id |
Definition at line 323 of file tree_manager.cpp.
References GetTreeReindex(), last_node_id, and tree_nodes.
Referenced by dead_code_elimination::add_gimple_nop(), PhiOpt::ApplyIfMerge(), PhiOpt::ApplyIfRemove(), PhiOpt::ApplyMultiMerge(), PhiOpt::ApplyMultiRemove(), collapse_into(), tree_manipulation::create_binary_operation(), tree_manipulation::create_extract_bit_expr(), tree_manipulation::create_function_decl(), tree_manipulation::create_gimple_call(), tree_manipulation::create_gimple_cond(), tree_manipulation::create_gimple_modify_stmt(), tree_manipulation::create_gimple_return(), tree_manipulation::create_goto(), tree_manipulation::create_identifier_node(), tree_manipulation::create_label(), tree_manipulation::create_lut_expr(), PragmaAnalysis::create_map_pragma(), PragmaAnalysis::create_omp_pragma(), tree_manipulation::create_parm_decl(), tree_manipulation::create_phi_node(), tree_manipulation::create_quaternary_operation(), tree_manipulation::create_result_decl(), tree_manipulation::create_ssa_name(), tree_manipulation::create_ternary_operation(), tree_manipulation::create_translation_unit_decl(), tree_manipulation::create_unary_operation(), create_unique_const(), tree_manipulation::create_var_decl(), tree_manipulation::CreateAddrExpr(), tree_manipulation::CreateAndExpr(), tree_manipulation::CreateCallExpr(), tree_manipulation::CreateEqExpr(), tree_manipulation::CreateNopExpr(), tree_manipulation::CreateNotExpr(), tree_manipulation::CreateOrExpr(), tree_manipulation::CreateUnsigned(), tree_manipulation::CreateVectorBooleanType(), tree_manipulation::GetBitsizeType(), tree_manipulation::GetBooleanType(), tree_manipulation::GetCustomIntegerType(), tree_manipulation::GetFunctionType(), tree_manipulation::GetPointerType(), tree_manipulation::GetSignedIntegerType(), tree_manipulation::GetSizeType(), tree_manipulation::GetUnsignedIntegerType(), tree_manipulation::GetUnsignedLongLongType(), tree_manipulation::GetVoidType(), SwitchFix::InternalExec(), rebuild_initialization::InternalExec(), operations_cfg_computation::InternalExec(), dead_code_elimination::kill_uses(), dead_code_elimination::kill_vdef(), rebuild_initialization2::look_for_ROMs(), merge_tree_managers(), multi_way_if::MergeCondCond(), multi_way_if::MergeCondMulti(), multi_way_if::MergeMultiCond(), and multi_way_if::MergeMultiMulti().
void tree_manager::print | ( | std::ostream & | os | ) | const |
Function that prints the class tree_manager.
Param | is the set of the parameter |
os | is the stream where tree_manager will be printed |
Definition at line 283 of file tree_manager.cpp.
References CompilerWrapper::bambu_ir_info, last_node_id, and tree_nodes.
Referenced by FrontendFlowStep::PrintTreeManager().
void tree_manager::PrintGimple | ( | std::ostream & | os, |
const bool | use_uid | ||
) | const |
Function that prints the bodies of function in gimple format.
os | is the stream where bodies will be printed |
use_uid | tells if uid of gimple index has to be used |
Definition at line 301 of file tree_manager.cpp.
References function_decl_nodes.
Referenced by collapse_into(), and FrontendFlowStep::PrintTreeManager().
void tree_manager::RecursiveReplaceTreeNode | ( | tree_nodeRef & | tn, |
const tree_nodeRef | old_node, | ||
const tree_nodeRef & | new_node, | ||
const tree_nodeRef & | stmt, | ||
bool | definition | ||
) |
Replace the occurrences of tree node old_node with new_node in statement identified by tn.
Operates recursively. NOTE: tn must be a reference since we are replacing the tree_node in other tree_node fields
tn | is the statement from which the recursion begin. It must be a statement. |
old_node | is the node whose occurrences have to be replace |
new_node | is the node that replaces occurrences of old_node |
stmt | is the statement from which the recursion originates (necessary to update ssa_nodes usage information) |
definition | is true if old_node is a ssa_name in the left part of a gimple_assign |
Check if we need to update uses or definitions
Definition at line 965 of file tree_manager.cpp.
References test_panda::arg, CASE_BINARY_EXPRESSION, CASE_CPP_NODES, CASE_FAKE_NODES, CASE_PRAGMA_NODES, CASE_QUATERNARY_EXPRESSION, CASE_TERNARY_EXPRESSION, CASE_TYPE_NODES, CASE_UNARY_EXPRESSION, tree_helper::ComputeSsaUses(), counter, DEBUG_LEVEL_PARANOIC, GET_CONST_NODE, GET_FUNCTION_DEBUG_LEVEL, GET_INDEX_NODE, tree_node::get_kind(), GET_NODE, INDENT_DBG_MEX, tree_node::index, Param, STR, THROW_ASSERT, THROW_ERROR, and tree_node::ToString().
Referenced by collapse_into(), FunctionCallTypeCleanup::ParametersTypeCleanup(), and ReplaceTreeNode().
void tree_manager::ReplaceTreeNode | ( | const tree_nodeRef & | stmt, |
const tree_nodeRef & | old_node, | ||
const tree_nodeRef & | new_node | ||
) |
Replace the occurrences of tree node old_node with new_node in statement identified by tn.
Operates recursively.
tn | is the statement from which the recursion begin. It must be a statement. |
old_node | is the node whose occurrences have to be replace |
new_node | is thenode that replaces occurrences of old_node |
Temporary variable used to pass first argument of RecursiveReplaceTreeNode by reference. Since it is a gimple_node it has not to be replaced
Definition at line 953 of file tree_manager.cpp.
References GET_NODE, RecursiveReplaceTreeNode(), STR, THROW_ASSERT, and tree_node::ToString().
Referenced by add_identifier_node(), tree_manipulation::InlineFunctionCall(), compute_implicit_calls::InternalExec(), MultipleEntryIfReduction::InternalExec(), PhiOpt::InternalExec(), dead_code_elimination::kill_uses(), Bit_Value_opt::optimize(), lut_transformation::ProcessBasicBlock(), Bit_Value_opt::propagateValue(), PhiOpt::RemoveCondExpr(), InterfaceInfer::setReadInterface(), PhiOpt::SinglePhiOptimization(), and tree_manipulation::VersionFunctionCall().
|
friend |
Friend definition of the << operator.
Definition at line 364 of file tree_manager.hpp.
|
friend |
Friend definition of the << operator.
Pointer version.
Definition at line 373 of file tree_manager.hpp.
|
private |
the number of added goto
Definition at line 113 of file tree_manager.hpp.
Referenced by add_goto(), and get_added_goto().
|
private |
set of already examined addr_expr used to avoid circular recursion
Definition at line 107 of file tree_manager.hpp.
|
private |
Index of current call of collapse_into_counter.
Definition at line 145 of file tree_manager.hpp.
Referenced by collapse_into().
|
private |
The debug level.
Definition at line 125 of file tree_manager.hpp.
Referenced by check_for_decl(), check_for_type(), collapse_into(), erase_usage_info(), insert_usage_info(), and merge_tree_managers().
|
private |
|
private |
Variable containing set of function_declaration with their index node.
Definition at line 101 of file tree_manager.hpp.
Referenced by add_function(), function_index_mngl(), get_function_decl_node_n(), GetAllFunctions(), GetFunction(), and PrintGimple().
|
private |
this table stores all identifier_nodes with their nodeID.
Definition at line 131 of file tree_manager.hpp.
Referenced by find_identifier_nodeID().
|
private |
last node_id used
Definition at line 128 of file tree_manager.hpp.
Referenced by AddTreeNode(), CGetTreeNode(), CGetTreeReindex(), get_next_available_tree_node_id(), get_tree_node_const(), GetTreeReindex(), new_tree_node_id(), and print().
|
private |
the number of parallel loops
Definition at line 110 of file tree_manager.hpp.
Referenced by add_parallel_loop(), and get_n_pl().
|
private |
Next version number for ssa variables.
Definition at line 142 of file tree_manager.hpp.
Referenced by get_next_vers().
|
private |
Set of parameters.
Definition at line 136 of file tree_manager.hpp.
Referenced by collapse_into(), create_tree_node(), get_next_vers(), is_CPP(), is_top_function(), merge_tree_managers(), and RecursiveReplaceTreeNode().
|
private |
the number of removable pointer_plus
Definition at line 119 of file tree_manager.hpp.
Referenced by get_removable_pointer_plus(), and increment_removable_pointer_plus().
|
private |
the number of removed pointer_plus
Definition at line 116 of file tree_manager.hpp.
Referenced by get_removed_pointer_plus(), and increment_removed_pointer_plus().
|
private |
list of examining statements during collapse_into recursion
Definition at line 104 of file tree_manager.hpp.
|
private |
Variable containing set of tree_nodes.
Definition at line 96 of file tree_manager.hpp.
Referenced by AddTreeNode(), CGetTreeNode(), CGetTreeReindex(), find(), get_next_vers(), get_tree_node_const(), GetTreeNode(), GetTreeReindex(), is_tree_node(), merge_tree_managers(), new_tree_node_id(), and print().
|
private |
Definition at line 133 of file tree_manager.hpp.
Referenced by create_unique_const().
|
private |
the number of unremoved pointer_plus
Definition at line 122 of file tree_manager.hpp.
Referenced by get_unremoved_pointer_plus(), and increment_unremoved_pointer_plus().
|
private |
Map containing temporary information for ssa_name uses deletion.
Definition at line 139 of file tree_manager.hpp.