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

Method GetTypeNumberKind

source/diff/diff.cpp:2110–2131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2108}
2109
2110spv_number_kind_t Differ::GetTypeNumberKind(const IdInstructions& id_to,
2111 uint32_t id,
2112 uint32_t* number_bit_width) {
2113 const opt::Instruction* type_inst = GetInst(id_to, id);
2114 if (!spvOpcodeIsScalarType(type_inst->opcode())) {
2115 type_inst = GetInst(id_to, type_inst->type_id());
2116 }
2117
2118 switch (type_inst->opcode()) {
2119 case spv::Op::OpTypeInt:
2120 *number_bit_width = type_inst->GetSingleWordOperand(1);
2121 return type_inst->GetSingleWordOperand(2) == 0 ? SPV_NUMBER_UNSIGNED_INT
2122 : SPV_NUMBER_SIGNED_INT;
2123 break;
2124 case spv::Op::OpTypeFloat:
2125 *number_bit_width = type_inst->GetSingleWordOperand(1);
2126 return SPV_NUMBER_FLOATING;
2127 default:
2128 assert(false && "Unreachable");
2129 return SPV_NUMBER_NONE;
2130 }
2131}
2132
2133void Differ::MatchCapabilities() {
2134 MatchPreambleInstructions(src_->capabilities(), dst_->capabilities());

Callers

nothing calls this directly

Calls 4

spvOpcodeIsScalarTypeFunction · 0.85
GetSingleWordOperandMethod · 0.80
opcodeMethod · 0.45
type_idMethod · 0.45

Tested by

no test coverage detected