| 111 | } |
| 112 | |
| 113 | spv_result_t ValidateGraphConstant(ValidationState_t& _, |
| 114 | const Instruction* inst) { |
| 115 | // Check Result Type |
| 116 | if (!_.IsTensorType(inst->type_id())) { |
| 117 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 118 | << spvOpcodeString(inst->opcode()) |
| 119 | << " must have a Result Type that is a tensor type."; |
| 120 | } |
| 121 | |
| 122 | // Check the instruction is not preceded by another OpGraphConstantARM with |
| 123 | // the same ID |
| 124 | const uint32_t cst_id = inst->word(3); |
| 125 | size_t inst_num = inst->LineNum() - 1; |
| 126 | while (--inst_num) { |
| 127 | auto prev_inst = &_.ordered_instructions()[inst_num]; |
| 128 | if (prev_inst->opcode() == spv::Op::OpGraphConstantARM) { |
| 129 | const uint32_t prev_cst_id = prev_inst->word(3); |
| 130 | if (prev_cst_id == cst_id) { |
| 131 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 132 | << "No two OpGraphConstantARM instructions may have the same " |
| 133 | "GraphConstantID"; |
| 134 | } |
| 135 | } |
| 136 | } |
| 137 | return SPV_SUCCESS; |
| 138 | } |
| 139 | |
| 140 | spv_result_t ValidateGraphEntryPoint(ValidationState_t& _, |
| 141 | const Instruction* inst) { |
no test coverage detected