| 24 | namespace spvtools { |
| 25 | |
| 26 | std::string GetExtensionString(const spv_parsed_instruction_t* inst) { |
| 27 | if ((inst->opcode != static_cast<uint16_t>(spv::Op::OpExtension)) && |
| 28 | (inst->opcode != |
| 29 | static_cast<uint16_t>(spv::Op::OpConditionalExtensionINTEL))) { |
| 30 | return "ERROR_not_op_extension"; |
| 31 | } |
| 32 | |
| 33 | const bool is_conditional = |
| 34 | inst->opcode == |
| 35 | static_cast<uint16_t>(spv::Op::OpConditionalExtensionINTEL); |
| 36 | assert(inst->num_operands == (is_conditional ? 2 : 1)); |
| 37 | const uint16_t op_i = is_conditional ? 1 : 0; |
| 38 | |
| 39 | const auto& operand = inst->operands[op_i]; |
| 40 | assert(operand.type == SPV_OPERAND_TYPE_LITERAL_STRING); |
| 41 | assert(inst->num_words > operand.offset); |
| 42 | (void)operand; /* No unused variables in release builds. */ |
| 43 | |
| 44 | return spvDecodeLiteralStringOperand(*inst, op_i); |
| 45 | } |
| 46 | |
| 47 | std::string ExtensionSetToString(const ExtensionSet& extensions) { |
| 48 | std::stringstream ss; |
no test coverage detected