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

Method MatchExtInstImportIds

source/diff/diff.cpp:2141–2163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2139}
2140
2141void Differ::MatchExtInstImportIds() {
2142 // Bunch all of this section's ids as potential matches.
2143 PotentialIdMap potential_id_map;
2144 auto get_result_id = [](const opt::Instruction& inst) {
2145 return inst.result_id();
2146 };
2147 auto accept_all = [](const opt::Instruction&) { return true; };
2148
2149 PoolPotentialIds(src_->ext_inst_imports(), potential_id_map.src_ids, true,
2150 accept_all, get_result_id);
2151 PoolPotentialIds(dst_->ext_inst_imports(), potential_id_map.dst_ids, false,
2152 accept_all, get_result_id);
2153
2154 // Then match the ids.
2155 MatchIds(potential_id_map, [](const opt::Instruction* src_inst,
2156 const opt::Instruction* dst_inst) {
2157 // Match OpExtInstImport by exact name, which is operand 1
2158 const opt::Operand& src_name = src_inst->GetOperand(1);
2159 const opt::Operand& dst_name = dst_inst->GetOperand(1);
2160
2161 return src_name.AsString() == dst_name.AsString();
2162 });
2163}
2164void Differ::MatchMemoryModel() {
2165 // Always match the memory model instructions, there is always a single one of
2166 // it.

Callers 1

DiffFunction · 0.80

Calls 3

result_idMethod · 0.45
ext_inst_importsMethod · 0.45
AsStringMethod · 0.45

Tested by

no test coverage detected