| 677 | sBB* exit; |
| 678 | path_t() : exit(nullptr) {} |
| 679 | bool validate(qstring* errorStr) |
| 680 | { |
| 681 | // check single node paths is large enought |
| 682 | if (size() < 2 && front()->instCnt < MIN_LEN_OF_1_BLOCK_INLINE) { |
| 683 | errorStr->sprnt("Single block inline applicant at %a has %d microcode instructions, should be at least %d", |
| 684 | front()->bgn, front()->instCnt, MIN_LEN_OF_1_BLOCK_INLINE); |
| 685 | return false; |
| 686 | } |
| 687 | |
| 688 | // do not check single block path for entries/exits |
| 689 | if(front()->kind == eBBK_single) |
| 690 | return true; |
| 691 | |
| 692 | // check path has no other entries from outside except head |
| 693 | if (size() > 1) { |
| 694 | auto pi = begin(); pi++; |
| 695 | for (; pi != end(); pi++) { |
| 696 | for (auto p : (*pi)->preds) { |
| 697 | if (!has_item(p)) { |
| 698 | errorStr->sprnt("entrance into the middle (from block %a to block %a). Head block %a must be a single entry", p->bgn, (*pi)->bgn, front()->bgn); |
| 699 | return false; |
| 700 | } |
| 701 | } |
| 702 | } |
| 703 | } |
| 704 | // check path has no any other exit outside |
| 705 | for (auto pi : *this) { |
| 706 | if(pi->kind == eBBK_tail) // tail block should be cut off before branch |
| 707 | continue; |
| 708 | for (auto s : pi->succs) { |
| 709 | if (!has_item(s) && s != exit) { |
| 710 | errorStr->sprnt("more then one exit (from block %a to block %a). Exit block %a must be alone", pi->bgn, s->bgn, exit->bgn); |
| 711 | return false; |
| 712 | } |
| 713 | } |
| 714 | } |
| 715 | return true; |
| 716 | } |
| 717 | bool create_from_head_exit(sBB* head, sBB* exit_, qstring* errorStr) |
| 718 | { |
| 719 | clear(); |
no test coverage detected