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

Function LookupOpcode

source/table2.cpp:168–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168spv_result_t LookupOpcode(spv::Op opcode, const InstructionDesc** desc) {
169 // Metaphor: Look for the needle in the haystack.
170 const InstructionDesc needle(opcode);
171 auto where = std::lower_bound(
172 kInstructionDesc.begin(), kInstructionDesc.end(), needle,
173 [&](const InstructionDesc& lhs, const InstructionDesc& rhs) {
174 return uint32_t(lhs.opcode) < uint32_t(rhs.opcode);
175 });
176 if (where != kInstructionDesc.end() && where->opcode == opcode) {
177 *desc = &*where;
178 return SPV_SUCCESS;
179 }
180 return SPV_ERROR_INVALID_LOOKUP;
181}
182
183spv_result_t LookupOpcode(const char* name, const InstructionDesc** desc) {
184 // The comparison function knows to use 'name' string to compare against

Callers 14

spvTextEncodeOperandFunction · 0.85
parseInstructionMethod · 0.85
parseOperandMethod · 0.85
EmitInstructionImplMethod · 0.85
EmitOperandMethod · 0.85
spvOpcodeStringFunction · 0.85
ReservedCheckFunction · 0.85
VersionCheckFunction · 0.85
BuildWarningMessageMethod · 0.85
TEST_PFunction · 0.85

Calls 3

getCharsFunction · 0.85
beginMethod · 0.45
endMethod · 0.45

Tested by 3

TEST_PFunction · 0.68
TEST_PFunction · 0.68
TESTFunction · 0.68