69 unsigned int _function_id,
70 const DesignFlowManagerConstRef _design_flow_manager)
80 switch(relationship_type)
102 auto* fd = GetPointerS<function_decl>(tn);
103 THROW_ASSERT(fd && fd->body,
"Node is not a function or it hasn't a body");
104 auto*
sl = GetPointerS<statement_list>(
GET_NODE(fd->body));
106 auto B_it_end =
sl->list_of_bloc.end();
111 for(
auto B_it =
sl->list_of_bloc.begin(); B_it != B_it_end; ++B_it)
113 blocRef
B = B_it->second;
115 const auto& list_of_stmt = B->CGetStmtList();
116 auto it_los_end = list_of_stmt.end();
117 auto it_los = list_of_stmt.begin();
118 while(it_los != it_los_end)
121 "-->Examining statement " +
GET_NODE(*it_los)->ToString());
122 if(
GET_NODE(*it_los)->get_kind() == gimple_assign_K)
124 auto* ga = GetPointerS<gimple_assign>(
GET_NODE(*it_los));
127 "Left part of assignment " +
GET_NODE(ga->op0)->get_kind_text() +
128 (code0 == array_ref_K ?
137 "check for an initialization such as var[const_index] = const_value; " +
139 auto* ar = GetPointerS<array_ref>(
GET_NODE(ga->op0));
140 if(
GET_NODE(ar->op0)->get_kind() == var_decl_K &&
GET_NODE(ar->op1)->get_kind() == integer_cst_K)
142 auto* vd = GetPointerS<var_decl>(
GET_NODE(ar->op0));
143 if(vd->readonly_flag)
145 THROW_ASSERT(!vd->init,
"Writing element of read only array already initialized: " +
STR(ga->op0));
148 "<--Statement removed " +
GET_NODE(*it_los)->ToString());
152 std::map<TreeVocabularyTokenTypes_TokenEnum, std::string> gimple_nop_schema;
161 std::map<TreeVocabularyTokenTypes_TokenEnum, std::string> gimple_nop_schema;
168 B->RemoveStmt(*it_los,
AppM);
169 it_los = list_of_stmt.begin();
170 it_los_end = list_of_stmt.end();
177 "<--Examined statement " +
GET_NODE(*it_los)->ToString());
184 for(
const auto&
init : inits)
187 std::map<TreeVocabularyTokenTypes_TokenEnum, std::string> constructor_tree_node_schema;
193 TM->
create_tree_node(constructor_index, constructor_K, constructor_tree_node_schema);
194 auto* constr = GetPointerS<constructor>(TM->
GetTreeNode(constructor_index));
195 const auto last_index =
init.second.rbegin()->first;
197 for(index = 0; index <= last_index; index++)
200 if(
init.second.count(index))
207 "Type not supported " +
STR(element_type));
219 unsigned int _function_id,
220 const DesignFlowManagerConstRef _design_flow_manager)
230 switch(relationship_type)
234 relationships.insert(std::make_pair(IR_LOWERING,
SAME_FUNCTION));
245 return relationships;
252 if(opSSA->
get_kind() == integer_cst_K)
257 auto* ssa_opSSA = GetPointerS<ssa_name>(opSSA);
258 auto opSSA_def_stmt =
GET_NODE(ssa_opSSA->CGetDefStmt());
259 if(opSSA_def_stmt->get_kind() == gimple_nop_K || opSSA_def_stmt->get_kind() == gimple_phi_K)
263 THROW_ASSERT(opSSA_def_stmt->get_kind() == gimple_assign_K,
264 "unexpected condition: " + opSSA_def_stmt->get_kind_text());
265 auto* opSSA_assign = GetPointerS<gimple_assign>(opSSA_def_stmt);
272 auto* ae = GetPointerS<addr_expr>(node);
274 if(ae_op->get_kind() == parm_decl_K)
278 THROW_ASSERT(ae_op->get_kind() == var_decl_K,
"unexpected condition: " + ae_op->get_kind_text());
284 #define REBUILD2_DEVEL 0 286 #define unexpetedPattern(node) \ 287 THROW_ERROR("unexpected condition: " + node->get_kind_text() + " --- " + node->ToString()); 298 auto* ppe = GetPointerS<pointer_plus_expr>(addr_assign_op1);
301 if(!addr2_assign_op1)
305 if(addr2_assign_op1->get_kind() == view_convert_expr_K || addr2_assign_op1->get_kind() == nop_expr_K)
307 auto* ue = GetPointerS<unary_expr>(addr2_assign_op1);
310 if(!addr3_assign_op1)
314 if(addr3_assign_op1->get_kind() == addr_expr_K)
316 return varFound(addr3_assign_op1, vd_index, vd_node);
320 if(addr3_assign_op1->get_kind() == ssa_name_K)
322 auto addr4_assign_op1 =
extractOp1(addr3_assign_op1);
323 if(!addr4_assign_op1)
327 if(addr4_assign_op1->get_kind() == pointer_plus_expr_K)
329 addr_assign_op1 = addr4_assign_op1;
332 else if(addr4_assign_op1->get_kind() == addr_expr_K)
334 return varFound(addr4_assign_op1, vd_index, vd_node);
336 else if(addr4_assign_op1->get_kind() == ssa_name_K)
338 auto addr5_assign_op1 =
extractOp1(addr4_assign_op1);
339 if(!addr5_assign_op1)
343 if(addr5_assign_op1->get_kind() == pointer_plus_expr_K)
345 addr_assign_op1 = addr5_assign_op1;
353 else if(addr4_assign_op1->get_kind() == mem_ref_K)
362 else if(addr3_assign_op1->get_kind() == pointer_plus_expr_K)
364 addr_assign_op1 = addr3_assign_op1;
372 else if(addr3_assign_op1->get_kind() == ssa_name_K)
374 auto addr4_assign_op1 =
extractOp1(addr3_assign_op1);
375 if(!addr4_assign_op1)
379 if(addr4_assign_op1->get_kind() == addr_expr_K)
381 return varFound(addr4_assign_op1, vd_index, vd_node);
383 else if(addr4_assign_op1->get_kind() == ssa_name_K)
385 auto addr5_assign_op1 =
extractOp1(addr4_assign_op1);
386 if(!addr5_assign_op1)
392 else if(addr4_assign_op1->get_kind() == nop_expr_K)
394 auto* ne1 = GetPointerS<nop_expr>(addr4_assign_op1);
397 if(!addr5_assign_op1)
403 else if(addr4_assign_op1->get_kind() == pointer_plus_expr_K)
412 else if(addr3_assign_op1->get_kind() == view_convert_expr_K)
414 auto* ue1 = GetPointerS<unary_expr>(addr3_assign_op1);
416 if(ue1_op->get_kind() == ssa_name_K)
419 if(!addr4_assign_op1)
423 if(addr4_assign_op1->get_kind() == addr_expr_K)
425 return varFound(addr4_assign_op1, vd_index, vd_node);
427 else if(addr4_assign_op1->get_kind() == pointer_plus_expr_K)
441 else if(addr3_assign_op1->get_kind() == pointer_plus_expr_K)
445 else if(addr3_assign_op1->get_kind() == plus_expr_K)
449 else if(addr3_assign_op1->get_kind() == call_expr_K)
458 else if(addr2_assign_op1->get_kind() == addr_expr_K)
460 return varFound(addr2_assign_op1, vd_index, vd_node);
462 else if(addr2_assign_op1->get_kind() == ssa_name_K)
464 auto addr3_assign_op1 =
extractOp1(addr2_assign_op1);
465 if(!addr3_assign_op1)
469 if(addr3_assign_op1->get_kind() == pointer_plus_expr_K)
473 addr_assign_op1 = addr3_assign_op1;
481 else if(addr3_assign_op1->get_kind() == addr_expr_K)
483 return varFound(addr3_assign_op1, vd_index, vd_node);
490 else if(addr2_assign_op1->get_kind() == pointer_plus_expr_K)
494 else if(addr2_assign_op1->get_kind() == mem_ref_K)
498 else if(addr2_assign_op1->get_kind() == call_expr_K)
502 else if(addr2_assign_op1->get_kind() == cond_expr_K)
516 THROW_ASSERT(me_op1->get_kind() == integer_cst_K,
"unexpected condition");
524 if(addr_assign_op1->
get_kind() == pointer_plus_expr_K)
528 else if(addr_assign_op1->
get_kind() == ssa_name_K)
530 auto addr2_assign_op1 =
extractOp1(addr_assign_op1);
531 if(!addr2_assign_op1)
535 if(addr2_assign_op1->get_kind() == nop_expr_K)
537 auto* ne = GetPointerS<nop_expr>(addr2_assign_op1);
540 if(!addr3_assign_op1)
546 else if(addr2_assign_op1->get_kind() == pointer_plus_expr_K)
548 addr_assign_op1 = addr2_assign_op1;
551 else if(addr2_assign_op1->get_kind() == addr_expr_K)
553 return varFound(addr2_assign_op1, vd_index, vd_node);
555 else if(addr2_assign_op1->get_kind() == mem_ref_K)
564 else if(addr_assign_op1->
get_kind() == addr_expr_K)
566 return varFound(addr_assign_op1, vd_index, vd_node);
568 else if(addr_assign_op1->
get_kind() == view_convert_expr_K || addr_assign_op1->
get_kind() == nop_expr_K ||
569 addr_assign_op1->
get_kind() == convert_expr_K)
571 auto* ue = GetPointerS<unary_expr>(addr_assign_op1);
574 if(!addr1_assign_op1)
578 if(addr1_assign_op1->get_kind() == addr_expr_K)
580 return varFound(addr1_assign_op1, vd_index, vd_node);
582 else if(addr1_assign_op1->get_kind() == ssa_name_K)
584 auto addr2_assign_op1 =
extractOp1(addr1_assign_op1);
585 if(!addr2_assign_op1)
589 if(addr2_assign_op1->get_kind() == pointer_plus_expr_K)
591 addr_assign_op1 = addr2_assign_op1;
596 else if(addr1_assign_op1->get_kind() == nop_expr_K)
598 auto* ne1 = GetPointerS<unary_expr>(addr1_assign_op1);
601 if(!addr2_assign_op1)
605 if(addr2_assign_op1->get_kind() == ssa_name_K)
608 if(!addr3_assign_op1)
612 if(addr3_assign_op1->get_kind() == pointer_plus_expr_K)
614 addr_assign_op1 = addr3_assign_op1;
627 else if(addr1_assign_op1->get_kind() == pointer_plus_expr_K)
629 addr_assign_op1 = addr1_assign_op1;
637 else if(addr_assign_op1->
get_kind() == mem_ref_K)
641 else if(addr_assign_op1->
get_kind() == call_expr_K)
645 else if(addr_assign_op1->
get_kind() == cond_expr_K)
655 #define foundNonConstant(VD) \ 658 nonConstantVars.insert(VD); \ 659 auto key = TM->CGetTreeReindex(VD); \ 664 #define unexpetedPattern2(node, VD) \ 665 THROW_ERROR("unexpected condition: " + node->get_kind_text() + " --- " + node->ToString()); 667 #define unexpetedPattern2(node, VD) foundNonConstant(VD) 674 auto* ssa_var = GetPointerS<ssa_name>(SSAop);
675 auto ssa_def_stmt =
GET_NODE(ssa_var->CGetDefStmt());
676 if(ssa_def_stmt->get_kind() == gimple_nop_K || ssa_def_stmt->get_kind() == gimple_phi_K)
678 nonConstantVars.insert(vd_index);
679 auto key = TM->CGetTreeReindex(vd_index);
685 THROW_ASSERT(ssa_def_stmt->get_kind() == gimple_assign_K,
686 "unexpected condition: " + ssa_def_stmt->get_kind_text());
687 auto* assign = GetPointerS<gimple_assign>(ssa_def_stmt);
697 auto* fd = GetPointerS<function_decl>(tn);
698 THROW_ASSERT(fd && fd->body,
"Node is not a function or it hasn't a body");
699 auto*
sl = GetPointerS<statement_list>(
GET_NODE(fd->body));
701 bool not_supported =
false;
702 std::map<unsigned, unsigned> var_writing_BB_relation;
703 std::map<unsigned, unsigned long long> var_writing_size_relation;
704 std::map<unsigned, unsigned long long> var_writing_elts_size_relation;
709 for(
const auto& Bit :
sl->list_of_bloc)
717 const auto& list_of_stmt =
B->CGetStmtList();
718 for(
const auto& inst : list_of_stmt)
721 auto gn = GetPointerS<gimple_node>(
GET_NODE(inst));
722 auto stmt_kind =
GET_NODE(inst)->get_kind();
723 if(gn->vdef && stmt_kind != gimple_assign_K)
726 not_supported =
true;
729 if(stmt_kind == gimple_assign_K && gn->vdef)
731 auto ga = GetPointerS<gimple_assign>(
GET_NODE(inst));
734 if(op0->get_kind() == mem_ref_K)
736 unsigned vd_index = 0;
739 auto* me = GetPointerS<mem_ref>(op0);
741 if(resolved && nonConstantVars.find(vd_index) == nonConstantVars.end())
743 THROW_ASSERT(vd_index && vd_node,
"unexpected condition");
747 if(!GetPointer<cst_node>(op1))
753 if(nonConstantVars.find(vd_index) == nonConstantVars.end())
755 if(VarsReadSeen.find(vd_index) != VarsReadSeen.end())
758 "---variable is not constant(2): " +
762 else if(var_writing_BB_relation.find(vd_index) == var_writing_BB_relation.end())
765 auto* vd = GetPointerS<var_decl>(
GET_NODE(vd_node));
769 "---variable is initialized: " +
773 else if(not vd->scpe or
GET_NODE(vd->scpe)->get_kind() == translation_unit_decl_K)
783 if(Type->get_kind() == array_type_K)
785 std::vector<unsigned long long> dims;
786 unsigned long long elts_size;
792 var_writing_BB_relation[vd_index] =
B->number;
793 var_writing_size_relation[vd_index] = dims[0];
794 var_writing_elts_size_relation[vd_index] = elts_size;
799 "---variable is not constant(3): " +
807 "---variable is currently classified as non-constant: " +
813 else if(var_writing_BB_relation.find(vd_index)->second !=
B->number)
816 "---variable is not constant(4): " +
821 if(nonConstantVars.find(vd_index) == nonConstantVars.end())
824 if(addr_assign_op1->
get_kind() == pointer_plus_expr_K)
826 auto* ppe = GetPointerS<pointer_plus_expr>(addr_assign_op1);
828 if(ppe_op1->get_kind() == ssa_name_K)
830 auto offset_assign_op1 =
getAssign(ppe_op1, vd_index, nonConstantVars, inits, TM);
831 if(!offset_assign_op1)
834 "---variable is not constant(9): " +
839 if(offset_assign_op1->get_kind() == lshift_expr_K)
841 auto* ls = GetPointerS<lshift_expr>(offset_assign_op1);
843 if(ls_op1->get_kind() == integer_cst_K)
848 std::vector<unsigned long long> dims;
849 THROW_ASSERT(var_writing_elts_size_relation.find(vd_index) !=
850 var_writing_elts_size_relation.end(),
851 "unexpected condition");
852 auto elts_size = var_writing_elts_size_relation[vd_index];
853 if(elts_size != (8ULL << nbit))
856 "---variable is not constant(9c): " +
863 if(ls_op0->get_kind() == ssa_name_K)
865 auto nop_assign_op1 =
866 getAssign(ls_op0, vd_index, nonConstantVars, inits, TM);
870 "---variable is not constant(9): " +
875 if(nop_assign_op1->get_kind() == nop_expr_K)
877 auto* ne = GetPointerS<nop_expr>(nop_assign_op1);
879 if(ne_op->get_kind() == integer_cst_K)
887 "---variable is not constant(5a): " +
892 else if(nop_assign_op1->get_kind() == integer_cst_K)
897 else if(nop_assign_op1->get_kind() != view_convert_expr_K)
900 "---variable is not constant(5b): " +
921 else if(offset_assign_op1->get_kind() == ssa_name_K)
923 auto offset_assign1_op1 =
924 getAssign(offset_assign_op1, vd_index, nonConstantVars, inits, TM);
925 if(!offset_assign1_op1)
928 "---variable is not constant(9): " +
933 if(offset_assign1_op1->get_kind() == nop_expr_K)
935 auto* ne = GetPointerS<nop_expr>(offset_assign1_op1);
937 if(ne_op->get_kind() == integer_cst_K)
941 else if(ne_op->get_kind() == ssa_name_K)
943 auto offset_assign2_op1 =
944 getAssign(ne_op, vd_index, nonConstantVars, inits, TM);
945 if(!offset_assign2_op1)
948 "---variable is not constant(5c): " +
951 else if(offset_assign2_op1->get_kind() == integer_cst_K)
959 "---variable is not constant(5c): " +
975 else if(offset_assign_op1->get_kind() == nop_expr_K)
977 auto* ne = GetPointerS<nop_expr>(offset_assign_op1);
979 if(ne_op->get_kind() == ssa_name_K)
981 auto offset_assign3_op1 =
getAssign(ne_op, vd_index, nonConstantVars, inits, TM);
982 if(!offset_assign3_op1)
985 "---variable is not constant(9): " +
1004 else if(ppe_op1->get_kind() == integer_cst_K)
1006 THROW_ASSERT(var_writing_elts_size_relation.find(vd_index) !=
1007 var_writing_elts_size_relation.end(),
1008 "unexpected condition");
1011 (
static_cast<integer_cst_t>(var_writing_elts_size_relation[vd_index]) / 8)] =
1019 else if(addr_assign_op1->
get_kind() == view_convert_expr_K)
1021 inits[vd_node][0] = ga->op1;
1023 else if(addr_assign_op1->
get_kind() == ssa_name_K)
1025 inits[vd_node][0] = ga->op1;
1027 else if(addr_assign_op1->
get_kind() == addr_expr_K)
1029 inits[vd_node][0] = ga->op1;
1042 "<--Examined statement: pattern not supported");
1043 not_supported =
true;
1047 else if(op0->get_kind() == ssa_name_K && op1->get_kind() == call_expr_K)
1050 not_supported =
true;
1053 else if(op0->get_kind() == realpart_expr_K || op0->get_kind() == imagpart_expr_K)
1056 not_supported =
true;
1059 else if(op0->get_kind() == ssa_name_K && op1->get_kind() == mem_ref_K)
1062 not_supported =
true;
1068 "<--Examined statement: Not supported" + op0->get_kind_text());
1069 not_supported =
true;
1073 else if(stmt_kind == gimple_assign_K && !gn->vuses.empty())
1075 auto ga = GetPointerS<gimple_assign>(
GET_NODE(inst));
1077 if(op1->get_kind() == mem_ref_K)
1079 unsigned vd_index = 0;
1082 auto* me = GetPointerS<mem_ref>(op1);
1088 VarsReadSeen.insert(vd_index);
1093 "<--Examined statement: pattern not supported");
1094 not_supported =
true;
1100 for(
auto var_written : var_writing_BB_relation)
1102 if(var_written.second ==
B->number)
1104 VarsReadSeen.insert(var_written.first);
1109 else if(!gn->vuses.empty())
1111 for(
auto var_written : var_writing_BB_relation)
1113 if(var_written.second ==
B->number)
1115 VarsReadSeen.insert(var_written.first);
1127 if(not_supported || var_writing_BB_relation.empty() ||
1128 var_writing_BB_relation.size() ==
static_cast<size_t>(nonConstantVars.size()))
1139 for(
const auto&
block :
sl->list_of_bloc)
1141 inverse_vertex_map[
block.first] =
1145 for(
const auto& curr_bb_pair :
sl->list_of_bloc)
1147 auto curr_bb = curr_bb_pair.first;
1148 auto lop_it_end =
sl->list_of_bloc[curr_bb]->list_of_pred.end();
1149 for(
auto lop_it =
sl->list_of_bloc[curr_bb]->list_of_pred.begin(); lop_it != lop_it_end; ++lop_it)
1151 THROW_ASSERT(inverse_vertex_map.find(*lop_it) != inverse_vertex_map.end(),
1152 "BB" +
STR(*lop_it) +
" (successor of BB" +
STR(curr_bb) +
") does not exist");
1153 GCC_bb_graphs_collection->AddEdge(inverse_vertex_map[*lop_it], inverse_vertex_map[curr_bb],
CFG_SELECTOR);
1155 auto los_it_end =
sl->list_of_bloc[curr_bb]->list_of_succ.end();
1156 for(
auto los_it =
sl->list_of_bloc[curr_bb]->list_of_succ.begin(); los_it != los_it_end; ++los_it)
1160 GCC_bb_graphs_collection->AddEdge(inverse_vertex_map[curr_bb], inverse_vertex_map[*los_it],
CFG_SELECTOR);
1163 if(
sl->list_of_bloc[curr_bb]->list_of_succ.empty())
1165 GCC_bb_graphs_collection->AddEdge(inverse_vertex_map[curr_bb], inverse_vertex_map[
bloc::EXIT_BLOCK_ID],
1174 for(
const auto& Bit :
sl->list_of_bloc)
1176 auto B = Bit.second;
1178 const auto& list_of_stmt =
B->CGetStmtList();
1179 for(
const auto& inst : list_of_stmt)
1182 auto gn = GetPointerS<gimple_node>(
GET_NODE(inst));
1183 auto stmt_kind =
GET_NODE(inst)->get_kind();
1184 if(stmt_kind == gimple_assign_K && !gn->vuses.empty())
1186 auto ga = GetPointerS<gimple_assign>(
GET_NODE(inst));
1188 if(op1->get_kind() == mem_ref_K)
1190 unsigned vd_index = 0;
1193 auto* me = GetPointerS<mem_ref>(op1);
1195 if(resolved && nonConstantVars.find(vd_index) == nonConstantVars.end())
1197 if(var_writing_BB_relation.find(vd_index) != var_writing_BB_relation.end())
1199 auto BB_written = var_writing_BB_relation.find(vd_index)->second;
1200 if(GCC_bb_graph->
IsReachable(inverse_vertex_map[BB_written], inverse_vertex_map[
B->number]))
1203 "---variable is not constant(6): " +
1216 for(
auto var_written : var_writing_BB_relation)
1218 if(nonConstantVars.find(var_written.first) == nonConstantVars.end())
1220 auto BB_written = var_written.second;
1221 if(GCC_bb_graph->
IsReachable(inverse_vertex_map[BB_written], inverse_vertex_map[
B->number]))
1224 "---variable is not constant(7): " +
1232 else if(!gn->vuses.empty())
1234 for(
auto var_written : var_writing_BB_relation)
1236 if(nonConstantVars.find(var_written.first) == nonConstantVars.end())
1238 auto BB_written = var_written.second;
1239 if(GCC_bb_graph->
IsReachable(inverse_vertex_map[BB_written], inverse_vertex_map[
B->number]))
1242 "---variable is not constant(8): " +
1256 for(
auto vars : var_writing_BB_relation)
1258 if(nonConstantVars.find(vars.first) == nonConstantVars.end())
1261 auto initIt = inits.find(
key);
1262 THROW_ASSERT(initIt != inits.end(),
"unexpected condition");
1263 THROW_ASSERT(var_writing_size_relation.find(vars.first) != var_writing_size_relation.end(),
1264 "unexpected condition");
1265 if(initIt->second.size() == var_writing_size_relation.find(vars.first)->second)
1269 ConstantVars.insert(vars.first);
1270 GetPointerS<var_decl>(vd_node)->readonly_flag =
true;
1274 inits.erase(initIt);
1278 if(ConstantVars.empty())
1283 for(
const auto& Bit :
sl->list_of_bloc)
1285 auto B = Bit.second;
1287 const auto& list_of_stmt =
B->CGetStmtList();
1288 auto it_los_end = list_of_stmt.end();
1289 auto it_los = list_of_stmt.begin();
1290 while(it_los != it_los_end)
1292 auto& inst = *it_los;
1294 auto gn = GetPointerS<gimple_node>(
GET_NODE(inst));
1295 auto stmt_kind =
GET_NODE(inst)->get_kind();
1296 if(stmt_kind == gimple_assign_K && gn->vdef)
1298 auto ga = GetPointerS<gimple_assign>(
GET_NODE(inst));
1300 if(op0->get_kind() == mem_ref_K)
1302 unsigned vd_index = 0;
1305 auto* me = GetPointerS<mem_ref>(op0);
1307 if(resolved && ConstantVars.find(vd_index) != ConstantVars.end())
1312 std::map<TreeVocabularyTokenTypes_TokenEnum, std::string> gimple_nop_schema;
1321 std::map<TreeVocabularyTokenTypes_TokenEnum, std::string> gimple_nop_schema;
1328 B->RemoveStmt(*it_los,
AppM);
1329 it_los = list_of_stmt.begin();
1330 it_los_end = list_of_stmt.end();
1343 for(
const auto&
init : inits)
1346 std::map<TreeVocabularyTokenTypes_TokenEnum, std::string> constructor_tree_node_schema;
1352 TM->
create_tree_node(constructor_index, constructor_K, constructor_tree_node_schema);
1353 auto* constr = GetPointerS<constructor>(TM->
GetTreeNode(constructor_index));
1354 const auto last_index =
init.second.rbegin()->first;
1356 for(index = 0; index <= last_index; index++)
1359 if(
init.second.count(index))
1366 "Type not supported " +
STR(element_type));
#define GET_NODE(t)
Macro used to hide implementation details when accessing a tree_node from another tree_node...
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
static bool unexpetedPattern(tree_nodeRef)
#define INDENT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
struct definition of the array_type tree node.
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.
Definition of the node_info object for the basic_block graph.
const tree_nodeRef CGetTreeReindex(const unsigned int i) const
Return a tree_reindex wrapping the i-th tree_node.
#define GET_CLASS(obj)
Macro returning the actual type of an object.
Definition of the class representing a generic C application.
RelationshipType
The relationship type.
Source must be executed to satisfy target.
~rebuild_initialization() override
Destructor.
rebuild_initialization2(const ParameterConstRef Param, const application_managerRef AppM, unsigned int function_id, const DesignFlowManagerConstRef design_flow_manager)
Constructor.
static tree_nodeConstRef CGetElements(const tree_nodeConstRef &type)
Given an array or a vector return the element type.
DesignFlowStep_Status InternalExec() override
Rebuild initialization function flow front-end step.
static bool varFound(tree_nodeRef node, unsigned &vd_index, tree_nodeRef &vd_node)
tree_nodeRef GetSignedIntegerType() const
Function that creates a integer type if it is not already present, otherwise it returns the one that ...
A simple interface to token object of the raw files.
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...
DesignFlowStep_Status InternalExec() override
Rebuild initialization function flow front-end step.
Data structure describing a basic block at tree level.
redefinition of map to manage ordered/unordered structures
#define TOK(token)
Macro used to convert a token symbol into a treeVocabularyTokenTypes.
const tree_nodeConstRef CGetTreeNode(const unsigned int i) const
#define unexpetedPattern2(node, VD)
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::string ToString(ActorGraphBackend_Type actor_graph_backend_type)
Header include.
bool extract_var_decl_ppe(tree_nodeRef addr_assign_op1, unsigned &vd_index, tree_nodeRef &vd_node)
extract_var_decl_ppe
const tree_nodeRef get_tree_node_const(unsigned int i) const
Return the reference to the i-th tree_node Constant version of get_tree_node.
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
Class used to describe a particular graph with basic blocks as nodes.
absl::flat_hash_map< T, U, Hash, Eq, Alloc > CustomUnorderedMap
unsigned int new_tree_node_id(const unsigned int ask=0)
Return a new node id in the intermediate representation.
refcount< BBNodeInfo > BBNodeInfoRef
refcount definition of the class
Information associated with the whole basic-block graph.
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...
void create_tree_node(const unsigned int node_id, enum kind tree_node_type, std::map< TreeVocabularyTokenTypes_TokenEnum, std::string > &tree_node_schema)
Factory method.
#define foundNonConstant(VD)
tree_nodeRef CreateUniqueIntegerCst(integer_cst_t value, const tree_nodeConstRef &type)
memoization of integer constants
Target must be reexecuted.
redefinition of set to manage ordered/unordered structures
tree_nodeRef GetTreeReindex(const unsigned int i)
Return a tree_reindex wrapping the i-th tree_node.
bool extract_var_decl(const mem_ref *me, unsigned &vd_index, tree_nodeRef &vd_node, tree_nodeRef &addr_assign_op1)
extract_var_decl return the variable decl referred by the mem_ref given it is resolvable ...
#define GET_CONST_NODE(t)
const ParameterConstRef parameters
Set of input parameters.
DesignFlowStep_Status
The status of a step.
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.
Class defining some useful functions to create tree nodes and to manipulate the tree manager...
#define DEBUG_LEVEL_NONE
no debugging print is performed.
~rebuild_initialization2() override
Destructor.
rebuild_initialization(const ParameterConstRef Param, const application_managerRef AppM, unsigned int function_id, const DesignFlowManagerConstRef design_flow_manager)
Constructor.
This struct specifies the block node.
This file collects some utility functions.
tree_nodeRef GetTreeNode(const unsigned int index) const
Return the index-th tree_node (modifiable version)
void init(int bucket[BUCKETSIZE])
bool IsReachable(const boost::graph_traits< graphs_collection >::vertex_descriptor x, const boost::graph_traits< graphs_collection >::vertex_descriptor y) const
Compute if vertex y is reachable from x.
const unsigned int function_id
The index of the function to be analyzed.
rebuild initialization where it is possible
const application_managerRef AppM
The application manager.
Class specification of the tree_reindex support class.
static const unsigned int ENTRY_BLOCK_ID
constant identifying the entry basic block
tree_nodeRef getAssign(tree_nodeRef SSAop, unsigned vd_index, CustomOrderedSet< unsigned > &nonConstantVars, TreeNodeMap< std::map< integer_cst_t, tree_nodeRef >> &inits, tree_managerRef TM)
bool look_for_ROMs()
look_for_ROMs transforms the IR by looking for an initial sequence of writes followed by read only in...
Class specification of the basic_block structure.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
static tree_nodeConstRef CGetType(const tree_nodeConstRef &node)
Return the treenode of the type of node.
this class is used to manage the command-line or XML options.
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.
refcount< tree_node > tree_nodeRef
RefCount type definition of the tree_node class structure.
struct definition of the integer_type tree node.
static integer_cst_t GetConstValue(const tree_nodeConstRef &tn, bool is_signed=true)
Get value from integer constant.
int debug_level
The debug level.
static tree_nodeRef extractOp1(tree_nodeRef opSSA)
#define CFG_SELECTOR
Control flow graph edge selector.
refcount< BBGraphInfo > BBGraphInfoRef
refcount definition of the class
This class creates a layer to add nodes and to manipulate the tree_nodes manager. ...
Class specification of the manager of the tree structures extracted from the raw file.
A map with key tree_nodeRef.
A brief description of the C++ Header File.
const FunctionBehaviorRef function_behavior
The function behavior of the function to be analyzed.
static void get_array_dim_and_bitsize(const tree_managerConstRef &TM, const unsigned int index, std::vector< unsigned long long > &dims, unsigned long long &elts_bitsize)
Return the dimension of the array.
This structure defines graphs where nodes are basic_blocks.
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...