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

Function GetArrayLength

source/opt/interface_var_sroa.cpp:41–50  ·  view source on GitHub ↗

Get the length of the OpTypeArray |array_type|.

Source from the content-addressed store, hash-verified

39
40// Get the length of the OpTypeArray |array_type|.
41uint32_t GetArrayLength(analysis::DefUseManager* def_use_mgr,
42 Instruction* array_type) {
43 assert(array_type->opcode() == spv::Op::OpTypeArray);
44 uint32_t const_int_id =
45 array_type->GetSingleWordInOperand(kOpTypeArrayLengthInOperandIndex);
46 Instruction* array_length_inst = def_use_mgr->GetDef(const_int_id);
47 assert(array_length_inst->opcode() == spv::Op::OpConstant);
48 return array_length_inst->GetSingleWordInOperand(
49 kOpConstantValueInOperandIndex);
50}
51
52// Get the element type instruction of the OpTypeArray |array_type|.
53Instruction* GetArrayElementType(analysis::DefUseManager* def_use_mgr,

Callers 5

CheckTypeMethod · 0.70
GetMaxLegalIndexMethod · 0.70

Calls 3

opcodeMethod · 0.45
GetDefMethod · 0.45

Tested by

no test coverage detected