tree node merger classes.
More...
#include "tree_nodes_merger.hpp"
#include "exceptions.hpp"
#include "ext_tree_node.hpp"
#include "token_interface.hpp"
#include "tree_basic_block.hpp"
#include "tree_common.hpp"
#include "tree_manager.hpp"
#include "tree_node.hpp"
#include "tree_reindex.hpp"
#include <string>
#include <utility>
#include <vector>
Go to the source code of this file.
tree node merger classes.
- Author
- Fabrizio Ferrandi fabri.nosp@m.zio..nosp@m.ferra.nosp@m.ndi@.nosp@m.polim.nosp@m.i.it $Revision$ $Date$ Last modified by $Author$
Definition in file tree_nodes_merger.cpp.
◆ ATTR_MACRO
#define ATTR_MACRO |
( |
|
r, |
|
|
|
data, |
|
|
|
elem |
|
) |
| |
Value:attr_p = GetPointer<attr>(source_tn)->list_attr.find(
TOK(elem)) != GetPointer<attr>(source_tn)->list_attr.end(); \
if(attr_p) \
dynamic_cast<
attr*>(curr_tree_node_ptr)->list_attr.insert(
TOK(elem));
#define TOK(token)
Macro used to convert a token symbol into a treeVocabularyTokenTypes.
struct definition of the field attr on function_decl, field_decl, var_decl tree node.
Referenced by tree_node_index_factory::create_tree_node().
◆ ATTR_SEQ
◆ CHECK_AND_ADD
#define CHECK_AND_ADD |
( |
|
Tree_Node, |
|
|
|
visit_index |
|
) |
| |
Value:{ \
if((Tree_Node) && remap.find(
GET_INDEX_NODE(Tree_Node)) == remap.end()) \
{ \
SET_VISIT_INDEX(mask, visit_index); \
remap[node_id] = TM->new_tree_node_id(node_id); \
not_yet_remapped.insert(node_id); \
} \
}
#define GET_INDEX_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
Definition at line 57 of file tree_nodes_merger.cpp.
◆ CREATE_TREE_NODE_CASE_BODY
#define CREATE_TREE_NODE_CASE_BODY |
( |
|
tree_node_name, |
|
|
|
node_id |
|
) |
| |
Value:{ \
auto tnn = new tree_node_name(node_id); \
if(dynamic_cast<function_decl*>(tnn)) \
{ \
TM->add_function(node_id, cur); \
} \
TM->AddTreeNode(node_id, cur); \
curr_tree_node_ptr = tnn; \
source_tn = tn; \
tnn->visit(this); \
curr_tree_node_ptr = nullptr; \
break; \
}
refcount< tree_node > tree_nodeRef
RefCount type definition of the tree_node class structure.
Definition at line 851 of file tree_nodes_merger.cpp.
Referenced by tree_node_index_factory::create_tree_node().
◆ LSEQ_SET_NODE_ID
#define LSEQ_SET_NODE_ID |
( |
|
list_field, |
|
|
|
type |
|
) |
| |
Value:if(!GetPointer<type>(source_tn)->list_field.empty()) \
{ \
std::list<tree_nodeRef>::const_iterator vend = GetPointer<type>(source_tn)->list_field.end(); \
for(std::list<tree_nodeRef>::const_iterator i = GetPointer<type>(source_tn)->list_field.begin(); i != vend; ++i) \
{ \
THROW_ASSERT(remap.find(node_id) != remap.end(), "missing an index: " + std::to_string(node_id)); \
node_id = remap.find(node_id)->second; \
dynamic_cast<
type*>(curr_tree_node_ptr)->list_field.push_back(TM->GetTreeReindex(node_id)); \
} \
}
#define GET_INDEX_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
Definition at line 1482 of file tree_nodes_merger.cpp.
◆ SEQ_SET_NODE_ID
#define SEQ_SET_NODE_ID |
( |
|
list_field, |
|
|
|
type |
|
) |
| |
Value:if(!GetPointer<type>(source_tn)->list_field.empty()) \
{ \
for(const auto& i : GetPointer<type>(source_tn)->list_field) \
{ \
THROW_ASSERT(remap.find(node_id) != remap.end(), "missing an index: " + std::to_string(node_id)); \
node_id = remap.find(node_id)->second; \
dynamic_cast<
type*>(curr_tree_node_ptr)->list_field.push_back(TM->GetTreeReindex(node_id)); \
} \
}
#define GET_INDEX_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
Definition at line 1458 of file tree_nodes_merger.cpp.
◆ SET_NODE_ID
#define SET_NODE_ID |
( |
|
field, |
|
|
|
type |
|
) |
| |
Value:if(GetPointer<type>(source_tn)->field) \
{ \
unsigned
int node_id =
GET_INDEX_NODE(GetPointer<type>(source_tn)->field); \
THROW_ASSERT(remap.find(node_id) != remap.end(), "missing an index: " + std::to_string(node_id)); \
node_id = remap.find(node_id)->second; \
dynamic_cast<
type*>(curr_tree_node_ptr)->field = TM->GetTreeReindex(node_id); \
}
#define GET_INDEX_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
Definition at line 1449 of file tree_nodes_merger.cpp.
◆ SET_SET_NODE_ID
#define SET_SET_NODE_ID |
( |
|
list_field, |
|
|
|
type |
|
) |
| |
Value:if(!GetPointer<type>(source_tn)->list_field.empty()) \
{ \
for(const auto& i : GetPointer<type>(source_tn)->list_field) \
{ \
THROW_ASSERT(remap.find(node_id) != remap.end(), "missing an index: " + std::to_string(node_id)); \
node_id = remap.find(node_id)->second; \
dynamic_cast<
type*>(curr_tree_node_ptr)->list_field.insert(TM->GetTreeReindex(node_id)); \
} \
}
#define GET_INDEX_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
Definition at line 1470 of file tree_nodes_merger.cpp.
◆ SET_VALUE
#define SET_VALUE |
( |
|
field, |
|
|
|
type |
|
) |
| (dynamic_cast<type*>(curr_tree_node_ptr)->field = GetPointer<type>(source_tn)->field) |