| 361 | } |
| 362 | |
| 363 | const char* GetOpString(const std::vector<uint32_t>& instructions, uint32_t string_id) { |
| 364 | uint32_t offset = kModuleStartingOffset; |
| 365 | while (offset < instructions.size()) { |
| 366 | const uint32_t instruction = instructions[offset]; |
| 367 | const uint32_t length = Length(instruction); |
| 368 | const uint32_t opcode = Opcode(instruction); |
| 369 | |
| 370 | // if here, seen all OpString and can return early |
| 371 | if (opcode == spv::OpFunction) break; |
| 372 | |
| 373 | if (opcode == spv::OpString) { |
| 374 | const uint32_t result_id = instructions[offset + 1]; |
| 375 | if (result_id == string_id) { |
| 376 | return reinterpret_cast<const char*>(&instructions[offset + 2]); |
| 377 | } |
| 378 | } |
| 379 | offset += length; |
| 380 | } |
| 381 | return nullptr; |
| 382 | } |
| 383 | |
| 384 | uint32_t GetConstantValue(const std::vector<uint32_t>& instructions, uint32_t constant_id) { |
| 385 | uint32_t offset = kModuleStartingOffset; |
no test coverage detected