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

Function ValidateExpect

source/val/validate_misc.cpp:93–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93spv_result_t ValidateExpect(ValidationState_t& _, const Instruction* inst) {
94 const auto result_type = inst->type_id();
95 if (!_.IsBoolScalarOrVectorType(result_type) &&
96 !_.IsIntScalarOrVectorType(result_type)) {
97 return _.diag(SPV_ERROR_INVALID_ID, inst)
98 << "Result of OpExpectKHR must be a scalar or vector of integer "
99 "type or boolean type";
100 }
101
102 if (_.GetOperandTypeId(inst, 2) != result_type) {
103 return _.diag(SPV_ERROR_INVALID_ID, inst)
104 << "Type of Value operand of OpExpectKHR does not match the result "
105 "type ";
106 }
107 if (_.GetOperandTypeId(inst, 3) != result_type) {
108 return _.diag(SPV_ERROR_INVALID_ID, inst)
109 << "Type of ExpectedValue operand of OpExpectKHR does not match the "
110 "result type ";
111 }
112 return SPV_SUCCESS;
113}
114
115spv_result_t ValidateAbort(ValidationState_t& _, const Instruction* inst) {
116 const auto message_type = _.FindDef(inst->GetOperandAs<uint32_t>(0u));

Callers 1

MiscPassFunction · 0.85

Calls 5

diagMethod · 0.80
GetOperandTypeIdMethod · 0.80
type_idMethod · 0.45

Tested by

no test coverage detected