PandA-2024.02
var_decl_fix.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  */
44 #include "var_decl_fix.hpp"
45 
46 #include "Parameter.hpp"
47 #include "application_manager.hpp"
48 #include "behavioral_helper.hpp"
49 #include "custom_map.hpp"
50 #include "dbgPrintHelper.hpp"
51 #include "exceptions.hpp"
52 #include "ext_tree_node.hpp"
53 #include "function_behavior.hpp"
54 #include "string_manipulation.hpp" // for GET_CLASS
55 #include "token_interface.hpp"
56 #include "tree_basic_block.hpp"
57 #include "tree_helper.hpp"
58 #include "tree_manager.hpp"
59 #include "tree_node.hpp"
60 #include "tree_reindex.hpp"
61 #include <fstream>
62 #include <string>
63 
64 VarDeclFix::VarDeclFix(const application_managerRef _AppM, unsigned int _function_id,
65  const DesignFlowManagerConstRef _design_flow_manager, const ParameterConstRef _parameters,
66  const FrontendFlowStepType _frontend_flow_step_type)
67  : FunctionFrontendFlowStep(_AppM, _function_id, _frontend_flow_step_type, _design_flow_manager, _parameters),
68  modified(false)
69 {
70  debug_level = parameters->get_class_debug_level(GET_CLASS(*this), DEBUG_LEVEL_NONE);
71 }
72 
73 VarDeclFix::~VarDeclFix() = default;
74 
77 {
79  switch(relationship_type)
80  {
82  {
83  relationships.insert(std::make_pair(CHECK_SYSTEM_TYPE, SAME_FUNCTION));
84  break;
85  }
87  {
88  break;
89  }
91  {
92  relationships.insert(std::make_pair(PARM_DECL_TAKEN_ADDRESS, SAME_FUNCTION));
93  relationships.insert(std::make_pair(INTERFACE_INFER, WHOLE_APPLICATION));
94  break;
95  }
96  default:
97  {
99  }
100  }
101  return relationships;
102 }
103 
105 {
106  const tree_managerRef TM = AppM->get_tree_manager();
107  const tree_nodeRef curr_tn = TM->GetTreeNode(function_id);
108  auto* fd = GetPointer<function_decl>(curr_tn);
109  auto* sl = GetPointer<statement_list>(GET_NODE(fd->body));
111  CustomUnorderedSet<unsigned int> already_examinated_decls;
112  modified = false;
113 
115  CustomUnorderedSet<std::string> already_examinated_names;
116 
118  CustomUnorderedSet<std::string> already_examinated_type_names;
119 
121  CustomUnorderedSet<unsigned int> already_visited_ae;
122 
123  for(const auto& arg : fd->list_of_args)
124  {
125  recursive_examinate(arg, already_examinated_decls, already_examinated_names, already_examinated_type_names,
126  already_visited_ae);
127  }
128 
129  std::map<unsigned int, blocRef>& blocks = sl->list_of_bloc;
130  std::map<unsigned int, blocRef>::iterator it, it_end;
131 
132  it_end = blocks.end();
133  for(it = blocks.begin(); it != it_end; ++it)
134  {
135  for(const auto& stmt : it->second->CGetStmtList())
136  {
137  recursive_examinate(stmt, already_examinated_decls, already_examinated_names, already_examinated_type_names,
138  already_visited_ae);
139  }
140  }
142 }
143 
145  CustomUnorderedSet<std::string>& already_examinated_names,
146  CustomUnorderedSet<std::string>& already_examinated_type_names,
147  CustomUnorderedSet<unsigned int>& already_visited_ae)
148 {
149  THROW_ASSERT(tn->get_kind() == tree_reindex_K, "Node is not a tree reindex");
150  const tree_managerRef TM = AppM->get_tree_manager();
151  const tree_nodeRef curr_tn = GET_NODE(tn);
153  "-->Analyzing recursively " + curr_tn->get_kind_text() + " " + STR(GET_INDEX_NODE(tn)) + ": " +
154  curr_tn->ToString());
155  switch(curr_tn->get_kind())
156  {
157  case call_expr_K:
158  case aggr_init_expr_K:
159  {
160  const call_expr* ce = GetPointer<call_expr>(curr_tn);
161  const std::vector<tree_nodeRef>& args = ce->args;
162  std::vector<tree_nodeRef>::const_iterator arg, arg_end = args.end();
163  for(arg = args.begin(); arg != arg_end; ++arg)
164  {
165  recursive_examinate(*arg, already_examinated_decls, already_examinated_names, already_examinated_type_names,
166  already_visited_ae);
167  }
168  break;
169  }
170  case gimple_call_K:
171  {
172  const gimple_call* ce = GetPointer<gimple_call>(curr_tn);
173  const std::vector<tree_nodeRef>& args = ce->args;
174  std::vector<tree_nodeRef>::const_iterator arg, arg_end = args.end();
175  for(arg = args.begin(); arg != arg_end; ++arg)
176  {
177  recursive_examinate(*arg, already_examinated_decls, already_examinated_names, already_examinated_type_names,
178  already_visited_ae);
179  }
180  break;
181  }
182  case gimple_assign_K:
183  {
184  auto* gm = GetPointer<gimple_assign>(curr_tn);
185  recursive_examinate(gm->op0, already_examinated_decls, already_examinated_names, already_examinated_type_names,
186  already_visited_ae);
187  recursive_examinate(gm->op1, already_examinated_decls, already_examinated_names, already_examinated_type_names,
188  already_visited_ae);
189  if(gm->predicate)
190  {
191  recursive_examinate(gm->predicate, already_examinated_decls, already_examinated_names,
192  already_examinated_type_names, already_visited_ae);
193  }
194  break;
195  }
196  case gimple_nop_K:
197  {
198  break;
199  }
200  case var_decl_K:
201  case parm_decl_K:
202  {
203  if(already_examinated_decls.find(GET_INDEX_NODE(tn)) == already_examinated_decls.end())
204  {
205  already_examinated_decls.insert(GET_INDEX_NODE(tn));
206  auto* dn = GetPointer<decl_node>(GET_NODE(tn));
207  recursive_examinate(dn->type, already_examinated_decls, already_examinated_names,
208  already_examinated_type_names, already_visited_ae);
209  if(dn->name)
210  {
211  // check if the var_decl
212  if(curr_tn->get_kind() == var_decl_K)
213  { /* this is a variable declaration */
214  auto* cast_res = GetPointer<var_decl>(curr_tn);
215  if(cast_res->static_flag)
216  {
218  "Found a static variable with identifier <" +
219  GetPointer<identifier_node>(GET_NODE(dn->name))->strg + "> within function #" +
220  STR(function_id));
221  }
222  }
223 
224  std::string original_name = Normalize(GetPointer<identifier_node>(GET_NODE(dn->name))->strg);
225  std::string name_id = tree_helper::NormalizeTypename(original_name);
226  if(already_examinated_names.find(original_name) == already_examinated_names.end())
227  {
228  already_examinated_names.insert(original_name);
229  }
230  else
231  {
232  PRINT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, name_id + " is a duplicated var_decl");
234  std::map<TreeVocabularyTokenTypes_TokenEnum, std::string> IR_schema;
235  unsigned int var_decl_name_nid_test;
236  unsigned var_decl_unique_id = 0;
237  do
238  {
239  IR_schema[TOK(TOK_STRG)] = name_id + STR(var_decl_unique_id++);
240  var_decl_name_nid_test = TM->find(identifier_node_K, IR_schema);
241  } while(var_decl_name_nid_test);
242  unsigned int var_decl_name_nid = TM->new_tree_node_id();
243  TM->create_tree_node(var_decl_name_nid, identifier_node_K, IR_schema);
244  IR_schema.clear();
245  tree_nodeRef tr_new_id = TM->GetTreeReindex(var_decl_name_nid);
246  dn->name = tr_new_id;
247  function_behavior->GetBehavioralHelper()->InvaildateVariableName(dn->index);
248  modified = true;
249  }
250  }
251  }
252  break;
253  }
254  case ssa_name_K:
255  {
256  const ssa_name* sn = GetPointer<ssa_name>(curr_tn);
257  if(sn->var)
258  {
259  recursive_examinate(sn->var, already_examinated_decls, already_examinated_names,
260  already_examinated_type_names, already_visited_ae);
261  }
262  break;
263  }
264  case tree_list_K:
265  {
266  tree_nodeRef current = tn;
267  while(current)
268  {
269  recursive_examinate(GetPointer<tree_list>(GET_NODE(current))->valu, already_examinated_decls,
270  already_examinated_names, already_examinated_type_names, already_visited_ae);
271  current = GetPointer<tree_list>(GET_NODE(current))->chan;
272  }
273  break;
274  }
276  {
277  if(curr_tn->get_kind() == addr_expr_K)
278  {
279  if(already_visited_ae.find(GET_INDEX_NODE(tn)) != already_visited_ae.end())
280  {
281  break;
282  }
283  already_visited_ae.insert(GET_INDEX_NODE(tn));
284  }
285  const unary_expr* ue = GetPointer<unary_expr>(curr_tn);
286  recursive_examinate(ue->op, already_examinated_decls, already_examinated_names, already_examinated_type_names,
287  already_visited_ae);
288  break;
289  }
291  {
292  const binary_expr* be = GetPointer<binary_expr>(curr_tn);
293  recursive_examinate(be->op0, already_examinated_decls, already_examinated_names, already_examinated_type_names,
294  already_visited_ae);
295  recursive_examinate(be->op1, already_examinated_decls, already_examinated_names, already_examinated_type_names,
296  already_visited_ae);
297  break;
298  }
300  {
301  const ternary_expr* te = GetPointer<ternary_expr>(curr_tn);
302  recursive_examinate(te->op0, already_examinated_decls, already_examinated_names, already_examinated_type_names,
303  already_visited_ae);
304  if(te->op1)
305  {
306  recursive_examinate(te->op1, already_examinated_decls, already_examinated_names,
307  already_examinated_type_names, already_visited_ae);
308  }
309  if(te->op2)
310  {
311  recursive_examinate(te->op2, already_examinated_decls, already_examinated_names,
312  already_examinated_type_names, already_visited_ae);
313  }
314  break;
315  }
317  {
318  const quaternary_expr* qe = GetPointer<quaternary_expr>(curr_tn);
319  recursive_examinate(qe->op0, already_examinated_decls, already_examinated_names, already_examinated_type_names,
320  already_visited_ae);
321  if(qe->op1)
322  {
323  recursive_examinate(qe->op1, already_examinated_decls, already_examinated_names,
324  already_examinated_type_names, already_visited_ae);
325  }
326  if(qe->op2)
327  {
328  recursive_examinate(qe->op2, already_examinated_decls, already_examinated_names,
329  already_examinated_type_names, already_visited_ae);
330  }
331  if(qe->op3)
332  {
333  recursive_examinate(qe->op3, already_examinated_decls, already_examinated_names,
334  already_examinated_type_names, already_visited_ae);
335  }
336  break;
337  }
338  case lut_expr_K:
339  {
340  auto* le = GetPointer<lut_expr>(curr_tn);
341  recursive_examinate(le->op0, already_examinated_decls, already_examinated_names, already_examinated_type_names,
342  already_visited_ae);
343  recursive_examinate(le->op1, already_examinated_decls, already_examinated_names, already_examinated_type_names,
344  already_visited_ae);
345  if(le->op2)
346  {
347  recursive_examinate(le->op2, already_examinated_decls, already_examinated_names,
348  already_examinated_type_names, already_visited_ae);
349  }
350  if(le->op3)
351  {
352  recursive_examinate(le->op3, already_examinated_decls, already_examinated_names,
353  already_examinated_type_names, already_visited_ae);
354  }
355  if(le->op4)
356  {
357  recursive_examinate(le->op4, already_examinated_decls, already_examinated_names,
358  already_examinated_type_names, already_visited_ae);
359  }
360  if(le->op5)
361  {
362  recursive_examinate(le->op5, already_examinated_decls, already_examinated_names,
363  already_examinated_type_names, already_visited_ae);
364  }
365  if(le->op6)
366  {
367  recursive_examinate(le->op6, already_examinated_decls, already_examinated_names,
368  already_examinated_type_names, already_visited_ae);
369  }
370  if(le->op7)
371  {
372  recursive_examinate(le->op7, already_examinated_decls, already_examinated_names,
373  already_examinated_type_names, already_visited_ae);
374  }
375  if(le->op8)
376  {
377  recursive_examinate(le->op8, already_examinated_decls, already_examinated_names,
378  already_examinated_type_names, already_visited_ae);
379  }
380  break;
381  }
382  case constructor_K:
383  {
384  const constructor* co = GetPointer<constructor>(curr_tn);
385  const std::vector<std::pair<tree_nodeRef, tree_nodeRef>>& list_of_idx_valu = co->list_of_idx_valu;
386  std::vector<std::pair<tree_nodeRef, tree_nodeRef>>::const_iterator it, it_end = list_of_idx_valu.end();
387  for(it = list_of_idx_valu.begin(); it != it_end; ++it)
388  {
389  recursive_examinate(it->second, already_examinated_decls, already_examinated_names,
390  already_examinated_type_names, already_visited_ae);
391  }
392  break;
393  }
394  case gimple_cond_K:
395  {
396  const gimple_cond* gc = GetPointer<gimple_cond>(curr_tn);
397  recursive_examinate(gc->op0, already_examinated_decls, already_examinated_names, already_examinated_type_names,
398  already_visited_ae);
399  break;
400  }
401  case gimple_switch_K:
402  {
403  const gimple_switch* se = GetPointer<gimple_switch>(curr_tn);
404  recursive_examinate(se->op0, already_examinated_decls, already_examinated_names, already_examinated_type_names,
405  already_visited_ae);
406  break;
407  }
408  case gimple_multi_way_if_K:
409  {
410  auto* gmwi = GetPointer<gimple_multi_way_if>(curr_tn);
411  for(const auto& cond : gmwi->list_of_cond)
412  {
413  if(cond.first)
414  {
415  recursive_examinate(cond.first, already_examinated_decls, already_examinated_names,
416  already_examinated_type_names, already_visited_ae);
417  }
418  }
419  break;
420  }
421  case gimple_return_K:
422  {
423  const gimple_return* re = GetPointer<gimple_return>(curr_tn);
424  if(re->op)
425  {
426  recursive_examinate(re->op, already_examinated_decls, already_examinated_names,
427  already_examinated_type_names, already_visited_ae);
428  }
429  break;
430  }
431  case gimple_for_K:
432  {
433  const gimple_for* fe = GetPointer<gimple_for>(curr_tn);
434  recursive_examinate(fe->op0, already_examinated_decls, already_examinated_names, already_examinated_type_names,
435  already_visited_ae);
436  recursive_examinate(fe->op1, already_examinated_decls, already_examinated_names, already_examinated_type_names,
437  already_visited_ae);
438  recursive_examinate(fe->op2, already_examinated_decls, already_examinated_names, already_examinated_type_names,
439  already_visited_ae);
440  break;
441  }
442  case gimple_while_K:
443  {
444  const gimple_while* we = GetPointer<gimple_while>(curr_tn);
445  recursive_examinate(we->op0, already_examinated_decls, already_examinated_names, already_examinated_type_names,
446  already_visited_ae);
447  break;
448  }
449  case CASE_TYPE_NODES:
450  {
451  if(already_examinated_decls.find(GET_INDEX_NODE(tn)) == already_examinated_decls.end())
452  {
453  already_examinated_decls.insert(GET_INDEX_NODE(tn));
454  auto* ty = GetPointer<type_node>(GET_NODE(tn));
455  if(ty && ty->name && GET_NODE(ty->name)->get_kind() == type_decl_K)
456  {
457  recursive_examinate(ty->name, already_examinated_decls, already_examinated_names,
458  already_examinated_type_names, already_visited_ae);
459  }
460  else if(ty and (not ty->system_flag) and ty->name and
461  (GET_NODE(ty->name)->get_kind() == identifier_node_K) and (ty->get_kind() != integer_type_K))
462  {
463  std::string name_id = GetPointer<identifier_node>(GET_NODE(ty->name))->strg;
464  if(already_examinated_type_names.find(name_id) == already_examinated_type_names.end())
465  {
466  already_examinated_type_names.insert(name_id);
467  }
468  else
469  {
470  INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "---" + name_id + " is a duplicated type");
472  std::map<TreeVocabularyTokenTypes_TokenEnum, std::string> IR_schema;
473  unsigned int var_decl_name_nid_test;
474  unsigned var_decl_unique_id = 0;
475  do
476  {
477  IR_schema[TOK(TOK_STRG)] = name_id + STR(var_decl_unique_id++);
478  var_decl_name_nid_test = TM->find(identifier_node_K, IR_schema);
479  } while(var_decl_name_nid_test);
480  unsigned int var_decl_name_nid = TM->new_tree_node_id();
481  TM->create_tree_node(var_decl_name_nid, identifier_node_K, IR_schema);
482  IR_schema.clear();
483  tree_nodeRef tr_new_id = TM->GetTreeReindex(var_decl_name_nid);
484  ty->name = tr_new_id;
485  modified = true;
486  }
487  }
488  }
489  break;
490  }
491  case type_decl_K:
492  {
493  auto* td = GetPointer<type_decl>(GET_NODE(tn));
494  if(td and td->name and td->include_name != "<built-in>" and (not td->operating_system_flag) and
495  (not td->library_system_flag))
496  {
497  std::string name_id = GetPointer<identifier_node>(GET_NODE(td->name))->strg;
498  if(already_examinated_type_names.find(name_id) == already_examinated_type_names.end())
499  {
500  already_examinated_type_names.insert(name_id);
501  }
502  else
503  {
504  INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "---" + name_id + " is a duplicated type");
506  std::map<TreeVocabularyTokenTypes_TokenEnum, std::string> IR_schema;
507  unsigned int var_decl_name_nid_test;
508  unsigned var_decl_unique_id = 0;
509  do
510  {
511  IR_schema[TOK(TOK_STRG)] = name_id + STR(var_decl_unique_id++);
512  var_decl_name_nid_test = TM->find(identifier_node_K, IR_schema);
513  } while(var_decl_name_nid_test);
514  unsigned int var_decl_name_nid = TM->new_tree_node_id();
515  TM->create_tree_node(var_decl_name_nid, identifier_node_K, IR_schema);
516  IR_schema.clear();
517  tree_nodeRef tr_new_id = TM->GetTreeReindex(var_decl_name_nid);
518  td->name = tr_new_id;
519  modified = true;
520  }
521  }
522  break;
523  }
524  case target_mem_ref_K:
525  {
526  const target_mem_ref* tmr = GetPointer<target_mem_ref>(curr_tn);
527  if(tmr->symbol)
528  {
529  recursive_examinate(tmr->symbol, already_examinated_decls, already_examinated_names,
530  already_examinated_type_names, already_visited_ae);
531  }
532  if(tmr->base)
533  {
534  recursive_examinate(tmr->base, already_examinated_decls, already_examinated_names,
535  already_examinated_type_names, already_visited_ae);
536  }
537  if(tmr->idx)
538  {
539  recursive_examinate(tmr->idx, already_examinated_decls, already_examinated_names,
540  already_examinated_type_names, already_visited_ae);
541  }
542  break;
543  }
544  case target_mem_ref461_K:
545  {
546  const target_mem_ref461* tmr = GetPointer<target_mem_ref461>(curr_tn);
547  if(tmr->base)
548  {
549  recursive_examinate(tmr->base, already_examinated_decls, already_examinated_names,
550  already_examinated_type_names, already_visited_ae);
551  }
552  if(tmr->idx)
553  {
554  recursive_examinate(tmr->idx, already_examinated_decls, already_examinated_names,
555  already_examinated_type_names, already_visited_ae);
556  }
557  if(tmr->idx2)
558  {
559  recursive_examinate(tmr->idx2, already_examinated_decls, already_examinated_names,
560  already_examinated_type_names, already_visited_ae);
561  }
562  break;
563  }
564  case real_cst_K:
565  case complex_cst_K:
566  case string_cst_K:
567  case integer_cst_K:
568  case field_decl_K:
569  case function_decl_K:
570  case label_decl_K:
571  case result_decl_K:
572  case template_decl_K:
573  case vector_cst_K:
574  case void_cst_K:
575  case tree_vec_K:
576  case case_label_expr_K:
577  case gimple_label_K:
578  case gimple_asm_K:
579  case gimple_goto_K:
580  case gimple_pragma_K:
581  case gimple_resx_K:
582  case CASE_PRAGMA_NODES:
583  break;
584  case binfo_K:
585  case block_K:
586  case const_decl_K:
587  case CASE_CPP_NODES:
588  case gimple_bind_K:
589  case gimple_phi_K:
590  case gimple_predict_K:
591  case identifier_node_K:
592  case last_tree_K:
593  case namespace_decl_K:
594  case none_K:
595  case placeholder_expr_K:
596  case statement_list_K:
597  case translation_unit_decl_K:
598  case error_mark_K:
599  case using_decl_K:
600  case tree_reindex_K:
601  case target_expr_K:
602  {
603  THROW_ERROR_CODE(NODE_NOT_YET_SUPPORTED_EC, "Not supported node: " + std::string(curr_tn->get_kind_text()));
604  break;
605  }
606  default:
607  THROW_UNREACHABLE("");
608  }
610  "<--Analyzed recursively " + STR(GET_INDEX_NODE(tn)) + ": " + STR(tn));
611  return;
612 }
613 
614 const std::string VarDeclFix::Normalize(const std::string& identifier) const
615 {
616  return identifier;
617 }
#define GET_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
Definition: tree_node.hpp:343
DesignFlowStep_Status InternalExec() override
Fixes the var_decl duplication.
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
#define INDENT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
File containing functions and utilities to support the printing of debug messagges.
#define PRINT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
std::string ToString() const
Print this node as string in gimple format.
#define DEBUG_LEVEL_PEDANTIC
very verbose debugging print is performed.
Step successfully executed.
#define CASE_BINARY_EXPRESSION
This macro collects all case labels for binary_expr objects.
Definition: tree_node.hpp:463
const CustomUnorderedSet< std::pair< FrontendFlowStepType, FunctionRelationship > > ComputeFrontendRelationships(const DesignFlowStep::RelationshipType relationship_type) const override
Return the set of analyses in relationship with this design step.
#define GET_CLASS(obj)
Macro returning the actual type of an object.
Definition of the class representing a generic C application.
tree_nodeRef idx
INDEX register.
Definition: tree_node.hpp:4955
std::vector< std::pair< tree_nodeRef, tree_nodeRef > > list_of_idx_valu
store the list initializers: <index, value>
Definition: tree_node.hpp:2445
RelationshipType
The relationship type.
Source must be executed to satisfy target.
tree_nodeRef var
var is the variable being referenced (macro SSA_NAME_VAR).
Definition: tree_node.hpp:4543
exceptions managed by PandA
tree_nodeRef op2
The third operand of the ternary expression.
Definition: tree_node.hpp:1253
tree_nodeRef op1
The second operand of the Quaternary expression.
Definition: tree_node.hpp:1287
A simple interface to token object of the raw files.
struct definition of the unary node structures.
Definition: tree_node.hpp:1177
tree_nodeRef base
BASE register.
Definition: tree_node.hpp:4949
#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
tree_nodeRef op1
The second operand of the binary expression.
Definition: tree_node.hpp:1217
struct definition of the ternary node structures.
Definition: tree_node.hpp:1239
This struct specifies the gimple_cond node.
Definition: tree_node.hpp:2345
std::vector< tree_nodeRef > args
The arguments of the gimple_call.
Definition: tree_node.hpp:1968
Node not yet supported.
Definition: exceptions.hpp:323
Data structure describing a basic block at tree level.
Constructor: return an aggregate value made from specified components.
Definition: tree_node.hpp:2434
redefinition of map to manage ordered/unordered structures
#define TOK(token)
Macro used to convert a token symbol into a treeVocabularyTokenTypes.
virtual enum kind get_kind() const =0
Virtual function returning the type of the actual class.
#define STR(s)
Macro which performs a lexical_cast to a string.
Auxiliary methods for manipulating string.
std::vector< tree_nodeRef > args
The arguments of the call_expr.
Definition: tree_node.hpp:1882
tree_nodeRef op3
The fourth operand of the Quaternary expression.
Definition: tree_node.hpp:1293
#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.
struct definition of the Quaternary node structures.
Definition: tree_node.hpp:1276
#define CASE_QUATERNARY_EXPRESSION
This macro collects all case labels for quaternary_expr objects.
Definition: tree_node.hpp:574
#define CASE_UNARY_EXPRESSION
This macro collects all case labels for unary_expr objects.
Definition: tree_node.hpp:371
VarDeclFix(const application_managerRef AppM, unsigned int _function_id, const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters, const FrontendFlowStepType frontend_flow_step_type=VAR_DECL_FIX)
Constructor.
Low-level memory addressing.
Definition: tree_node.hpp:4938
This struct specifies the gimple_return node.
Definition: tree_node.hpp:4354
tree_nodeRef idx
INDEX register.
Definition: tree_node.hpp:4882
Pre-analysis step fixing var_decl duplication.
tree_nodeRef base
BASE register.
Definition: tree_node.hpp:4879
tree_nodeRef op0
the branch var
Definition: tree_node.hpp:4781
Classes specification of the tree_node data structures.
static std::string NormalizeTypename(const std::string &id)
Return normalized name of types and variables.
GIMPLE_SWITCH <INDEX, DEFAULT_LAB, LAB1, ..., LABN> represents the multiway branch: ...
Definition: tree_node.hpp:4773
const ParameterConstRef parameters
Set of input parameters.
DesignFlowStep_Status
The status of a step.
tree_nodeRef op0
The first operand of the ternary expression.
Definition: tree_node.hpp:2353
#define DEBUG_LEVEL_NONE
no debugging print is performed.
virtual const std::string Normalize(const std::string &identifier) const
Return the normalized identifier; in this class it is the identifier itself.
#define CASE_TYPE_NODES
This macro collects all case labels for type objects.
Definition: tree_node.hpp:581
This file collects some utility functions.
tree_nodeRef op0
The first operand of the binary expression.
Definition: tree_node.hpp:1214
tree_nodeRef GetTreeNode(const unsigned int index) const
Return the index-th tree_node (modifiable version)
enum FrontendFlowStepType { CREATE_TREE_MANAGER, FIND_MAX_TRANSFORMATIONS, FUNCTION_ANALYSIS, SYMBOLIC_APPLICATION_FRONTEND_FLOW_STEP, ADD_BB_ECFG_EDGES, ADD_ARTIFICIAL_CALL_FLOW_EDGES, ADD_OP_EXIT_FLOW_EDGES, ADD_OP_LOOP_FLOW_EDGES, ADD_OP_PHI_FLOW_EDGES, BAMBU_FRONTEND_FLOW, BASIC_BLOCKS_CFG_COMPUTATION, BB_CONTROL_DEPENDENCE_COMPUTATION, BB_FEEDBACK_EDGES_IDENTIFICATION, BB_ORDER_COMPUTATION, BB_REACHABILITY_COMPUTATION, BIT_VALUE, BIT_VALUE_OPT, BITVALUE_RANGE, BIT_VALUE_IPA, BLOCK_FIX, BUILD_VIRTUAL_PHI, CALL_EXPR_FIX, CALL_GRAPH_BUILTIN_CALL, CHECK_SYSTEM_TYPE, COMPLETE_BB_GRAPH, COMPLETE_CALL_GRAPH, COMPUTE_IMPLICIT_CALLS, COMMUTATIVE_EXPR_RESTRUCTURING, COND_EXPR_RESTRUCTURING, CSE_STEP, DATAFLOW_CG_EXT, DEAD_CODE_ELIMINATION, DEAD_CODE_ELIMINATION_IPA, DETERMINE_MEMORY_ACCESSES, DOM_POST_DOM_COMPUTATION, EXTRACT_GIMPLE_COND_OP, EXTRACT_PATTERNS, FIX_STRUCTS_PASSED_BY_VALUE, FUNCTION_CALL_TYPE_CLEANUP, FUNCTION_CALL_OPT, FANOUT_OPT, FIX_VDEF, HDL_FUNCTION_DECL_FIX, HDL_VAR_DECL_FIX, HLS_DIV_CG_EXT, HWCALL_INJECTION, INTERFACE_INFER, IR_LOWERING, LOOP_COMPUTATION, LOOPS_ANALYSIS_BAMBU, LOOPS_COMPUTATION, LUT_TRANSFORMATION, MULTI_WAY_IF, MULTIPLE_ENTRY_IF_REDUCTION, NI_SSA_LIVENESS, OP_CONTROL_DEPENDENCE_COMPUTATION, OP_FEEDBACK_EDGES_IDENTIFICATION, OP_ORDER_COMPUTATION, OP_REACHABILITY_COMPUTATION, OPERATIONS_CFG_COMPUTATION, PARM2SSA, PARM_DECL_TAKEN_ADDRESS, PHI_OPT, PREDICATE_STATEMENTS, ESSA, RANGE_ANALYSIS, REBUILD_INITIALIZATION, REBUILD_INITIALIZATION2, REMOVE_CLOBBER_GA, REMOVE_ENDING_IF, SCALAR_SSA_DATA_FLOW_ANALYSIS, SERIALIZE_MUTUAL_EXCLUSIONS, SPLIT_RETURN, SHORT_CIRCUIT_TAF, SIMPLE_CODE_MOTION, SOFT_FLOAT_CG_EXT, STRING_CST_FIX, SWITCH_FIX, UN_COMPARISON_LOWERING, UNROLLING_DEGREE, USE_COUNTING, VAR_ANALYSIS, VAR_DECL_FIX, VECTORIZE, VERIFICATION_OPERATION, VIRTUAL_AGGREGATE_DATA_FLOW_ANALYSIS, VIRTUAL_PHI_NODES_SPLIT } FrontendFlowStepType
~VarDeclFix() override
Destructor.
const unsigned int function_id
The index of the function to be analyzed.
const application_managerRef AppM
The application manager.
Class specification of the tree_reindex support class.
This struct specifies the call_expr node.
Definition: tree_node.hpp:1873
tree_nodeRef op1
initialization
tree_nodeRef op0
The first operand of the Quaternary expression.
Definition: tree_node.hpp:1284
tree_nodeRef op0
The first operand of the ternary expression.
Definition: tree_node.hpp:1247
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Definition: refcount.hpp:94
void recursive_examinate(const tree_nodeRef &tn, CustomUnorderedSet< unsigned int > &already_examinated_decls, CustomUnorderedSet< std::string > &already_examinated_names, CustomUnorderedSet< std::string > &already_examinated_type_names, CustomUnorderedSet< unsigned int > &already_visited_ae)
Recursive examinate tree node.
#define THROW_ERROR_CODE(code, str_expr)
helper function used to throw an error with a code error
Definition: exceptions.hpp:266
tree_nodeRef idx2
INDEX register.
Definition: tree_node.hpp:4961
Classes specification of the tree_node data structures not present in the gcc.
this class is used to manage the command-line or XML options.
#define CASE_CPP_NODES
This macro collects all case labels for cpp nodes.
Definition: tree_node.hpp:644
Low-level memory addressing.
Definition: tree_node.hpp:4865
This struct specifies the ssa_name node.
Definition: tree_node.hpp:4523
tree_nodeRef op
op field is the operand of this node
Definition: tree_node.hpp:4362
This struct specifies the for expression Used to represent a for construct.
int debug_level
The debug level.
tree_nodeRef op2
postincrement
struct definition of the binary node structures.
Definition: tree_node.hpp:1206
tree_nodeRef op
op field is the operand of the unary expression
Definition: tree_node.hpp:1185
tree_nodeRef op0
The boolean condition.
tree_nodeRef symbol
static or global variable
Definition: tree_node.hpp:4876
tree_nodeRef op1
The second operand of the ternary expression.
Definition: tree_node.hpp:1250
This struct specifies the gimple_call node.
Definition: tree_node.hpp:1959
#define CASE_TERNARY_EXPRESSION
This macro collects all case labels for ternary_expr objects.
Definition: tree_node.hpp:550
tree_nodeRef op2
The third operand of the Quaternary expression.
Definition: tree_node.hpp:1290
Class specification of the manager of the tree structures extracted from the raw file.
A brief description of the C++ Header File.
This struct specifies the while expression Used to represent a while construct.
const FunctionBehaviorRef function_behavior
The function behavior of the function to be analyzed.
int sl
Definition: adpcm.c:105
#define CASE_PRAGMA_NODES
This macro collects all case labels for pragma objects.
Definition: tree_node.hpp:610
#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:52 for PandA-2024.02 by doxygen 1.8.13