An easily-constructible and comparable object for the contents of an spv_parsed_instruction_t. Unlike spv_parsed_instruction_t, owns the memory of its components.
| 70 | // spv_parsed_instruction_t. Unlike spv_parsed_instruction_t, owns the memory |
| 71 | // of its components. |
| 72 | struct ParsedInstruction { |
| 73 | explicit ParsedInstruction(const spv_parsed_instruction_t& inst) |
| 74 | : words(inst.words, inst.words + inst.num_words), |
| 75 | opcode(static_cast<spv::Op>(inst.opcode)), |
| 76 | ext_inst_type(inst.ext_inst_type), |
| 77 | type_id(inst.type_id), |
| 78 | result_id(inst.result_id), |
| 79 | operands(inst.operands, inst.operands + inst.num_operands) {} |
| 80 | |
| 81 | std::vector<uint32_t> words; |
| 82 | spv::Op opcode; |
| 83 | spv_ext_inst_type_t ext_inst_type; |
| 84 | uint32_t type_id; |
| 85 | uint32_t result_id; |
| 86 | std::vector<spv_parsed_operand_t> operands; |
| 87 | |
| 88 | bool operator==(const ParsedInstruction& b) const { |
| 89 | return words == b.words && opcode == b.opcode && |
| 90 | ext_inst_type == b.ext_inst_type && type_id == b.type_id && |
| 91 | result_id == b.result_id && operands == b.operands; |
| 92 | } |
| 93 | }; |
| 94 | |
| 95 | // Prints a ParsedInstruction object to the given output stream, and returns |
| 96 | // the stream. |
no outgoing calls