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

Function LookupOperand

source/table2.cpp:235–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233}
234
235spv_result_t LookupOperand(spv_operand_type_t type, uint32_t value,
236 const OperandDesc** desc) {
237 auto ir = OperandByValueRangeForKind(type);
238 if (ir.empty()) {
239 return SPV_ERROR_INVALID_LOOKUP;
240 }
241
242 auto span = ir.apply(kOperandsByValue.data());
243
244 // Metaphor: Look for the needle in the haystack.
245 // The operand value is the first member.
246 const OperandDesc needle{value};
247 auto where =
248 std::lower_bound(span.begin(), span.end(), needle,
249 [&](const OperandDesc& lhs, const OperandDesc& rhs) {
250 return lhs.value < rhs.value;
251 });
252 if (where != span.end() && where->value == value) {
253 *desc = &*where;
254 return SPV_SUCCESS;
255 }
256 return SPV_ERROR_INVALID_LOOKUP;
257}
258
259spv_result_t LookupOperand(spv_operand_type_t type, const char* name,
260 size_t name_len, const OperandDesc** desc) {

Callers 15

recordTypeDefinitionMethod · 0.85
spvTextEncodeOperandFunction · 0.85
parseOperandMethod · 0.85
recordNumberTypeMethod · 0.85
spvTextParseMaskOperandFunction · 0.85
lookupOperandNameMethod · 0.85
NameForEnumOperandMethod · 0.85
EmitOperandMethod · 0.85
EmitMaskOperandMethod · 0.85
MergeModulesFunction · 0.85

Calls 7

getCharsFunction · 0.85
applyMethod · 0.80
emptyMethod · 0.45
dataMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
countMethod · 0.45

Tested by 4

TEST_PFunction · 0.68
TEST_PFunction · 0.68
TESTFunction · 0.68