PandA-2024.02
Macros
tree_node_dup.cpp File Reference

tree node duplication class. More...

#include "exceptions.hpp"
#include "string_manipulation.hpp"
#include "tree_common.hpp"
#include <string>
#include <utility>
#include <vector>
#include "token_interface.hpp"
#include "application_manager.hpp"
#include "ext_tree_node.hpp"
#include "tree_basic_block.hpp"
#include "tree_helper.hpp"
#include "tree_manager.hpp"
#include "tree_node.hpp"
#include "tree_node_dup.hpp"
#include "tree_reindex.hpp"
Include dependency graph for tree_node_dup.cpp:

Go to the source code of this file.

Macros

#define DECLARATION   (2)
 Autoheader include. More...
 
#define CREATE_TREE_NODE_CASE_BODY(tree_node_name, node_id)
 
#define RET_NODE_ID_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 duplication class.

Author
Fabrizio Ferrandi fabri.nosp@m.zio..nosp@m.ferra.nosp@m.ndi@.nosp@m.polim.nosp@m.i.it
Michele Fiorito miche.nosp@m.le.f.nosp@m.iorit.nosp@m.o@po.nosp@m.limi..nosp@m.it $Revision$ $Date$ Last modified by $Author$

Definition in file tree_node_dup.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_dup::get_loop_id().

◆ 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_dup::get_loop_id().

◆ CREATE_TREE_NODE_CASE_BODY

#define CREATE_TREE_NODE_CASE_BODY (   tree_node_name,
  node_id 
)
Value:
{ \
(node_id) = TM->new_tree_node_id(); \
remap.insert({tn->index, (node_id)}); \
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 67 of file tree_node_dup.cpp.

Referenced by tree_node_dup::create_tree_node().

◆ DECLARATION

#define DECLARATION   (2)

Autoheader include.

parser/compiler include

Definition at line 65 of file tree_node_dup.cpp.

Referenced by tree_node_dup::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); \
if(remap.find(node_id) != remap.end()) \
node_id = remap.find(node_id)->second; \
else \
{ \
tree_node* saved_curr_tree_node_ptr = curr_tree_node_ptr; \
tree_nodeRef saved_source_tn = source_tn; \
node_id = create_tree_node(GET_NODE(*i), mode); \
curr_tree_node_ptr = saved_curr_tree_node_ptr; \
source_tn = saved_source_tn; \
} \
dynamic_cast<type*>(curr_tree_node_ptr)->list_field.push_back(TM->GetTreeReindex(node_id)); \
} \
}
#define GET_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
Definition: tree_node.hpp:343
#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 834 of file tree_node_dup.cpp.

◆ RET_NODE_ID_CASE_BODY

#define RET_NODE_ID_CASE_BODY (   tree_node_name,
  node_id 
)
Value:
{ \
if(remap.find(tn->index) != remap.end()) \
(node_id) = remap.find(tn->index)->second; \
else \
(node_id) = tn->index; \
break; \
}

Definition at line 86 of file tree_node_dup.cpp.

Referenced by tree_node_dup::create_tree_node().

◆ SEQ_SET_NODE_ID

#define SEQ_SET_NODE_ID (   list_field,
  type 
)
Value:
if(!GetPointer<type>(source_tn)->list_field.empty()) \
{ \
for(auto const& field : GetPointer<type>(source_tn)->list_field) \
{ \
unsigned int node_id = field->index; \
if(remap.find(node_id) != remap.end()) \
node_id = remap.find(node_id)->second; \
else \
{ \
tree_node* saved_curr_tree_node_ptr = curr_tree_node_ptr; \
tree_nodeRef saved_source_tn = source_tn; \
node_id = create_tree_node(GET_NODE(field), mode); \
curr_tree_node_ptr = saved_curr_tree_node_ptr; \
source_tn = saved_source_tn; \
} \
dynamic_cast<type*>(curr_tree_node_ptr)->list_field.push_back(TM->GetTreeReindex(node_id)); \
} \
}
#define GET_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
Definition: tree_node.hpp:343

Definition at line 794 of file tree_node_dup.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); \
if(remap.find(node_id) != remap.end()) \
{ \
node_id = remap.find(node_id)->second; \
} \
else \
{ \
tree_node* saved_curr_tree_node_ptr = curr_tree_node_ptr; \
tree_nodeRef saved_source_tn = source_tn; \
node_id = create_tree_node(GET_NODE(GetPointer<type>(source_tn)->field), mode); \
curr_tree_node_ptr = saved_curr_tree_node_ptr; \
source_tn = saved_source_tn; \
} \
dynamic_cast<type*>(curr_tree_node_ptr)->field = TM->GetTreeReindex(node_id); \
}
#define GET_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
Definition: tree_node.hpp:343
#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 775 of file tree_node_dup.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); \
if(remap.find(node_id) != remap.end()) \
node_id = remap.find(node_id)->second; \
else \
{ \
tree_node* saved_curr_tree_node_ptr = curr_tree_node_ptr; \
tree_nodeRef saved_source_tn = source_tn; \
node_id = create_tree_node(GET_NODE(i), mode); \
curr_tree_node_ptr = saved_curr_tree_node_ptr; \
source_tn = saved_source_tn; \
} \
dynamic_cast<type*>(curr_tree_node_ptr)->list_field.insert(TM->GetTreeReindex(node_id)); \
} \
}
#define GET_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
Definition: tree_node.hpp:343
#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 814 of file tree_node_dup.cpp.

◆ SET_VALUE

#define SET_VALUE (   field,
  type 
)    (dynamic_cast<type*>(curr_tree_node_ptr)->field = GetPointer<type>(source_tn)->field)

Definition at line 855 of file tree_node_dup.cpp.


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