PandA-2024.02
Macros
tree_nodes_merger.cpp File Reference

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>
Include dependency graph for tree_nodes_merger.cpp:

Go to the source code of this file.

Macros

#define CHECK_AND_ADD(Tree_Node, visit_index)
 
#define CREATE_TREE_NODE_CASE_BODY(tree_node_name, node_id)
 
#define ATTR_SEQ
 
#define ATTR_MACRO(r, data, elem)
 
#define SET_NODE_ID(field, type)
 
#define SEQ_SET_NODE_ID(list_field, type)
 
#define SET_SET_NODE_ID(list_field, type)
 
#define LSEQ_SET_NODE_ID(list_field, type)
 
#define SET_VALUE(field, type)   (dynamic_cast<type*>(curr_tree_node_ptr)->field = GetPointer<type>(source_tn)->field)
 

Detailed Description

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.

Macro Definition Documentation

◆ 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.
Definition: tree_node.hpp:774

Referenced by tree_node_index_factory::create_tree_node().

◆ ATTR_SEQ

#define ATTR_SEQ
Value:
(TOK_NEW)(TOK_DELETE)(TOK_ASSIGN)(TOK_MEMBER)(TOK_PUBLIC)(TOK_PROTECTED)(TOK_PRIVATE)(TOK_NORETURN)(TOK_VOLATILE)( \
TOK_NOINLINE)(TOK_ALWAYS_INLINE)(TOK_USED)(TOK_UNUSED)(TOK_CONST)(TOK_TRANSPARENT_UNION)(TOK_CONSTRUCTOR)( \
TOK_DESTRUCTOR)(TOK_MODE)(TOK_SECTION)(TOK_ALIGNED)(TOK_WEAK)(TOK_ALIAS)(TOK_NO_INSTRUMENT_FUNCTION)( \
TOK_MALLOC)(TOK_NO_STACK_LIMIT)(TOK_PURE)(TOK_DEPRECATED)(TOK_VECTOR_SIZE)(TOK_VISIBILITY)(TOK_TLS_MODEL)( \
TOK_NONNULL)(TOK_NOTHROW)(TOK_MAY_ALIAS)(TOK_WARN_UNUSED_RESULT)(TOK_FORMAT)(TOK_FORMAT_ARG)(TOK_NULL)( \
TOK_GLOBAL_INIT)(TOK_GLOBAL_FINI)(TOK_CONVERSION)(TOK_VIRTUAL)(TOK_LSHIFT)(TOK_MUTABLE)(TOK_PSEUDO_TMPL)( \
TOK_VECNEW)(TOK_VECDELETE)(TOK_POS)(TOK_NEG)(TOK_ADDR)(TOK_DEREF)(TOK_LNOT)(TOK_NOT)(TOK_PREINC)(TOK_PREDEC)( \
TOK_PLUSASSIGN)(TOK_PLUS)(TOK_MINUSASSIGN)(TOK_MINUS)(TOK_MULTASSIGN)(TOK_MULT)(TOK_DIVASSIGN)(TOK_DIV)( \
TOK_MODASSIGN)(TOK_MOD)(TOK_ANDASSIGN)(TOK_AND)(TOK_ORASSIGN)(TOK_OR)(TOK_XORASSIGN)(TOK_XOR)( \
TOK_LSHIFTASSIGN)(TOK_RSHIFTASSIGN)(TOK_RSHIFT)(TOK_EQ)(TOK_NE)(TOK_LT)(TOK_GT)(TOK_LE)(TOK_GE)(TOK_LAND)( \
TOK_LOR)(TOK_COMPOUND)(TOK_MEMREF)(TOK_REF)(TOK_SUBS)(TOK_POSTINC)(TOK_POSTDEC)(TOK_CALL)(TOK_THUNK)( \
TOK_THIS_ADJUSTING)(TOK_RESULT_ADJUSTING)(TOK_BITFIELD)

Referenced by tree_node_index_factory::create_tree_node().

◆ 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); \
unsigned int node_id = GET_INDEX_NODE(Tree_Node); \
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: tree_node.hpp:361

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); \
tree_nodeRef cur = tree_nodeRef(tnn); \
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; \
source_tn = tree_nodeRef(); \
break; \
}
refcount< tree_node > tree_nodeRef
RefCount type definition of the tree_node class structure.
Definition: tree_node.hpp:212

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) \
{ \
unsigned int node_id = GET_INDEX_NODE(*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: tree_node.hpp:361

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) \
{ \
unsigned int node_id = GET_INDEX_NODE(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: tree_node.hpp:361

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: tree_node.hpp:361

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) \
{ \
unsigned int node_id = GET_INDEX_NODE(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.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: tree_node.hpp:361

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)

Definition at line 1495 of file tree_nodes_merger.cpp.


Generated on Mon Feb 12 2024 13:03:34 for PandA-2024.02 by doxygen 1.8.13