PandA-2024.02
tree_node_dup.cpp
Go to the documentation of this file.
1 /*
2  *
3  * _/_/_/ _/_/ _/ _/ _/_/_/ _/_/
4  * _/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/
5  * _/_/_/ _/_/_/_/ _/ _/_/ _/ _/ _/_/_/_/
6  * _/ _/ _/ _/ _/ _/ _/ _/ _/
7  * _/ _/ _/ _/ _/ _/_/_/ _/ _/
8  *
9  * ***********************************************
10  * PandA Project
11  * URL: http://panda.dei.polimi.it
12  * Politecnico di Milano - DEIB
13  * System Architectures Group
14  * ***********************************************
15  * Copyright (C) 2004-2024 Politecnico di Milano
16  *
17  * This file is part of the PandA framework.
18  *
19  * The PandA framework is free software; you can redistribute it and/or modify
20  * it under the terms of the GNU General Public License as published by
21  * the Free Software Foundation; either version 3 of the License, or
22  * (at your option) any later version.
23  *
24  * This program is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27  * GNU General Public License for more details.
28  *
29  * You should have received a copy of the GNU General Public License
30  * along with this program. If not, see <http://www.gnu.org/licenses/>.
31  *
32  */
45 #include "exceptions.hpp" // for THROW_ASSERT, THROW...
47 #include "string_manipulation.hpp" // for STR
48 #include "tree_common.hpp" // for CharType_K, abs_expr_K
49 #include <string> // for string, operator+
50 #include <utility> // for pair
51 #include <vector> // for vector, vector<>::c...
52 
54 #include "token_interface.hpp"
55 
56 #include "application_manager.hpp"
57 #include "ext_tree_node.hpp"
58 #include "tree_basic_block.hpp"
59 #include "tree_helper.hpp"
60 #include "tree_manager.hpp"
61 #include "tree_node.hpp"
62 #include "tree_node_dup.hpp"
63 #include "tree_reindex.hpp"
64 
65 #define DECLARATION (2) // All nodes including declarations are duplicated (not function_decl)
66 
67 #define CREATE_TREE_NODE_CASE_BODY(tree_node_name, node_id) \
68  { \
69  (node_id) = TM->new_tree_node_id(); \
70  remap.insert({tn->index, (node_id)}); \
71  auto tnn = new tree_node_name(node_id); \
72  tree_nodeRef cur = tree_nodeRef(tnn); \
73  if(dynamic_cast<function_decl*>(tnn)) \
74  { \
75  TM->add_function(node_id, cur); \
76  } \
77  TM->AddTreeNode(node_id, cur); \
78  curr_tree_node_ptr = tnn; \
79  source_tn = tn; \
80  tnn->visit(this); \
81  curr_tree_node_ptr = nullptr; \
82  source_tn = tree_nodeRef(); \
83  break; \
84  }
85 
86 #define RET_NODE_ID_CASE_BODY(tree_node_name, node_id) \
87  { \
88  if(remap.find(tn->index) != remap.end()) \
89  (node_id) = remap.find(tn->index)->second; \
90  else \
91  (node_id) = tn->index; \
92  break; \
93  }
94 
96  const application_managerRef _AppM, unsigned int _remap_bbi, unsigned int _remap_loop_id,
97  bool _use_counting)
98  : remap(_remap),
99  use_counting(_use_counting),
100  remap_bbi(_remap_bbi),
101  remap_bb(),
102  remap_loop_id(_remap_loop_id),
103  remap_lid(),
104  AppM(_AppM),
105  TM(_AppM->get_tree_manager()),
106  curr_tree_node_ptr(nullptr),
107  curr_bloc(nullptr)
108 {
109  if(remap_bbi)
110  {
111  remap_bb.insert(std::make_pair(bloc::ENTRY_BLOCK_ID, bloc::ENTRY_BLOCK_ID));
112  remap_bb.insert(std::make_pair(bloc::EXIT_BLOCK_ID, bloc::EXIT_BLOCK_ID));
113  }
114 }
115 
116 unsigned int tree_node_dup::create_tree_node(const tree_nodeRef& tn, int _mode)
117 {
118  unsigned int node_id = 0U;
119  mode = _mode;
120  switch(tn->get_kind())
121  {
122  case abs_expr_K:
123  CREATE_TREE_NODE_CASE_BODY(abs_expr, node_id)
124  case addr_expr_K:
125  CREATE_TREE_NODE_CASE_BODY(addr_expr, node_id)
126  case array_range_ref_K:
127  CREATE_TREE_NODE_CASE_BODY(array_range_ref, node_id)
128  case array_ref_K:
129  CREATE_TREE_NODE_CASE_BODY(array_ref, node_id)
130  case array_type_K:
132  case alignof_expr_K:
133  CREATE_TREE_NODE_CASE_BODY(alignof_expr, node_id)
134  case arrow_expr_K:
135  CREATE_TREE_NODE_CASE_BODY(arrow_expr, node_id)
136  case gimple_asm_K:
138  case assert_expr_K:
139  CREATE_TREE_NODE_CASE_BODY(assert_expr, node_id)
140  case baselink_K:
142  case gimple_bind_K:
144  case binfo_K:
146  case bit_and_expr_K:
147  CREATE_TREE_NODE_CASE_BODY(bit_and_expr, node_id)
148  case bit_field_ref_K:
149  CREATE_TREE_NODE_CASE_BODY(bit_field_ref, node_id)
150  case bit_ior_expr_K:
151  CREATE_TREE_NODE_CASE_BODY(bit_ior_expr, node_id)
152  case bit_ior_concat_expr_K:
153  CREATE_TREE_NODE_CASE_BODY(bit_ior_concat_expr, node_id)
154  case bit_not_expr_K:
155  CREATE_TREE_NODE_CASE_BODY(bit_not_expr, node_id)
156  case bit_xor_expr_K:
157  CREATE_TREE_NODE_CASE_BODY(bit_xor_expr, node_id)
158  case block_K:
160  case boolean_type_K:
161  RET_NODE_ID_CASE_BODY(boolean_type, node_id)
162  case buffer_ref_K:
163  CREATE_TREE_NODE_CASE_BODY(buffer_ref, node_id)
164  case call_expr_K:
166  case aggr_init_expr_K:
168  case gimple_call_K:
170  case card_expr_K:
171  CREATE_TREE_NODE_CASE_BODY(card_expr, node_id)
172  case case_label_expr_K:
174  case cast_expr_K:
176  case catch_expr_K:
177  CREATE_TREE_NODE_CASE_BODY(catch_expr, node_id)
178  case ceil_div_expr_K:
179  CREATE_TREE_NODE_CASE_BODY(ceil_div_expr, node_id)
180  case ceil_mod_expr_K:
181  CREATE_TREE_NODE_CASE_BODY(ceil_mod_expr, node_id)
182  case CharType_K:
183  CREATE_TREE_NODE_CASE_BODY(CharType, node_id)
184  case nullptr_type_K:
185  CREATE_TREE_NODE_CASE_BODY(nullptr_type, node_id)
186  case type_pack_expansion_K:
188  case cleanup_point_expr_K:
189  CREATE_TREE_NODE_CASE_BODY(cleanup_point_expr, node_id)
190  case complex_cst_K:
192  case complex_expr_K:
193  CREATE_TREE_NODE_CASE_BODY(complex_expr, node_id)
194  case complex_type_K:
196  case component_ref_K:
197  CREATE_TREE_NODE_CASE_BODY(component_ref, node_id)
198  case compound_expr_K:
199  CREATE_TREE_NODE_CASE_BODY(compound_expr, node_id)
200  case cond_expr_K:
201  CREATE_TREE_NODE_CASE_BODY(cond_expr, node_id)
202  case conj_expr_K:
203  CREATE_TREE_NODE_CASE_BODY(conj_expr, node_id)
204  case const_decl_K:
206  case constructor_K:
207  if(mode)
209  else
211  case convert_expr_K:
212  CREATE_TREE_NODE_CASE_BODY(convert_expr, node_id)
213  case ctor_initializer_K:
214  CREATE_TREE_NODE_CASE_BODY(ctor_initializer, node_id)
215  case eh_filter_expr_K:
216  CREATE_TREE_NODE_CASE_BODY(eh_filter_expr, node_id)
217  case enumeral_type_K:
219  case eq_expr_K:
220  CREATE_TREE_NODE_CASE_BODY(eq_expr, node_id)
221  case error_mark_K:
223  case exact_div_expr_K:
224  CREATE_TREE_NODE_CASE_BODY(exact_div_expr, node_id)
225  case exit_expr_K:
226  CREATE_TREE_NODE_CASE_BODY(exit_expr, node_id)
227  case expr_stmt_K:
229  case fdesc_expr_K:
230  CREATE_TREE_NODE_CASE_BODY(fdesc_expr, node_id)
231  case field_decl_K:
234  else
236  case fix_ceil_expr_K:
237  CREATE_TREE_NODE_CASE_BODY(fix_ceil_expr, node_id)
238  case fix_floor_expr_K:
239  CREATE_TREE_NODE_CASE_BODY(fix_floor_expr, node_id)
240  case fix_round_expr_K:
241  CREATE_TREE_NODE_CASE_BODY(fix_round_expr, node_id)
242  case fix_trunc_expr_K:
243  CREATE_TREE_NODE_CASE_BODY(fix_trunc_expr, node_id)
244  case float_expr_K:
245  CREATE_TREE_NODE_CASE_BODY(float_expr, node_id)
246  case floor_div_expr_K:
247  CREATE_TREE_NODE_CASE_BODY(floor_div_expr, node_id)
248  case floor_mod_expr_K:
249  CREATE_TREE_NODE_CASE_BODY(floor_mod_expr, node_id)
250  case function_decl_K:
253  else
255  case function_type_K:
258  else
260  case ge_expr_K:
261  CREATE_TREE_NODE_CASE_BODY(ge_expr, node_id)
262  case gimple_assign_K:
264  case gimple_cond_K:
266  case gimple_goto_K:
268  case gimple_label_K:
269  if(mode >= DECLARATION)
271  else
273  case goto_subroutine_K:
274  CREATE_TREE_NODE_CASE_BODY(goto_subroutine, node_id)
275  case gt_expr_K:
276  CREATE_TREE_NODE_CASE_BODY(gt_expr, node_id)
277  case handler_K:
279  case imagpart_expr_K:
280  CREATE_TREE_NODE_CASE_BODY(imagpart_expr, node_id)
281  case indirect_ref_K:
282  CREATE_TREE_NODE_CASE_BODY(indirect_ref, node_id)
283  case misaligned_indirect_ref_K:
284  CREATE_TREE_NODE_CASE_BODY(misaligned_indirect_ref, node_id)
285  case in_expr_K:
286  CREATE_TREE_NODE_CASE_BODY(in_expr, node_id)
287  case init_expr_K:
288  CREATE_TREE_NODE_CASE_BODY(init_expr, node_id)
289  case integer_cst_K:
291  case integer_type_K:
293  case label_decl_K:
294  if(mode >= DECLARATION)
295  CREATE_TREE_NODE_CASE_BODY(label_decl, node_id)
296  else
297  RET_NODE_ID_CASE_BODY(label_decl, node_id)
298  case lang_type_K:
299  RET_NODE_ID_CASE_BODY(lang_type, node_id)
300  case le_expr_K:
301  CREATE_TREE_NODE_CASE_BODY(le_expr, node_id)
302  case loop_expr_K:
303  CREATE_TREE_NODE_CASE_BODY(loop_expr, node_id)
304  case lut_expr_K:
306  case lrotate_expr_K:
307  CREATE_TREE_NODE_CASE_BODY(lrotate_expr, node_id)
308  case lshift_expr_K:
309  CREATE_TREE_NODE_CASE_BODY(lshift_expr, node_id)
310  case lt_expr_K:
311  CREATE_TREE_NODE_CASE_BODY(lt_expr, node_id)
312  case ltgt_expr_K:
313  CREATE_TREE_NODE_CASE_BODY(ltgt_expr, node_id)
314  case max_expr_K:
315  CREATE_TREE_NODE_CASE_BODY(max_expr, node_id)
316  case method_type_K:
319  else
321  case min_expr_K:
322  CREATE_TREE_NODE_CASE_BODY(min_expr, node_id)
323  case minus_expr_K:
324  CREATE_TREE_NODE_CASE_BODY(minus_expr, node_id)
325  case modify_expr_K:
326  CREATE_TREE_NODE_CASE_BODY(modify_expr, node_id)
327  case modop_expr_K:
328  CREATE_TREE_NODE_CASE_BODY(modop_expr, node_id)
329  case mult_expr_K:
330  CREATE_TREE_NODE_CASE_BODY(mult_expr, node_id)
331  case mult_highpart_expr_K:
332  CREATE_TREE_NODE_CASE_BODY(mult_highpart_expr, node_id)
333  case namespace_decl_K:
335  case ne_expr_K:
336  CREATE_TREE_NODE_CASE_BODY(ne_expr, node_id)
337  case negate_expr_K:
338  CREATE_TREE_NODE_CASE_BODY(negate_expr, node_id)
339  case new_expr_K:
340  CREATE_TREE_NODE_CASE_BODY(new_expr, node_id)
341  case non_lvalue_expr_K:
342  CREATE_TREE_NODE_CASE_BODY(non_lvalue_expr, node_id)
343  case nop_expr_K:
344  CREATE_TREE_NODE_CASE_BODY(nop_expr, node_id)
345  case obj_type_ref_K:
346  CREATE_TREE_NODE_CASE_BODY(obj_type_ref, node_id)
347  case offset_type_K:
348  RET_NODE_ID_CASE_BODY(offset_type, node_id)
349  case ordered_expr_K:
350  CREATE_TREE_NODE_CASE_BODY(ordered_expr, node_id)
351  case overload_K:
353  case parm_decl_K:
354  if(mode >= DECLARATION)
356  else
358  case gimple_phi_K:
359  if(mode)
361  else
363  case plus_expr_K:
364  CREATE_TREE_NODE_CASE_BODY(plus_expr, node_id)
365  case pointer_plus_expr_K:
366  CREATE_TREE_NODE_CASE_BODY(pointer_plus_expr, node_id)
367  case pointer_type_K:
369  case postdecrement_expr_K:
370  CREATE_TREE_NODE_CASE_BODY(postdecrement_expr, node_id)
371  case postincrement_expr_K:
372  CREATE_TREE_NODE_CASE_BODY(postincrement_expr, node_id)
373  case predecrement_expr_K:
374  CREATE_TREE_NODE_CASE_BODY(predecrement_expr, node_id)
375  case preincrement_expr_K:
376  CREATE_TREE_NODE_CASE_BODY(preincrement_expr, node_id)
377  case qual_union_type_K:
378  RET_NODE_ID_CASE_BODY(qual_union_type, node_id)
379  case range_expr_K:
380  CREATE_TREE_NODE_CASE_BODY(range_expr, node_id)
381  case paren_expr_K:
382  CREATE_TREE_NODE_CASE_BODY(paren_expr, node_id)
383  case rdiv_expr_K:
384  CREATE_TREE_NODE_CASE_BODY(rdiv_expr, node_id)
385  case real_cst_K:
387  case realpart_expr_K:
388  CREATE_TREE_NODE_CASE_BODY(realpart_expr, node_id)
389  case real_type_K:
391  case record_type_K:
393  case reduc_max_expr_K:
394  CREATE_TREE_NODE_CASE_BODY(reduc_max_expr, node_id)
395  case reduc_min_expr_K:
396  CREATE_TREE_NODE_CASE_BODY(reduc_min_expr, node_id)
397  case reduc_plus_expr_K:
398  CREATE_TREE_NODE_CASE_BODY(reduc_plus_expr, node_id)
399  case reference_expr_K:
400  CREATE_TREE_NODE_CASE_BODY(reference_expr, node_id)
401  case reference_type_K:
403  case reinterpret_cast_expr_K:
404  CREATE_TREE_NODE_CASE_BODY(reinterpret_cast_expr, node_id)
405  case result_decl_K:
406  if(mode >= DECLARATION)
408  else
410  case gimple_resx_K:
412  case gimple_return_K:
414  case return_stmt_K:
416  case round_div_expr_K:
417  CREATE_TREE_NODE_CASE_BODY(round_div_expr, node_id)
418  case round_mod_expr_K:
419  CREATE_TREE_NODE_CASE_BODY(round_mod_expr, node_id)
420  case rrotate_expr_K:
421  CREATE_TREE_NODE_CASE_BODY(rrotate_expr, node_id)
422  case rshift_expr_K:
423  CREATE_TREE_NODE_CASE_BODY(rshift_expr, node_id)
424  case save_expr_K:
425  CREATE_TREE_NODE_CASE_BODY(save_expr, node_id)
426  case scope_ref_K:
427  if(mode)
429  else
431  case set_le_expr_K:
432  CREATE_TREE_NODE_CASE_BODY(set_le_expr, node_id)
433  case set_type_K:
434  RET_NODE_ID_CASE_BODY(set_type, node_id)
435  case sizeof_expr_K:
436  CREATE_TREE_NODE_CASE_BODY(sizeof_expr, node_id)
437  case ssa_name_K:
438  if(mode)
440  else
442  case statement_list_K:
443  if(mode)
445  else
447  case static_cast_expr_K:
448  CREATE_TREE_NODE_CASE_BODY(static_cast_expr, node_id)
449  case string_cst_K:
451  case gimple_switch_K:
453  case target_expr_K:
455  case target_mem_ref_K:
457  case target_mem_ref461_K:
459  case mem_ref_K:
460  CREATE_TREE_NODE_CASE_BODY(mem_ref, node_id)
461  case template_decl_K:
464  else
466  case template_id_expr_K:
468  case template_parm_index_K:
470  case template_type_parm_K:
471  RET_NODE_ID_CASE_BODY(template_type_parm, node_id)
472  case ternary_plus_expr_K:
473  CREATE_TREE_NODE_CASE_BODY(ternary_plus_expr, node_id)
474  case ternary_pm_expr_K:
475  CREATE_TREE_NODE_CASE_BODY(ternary_pm_expr, node_id)
476  case ternary_mp_expr_K:
477  CREATE_TREE_NODE_CASE_BODY(ternary_mp_expr, node_id)
478  case ternary_mm_expr_K:
479  CREATE_TREE_NODE_CASE_BODY(ternary_mm_expr, node_id)
480  case throw_expr_K:
481  CREATE_TREE_NODE_CASE_BODY(throw_expr, node_id)
482  case translation_unit_decl_K:
483  RET_NODE_ID_CASE_BODY(translation_unit_decl, node_id)
484  case tree_list_K:
486  case tree_vec_K:
488  case trunc_div_expr_K:
489  CREATE_TREE_NODE_CASE_BODY(trunc_div_expr, node_id)
490  case trunc_mod_expr_K:
491  CREATE_TREE_NODE_CASE_BODY(trunc_mod_expr, node_id)
492  case truth_and_expr_K:
493  CREATE_TREE_NODE_CASE_BODY(truth_and_expr, node_id)
494  case truth_andif_expr_K:
495  CREATE_TREE_NODE_CASE_BODY(truth_andif_expr, node_id)
496  case truth_not_expr_K:
497  CREATE_TREE_NODE_CASE_BODY(truth_not_expr, node_id)
498  case truth_or_expr_K:
499  CREATE_TREE_NODE_CASE_BODY(truth_or_expr, node_id)
500  case truth_orif_expr_K:
501  CREATE_TREE_NODE_CASE_BODY(truth_orif_expr, node_id)
502  case truth_xor_expr_K:
503  CREATE_TREE_NODE_CASE_BODY(truth_xor_expr, node_id)
504  case try_block_K:
506  case try_catch_expr_K:
507  CREATE_TREE_NODE_CASE_BODY(try_catch_expr, node_id)
508  case try_finally_K:
509  CREATE_TREE_NODE_CASE_BODY(try_finally, node_id)
510  case type_decl_K:
512  case typename_type_K:
514  case uneq_expr_K:
515  CREATE_TREE_NODE_CASE_BODY(uneq_expr, node_id)
516  case unge_expr_K:
517  CREATE_TREE_NODE_CASE_BODY(unge_expr, node_id)
518  case ungt_expr_K:
519  CREATE_TREE_NODE_CASE_BODY(ungt_expr, node_id)
520  case union_type_K:
522  case unle_expr_K:
523  CREATE_TREE_NODE_CASE_BODY(unle_expr, node_id)
524  case unlt_expr_K:
525  CREATE_TREE_NODE_CASE_BODY(unlt_expr, node_id)
526  case unordered_expr_K:
527  CREATE_TREE_NODE_CASE_BODY(unordered_expr, node_id)
528  case unsave_expr_K:
529  CREATE_TREE_NODE_CASE_BODY(unsave_expr, node_id)
530  case using_decl_K:
532  case va_arg_expr_K:
533  CREATE_TREE_NODE_CASE_BODY(va_arg_expr, node_id)
534  case var_decl_K:
535  {
536  const auto vd = GetPointerS<const var_decl>(tn);
537  if(mode >= DECLARATION && (!vd->scpe || (GET_CONST_NODE(vd->scpe)->get_kind() != translation_unit_decl_K &&
538  GET_CONST_NODE(vd->scpe)->get_kind() != namespace_decl_K)))
539  {
540  if(vd->static_flag)
541  {
542  if(remap.find(tn->index) != remap.end())
543  {
544  node_id = remap.find(tn->index)->second;
545  }
546  else
547  {
548  node_id = tn->index;
549  }
550  const auto new_tn = GetPointerS<var_decl>(TM->GetTreeNode(node_id));
551  new_tn->scpe = GetPointerS<const decl_node>(GET_CONST_NODE(new_tn->scpe))->scpe;
552  break;
553  }
554  else
556  }
557  else
559  }
560  case vec_new_expr_K:
561  CREATE_TREE_NODE_CASE_BODY(vec_new_expr, node_id)
562  case vec_cond_expr_K:
563  CREATE_TREE_NODE_CASE_BODY(vec_cond_expr, node_id)
564  case vec_perm_expr_K:
565  CREATE_TREE_NODE_CASE_BODY(vec_perm_expr, node_id)
566  case dot_prod_expr_K:
567  CREATE_TREE_NODE_CASE_BODY(dot_prod_expr, node_id)
568  case vec_lshift_expr_K:
569  CREATE_TREE_NODE_CASE_BODY(vec_lshift_expr, node_id)
570  case vec_rshift_expr_K:
571  CREATE_TREE_NODE_CASE_BODY(vec_rshift_expr, node_id)
572  case widen_mult_hi_expr_K:
573  CREATE_TREE_NODE_CASE_BODY(widen_mult_hi_expr, node_id)
574  case widen_mult_lo_expr_K:
575  CREATE_TREE_NODE_CASE_BODY(widen_mult_lo_expr, node_id)
576  case vec_unpack_hi_expr_K:
577  CREATE_TREE_NODE_CASE_BODY(vec_unpack_hi_expr, node_id)
578  case vec_unpack_lo_expr_K:
579  CREATE_TREE_NODE_CASE_BODY(vec_unpack_lo_expr, node_id)
580  case vec_unpack_float_hi_expr_K:
581  CREATE_TREE_NODE_CASE_BODY(vec_unpack_float_hi_expr, node_id)
582  case vec_unpack_float_lo_expr_K:
583  CREATE_TREE_NODE_CASE_BODY(vec_unpack_float_lo_expr, node_id)
584  case vec_pack_trunc_expr_K:
585  CREATE_TREE_NODE_CASE_BODY(vec_pack_trunc_expr, node_id)
586  case vec_pack_sat_expr_K:
587  CREATE_TREE_NODE_CASE_BODY(vec_pack_sat_expr, node_id)
588  case vec_pack_fix_trunc_expr_K:
589  CREATE_TREE_NODE_CASE_BODY(vec_pack_fix_trunc_expr, node_id)
590  case vec_extracteven_expr_K:
591  CREATE_TREE_NODE_CASE_BODY(vec_extracteven_expr, node_id)
592  case vec_extractodd_expr_K:
593  CREATE_TREE_NODE_CASE_BODY(vec_extractodd_expr, node_id)
594  case vec_interleavehigh_expr_K:
595  CREATE_TREE_NODE_CASE_BODY(vec_interleavehigh_expr, node_id)
596  case vec_interleavelow_expr_K:
597  CREATE_TREE_NODE_CASE_BODY(vec_interleavelow_expr, node_id)
598  case vector_cst_K:
600  case void_cst_K:
601  RET_NODE_ID_CASE_BODY(void_cst, node_id)
602  case type_argument_pack_K:
604  case nontype_argument_pack_K:
606  case expr_pack_expansion_K:
608  case vector_type_K:
610  case view_convert_expr_K:
611  CREATE_TREE_NODE_CASE_BODY(view_convert_expr, node_id)
612  case gimple_predict_K:
614  case void_type_K:
615  RET_NODE_ID_CASE_BODY(void_type, node_id)
616  case vtable_ref_K:
617  RET_NODE_ID_CASE_BODY(vtable_ref, node_id)
618  case with_cleanup_expr_K:
619  CREATE_TREE_NODE_CASE_BODY(with_cleanup_expr, node_id)
620  case with_size_expr_K:
621  CREATE_TREE_NODE_CASE_BODY(with_size_expr, node_id)
622  case gimple_while_K:
624  case gimple_for_K:
626  case gimple_pragma_K:
628  case omp_pragma_K:
630  case omp_atomic_pragma_K:
632  case omp_for_pragma_K:
634  case omp_simd_pragma_K:
636  case omp_declare_simd_pragma_K:
638  case omp_parallel_pragma_K:
640  case omp_sections_pragma_K:
642  case omp_parallel_sections_pragma_K:
644  case omp_section_pragma_K:
646  case map_pragma_K:
648  case call_hw_pragma_K:
650  case call_point_hw_pragma_K:
652  case issue_pragma_K:
654  case profiling_pragma_K:
656  case blackbox_pragma_K:
658  case statistical_profiling_K:
660  case null_node_K:
662  case gimple_nop_K:
664  case identifier_node_K:
666  case widen_sum_expr_K:
667  CREATE_TREE_NODE_CASE_BODY(widen_sum_expr, node_id)
668  case widen_mult_expr_K:
669  CREATE_TREE_NODE_CASE_BODY(widen_mult_expr, node_id)
670  case trait_expr_K:
671  CREATE_TREE_NODE_CASE_BODY(trait_expr, node_id)
672  case omp_target_pragma_K:
674  case omp_task_pragma_K:
676  case omp_critical_pragma_K:
678  case gimple_multi_way_if_K:
680  case extract_bit_expr_K:
681  CREATE_TREE_NODE_CASE_BODY(extract_bit_expr, node_id)
682  case sat_plus_expr_K:
683  CREATE_TREE_NODE_CASE_BODY(sat_plus_expr, node_id)
684  case sat_minus_expr_K:
685  CREATE_TREE_NODE_CASE_BODY(sat_minus_expr, node_id)
686  case fshl_expr_K:
687  CREATE_TREE_NODE_CASE_BODY(fshl_expr, node_id)
688  case fshr_expr_K:
689  CREATE_TREE_NODE_CASE_BODY(fshr_expr, node_id)
690  case extractvalue_expr_K:
691  CREATE_TREE_NODE_CASE_BODY(extractvalue_expr, node_id)
692  case insertvalue_expr_K:
693  CREATE_TREE_NODE_CASE_BODY(insertvalue_expr, node_id)
694  case extractelement_expr_K:
695  CREATE_TREE_NODE_CASE_BODY(extractelement_expr, node_id)
696  case insertelement_expr_K:
697  CREATE_TREE_NODE_CASE_BODY(insertelement_expr, node_id)
698  case frem_expr_K:
699  CREATE_TREE_NODE_CASE_BODY(frem_expr, node_id)
700  case do_stmt_K:
701  case if_stmt_K:
702  case for_stmt_K:
703  case while_stmt_K:
704  case CASE_FAKE_NODES:
705  {
707  break;
708  }
709  default:
710  THROW_UNREACHABLE("");
711  }
712  return node_id;
713 }
714 
715 unsigned int tree_node_dup::get_bbi(unsigned int old_bbi)
716 {
717  if(remap_bbi)
718  {
719  const auto t = remap_bb.insert(std::make_pair(old_bbi, remap_bbi));
720  return t.second ? remap_bbi++ : t.first->second;
721  }
722  return old_bbi;
723 }
724 
725 unsigned int tree_node_dup::get_loop_id(unsigned int old_loop_id)
726 {
727  if(remap_loop_id)
728  {
729  const auto t = remap_lid.insert(std::make_pair(old_loop_id, remap_loop_id));
730  return t.second ? remap_loop_id++ : t.first->second;
731  }
732  return old_loop_id;
733 }
734 
735 void tree_node_dup::operator()(const tree_node* obj, unsigned int&)
736 {
737  THROW_ERROR("tree_node not supported: " + std::string(obj->get_kind_text()));
738 }
739 
740 void tree_node_dup::operator()(const tree_reindex* obj, unsigned int&)
741 {
742  THROW_ERROR("tree_node not supported: " + std::string(obj->get_kind_text()));
743 }
744 
745 void tree_node_dup::operator()(const attr* obj, unsigned int& mask)
746 {
747  THROW_ASSERT(obj == dynamic_cast<attr*>(curr_tree_node_ptr), "wrong factory setup");
748  tree_node_mask::operator()(obj, mask);
749  // cppcheck-suppress unusedVariable
750  bool attr_p;
751 
752 #define ATTR_SEQ \
753  (TOK_NEW)(TOK_DELETE)(TOK_ASSIGN)(TOK_MEMBER)(TOK_PUBLIC)(TOK_PROTECTED)(TOK_PRIVATE)(TOK_NORETURN)(TOK_VOLATILE)( \
754  TOK_NOINLINE)(TOK_ALWAYS_INLINE)(TOK_USED)(TOK_UNUSED)(TOK_CONST)(TOK_TRANSPARENT_UNION)(TOK_CONSTRUCTOR)( \
755  TOK_DESTRUCTOR)(TOK_MODE)(TOK_SECTION)(TOK_ALIGNED)(TOK_WEAK)(TOK_ALIAS)(TOK_NO_INSTRUMENT_FUNCTION)( \
756  TOK_MALLOC)(TOK_NO_STACK_LIMIT)(TOK_PURE)(TOK_DEPRECATED)(TOK_VECTOR_SIZE)(TOK_VISIBILITY)(TOK_TLS_MODEL)( \
757  TOK_NONNULL)(TOK_NOTHROW)(TOK_MAY_ALIAS)(TOK_WARN_UNUSED_RESULT)(TOK_FORMAT)(TOK_FORMAT_ARG)(TOK_NULL)( \
758  TOK_GLOBAL_INIT)(TOK_GLOBAL_FINI)(TOK_CONVERSION)(TOK_VIRTUAL)(TOK_LSHIFT)(TOK_MUTABLE)(TOK_PSEUDO_TMPL)( \
759  TOK_VECNEW)(TOK_VECDELETE)(TOK_POS)(TOK_NEG)(TOK_ADDR)(TOK_DEREF)(TOK_LNOT)(TOK_NOT)(TOK_PREINC)(TOK_PREDEC)( \
760  TOK_PLUSASSIGN)(TOK_PLUS)(TOK_MINUSASSIGN)(TOK_MINUS)(TOK_MULTASSIGN)(TOK_MULT)(TOK_DIVASSIGN)(TOK_DIV)( \
761  TOK_MODASSIGN)(TOK_MOD)(TOK_ANDASSIGN)(TOK_AND)(TOK_ORASSIGN)(TOK_OR)(TOK_XORASSIGN)(TOK_XOR)( \
762  TOK_LSHIFTASSIGN)(TOK_RSHIFTASSIGN)(TOK_RSHIFT)(TOK_EQ)(TOK_NE)(TOK_LT)(TOK_GT)(TOK_LE)(TOK_GE)(TOK_LAND)( \
763  TOK_LOR)(TOK_COMPOUND)(TOK_MEMREF)(TOK_REF)(TOK_SUBS)(TOK_POSTINC)(TOK_POSTDEC)(TOK_CALL)(TOK_THUNK)( \
764  TOK_THIS_ADJUSTING)(TOK_RESULT_ADJUSTING)(TOK_BITFIELD)
765 #define ATTR_MACRO(r, data, elem) \
766  attr_p = GetPointer<attr>(source_tn)->list_attr.find(TOK(elem)) != GetPointer<attr>(source_tn)->list_attr.end(); \
767  if(attr_p) \
768  dynamic_cast<attr*>(curr_tree_node_ptr)->list_attr.insert(TOK(elem));
769 
770  BOOST_PP_SEQ_FOR_EACH(ATTR_MACRO, BOOST_PP_EMPTY, ATTR_SEQ);
771 #undef ATTR_MACRO
772 #undef ATTR_SEQ
773 }
774 
775 #define SET_NODE_ID(field, type) \
776  if(GetPointer<type>(source_tn)->field) \
777  { \
778  unsigned int node_id = GET_INDEX_NODE(GetPointer<type>(source_tn)->field); \
779  if(remap.find(node_id) != remap.end()) \
780  { \
781  node_id = remap.find(node_id)->second; \
782  } \
783  else \
784  { \
785  tree_node* saved_curr_tree_node_ptr = curr_tree_node_ptr; \
786  tree_nodeRef saved_source_tn = source_tn; \
787  node_id = create_tree_node(GET_NODE(GetPointer<type>(source_tn)->field), mode); \
788  curr_tree_node_ptr = saved_curr_tree_node_ptr; \
789  source_tn = saved_source_tn; \
790  } \
791  dynamic_cast<type*>(curr_tree_node_ptr)->field = TM->GetTreeReindex(node_id); \
792  }
793 
794 #define SEQ_SET_NODE_ID(list_field, type) \
795  if(!GetPointer<type>(source_tn)->list_field.empty()) \
796  { \
797  for(auto const& field : GetPointer<type>(source_tn)->list_field) \
798  { \
799  unsigned int node_id = field->index; \
800  if(remap.find(node_id) != remap.end()) \
801  node_id = remap.find(node_id)->second; \
802  else \
803  { \
804  tree_node* saved_curr_tree_node_ptr = curr_tree_node_ptr; \
805  tree_nodeRef saved_source_tn = source_tn; \
806  node_id = create_tree_node(GET_NODE(field), mode); \
807  curr_tree_node_ptr = saved_curr_tree_node_ptr; \
808  source_tn = saved_source_tn; \
809  } \
810  dynamic_cast<type*>(curr_tree_node_ptr)->list_field.push_back(TM->GetTreeReindex(node_id)); \
811  } \
812  }
813 
814 #define SET_SET_NODE_ID(list_field, type) \
815  if(!GetPointer<type>(source_tn)->list_field.empty()) \
816  { \
817  for(const auto& i : GetPointer<type>(source_tn)->list_field) \
818  { \
819  unsigned int node_id = GET_INDEX_NODE(i); \
820  if(remap.find(node_id) != remap.end()) \
821  node_id = remap.find(node_id)->second; \
822  else \
823  { \
824  tree_node* saved_curr_tree_node_ptr = curr_tree_node_ptr; \
825  tree_nodeRef saved_source_tn = source_tn; \
826  node_id = create_tree_node(GET_NODE(i), mode); \
827  curr_tree_node_ptr = saved_curr_tree_node_ptr; \
828  source_tn = saved_source_tn; \
829  } \
830  dynamic_cast<type*>(curr_tree_node_ptr)->list_field.insert(TM->GetTreeReindex(node_id)); \
831  } \
832  }
833 
834 #define LSEQ_SET_NODE_ID(list_field, type) \
835  if(!GetPointer<type>(source_tn)->list_field.empty()) \
836  { \
837  std::list<tree_nodeRef>::const_iterator vend = GetPointer<type>(source_tn)->list_field.end(); \
838  for(std::list<tree_nodeRef>::const_iterator i = GetPointer<type>(source_tn)->list_field.begin(); i != vend; ++i) \
839  { \
840  unsigned int node_id = GET_INDEX_NODE(*i); \
841  if(remap.find(node_id) != remap.end()) \
842  node_id = remap.find(node_id)->second; \
843  else \
844  { \
845  tree_node* saved_curr_tree_node_ptr = curr_tree_node_ptr; \
846  tree_nodeRef saved_source_tn = source_tn; \
847  node_id = create_tree_node(GET_NODE(*i), mode); \
848  curr_tree_node_ptr = saved_curr_tree_node_ptr; \
849  source_tn = saved_source_tn; \
850  } \
851  dynamic_cast<type*>(curr_tree_node_ptr)->list_field.push_back(TM->GetTreeReindex(node_id)); \
852  } \
853  }
854 
855 #define SET_VALUE(field, type) (dynamic_cast<type*>(curr_tree_node_ptr)->field = GetPointer<type>(source_tn)->field)
856 
857 void tree_node_dup::operator()(const srcp* obj, unsigned int& mask)
858 {
859  THROW_ASSERT(obj == dynamic_cast<srcp*>(curr_tree_node_ptr), "wrong factory setup");
860  tree_node_mask::operator()(obj, mask);
861  SET_VALUE(include_name, srcp);
862  SET_VALUE(line_number, srcp);
863  SET_VALUE(column_number, srcp);
864 }
865 
866 void tree_node_dup::operator()(const WeightedNode* obj, unsigned int& mask)
867 {
868  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
869  tree_node_mask::operator()(obj, mask);
870 }
871 
872 void tree_node_dup::operator()(const decl_node* obj, unsigned int& mask)
873 {
874  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
875  tree_node_mask::operator()(obj, mask);
876 
877  SET_NODE_ID(name, decl_node);
878  SET_NODE_ID(mngl, decl_node);
879  SET_NODE_ID(orig, decl_node);
881  SET_NODE_ID(scpe, decl_node);
882  SET_NODE_ID(attributes, decl_node);
883  SET_NODE_ID(chan, decl_node);
884  SET_VALUE(artificial_flag, decl_node);
885  SET_VALUE(packed_flag, decl_node);
886  SET_VALUE(operating_system_flag, decl_node);
887  SET_VALUE(library_system_flag, decl_node);
888  SET_VALUE(C_flag, decl_node);
889  SET_VALUE(uid, decl_node);
890 }
891 
892 void tree_node_dup::operator()(const expr_node* obj, unsigned int& mask)
893 {
894  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
895  tree_node_mask::operator()(obj, mask);
897 }
898 
899 void tree_node_dup::operator()(const gimple_node* obj, unsigned int& mask)
900 {
901  tree_node_mask::operator()(obj, mask);
902  SET_NODE_ID(memuse, gimple_node);
903  SET_NODE_ID(memdef, gimple_node);
905  SET_NODE_ID(vdef, gimple_node);
906  SET_SET_NODE_ID(vovers, gimple_node);
907  SEQ_SET_NODE_ID(pragmas, gimple_node);
908  SET_NODE_ID(scpe, gimple_node);
909  SET_VALUE(bb_index, gimple_node);
910  SET_VALUE(use_set->anything, gimple_node);
911  SET_VALUE(use_set->escaped, gimple_node);
912  SET_VALUE(use_set->ipa_escaped, gimple_node);
913  SET_VALUE(use_set->nonlocal, gimple_node);
914  SET_VALUE(use_set->null, gimple_node);
915  SET_VALUE(clobbered_set->anything, gimple_node);
916  SET_VALUE(clobbered_set->escaped, gimple_node);
917  SET_VALUE(clobbered_set->ipa_escaped, gimple_node);
918  SET_VALUE(clobbered_set->nonlocal, gimple_node);
919  SET_VALUE(clobbered_set->null, gimple_node);
920  SEQ_SET_NODE_ID(use_set->variables, gimple_node);
921  SEQ_SET_NODE_ID(clobbered_set->variables, gimple_node);
922 }
923 
924 void tree_node_dup::operator()(const unary_expr* obj, unsigned int& mask)
925 {
926  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
927  tree_node_mask::operator()(obj, mask);
928  SET_NODE_ID(op, unary_expr);
929 }
930 
931 void tree_node_dup::operator()(const binary_expr* obj, unsigned int& mask)
932 {
933  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
934  tree_node_mask::operator()(obj, mask);
935  SET_NODE_ID(op0, binary_expr);
936  SET_NODE_ID(op1, binary_expr);
937 }
938 
939 void tree_node_dup::operator()(const ternary_expr* obj, unsigned int& mask)
940 {
941  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
942  tree_node_mask::operator()(obj, mask);
946 }
947 
948 void tree_node_dup::operator()(const quaternary_expr* obj, unsigned int& mask)
949 {
950  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
951  tree_node_mask::operator()(obj, mask);
956 }
957 
958 void tree_node_dup::operator()(const type_node* obj, unsigned int& mask)
959 {
960  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
961  tree_node_mask::operator()(obj, mask);
962  SET_VALUE(qual, type_node);
963  SET_NODE_ID(name, type_node);
964  SET_NODE_ID(unql, type_node);
965  SET_NODE_ID(size, type_node);
966  SET_NODE_ID(scpe, type_node);
967  SET_VALUE(system_flag, type_node);
968  SET_VALUE(packed_flag, type_node);
969  SET_VALUE(algn, type_node);
970 }
971 
972 void tree_node_dup::operator()(const memory_tag* obj, unsigned int& mask)
973 {
974  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
975  tree_node_mask::operator()(obj, mask);
976  SEQ_SET_NODE_ID(list_of_aliases, memory_tag);
977 }
978 
979 void tree_node_dup::operator()(const cst_node* obj, unsigned int& mask)
980 {
981  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
982  tree_node_mask::operator()(obj, mask);
984 }
985 
986 void tree_node_dup::operator()(const error_mark* obj, unsigned int& mask)
987 {
988  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
989  tree_node_mask::operator()(obj, mask);
990 }
991 
992 void tree_node_dup::operator()(const array_type* obj, unsigned int& mask)
993 {
994  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
995  tree_node_mask::operator()(obj, mask);
996  SET_NODE_ID(elts, array_type);
997  SET_NODE_ID(domn, array_type);
998 }
999 
1000 void tree_node_dup::operator()(const gimple_asm* obj, unsigned int& mask)
1001 {
1002  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1003  tree_node_mask::operator()(obj, mask);
1004  SET_VALUE(volatile_flag, gimple_asm);
1006  SET_NODE_ID(out, gimple_asm);
1007  SET_NODE_ID(in, gimple_asm);
1008  SET_NODE_ID(clob, gimple_asm);
1009 }
1010 
1011 void tree_node_dup::operator()(const baselink* obj, unsigned int& mask)
1012 {
1013  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1014  tree_node_mask::operator()(obj, mask);
1016 }
1017 
1018 void tree_node_dup::operator()(const gimple_bind* obj, unsigned int& mask)
1019 {
1020  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1021  tree_node_mask::operator()(obj, mask);
1022  SEQ_SET_NODE_ID(list_of_vars, gimple_bind);
1023  SET_NODE_ID(body, gimple_bind);
1024 }
1025 
1026 void tree_node_dup::operator()(const binfo* obj, unsigned int& mask)
1027 {
1028  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1029  tree_node_mask::operator()(obj, mask);
1031  SET_VALUE(virt_flag, binfo);
1032  SET_VALUE(bases, binfo);
1033  if(!GetPointer<binfo>(source_tn)->list_of_access_binf.empty())
1034  {
1035  auto vend = GetPointer<binfo>(source_tn)->list_of_access_binf.end();
1036  for(auto i = GetPointer<binfo>(source_tn)->list_of_access_binf.begin(); i != vend; ++i)
1037  {
1038  unsigned int node_id = GET_INDEX_NODE(i->second);
1039  THROW_ASSERT(remap.find(node_id) != remap.end(), "missing an index");
1040  node_id = remap.find(node_id)->second;
1041  dynamic_cast<binfo*>(curr_tree_node_ptr)->add_access_binf(TM->GetTreeReindex(node_id), i->first);
1042  }
1043  }
1044 }
1045 
1046 void tree_node_dup::operator()(const block* obj, unsigned int& mask)
1047 {
1048  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1049  tree_node_mask::operator()(obj, mask);
1050  SET_VALUE(bl_flag, block);
1051  SET_VALUE(bl, block);
1052 }
1053 
1054 void tree_node_dup::operator()(const call_expr* obj, unsigned int& mask)
1055 {
1056  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1057  tree_node_mask::operator()(obj, mask);
1058  SET_NODE_ID(fn, call_expr);
1060 }
1061 
1062 void tree_node_dup::operator()(const aggr_init_expr* obj, unsigned int& mask)
1063 {
1064  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1065  tree_node_mask::operator()(obj, mask);
1066  SET_NODE_ID(slot, aggr_init_expr);
1067 }
1068 
1069 void tree_node_dup::operator()(const gimple_call* obj, unsigned int& mask)
1070 {
1071  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1072  tree_node_mask::operator()(obj, mask);
1073  SET_NODE_ID(fn, gimple_call);
1075  SET_VALUE(use_set->anything, gimple_call);
1076  SET_VALUE(use_set->escaped, gimple_call);
1077  SET_VALUE(use_set->ipa_escaped, gimple_call);
1078  SET_VALUE(use_set->nonlocal, gimple_call);
1079  SET_VALUE(use_set->null, gimple_call);
1080  SET_VALUE(clobbered_set->anything, gimple_call);
1081  SET_VALUE(clobbered_set->escaped, gimple_call);
1082  SET_VALUE(clobbered_set->ipa_escaped, gimple_call);
1083  SET_VALUE(clobbered_set->nonlocal, gimple_call);
1084  SET_VALUE(clobbered_set->null, gimple_call);
1085  SEQ_SET_NODE_ID(use_set->variables, gimple_call);
1086  SEQ_SET_NODE_ID(clobbered_set->variables, gimple_call);
1087 }
1088 
1089 void tree_node_dup::operator()(const case_label_expr* obj, unsigned int& mask)
1090 {
1091  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1092  tree_node_mask::operator()(obj, mask);
1095  SET_VALUE(default_flag, case_label_expr);
1097 }
1098 
1099 void tree_node_dup::operator()(const cast_expr* obj, unsigned int& mask)
1100 {
1101  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1102  tree_node_mask::operator()(obj, mask);
1103  SET_NODE_ID(op, cast_expr);
1104 }
1105 
1106 void tree_node_dup::operator()(const complex_cst* obj, unsigned int& mask)
1107 {
1108  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1109  tree_node_mask::operator()(obj, mask);
1110  SET_NODE_ID(real, complex_cst);
1111  SET_NODE_ID(imag, complex_cst);
1112 }
1113 
1114 void tree_node_dup::operator()(const complex_type* obj, unsigned int& mask)
1115 {
1116  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1117  tree_node_mask::operator()(obj, mask);
1118  SET_VALUE(unsigned_flag, complex_type);
1119  SET_VALUE(real_flag, complex_type);
1120 }
1121 
1122 void tree_node_dup::operator()(const gimple_cond* obj, unsigned int& mask)
1123 {
1124  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1125  tree_node_mask::operator()(obj, mask);
1126  SET_NODE_ID(op0, gimple_cond);
1127 }
1128 
1129 void tree_node_dup::operator()(const const_decl* obj, unsigned int& mask)
1130 {
1131  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1132  tree_node_mask::operator()(obj, mask);
1133  SET_NODE_ID(cnst, const_decl);
1134 }
1135 
1136 void tree_node_dup::operator()(const constructor* obj, unsigned int& mask)
1137 {
1138  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1139  tree_node_mask::operator()(obj, mask);
1141  if(!GetPointer<constructor>(source_tn)->list_of_idx_valu.empty())
1142  {
1143  auto vend = GetPointer<constructor>(source_tn)->list_of_idx_valu.end();
1144  for(auto i = GetPointer<constructor>(source_tn)->list_of_idx_valu.begin(); i != vend; ++i)
1145  {
1146  unsigned int node_id1 = i->first ? GET_INDEX_NODE(i->first) : 0;
1147  unsigned int node_id2 = GET_INDEX_NODE(i->second);
1148  if(mode && node_id1 && remap.find(node_id1) == remap.end())
1149  {
1150  tree_node* saved_curr_tree_node_ptr = curr_tree_node_ptr;
1151  tree_nodeRef saved_source_tn = source_tn;
1152  node_id1 = create_tree_node(GET_NODE(i->first), mode);
1153  curr_tree_node_ptr = saved_curr_tree_node_ptr;
1154  source_tn = saved_source_tn;
1155  }
1156  else
1157  {
1158  THROW_ASSERT(!node_id1 || remap.find(node_id1) != remap.end(), "missing an index");
1159  node_id1 = node_id1 ? remap.find(node_id1)->second : 0;
1160  }
1161  if(mode && remap.find(node_id2) == remap.end())
1162  {
1163  tree_node* saved_curr_tree_node_ptr = curr_tree_node_ptr;
1164  tree_nodeRef saved_source_tn = source_tn;
1165  node_id2 = create_tree_node(GET_NODE(i->second), mode);
1166  curr_tree_node_ptr = saved_curr_tree_node_ptr;
1167  source_tn = saved_source_tn;
1168  }
1169  else
1170  {
1171  THROW_ASSERT(remap.find(node_id2) != remap.end(), "missing an index");
1172  node_id2 = remap.find(node_id2)->second;
1173  }
1174  if(node_id1)
1175  {
1176  dynamic_cast<constructor*>(curr_tree_node_ptr)
1177  ->add_idx_valu(TM->GetTreeReindex(node_id1), TM->GetTreeReindex(node_id2));
1178  }
1179  else
1180  {
1181  dynamic_cast<constructor*>(curr_tree_node_ptr)->add_valu(TM->GetTreeReindex(node_id2));
1182  }
1183  }
1184  }
1185 }
1186 
1187 void tree_node_dup::operator()(const enumeral_type* obj, unsigned int& mask)
1188 {
1189  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1190  tree_node_mask::operator()(obj, mask);
1191  SET_VALUE(prec, enumeral_type);
1192  SET_VALUE(unsigned_flag, enumeral_type);
1195  SET_NODE_ID(csts, enumeral_type);
1196 }
1197 
1198 void tree_node_dup::operator()(const expr_stmt* obj, unsigned int& mask)
1199 {
1200  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1201  tree_node_mask::operator()(obj, mask);
1202 
1204  SET_NODE_ID(expr, expr_stmt);
1205  SET_NODE_ID(next, expr_stmt);
1206 }
1207 
1208 void tree_node_dup::operator()(const field_decl* obj, unsigned int& mask)
1209 {
1210  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1211  tree_node_mask::operator()(obj, mask);
1212  SET_VALUE(algn, field_decl);
1214  SET_NODE_ID(size, field_decl);
1215  SET_NODE_ID(bpos, field_decl);
1216  SET_NODE_ID(smt_ann, field_decl);
1217 }
1218 
1219 void tree_node_dup::operator()(const function_decl* obj, unsigned int& mask)
1220 {
1221  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1222  tree_node_mask::operator()(obj, mask);
1223  SET_VALUE(operator_flag, function_decl);
1224  if(!GetPointer<function_decl>(source_tn)->list_of_op_names.empty())
1225  {
1226  auto vend = GetPointer<function_decl>(source_tn)->list_of_op_names.end();
1227  for(auto i = GetPointer<function_decl>(source_tn)->list_of_op_names.begin(); i != vend; ++i)
1228  {
1229  dynamic_cast<function_decl*>(curr_tree_node_ptr)->add(*i);
1230  }
1231  }
1232 
1233  SET_NODE_ID(tmpl_parms, function_decl);
1234  SET_NODE_ID(tmpl_args, function_decl);
1235 
1236  SET_VALUE(fixd, function_decl);
1237  SET_VALUE(fixd_flag, function_decl);
1238  SET_VALUE(virt_flag, function_decl);
1239  SET_VALUE(virt, function_decl);
1241  SEQ_SET_NODE_ID(list_of_args, function_decl);
1242  SET_VALUE(undefined_flag, function_decl);
1243  SET_VALUE(builtin_flag, function_decl);
1244  SET_VALUE(static_flag, function_decl);
1245  SET_VALUE(hwcall_flag, function_decl);
1246  SET_VALUE(reverse_restrict_flag, function_decl);
1247  SET_VALUE(writing_memory, function_decl);
1248  SET_VALUE(reading_memory, function_decl);
1249  SET_VALUE(pipeline_enabled, function_decl);
1250  SET_VALUE(simple_pipeline, function_decl);
1251  SET_VALUE(initiation_time, function_decl);
1252 #if HAVE_FROM_PRAGMA_BUILT
1253  SET_VALUE(omp_atomic, function_decl);
1254  SET_VALUE(omp_body_loop, function_decl);
1255  SET_VALUE(omp_critical, function_decl);
1256  SET_VALUE(omp_for_wrapper, function_decl);
1257 #endif
1258  const auto prev_mode = mode;
1260  {
1261  // Avoid recursvie function_decl duplication
1262  mode = DECLARATION;
1263  }
1264  SET_NODE_ID(body, function_decl);
1265  SET_NODE_ID(inline_body, function_decl);
1266  mode = prev_mode;
1267 }
1268 
1269 void tree_node_dup::operator()(const function_type* obj, unsigned int& mask)
1270 {
1271  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1272  tree_node_mask::operator()(obj, mask);
1273  SET_NODE_ID(retn, function_type);
1274  SET_NODE_ID(prms, function_type);
1275  SET_VALUE(varargs_flag, function_type);
1276 }
1277 
1278 void tree_node_dup::operator()(const gimple_assign* obj, unsigned int& mask)
1279 {
1280  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1281  tree_node_mask::operator()(obj, mask);
1282  SET_NODE_ID(op0, gimple_assign);
1283  SET_NODE_ID(op1, gimple_assign);
1284  SET_NODE_ID(predicate, gimple_assign);
1285  SET_VALUE(init_assignment, gimple_assign);
1286  SET_VALUE(clobber, gimple_assign);
1287  SET_VALUE(temporary_address, gimple_assign);
1288  SET_VALUE(use_set->anything, gimple_assign);
1289  SET_VALUE(use_set->escaped, gimple_assign);
1290  SET_VALUE(use_set->ipa_escaped, gimple_assign);
1291  SET_VALUE(use_set->nonlocal, gimple_assign);
1292  SET_VALUE(use_set->null, gimple_assign);
1293  SET_VALUE(clobbered_set->anything, gimple_assign);
1294  SET_VALUE(clobbered_set->escaped, gimple_assign);
1295  SET_VALUE(clobbered_set->ipa_escaped, gimple_assign);
1296  SET_VALUE(clobbered_set->nonlocal, gimple_assign);
1297  SET_VALUE(clobbered_set->null, gimple_assign);
1298  SEQ_SET_NODE_ID(use_set->variables, gimple_assign);
1299  SEQ_SET_NODE_ID(clobbered_set->variables, gimple_assign);
1300 }
1301 
1302 void tree_node_dup::operator()(const gimple_goto* obj, unsigned int& mask)
1303 {
1304  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1305  tree_node_mask::operator()(obj, mask);
1306  SET_NODE_ID(op, gimple_goto);
1307 }
1308 
1309 void tree_node_dup::operator()(const handler* obj, unsigned int& mask)
1310 {
1311  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1312  tree_node_mask::operator()(obj, mask);
1313 
1315  SET_NODE_ID(body, handler);
1316 }
1317 
1318 void tree_node_dup::operator()(const identifier_node* obj, unsigned int& mask)
1319 {
1320  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1321  tree_node_mask::operator()(obj, mask);
1322  THROW_ERROR("Use find_identifier_nodeID to find identifier_node objects");
1323 }
1324 
1325 void tree_node_dup::operator()(const integer_cst* obj, unsigned int& mask)
1326 {
1327  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1328  tree_node_mask::operator()(obj, mask);
1330 }
1331 
1332 void tree_node_dup::operator()(const integer_type* obj, unsigned int& mask)
1333 {
1334  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1335  tree_node_mask::operator()(obj, mask);
1336  SET_VALUE(prec, integer_type);
1338  SET_VALUE(unsigned_flag, integer_type);
1341 }
1342 
1343 void tree_node_dup::operator()(const gimple_label* obj, unsigned int& mask)
1344 {
1345  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1346  tree_node_mask::operator()(obj, mask);
1348 }
1349 
1350 void tree_node_dup::operator()(const method_type* obj, unsigned int& mask)
1351 {
1352  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1353  tree_node_mask::operator()(obj, mask);
1354  SET_NODE_ID(clas, method_type);
1355 }
1356 
1357 void tree_node_dup::operator()(const namespace_decl* obj, unsigned int& mask)
1358 {
1359  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1360  tree_node_mask::operator()(obj, mask);
1361  SET_NODE_ID(dcls, namespace_decl);
1362 }
1363 
1364 void tree_node_dup::operator()(const overload* obj, unsigned int& mask)
1365 {
1366  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1367  tree_node_mask::operator()(obj, mask);
1368 
1369  SET_NODE_ID(crnt, overload);
1370  SET_NODE_ID(chan, overload);
1371 }
1372 
1373 void tree_node_dup::operator()(const parm_decl* obj, unsigned int& mask)
1374 {
1375  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1376  tree_node_mask::operator()(obj, mask);
1377  SET_NODE_ID(argt, parm_decl);
1378  SET_NODE_ID(size, parm_decl);
1379  SET_NODE_ID(scpe, parm_decl);
1380  SET_VALUE(algn, parm_decl);
1381  SET_VALUE(used, parm_decl);
1382  SET_VALUE(register_flag, parm_decl);
1383  SET_VALUE(readonly_flag, parm_decl);
1384  SET_NODE_ID(smt_ann, parm_decl);
1385 }
1386 
1387 void tree_node_dup::operator()(const gimple_phi* obj, unsigned int& mask)
1388 {
1389  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1390  tree_node_mask::operator()(obj, mask);
1391 
1392  SET_NODE_ID(res, gimple_phi);
1393  for(const auto& def_edge : GetPointer<gimple_phi>(source_tn)->CGetDefEdgesList())
1394  {
1395  unsigned int node_id = GET_INDEX_NODE(def_edge.first);
1396  if(mode)
1397  {
1398  const auto rnode = remap.find(node_id);
1399  if(rnode != remap.end())
1400  {
1401  node_id = rnode->second;
1402  }
1403  else
1404  {
1405  tree_node* saved_curr_tree_node_ptr = curr_tree_node_ptr;
1406  tree_nodeRef saved_source_tn = source_tn;
1407  node_id = create_tree_node(GET_NODE(def_edge.first), mode);
1408  curr_tree_node_ptr = saved_curr_tree_node_ptr;
1409  source_tn = saved_source_tn;
1410  }
1411  }
1412  else
1413  {
1414  const auto rnode = remap.find(node_id);
1415  if(rnode != remap.end())
1416  {
1417  node_id = rnode->second;
1418  }
1419  }
1420 
1421  dynamic_cast<gimple_phi*>(curr_tree_node_ptr)
1422  ->AddDefEdge(TM, gimple_phi::DefEdge(TM->GetTreeReindex(node_id), get_bbi(def_edge.second)));
1423  }
1424  SET_VALUE(virtual_flag, gimple_phi);
1425  if(use_counting)
1426  {
1427  dynamic_cast<gimple_phi*>(curr_tree_node_ptr)->SetSSAUsesComputed();
1428  }
1429 }
1430 
1431 void tree_node_dup::operator()(const pointer_type* obj, unsigned int& mask)
1432 {
1433  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1434  tree_node_mask::operator()(obj, mask);
1435  SET_NODE_ID(ptd, pointer_type);
1436 }
1437 
1438 void tree_node_dup::operator()(const real_cst* obj, unsigned int& mask)
1439 {
1440  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1441  tree_node_mask::operator()(obj, mask);
1442  SET_VALUE(overflow_flag, real_cst);
1443  SET_VALUE(valr, real_cst);
1444  SET_VALUE(valx, real_cst);
1445 }
1446 
1447 void tree_node_dup::operator()(const real_type* obj, unsigned int& mask)
1448 {
1449  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1450  tree_node_mask::operator()(obj, mask);
1451  SET_VALUE(prec, real_type);
1452 }
1453 
1454 void tree_node_dup::operator()(const record_type* obj, unsigned int& mask)
1455 {
1456  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1457  tree_node_mask::operator()(obj, mask);
1458  SET_NODE_ID(tmpl_parms, record_type);
1459  SET_NODE_ID(tmpl_args, record_type);
1460 
1461  SET_VALUE(ptrmem_flag, record_type);
1462  SET_NODE_ID(ptd, record_type);
1463  SET_NODE_ID(cls, record_type);
1464  SET_NODE_ID(bfld, record_type);
1465  SET_NODE_ID(vfld, record_type);
1466  SET_VALUE(spec_flag, record_type);
1467  SET_VALUE(struct_flag, record_type);
1468  SEQ_SET_NODE_ID(list_of_flds, record_type);
1469  SEQ_SET_NODE_ID(list_of_fncs, record_type);
1470  SET_NODE_ID(binf, record_type);
1471 }
1472 
1473 void tree_node_dup::operator()(const reference_type* obj, unsigned int& mask)
1474 {
1475  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1476  tree_node_mask::operator()(obj, mask);
1477  SET_NODE_ID(refd, reference_type);
1478 }
1479 
1480 void tree_node_dup::operator()(const result_decl* obj, unsigned int& mask)
1481 {
1482  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1483  tree_node_mask::operator()(obj, mask);
1485  SET_NODE_ID(size, result_decl);
1486  SET_VALUE(algn, result_decl);
1487  SET_NODE_ID(smt_ann, result_decl);
1488 }
1489 
1490 void tree_node_dup::operator()(const gimple_return* obj, unsigned int& mask)
1491 {
1492  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1493  tree_node_mask::operator()(obj, mask);
1495 }
1496 
1497 void tree_node_dup::operator()(const return_stmt* obj, unsigned int& mask)
1498 {
1499  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1500  tree_node_mask::operator()(obj, mask);
1501 
1503  SET_NODE_ID(expr, return_stmt);
1504 }
1505 
1506 void tree_node_dup::operator()(const scope_ref* obj, unsigned int& mask)
1507 {
1508  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1509  tree_node_mask::operator()(obj, mask);
1510  SET_NODE_ID(op0, scope_ref);
1511  SET_NODE_ID(op1, scope_ref);
1512 }
1513 
1514 void tree_node_dup::operator()(const ssa_name* obj, unsigned int& mask)
1515 {
1516  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1517  tree_node_mask::operator()(obj, mask);
1518 
1520  SET_NODE_ID(var, ssa_name);
1521  if(mode)
1522  {
1523  dynamic_cast<ssa_name*>(curr_tree_node_ptr)->vers = TM->get_next_vers();
1524  }
1525  else
1526  {
1527  SET_VALUE(vers, ssa_name);
1528  }
1529  SET_VALUE(orig_vers, ssa_name);
1530  SET_VALUE(use_set->anything, ssa_name);
1531  SET_VALUE(use_set->escaped, ssa_name);
1532  SET_VALUE(use_set->ipa_escaped, ssa_name);
1533  SET_VALUE(use_set->nonlocal, ssa_name);
1534  SET_VALUE(use_set->null, ssa_name);
1535  SEQ_SET_NODE_ID(use_set->variables, ssa_name);
1536 
1537  SET_VALUE(volatile_flag, ssa_name);
1538  SET_VALUE(virtual_flag, ssa_name);
1539  SET_VALUE(default_flag, ssa_name);
1540  for(const auto& def_stmt : GetPointer<ssa_name>(source_tn)->CGetDefStmts())
1541  {
1542  if(mode)
1543  {
1544  unsigned int node_id = GET_INDEX_NODE(def_stmt);
1545  const auto rnode = remap.find(node_id);
1546  if(rnode != remap.end())
1547  {
1548  node_id = rnode->second;
1549  }
1550  else
1551  {
1552  const auto saved_curr_tree_node_ptr = curr_tree_node_ptr;
1553  const auto saved_source_tn = source_tn;
1554  node_id = create_tree_node(GET_NODE(def_stmt), mode);
1555  curr_tree_node_ptr = saved_curr_tree_node_ptr;
1556  source_tn = saved_source_tn;
1557  }
1558  dynamic_cast<ssa_name*>(curr_tree_node_ptr)->AddDefStmt(TM->GetTreeReindex(node_id));
1559  }
1560  else
1561  {
1562  dynamic_cast<ssa_name*>(curr_tree_node_ptr)->AddDefStmt(def_stmt);
1563  }
1564  }
1565  if(!mode)
1566  {
1569  SET_VALUE(bit_values, ssa_name);
1570  SET_VALUE(range, ssa_name);
1571  }
1572 }
1573 
1574 void tree_node_dup::operator()(const statement_list* obj, unsigned int& mask)
1575 {
1576  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1577  tree_node_mask::operator()(obj, mask);
1578  LSEQ_SET_NODE_ID(list_of_stmt, statement_list);
1579  const auto mend = GetPointerS<const statement_list>(source_tn)->list_of_bloc.end();
1580  for(auto i = GetPointerS<const statement_list>(source_tn)->list_of_bloc.begin(); i != mend; ++i)
1581  {
1582  curr_bloc = new bloc(get_bbi(i->first));
1583  source_bloc = i->second;
1584  curr_bloc->visit(this);
1585  THROW_ASSERT(!static_cast<statement_list*>(curr_tree_node_ptr)->list_of_bloc.count(get_bbi(i->first)),
1586  "Block already present " + STR(get_bbi(i->first)));
1587  static_cast<statement_list*>(curr_tree_node_ptr)->add_bloc(blocRef(curr_bloc));
1588  curr_bloc = nullptr;
1589  source_bloc = blocRef();
1590  }
1591  THROW_ASSERT(static_cast<statement_list*>(curr_tree_node_ptr)->list_of_bloc.size() ==
1592  GetPointerS<const statement_list>(source_tn)->list_of_bloc.size(),
1593  "");
1594 }
1595 
1596 void tree_node_dup::operator()(const string_cst* obj, unsigned int& mask)
1597 {
1598  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1599  tree_node_mask::operator()(obj, mask);
1600  SET_VALUE(strg, string_cst);
1601 }
1602 
1603 void tree_node_dup::operator()(const gimple_switch* obj, unsigned int& mask)
1604 {
1605  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1606  tree_node_mask::operator()(obj, mask);
1607  SET_NODE_ID(op0, gimple_switch);
1608  SET_NODE_ID(op1, gimple_switch);
1609 }
1610 
1611 void tree_node_dup::operator()(const target_expr* obj, unsigned int& mask)
1612 {
1613  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1614  tree_node_mask::operator()(obj, mask);
1615  SET_NODE_ID(decl, target_expr);
1617  SET_NODE_ID(clnp, target_expr);
1618 }
1619 
1620 void tree_node_dup::operator()(const lut_expr* obj, unsigned int& mask)
1621 {
1622  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1623  tree_node_mask::operator()(obj, mask);
1624  SET_NODE_ID(op0, lut_expr);
1625  SET_NODE_ID(op1, lut_expr);
1626  SET_NODE_ID(op2, lut_expr);
1627  SET_NODE_ID(op3, lut_expr);
1628  SET_NODE_ID(op4, lut_expr);
1629  SET_NODE_ID(op5, lut_expr);
1630  SET_NODE_ID(op6, lut_expr);
1631  SET_NODE_ID(op7, lut_expr);
1632  SET_NODE_ID(op8, lut_expr);
1633 }
1634 void tree_node_dup::operator()(const template_decl* obj, unsigned int& mask)
1635 {
1636  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1637  tree_node_mask::operator()(obj, mask);
1638  SET_NODE_ID(rslt, template_decl);
1639  SET_NODE_ID(inst, template_decl);
1640  SET_NODE_ID(spcs, template_decl);
1641  SET_NODE_ID(prms, template_decl);
1642 }
1643 
1644 void tree_node_dup::operator()(const template_parm_index* obj, unsigned int& mask)
1645 {
1646  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1647  tree_node_mask::operator()(obj, mask);
1650  SET_VALUE(constant_flag, template_parm_index);
1651  SET_VALUE(readonly_flag, template_parm_index);
1654  SET_VALUE(orig_level, template_parm_index);
1655 }
1656 
1657 void tree_node_dup::operator()(const tree_list* obj, unsigned int& mask)
1658 {
1659  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1660  tree_node_mask::operator()(obj, mask);
1661 
1662  SET_NODE_ID(purp, tree_list);
1663  SET_NODE_ID(valu, tree_list);
1664  SET_NODE_ID(chan, tree_list);
1665 }
1666 
1667 void tree_node_dup::operator()(const tree_vec* obj, unsigned int& mask)
1668 {
1669  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1670  tree_node_mask::operator()(obj, mask);
1671 
1672  SET_VALUE(lngt, tree_vec);
1673  SEQ_SET_NODE_ID(list_of_op, tree_vec);
1674 }
1675 
1676 void tree_node_dup::operator()(const try_block* obj, unsigned int& mask)
1677 {
1678  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1679  tree_node_mask::operator()(obj, mask);
1680 
1682  SET_NODE_ID(body, try_block);
1683  SET_NODE_ID(hdlr, try_block);
1684  SET_NODE_ID(next, try_block);
1685 }
1686 
1687 void tree_node_dup::operator()(const type_decl* obj, unsigned int& mask)
1688 {
1689  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1690  tree_node_mask::operator()(obj, mask);
1691  SET_NODE_ID(tmpl_parms, type_decl);
1692  SET_NODE_ID(tmpl_args, type_decl);
1693 }
1694 
1695 void tree_node_dup::operator()(const union_type* obj, unsigned int& mask)
1696 {
1697  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1698  tree_node_mask::operator()(obj, mask);
1699  SEQ_SET_NODE_ID(list_of_flds, union_type);
1700  SEQ_SET_NODE_ID(list_of_fncs, union_type);
1701  SET_NODE_ID(binf, union_type);
1702 }
1703 
1704 void tree_node_dup::operator()(const var_decl* obj, unsigned int& mask)
1705 {
1706  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1707  tree_node_mask::operator()(obj, mask);
1708 
1709  SET_VALUE(use_tmpl, var_decl);
1710  SET_VALUE(static_static_flag, var_decl);
1711  SET_VALUE(static_flag, var_decl);
1712  SET_VALUE(extern_flag, var_decl);
1713  SET_VALUE(addr_taken, var_decl);
1714  SET_VALUE(addr_not_taken, var_decl);
1716  SET_NODE_ID(size, var_decl);
1717  SET_VALUE(algn, var_decl);
1718  SET_VALUE(used, var_decl);
1719  SET_VALUE(register_flag, var_decl);
1720  SET_VALUE(readonly_flag, var_decl);
1721  if(!mode)
1722  {
1723  SET_VALUE(bit_values, var_decl);
1724  }
1725  SET_NODE_ID(smt_ann, var_decl);
1726  SET_SET_NODE_ID(defs, var_decl);
1727  SET_SET_NODE_ID(uses, var_decl);
1728  SET_SET_NODE_ID(addressings, var_decl);
1729 }
1730 
1731 void tree_node_dup::operator()(const vector_cst* obj, unsigned int& mask)
1732 {
1733  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1734  tree_node_mask::operator()(obj, mask);
1735  SEQ_SET_NODE_ID(list_of_valu, vector_cst);
1736 }
1737 
1738 void tree_node_dup::operator()(const type_argument_pack* obj, unsigned int& mask)
1739 {
1740  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1741  tree_node_mask::operator()(obj, mask);
1743 }
1744 
1745 void tree_node_dup::operator()(const nontype_argument_pack* obj, unsigned int& mask)
1746 {
1747  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1748  tree_node_mask::operator()(obj, mask);
1750 }
1751 
1752 void tree_node_dup::operator()(const type_pack_expansion* obj, unsigned int& mask)
1753 {
1754  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1755  tree_node_mask::operator()(obj, mask);
1757  SET_NODE_ID(param_packs, type_pack_expansion);
1759 }
1760 
1761 void tree_node_dup::operator()(const expr_pack_expansion* obj, unsigned int& mask)
1762 {
1763  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1764  tree_node_mask::operator()(obj, mask);
1766  SET_NODE_ID(param_packs, expr_pack_expansion);
1768 }
1769 
1770 void tree_node_dup::operator()(const vector_type* obj, unsigned int& mask)
1771 {
1772  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1773  tree_node_mask::operator()(obj, mask);
1774  SET_NODE_ID(elts, vector_type);
1775 }
1776 
1777 void tree_node_dup::operator()(const target_mem_ref* obj, unsigned int& mask)
1778 {
1779  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1780  tree_node_mask::operator()(obj, mask);
1781 
1783  SET_NODE_ID(symbol, target_mem_ref);
1786  SET_NODE_ID(step, target_mem_ref);
1788  SET_NODE_ID(orig, target_mem_ref);
1790 }
1791 
1792 void tree_node_dup::operator()(const target_mem_ref461* obj, unsigned int& mask)
1793 {
1794  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1795  tree_node_mask::operator()(obj, mask);
1796 
1803 }
1804 
1805 void tree_node_dup::operator()(const bloc* obj, unsigned int& mask)
1806 {
1807  tree_node_mask::operator()(obj, mask);
1808 
1809  curr_bloc->hpl = source_bloc->hpl;
1811  std::transform(source_bloc->list_of_pred.cbegin(), source_bloc->list_of_pred.cend(),
1812  std::back_inserter(curr_bloc->list_of_pred), [&](const unsigned int& bbi) { return get_bbi(bbi); });
1813  std::transform(source_bloc->list_of_succ.cbegin(), source_bloc->list_of_succ.cend(),
1814  std::back_inserter(curr_bloc->list_of_succ), [&](const unsigned int& bbi) { return get_bbi(bbi); });
1815  curr_bloc->true_edge = get_bbi(source_bloc->true_edge);
1816  curr_bloc->false_edge = get_bbi(source_bloc->false_edge);
1817 
1818  if(use_counting)
1819  {
1821  }
1822  for(const auto& phi : source_bloc->CGetPhiList())
1823  {
1824  unsigned int node_id = GET_INDEX_NODE(phi);
1825  if(mode)
1826  {
1827  const auto rnode = remap.find(node_id);
1828  if(rnode != remap.end())
1829  {
1830  node_id = rnode->second;
1831  }
1832  else
1833  {
1834  tree_node* saved_curr_tree_node_ptr = curr_tree_node_ptr;
1835  tree_nodeRef saved_source_tn = source_tn;
1836  bloc* saved_curr_bloc = curr_bloc;
1837  node_id = create_tree_node(GET_NODE(phi), mode);
1838  curr_tree_node_ptr = saved_curr_tree_node_ptr;
1839  source_tn = saved_source_tn;
1840  curr_bloc = saved_curr_bloc;
1841  }
1842  }
1843  else
1844  {
1845  THROW_ASSERT(remap.find(node_id) != remap.end(), "missing an index");
1846  node_id = remap.find(node_id)->second;
1847  }
1848  curr_bloc->AddPhi(TM->GetTreeReindex(node_id));
1849  }
1850  for(const auto& stmt : source_bloc->CGetStmtList())
1851  {
1852  unsigned int node_id = GET_INDEX_CONST_NODE(stmt);
1853  if(mode)
1854  {
1855  const auto rnode = remap.find(node_id);
1856  if(rnode != remap.end())
1857  {
1858  node_id = rnode->second;
1859  }
1860  else
1861  {
1862  const auto saved_curr_tree_node_ptr = curr_tree_node_ptr;
1863  const auto saved_source_tn = source_tn;
1864  const auto saved_curr_bloc = curr_bloc;
1865  node_id = create_tree_node(GET_NODE(stmt), mode);
1866  curr_tree_node_ptr = saved_curr_tree_node_ptr;
1867  source_tn = saved_source_tn;
1868  curr_bloc = saved_curr_bloc;
1869  }
1870  }
1871  else
1872  {
1873  THROW_ASSERT(remap.find(node_id) != remap.end(), "missing an index");
1874  node_id = remap.find(node_id)->second;
1875  }
1876  curr_bloc->PushBack(TM->GetTreeReindex(node_id), AppM);
1877  }
1878 }
1879 
1880 void tree_node_dup::operator()(const gimple_while* obj, unsigned int& mask)
1881 {
1882  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1883  tree_node_mask::operator()(obj, mask);
1884  SET_NODE_ID(op0, gimple_while);
1885 }
1886 
1887 void tree_node_dup::operator()(const gimple_for* obj, unsigned int& mask)
1888 {
1889  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1890  tree_node_mask::operator()(obj, mask);
1891  SET_NODE_ID(op1, gimple_for);
1892  SET_NODE_ID(op2, gimple_for);
1893 }
1894 
1895 void tree_node_dup::operator()(const gimple_multi_way_if* obj, unsigned int& mask)
1896 {
1897  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1898  tree_node_mask::operator()(obj, mask);
1899  THROW_ASSERT(source_tn, "");
1900  if(!GetPointer<gimple_multi_way_if>(source_tn)->list_of_cond.empty())
1901  {
1902  for(const auto& cond : GetPointer<gimple_multi_way_if>(source_tn)->list_of_cond)
1903  {
1904  if(cond.first)
1905  {
1906  unsigned int node_id = GET_INDEX_NODE(cond.first);
1907  if(mode)
1908  {
1909  if(remap.find(node_id) != remap.end())
1910  {
1911  node_id = remap.find(node_id)->second;
1912  THROW_ASSERT(node_id, "");
1913  }
1914  else
1915  {
1916  tree_node* saved_curr_tree_node_ptr = curr_tree_node_ptr;
1917  tree_nodeRef saved_source_tn = source_tn;
1918  node_id = create_tree_node(GET_NODE(cond.first), mode);
1919  curr_tree_node_ptr = saved_curr_tree_node_ptr;
1920  source_tn = saved_source_tn;
1921  }
1922  }
1923  else
1924  {
1925  THROW_ASSERT(remap.find(node_id) != remap.end(), "missing " + STR(TM->CGetTreeNode(node_id)));
1926  node_id = remap.find(node_id)->second;
1927  THROW_ASSERT(node_id, "");
1928  }
1929  dynamic_cast<gimple_multi_way_if*>(curr_tree_node_ptr)
1930  ->add_cond(TM->GetTreeReindex(node_id), get_bbi(cond.second));
1931  }
1932  else
1933  {
1934  dynamic_cast<gimple_multi_way_if*>(curr_tree_node_ptr)->add_cond(tree_nodeRef(), get_bbi(cond.second));
1935  }
1936  }
1937  }
1938 }
1939 
1940 void tree_node_dup::operator()(const null_node* obj, unsigned int& mask)
1941 {
1942  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1943  tree_node_mask::operator()(obj, mask);
1944 }
1945 
1946 void tree_node_dup::operator()(const gimple_pragma* obj, unsigned int& mask)
1947 {
1948  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1949  tree_node_mask::operator()(obj, mask);
1950  SET_VALUE(is_block, gimple_pragma);
1951  SET_VALUE(is_opening, gimple_pragma);
1953  SET_NODE_ID(scope, gimple_pragma);
1954  SET_NODE_ID(directive, gimple_pragma);
1955 }
1956 
1957 void tree_node_dup::operator()(const omp_pragma* obj, unsigned int& mask)
1958 {
1959  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1960  tree_node_mask::operator()(obj, mask);
1961 }
1962 
1963 void tree_node_dup::operator()(const omp_parallel_pragma* obj, unsigned int& mask)
1964 {
1965  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1966  tree_node_mask::operator()(obj, mask);
1967  SET_VALUE(is_shortcut, omp_parallel_pragma);
1968  if(!GetPointer<omp_parallel_pragma>(source_tn)->clauses.empty())
1969  {
1970  auto vend = GetPointer<omp_parallel_pragma>(source_tn)->clauses.end();
1971  for(auto i = GetPointer<omp_parallel_pragma>(source_tn)->clauses.begin(); i != vend; ++i)
1972  {
1973  dynamic_cast<omp_parallel_pragma*>(curr_tree_node_ptr)->clauses[i->first] = i->second;
1974  }
1975  }
1976 }
1977 
1978 void tree_node_dup::operator()(const omp_for_pragma* obj, unsigned int& mask)
1979 {
1980  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1981  tree_node_mask::operator()(obj, mask);
1982  if(!GetPointer<omp_for_pragma>(source_tn)->clauses.empty())
1983  {
1984  auto vend = GetPointer<omp_for_pragma>(source_tn)->clauses.end();
1985  for(auto i = GetPointer<omp_for_pragma>(source_tn)->clauses.begin(); i != vend; ++i)
1986  {
1987  dynamic_cast<omp_for_pragma*>(curr_tree_node_ptr)->clauses[i->first] = i->second;
1988  }
1989  }
1990 }
1991 
1992 void tree_node_dup::operator()(const omp_simd_pragma* obj, unsigned int& mask)
1993 {
1994  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
1995  tree_node_mask::operator()(obj, mask);
1996  if(!GetPointer<omp_simd_pragma>(source_tn)->clauses.empty())
1997  {
1998  auto vend = GetPointer<omp_simd_pragma>(source_tn)->clauses.end();
1999  for(auto i = GetPointer<omp_simd_pragma>(source_tn)->clauses.begin(); i != vend; ++i)
2000  {
2001  dynamic_cast<omp_simd_pragma*>(curr_tree_node_ptr)->clauses[i->first] = i->second;
2002  }
2003  }
2004 }
2005 
2006 void tree_node_dup::operator()(const omp_declare_simd_pragma* obj, unsigned int& mask)
2007 {
2008  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
2009  tree_node_mask::operator()(obj, mask);
2010  if(!GetPointer<omp_declare_simd_pragma>(source_tn)->clauses.empty())
2011  {
2012  auto vend = GetPointer<omp_declare_simd_pragma>(source_tn)->clauses.end();
2013  for(auto i = GetPointer<omp_declare_simd_pragma>(source_tn)->clauses.begin(); i != vend; ++i)
2014  {
2015  dynamic_cast<omp_declare_simd_pragma*>(curr_tree_node_ptr)->clauses[i->first] = i->second;
2016  }
2017  }
2018 }
2019 
2020 void tree_node_dup::operator()(const omp_target_pragma* obj, unsigned int& mask)
2021 {
2022  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
2023  tree_node_mask::operator()(obj, mask);
2024  if(!GetPointer<omp_target_pragma>(source_tn)->clauses.empty())
2025  {
2026  auto vend = GetPointer<omp_target_pragma>(source_tn)->clauses.end();
2027  for(auto i = GetPointer<omp_target_pragma>(source_tn)->clauses.begin(); i != vend; ++i)
2028  {
2029  dynamic_cast<omp_target_pragma*>(curr_tree_node_ptr)->clauses[i->first] = i->second;
2030  }
2031  }
2032 }
2033 
2034 void tree_node_dup::operator()(const omp_critical_pragma* obj, unsigned int& mask)
2035 {
2036  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
2037  tree_node_mask::operator()(obj, mask);
2038  if(!GetPointer<omp_critical_pragma>(source_tn)->clauses.empty())
2039  {
2040  auto vend = GetPointer<omp_critical_pragma>(source_tn)->clauses.end();
2041  for(auto i = GetPointer<omp_critical_pragma>(source_tn)->clauses.begin(); i != vend; ++i)
2042  {
2043  dynamic_cast<omp_critical_pragma*>(curr_tree_node_ptr)->clauses[i->first] = i->second;
2044  }
2045  }
2046 }
2047 
2048 void tree_node_dup::operator()(const omp_task_pragma* obj, unsigned int& mask)
2049 {
2050  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
2051  tree_node_mask::operator()(obj, mask);
2052  if(!GetPointer<omp_task_pragma>(source_tn)->clauses.empty())
2053  {
2054  auto vend = GetPointer<omp_task_pragma>(source_tn)->clauses.end();
2055  for(auto i = GetPointer<omp_task_pragma>(source_tn)->clauses.begin(); i != vend; ++i)
2056  {
2057  dynamic_cast<omp_task_pragma*>(curr_tree_node_ptr)->clauses[i->first] = i->second;
2058  }
2059  }
2060 }
2061 
2062 void tree_node_dup::operator()(const omp_sections_pragma* obj, unsigned int& mask)
2063 {
2064  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
2065  tree_node_mask::operator()(obj, mask);
2066  SET_VALUE(is_shortcut, omp_sections_pragma);
2067 }
2068 
2069 void tree_node_dup::operator()(const omp_parallel_sections_pragma* obj, unsigned int& mask)
2070 {
2071  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
2072  tree_node_mask::operator()(obj, mask);
2075 }
2076 
2077 void tree_node_dup::operator()(const omp_section_pragma* obj, unsigned int& mask)
2078 {
2079  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
2080  tree_node_mask::operator()(obj, mask);
2081 }
2082 
2083 void tree_node_dup::operator()(const map_pragma* obj, unsigned int& mask)
2084 {
2085  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
2086  tree_node_mask::operator()(obj, mask);
2087 }
2088 
2089 void tree_node_dup::operator()(const call_hw_pragma* obj, unsigned int& mask)
2090 {
2091  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
2092  tree_node_mask::operator()(obj, mask);
2093  SET_VALUE(HW_component, call_hw_pragma);
2094 }
2095 
2096 void tree_node_dup::operator()(const call_point_hw_pragma* obj, unsigned int& mask)
2097 {
2098  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
2099  tree_node_mask::operator()(obj, mask);
2100  SET_VALUE(HW_component, call_point_hw_pragma);
2101  SET_VALUE(ID_implementation, call_point_hw_pragma);
2102  SET_VALUE(recursive, call_point_hw_pragma);
2103 }
2104 
2105 void tree_node_dup::operator()(const issue_pragma* obj, unsigned int& mask)
2106 {
2107  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
2108  tree_node_mask::operator()(obj, mask);
2109 }
2110 
2111 void tree_node_dup::operator()(const profiling_pragma* obj, unsigned int& mask)
2112 {
2113  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
2114  tree_node_mask::operator()(obj, mask);
2115 }
2116 
2117 void tree_node_dup::operator()(const blackbox_pragma* obj, unsigned int& mask)
2118 {
2119  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
2120  tree_node_mask::operator()(obj, mask);
2121 }
2122 
2123 void tree_node_dup::operator()(const statistical_profiling* obj, unsigned int& mask)
2124 {
2125  THROW_ASSERT(obj == curr_tree_node_ptr, "wrong factory setup");
2126  tree_node_mask::operator()(obj, mask);
2127 }
#define GET_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
Definition: tree_node.hpp:343
struct definition of the type_decl tree node.
Definition: tree_node.hpp:5470
This struct specifies the integer_cst node.
Definition: tree_node.hpp:3242
void PushBack(const tree_nodeRef statement, const application_managerRef AppM)
Add a statement as last non controlling statement.
struct definition of the const_decl tree node.
Definition: tree_node.hpp:2386
This struct implements the target_expr node.
Definition: tree_node.hpp:4815
tree_node_dup(CustomUnorderedMapStable< unsigned int, unsigned int > &_remap, const application_managerRef _AppM, unsigned int _remap_bbi=0, unsigned int _remap_loop_id=0, bool _use_counting=false)
Construct a new tree node dup object.
() label_decl()() modop_expr() new_expr() placeholder_expr()() boolean_type() CharType() nullptr_type() lang_type() offset_type() qual_union_type() set_type() template_type_parm() typename_type(void_type)) void tree_node
Definition: tree_node.cpp:168
virtual void visit(tree_node_visitor *const v) const
virtual function used to traverse the tree_node data structure.
This struct specifies the field bloc (basic block).
() label_decl()() modop_expr() new_expr() placeholder_expr() template_id_expr(vec_new_expr)) BOOST_PP_SEQ_FOR_EACH(VISIT_TREE_NODE_MACRO
struct definition of the vector_type tree node.
Definition: tree_node.hpp:5938
struct definition of the array_type tree node.
Definition: tree_node.hpp:1520
struct definition of the real_type tree node.
Definition: tree_node.hpp:4039
unsigned int remap_bbi
basic block indexes remap base
Any erroneous construct is parsed into a node of this type.
Definition: tree_node.hpp:1462
char base
This version is stamped on May 10, 2016.
Definition: nussinov.c:24
This struct specifies the statement_list node.
Definition: tree_node.hpp:4662
Definition of the class representing a generic C application.
A HANDLER wraps a catch handler for the HANDLER_TYPE.
Definition: tree_node.hpp:3141
struct definition of the source position.
Definition: tree_node.hpp:832
std::vector< unsigned int > list_of_succ
list_of_succ is the list of successors.
Represents an argument pack of types (or templates).
Definition: tree_node.hpp:5139
struct definition of the function_decl tree node.
Definition: tree_node.hpp:2759
struct definition of the method_type tree node.
Definition: tree_node.hpp:3452
This struct specifies the gimple_label node.
Definition: tree_node.hpp:3343
This struct specifies the string_cst node.
Definition: tree_node.hpp:4724
exceptions managed by PandA
struct definition of the union_type tree node.
Definition: tree_node.hpp:5540
A simple interface to token object of the raw files.
struct definition of the unary node structures.
Definition: tree_node.hpp:1177
struct definition of the record_type tree node.
Definition: tree_node.hpp:4078
GIMPLE_BIND <VARS, BLOCK, BODY> represents a lexical scope.
Definition: tree_node.hpp:1664
static const unsigned int EXIT_BLOCK_ID
constant identifying the exit basic block
#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
struct definition of the ternary node structures.
Definition: tree_node.hpp:1239
#define min(x, y)
This struct specifies the gimple_cond node.
Definition: tree_node.hpp:2345
tree_nodeRef source_tn
current tree_node source
struct definition of the function_type tree node.
Definition: tree_node.hpp:2960
struct definition of the parm_decl tree node.
Definition: tree_node.hpp:3660
Data structure describing a basic block at tree level.
This class is used to perform the re-index of all tree nodes.
AGGR_INIT_EXPRs have a variably-sized representation similar to that of CALL_EXPRs.
Definition: tree_node.hpp:1919
Constructor: return an aggregate value made from specified components.
Definition: tree_node.hpp:2434
This struct specifies the binfo node.
Definition: tree_node.hpp:1713
struct definition of the template_decl tree node.
Definition: tree_node.hpp:4993
const application_managerRef AppM
application manager
This struct represents a try-block statement.
Definition: tree_node.hpp:5409
int mode
enables full nodes duplication
Abstract pure class for the tree structure.
Definition: tree_node.hpp:139
virtual enum kind get_kind() const =0
Virtual function returning the type of the actual class.
struct definition of the label_decl tree node.
Definition: tree_node.hpp:3529
#define STR(s)
Macro which performs a lexical_cast to a string.
void line(int x1, int y1, int x2, int y2, unsigned int color)
Definition: main.c:110
Auxiliary methods for manipulating string.
struct definition of the label_decl tree node.
Definition: tree_node.hpp:5659
#define max
Definition: backprop.h:17
Directive represinting mapping of a software function on a component.
struct definition of the result_decl tree node.
Definition: tree_node.hpp:4266
This struct specifies the vector_cst node.
Definition: tree_node.hpp:5888
#define SET_VALUE(field, type)
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
Definition: exceptions.hpp:292
virtual std::string get_kind_text() const =0
Virtual function returning the name of the actual class.
This struct specifies the gimple_phi node.
Definition: tree_node.hpp:3742
() label_decl() using_decl(translation_unit_decl)) BOOST_PP_SEQ_FOR_EACH(VISIT_TREE_NODE_MACRO
CustomUnorderedMapStable< unsigned int, unsigned int > remap_bb
remap old basic block indexes in new indexes
unsigned int loop_id
loop identifier coming from GCC
This struct represents a list-like node for chaining overloading candidates.
Definition: tree_node.hpp:3621
struct definition of the Quaternary node structures.
Definition: tree_node.hpp:1276
unsigned int remap_loop_id
basic block loop ids remap base
This struct specifies the gimple_assign node (GCC 4.3 tree node).
Definition: tree_node.hpp:3015
This C++ header file contains common macros for the tree structure.
This struct specifies super class for constant nodes.
Definition: tree_node.hpp:1431
Directive represinting mapping of a function call on a component.
unsigned int create_tree_node(const tree_nodeRef &tn, int mode=tree_node_dup_mode::DEFAULT)
tree_node visitors
#define ATTR_MACRO(r, data, elem)
unsigned int hpl
store the relation between the phi defs inserted in the live_out set and phi uses ...
const unsigned int index
Represent the index read from the raw file and the index-1 of the vector of tree_node associated to t...
Definition: tree_node.hpp:146
Low-level memory addressing.
Definition: tree_node.hpp:4938
#define LSEQ_SET_NODE_ID(list_field, type)
This struct specifies the gimple_return node.
Definition: tree_node.hpp:4354
std::pair< tree_nodeRef, unsigned int > DefEdge
The type of the def edge.
Definition: tree_node.hpp:3750
Represents an expression that will be expanded into a list of expressions when instantiated with one ...
Definition: tree_node.hpp:2186
struct definition of the function_decl tree node.
Definition: tree_node.hpp:3179
#define RET_NODE_ID_CASE_BODY(tree_node_name, node_id)
CustomUnorderedMapStable< unsigned int, unsigned int > remap_lid
remap old basic block loop ids in new ids
unsigned offset[NUM_VERTICES+1]
Definition: graph.h:3
struct definition of the field_decl tree node.
Definition: tree_node.hpp:2640
struct definition of the complex_type tree node.
Definition: tree_node.hpp:2282
#define GET_CONST_NODE(t)
Definition: tree_node.hpp:347
Classes specification of the tree_node data structures.
GIMPLE_SWITCH <INDEX, DEFAULT_LAB, LAB1, ..., LABN> represents the multiway branch: ...
Definition: tree_node.hpp:4773
struct definition of the field attr on function_decl, field_decl, var_decl tree node.
Definition: tree_node.hpp:774
#define THROW_ERROR(str_expr)
helper function used to throw an error in a standard way
Definition: exceptions.hpp:263
#define SET_SET_NODE_ID(list_field, type)
struct definition of the pointer_type tree node.
Definition: tree_node.hpp:3896
BOOST_PP_SEQ_FOR_EACH(OPERATOR_MACRO, BOOST_PP_EMPTY, VISITED_OBJ_SEQ1)
virtual template object functor
This struct specifies the block node.
Definition: tree_node.hpp:1820
This file collects some utility functions.
struct definition of common part of WeightedNode (gimple_assign, expr_node)
Definition: tree_node.hpp:738
struct definition of the reference_type tree node.
Definition: tree_node.hpp:4220
This struct specifies the cast_expr node.
Definition: tree_node.hpp:2057
CustomUnorderedMapStable< unsigned int, unsigned int > & remap
remap old indexes in new indexes
void init(int bucket[BUCKETSIZE])
Definition: sort.c:42
struct definition of the common part of an expression
Definition: tree_node.hpp:973
#define CREATE_TREE_NODE_CASE_BODY(tree_node_name, node_id)
void add(int accelnum, int startidx, int endidx)
Definition: add.c:11
This struct specifies the lut_expr node.
Definition: tree_node.hpp:6042
This struct specifies the complex_cst node.
Definition: tree_node.hpp:2237
void AddPhi(const tree_nodeRef phi)
Add a value to list of phi node.
struct definition of the type node structures.
Definition: tree_node.hpp:1318
This struct specifies the tree_list node.
Definition: tree_node.hpp:5255
Class specification of the tree_reindex support class.
static const unsigned int ENTRY_BLOCK_ID
constant identifying the entry basic block
#define ATTR_SEQ
#define CASE_FAKE_NODES
This macro collects all case labels for fake or empty nodes.
Definition: tree_node.hpp:635
This struct represent a statement expression.
Definition: tree_node.hpp:2592
This struct specifies the call_expr node.
Definition: tree_node.hpp:1873
bloc * curr_bloc
current basic block pointer
This struct specifies reference to particular overloaded struct method The tree walker structure of t...
Definition: tree_node.hpp:4463
#define DECLARATION
Autoheader include.
struct definition of the common part of a gimple with virtual operands
Definition: tree_node.hpp:1078
This struct represent a &#39;return&#39; statement.
Definition: tree_node.hpp:4387
This struct specifies a multi-way-if construct.
unsigned int get_bbi(unsigned int old_bb)
This struct specifies the real_cst node.
Definition: tree_node.hpp:3990
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Definition: refcount.hpp:94
char str[25]
Definition: fixedptc.c:8
int level
Definition: main.c:98
This struct specifies the case_label_expr node.
Definition: tree_node.hpp:2011
Classes specification of the tree_node data structures not present in the gcc.
unsigned int true_edge
in case the last statement is a gimple_cond associated with an if statement this member contains the ...
unsigned int get_loop_id(unsigned int old_loop_id)
std::vector< unsigned int > list_of_pred
list_of_pred is the list of predecessors.
Low-level memory addressing.
Definition: tree_node.hpp:4865
blocRef source_bloc
current basic block source
refcount< tree_node > tree_nodeRef
RefCount type definition of the tree_node class structure.
Definition: tree_node.hpp:212
tree node duplication class.
This struct specifies the ssa_name node.
Definition: tree_node.hpp:4523
#define SET_NODE_ID(field, type)
This struct specifies the gimple_goto node.
Definition: tree_node.hpp:3089
This struct specifies the for expression Used to represent a for construct.
tree_node * curr_tree_node_ptr
current tree node filled according to the source tree_node
struct definition of the integer_type tree node.
Definition: tree_node.hpp:2513
struct definition of the integer_type tree node.
Definition: tree_node.hpp:3279
const tree_managerRef TM
tree manager
absl::node_hash_map< T, U, Hash, Eq, Alloc > CustomUnorderedMapStable
Definition: custom_map.hpp:152
This struct specifies a hint for branch prediction.
Definition: tree_node.hpp:3846
#define GET_INDEX_CONST_NODE(t)
Definition: tree_node.hpp:363
struct definition of the binary node structures.
Definition: tree_node.hpp:1206
This struct specifies the tree_vec node.
Definition: tree_node.hpp:5299
#define SEQ_SET_NODE_ID(list_field, type)
This struct specifies the gimple_asm node.
Definition: tree_node.hpp:1574
This struct specifies the gimple_call node.
Definition: tree_node.hpp:1959
struct definition of the declaration node structures.
Definition: tree_node.hpp:877
Superclass include.
Class specification of the manager of the tree structures extracted from the raw file.
void SetSSAUsesComputed()
Set that uses of ssa have been computed.
unsigned int false_edge
in case the last statement is a gimple_cond associated with an if statement this member contains the ...
This struct specifies the while expression Used to represent a while construct.
Memory tags used in tree-ssa to represent memory locations in virtual SSA.
Definition: tree_node.hpp:1393
Represents a type expression that will be expanded into a list of types when instantiated with one or...
Definition: tree_node.hpp:2141
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...
Definition: exceptions.hpp:289

Generated on Mon Feb 12 2024 13:02:56 for PandA-2024.02 by doxygen 1.8.13