MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / MatchTypeForwardPointersByTypeOp

Method MatchTypeForwardPointersByTypeOp

source/diff/diff.cpp:1568–1594  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1566}
1567
1568void Differ::MatchTypeForwardPointersByTypeOp(const IdGroup& src,
1569 const IdGroup& dst) {
1570 // Given two sets of compatible groups of OpTypeForwardPointer instructions,
1571 // attempts to match them by type op. Must be called after
1572 // MatchTypeForwardPointersByName to match as many as possible by debug info.
1573
1574 // Remove ids that are matched with debug info in
1575 // MatchTypeForwardPointersByName.
1576 IdGroup src_unmatched_ids;
1577 IdGroup dst_unmatched_ids;
1578
1579 std::copy_if(src.begin(), src.end(), std::back_inserter(src_unmatched_ids),
1580 [this](uint32_t id) { return !id_map_.IsSrcMapped(id); });
1581 std::copy_if(dst.begin(), dst.end(), std::back_inserter(dst_unmatched_ids),
1582 [this](uint32_t id) { return !id_map_.IsDstMapped(id); });
1583
1584 // Match only if there's a unique forward declaration with this
1585 // storage class and type opcode. If both have debug info, they
1586 // must not have been matchable.
1587 if (src_unmatched_ids.size() == 1 && dst_unmatched_ids.size() == 1) {
1588 uint32_t src_id = src_unmatched_ids[0];
1589 uint32_t dst_id = dst_unmatched_ids[0];
1590 if (!HasName(src_id_to_, src_id) || !HasName(dst_id_to_, dst_id)) {
1591 id_map_.MapIds(src_id, dst_id);
1592 }
1593 }
1594}
1595
1596InstructionList Differ::GetFunctionBody(opt::IRContext* context,
1597 opt::Function& function) {

Callers

nothing calls this directly

Calls 6

IsSrcMappedMethod · 0.80
IsDstMappedMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
MapIdsMethod · 0.45

Tested by

no test coverage detected