| 496 | /* ===================== TagTraitMutableBase ===================== */ |
| 497 | |
| 498 | void StaticInferManagerImpl::TagTraitMutableBase::init( |
| 499 | SourceType src_type, StaticInferManagerImpl* mgr) { |
| 500 | mgb_assert(!m_initialized, "can not overwrite infer desc"); |
| 501 | m_initialized = true; |
| 502 | |
| 503 | if (src_type == SourceType::CONSTANT) { |
| 504 | mgb_assert(raw_deps().empty()); |
| 505 | m_infer_type = InferType::CONST; |
| 506 | return; |
| 507 | } |
| 508 | |
| 509 | if (src_type == SourceType::MUTABLE) { |
| 510 | mgb_assert(raw_deps().empty()); |
| 511 | m_infer_type = InferType::RT_STATIC; |
| 512 | return; |
| 513 | } |
| 514 | |
| 515 | mgb_assert(src_type == SourceType::DEP && !raw_deps().empty()); |
| 516 | |
| 517 | for (auto&& i : raw_deps()) { |
| 518 | auto dst0 = mgr->get_tag_trait_for_dep(i); |
| 519 | |
| 520 | m_deps.push_back(dst0); |
| 521 | if (dst0->is_const()) { |
| 522 | m_infer_type = std::max(m_infer_type, InferType::CONST); |
| 523 | continue; |
| 524 | } |
| 525 | |
| 526 | auto dst = static_cast<TagTraitMutableBase*>(dst0); |
| 527 | dst->m_receivers.insert(this); |
| 528 | |
| 529 | // compute infer type and missing_inp |
| 530 | if (!dst->m_initialized) { |
| 531 | // dst has no infer desc |
| 532 | mgb_assert(dst->m_infer_type == InferType::NO_DESC); |
| 533 | m_infer_type = InferType::MISSING_INP; |
| 534 | m_missing_input.merge_from(dst->missing_inp()); |
| 535 | } else { |
| 536 | mgb_assert(dst->m_infer_type != InferType::NO_DESC); |
| 537 | m_infer_type = std::max(m_infer_type, dst->infer_type()); |
| 538 | if (dst->infer_type() == InferType::MISSING_INP) |
| 539 | m_missing_input.merge_from(dst->missing_inp()); |
| 540 | } |
| 541 | } |
| 542 | |
| 543 | mgb_assert(m_infer_type != InferType::NO_DESC); |
| 544 | if (m_infer_type != InferType::MISSING_INP) |
| 545 | mgb_assert(!m_missing_input); |
| 546 | } |
| 547 | |
| 548 | const InpElement* StaticInferManagerImpl::TagTraitMutableBase::infer_withoutexc( |
| 549 | VarNode** cur_active_var, bool recomp_mutable_srcnode) { |
no test coverage detected