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

Method MatchVariablesUsedByMatchedInstructions

source/diff/diff.cpp:1828–1855  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1826}
1827
1828void Differ::MatchVariablesUsedByMatchedInstructions(
1829 const opt::Instruction* src_inst, const opt::Instruction* dst_inst,
1830 uint32_t flexibility) {
1831 // For OpAccessChain, OpLoad and OpStore instructions that reference unmatched
1832 // variables, match them as a best effort.
1833 assert(src_inst->opcode() == dst_inst->opcode());
1834 switch (src_inst->opcode()) {
1835 default:
1836 // TODO: match functions based on OpFunctionCall?
1837 break;
1838 case spv::Op::OpAccessChain:
1839 case spv::Op::OpInBoundsAccessChain:
1840 case spv::Op::OpPtrAccessChain:
1841 case spv::Op::OpInBoundsPtrAccessChain:
1842 case spv::Op::OpLoad:
1843 case spv::Op::OpStore:
1844 const uint32_t src_pointer_id = src_inst->GetSingleWordInOperand(0);
1845 const uint32_t dst_pointer_id = dst_inst->GetSingleWordInOperand(0);
1846 if (IsVariable(src_id_to_, src_pointer_id) &&
1847 IsVariable(dst_id_to_, dst_pointer_id) &&
1848 !id_map_.IsSrcMapped(src_pointer_id) &&
1849 !id_map_.IsDstMapped(dst_pointer_id) &&
1850 AreVariablesMatchable(src_pointer_id, dst_pointer_id, flexibility)) {
1851 id_map_.MapIds(src_pointer_id, dst_pointer_id);
1852 }
1853 break;
1854 }
1855}
1856
1857const opt::Instruction* Differ::GetInst(const IdInstructions& id_to,
1858 uint32_t id) {

Callers

nothing calls this directly

Calls 5

IsSrcMappedMethod · 0.80
IsDstMappedMethod · 0.80
opcodeMethod · 0.45
MapIdsMethod · 0.45

Tested by

no test coverage detected