Lines Matching full:operands
73 ArrayRef<uint32_t> operands;
76 // Slice the next instruction out and populate `opcode` and `operands`.
78 if (failed(sliceInstruction(opcode, operands)))
81 if (failed(processInstruction(opcode, operands)))
156 spirv::Deserializer::processCapability(ArrayRef<uint32_t> operands) {
157 if (operands.size() != 1)
160 auto cap = spirv::symbolizeCapability(operands[0]);
162 return emitError(unknownLoc, "unknown capability: ") << operands[0];
213 spirv::Deserializer::processMemoryModel(ArrayRef<uint32_t> operands) {
214 if (operands.size() != 2)
215 return emitError(unknownLoc, "OpMemoryModel must have two operands");
220 static_cast<spirv::AddressingModel>(operands.front())));
224 static_cast<spirv::MemoryModel>(operands.back())));
393 "OpMemberDecorate must have at least 3 operands");
412 return emitError(unknownLoc, "OpMemberName must have at least 3 operands");
465 spirv::Deserializer::processFunction(ArrayRef<uint32_t> operands) {
471 if (operands.size() != 4) {
474 Type resultType = getType(operands[0]);
477 << operands[0];
480 uint32_t fnID = operands[1];
485 auto fnControl = spirv::symbolizeFunctionControl(operands[2]);
487 return emitError(unknownLoc, "unknown Function Control: ") << operands[2];
490 Type fnType = getType(operands[3]);
493 << operands[3];
533 ArrayRef<uint32_t> operands;
534 if (failed(sliceInstruction(opcode, operands,
544 if (operands.size() != 2) {
549 auto argDefinedType = getType(operands[0]);
557 if (getValue(operands[1])) {
559 << operands[1];
561 if (failed(setFunctionArgAttrs(operands[1], argAttrs, i))) {
566 valueMap[operands[1]] = argValue;
633 spirv::Deserializer::processFunctionEnd(ArrayRef<uint32_t> operands) {
635 if (!operands.empty()) {
636 return emitError(unknownLoc, "unexpected operands for OpFunctionEnd");
704 spirv::Deserializer::processGlobalVariable(ArrayRef<uint32_t> operands) {
706 if (operands.size() < 3) {
709 "OpVariable needs at least 3 operands, type, <id> and storage class");
713 auto type = getType(operands[wordIndex]);
716 << operands[wordIndex];
727 auto variableID = operands[wordIndex];
735 auto storageClass = static_cast<spirv::StorageClass>(operands[wordIndex]);
746 if (wordIndex < operands.size()) {
749 if (auto initOp = getGlobalVariable(operands[wordIndex]))
751 else if (auto initOp = getSpecConstant(operands[wordIndex]))
753 else if (auto initOp = getSpecConstantComposite(operands[wordIndex]))
757 << operands[wordIndex] << "used as initializer";
762 if (wordIndex != operands.size()) {
764 "found more operands than expected when deserializing "
766 << wordIndex << " of " << operands.size() << " processed";
790 LogicalResult spirv::Deserializer::processName(ArrayRef<uint32_t> operands) {
791 if (operands.size() < 2) {
792 return emitError(unknownLoc, "OpName needs at least 2 operands");
794 if (!nameMap.lookup(operands[0]).empty()) {
796 << operands[0];
799 StringRef name = decodeStringLiteral(operands, wordIndex);
800 if (wordIndex != operands.size()) {
804 nameMap[operands[0]] = name;
813 ArrayRef<uint32_t> operands) {
814 if (operands.empty()) {
821 if (typeMap.count(operands[0])) {
823 << operands[0];
828 if (operands.size() != 1)
830 typeMap[operands[0]] = opBuilder.getNoneType();
833 if (operands.size() != 1)
835 typeMap[operands[0]] = opBuilder.getI1Type();
838 if (operands.size() != 3)
849 auto sign = operands[2] == 1 ? IntegerType::SignednessSemantics::Signed
851 typeMap[operands[0]] = IntegerType::get(context, operands[1], sign);
854 if (operands.size() != 2)
858 switch (operands[1]) {
870 << operands[1];
872 typeMap[operands[0]] = floatTy;
875 if (operands.size() != 3) {
880 Type elementTy = getType(operands[1]);
883 << operands[1];
885 typeMap[operands[0]] = VectorType::get({operands[2]}, elementTy);
888 return processOpTypePointer(operands);
891 return processArrayType(operands);
893 return processCooperativeMatrixTypeKHR(operands);
895 return processFunctionType(operands);
897 return processImageType(operands);
899 return processSampledImageType(operands);
901 return processRuntimeArrayType(operands);
903 return processStructType(operands);
905 return processMatrixType(operands);
913 spirv::Deserializer::processOpTypePointer(ArrayRef<uint32_t> operands) {
914 if (operands.size() != 3)
917 auto pointeeType = getType(operands[2]);
920 << operands[2];
922 uint32_t typePointerID = operands[0];
923 auto storageClass = static_cast<spirv::StorageClass>(operands[1]);
967 spirv::Deserializer::processArrayType(ArrayRef<uint32_t> operands) {
968 if (operands.size() != 3) {
973 Type elementTy = getType(operands[1]);
976 << operands[1];
981 auto countInfo = getConstant(operands[2]);
984 << operands[2] << "can only come from normal constant right now";
994 typeMap[operands[0]] = spirv::ArrayType::get(
995 elementTy, count, typeDecorations.lookup(operands[0]));
1000 spirv::Deserializer::processFunctionType(ArrayRef<uint32_t> operands) {
1001 assert(!operands.empty() && "No operands for processing function type");
1002 if (operands.size() == 1) {
1005 auto returnType = getType(operands[1]);
1010 for (size_t i = 2, e = operands.size(); i < e; ++i) {
1011 auto ty = getType(operands[i]);
1021 typeMap[operands[0]] = FunctionType::get(context, argTypes, returnTypes);
1026 ArrayRef<uint32_t> operands) {
1027 if (operands.size() != 6) {
1033 Type elementTy = getType(operands[1]);
1037 << operands[1];
1041 spirv::symbolizeScope(getConstantInt(operands[2]).getInt());
1046 << operands[2];
1049 unsigned rows = getConstantInt(operands[3]).getInt();
1050 unsigned columns = getConstantInt(operands[4]).getInt();
1054 getConstantInt(operands[5]).getInt());
1059 << operands[5];
1062 typeMap[operands[0]] =
1068 spirv::Deserializer::processRuntimeArrayType(ArrayRef<uint32_t> operands) {
1069 if (operands.size() != 2) {
1070 return emitError(unknownLoc, "OpTypeRuntimeArray must have two operands");
1072 Type memberType = getType(operands[1]);
1076 << operands[1];
1078 typeMap[operands[0]] = spirv::RuntimeArrayType::get(
1079 memberType, typeDecorations.lookup(operands[0]));
1084 spirv::Deserializer::processStructType(ArrayRef<uint32_t> operands) {
1087 if (operands.empty()) {
1091 if (operands.size() == 1) {
1093 typeMap[operands[0]] =
1094 spirv::StructType::getEmpty(context, nameMap.lookup(operands[0]).str());
1102 for (auto op : llvm::drop_begin(operands, 1)) {
1118 if (memberDecorationMap.count(operands[0])) {
1119 auto &allMemberDecorations = memberDecorationMap[operands[0]];
1145 uint32_t structID = operands[0];
1172 spirv::Deserializer::processMatrixType(ArrayRef<uint32_t> operands) {
1173 if (operands.size() != 3) {
1174 // Three operands are needed: result_id, column_type, and column_count
1175 return emitError(unknownLoc, "OpTypeMatrix must have 3 operands"
1179 Type elementTy = getType(operands[1]);
1183 << operands[1];
1186 uint32_t colsCount = operands[2];
1187 typeMap[operands[0]] = spirv::MatrixType::get(elementTy, colsCount);
1192 spirv::Deserializer::processTypeForwardPointer(ArrayRef<uint32_t> operands) {
1193 if (operands.size() != 2)
1195 "OpTypeForwardPointer instruction must have two operands");
1197 typeForwardPointerIDs.insert(operands[0]);
1205 spirv::Deserializer::processImageType(ArrayRef<uint32_t> operands) {
1207 if (operands.size() != 8)
1210 "OpTypeImage with non-eight operands are not supported yet");
1212 Type elementTy = getType(operands[1]);
1215 << operands[1];
1217 auto dim = spirv::symbolizeDim(operands[2]);
1220 << operands[2];
1222 auto depthInfo = spirv::symbolizeImageDepthInfo(operands[3]);
1225 << operands[3];
1227 auto arrayedInfo = spirv::symbolizeImageArrayedInfo(operands[4]);
1230 << operands[4];
1232 auto samplingInfo = spirv::symbolizeImageSamplingInfo(operands[5]);
1234 return emitError(unknownLoc, "unknown MS for OpTypeImage: ") << operands[5];
1236 auto samplerUseInfo = spirv::symbolizeImageSamplerUseInfo(operands[6]);
1239 << operands[6];
1241 auto format = spirv::symbolizeImageFormat(operands[7]);
1244 << operands[7];
1246 typeMap[operands[0]] = spirv::ImageType::get(
1253 spirv::Deserializer::processSampledImageType(ArrayRef<uint32_t> operands) {
1254 if (operands.size() != 2)
1255 return emitError(unknownLoc, "OpTypeSampledImage must have two operands");
1257 Type elementTy = getType(operands[1]);
1261 << operands[1];
1263 typeMap[operands[0]] = spirv::SampledImageType::get(elementTy);
1271 LogicalResult spirv::Deserializer::processConstant(ArrayRef<uint32_t> operands,
1275 if (operands.size() < 2) {
1279 if (operands.size() < 3) {
1284 Type resultType = getType(operands[0]);
1287 << operands[0];
1292 if (operands.size() == 4) {
1299 if (operands.size() == 3) {
1311 auto resultID = operands[1];
1327 } words = {operands[2], operands[3]};
1330 value = APInt(bitwidth, operands[2], /*isSigned=*/true,
1361 } words = {operands[2], operands[3]};
1364 value = APFloat(llvm::bit_cast<float>(operands[2]));
1366 APInt data(16, operands[2]);
1387 bool isTrue, ArrayRef<uint32_t> operands, bool isSpec) {
1388 if (operands.size() != 2) {
1396 auto resultID = operands[1];
1409 spirv::Deserializer::processConstantComposite(ArrayRef<uint32_t> operands) {
1410 if (operands.size() < 2) {
1414 if (operands.size() < 3) {
1419 Type resultType = getType(operands[0]);
1422 << operands[0];
1426 elements.reserve(operands.size() - 2);
1427 for (unsigned i = 2, e = operands.size(); i < e; ++i) {
1428 auto elementInfo = getConstant(operands[i]);
1431 << operands[i] << " must come from a normal constant";
1436 auto resultID = operands[1];
1454 spirv::Deserializer::processSpecConstantComposite(ArrayRef<uint32_t> operands) {
1455 if (operands.size() < 2) {
1459 if (operands.size() < 3) {
1464 Type resultType = getType(operands[0]);
1467 << operands[0];
1470 auto resultID = operands[1];
1474 elements.reserve(operands.size() - 2);
1475 for (unsigned i = 2, e = operands.size(); i < e; ++i) {
1476 auto elementInfo = getSpecConstant(operands[i]);
1489 spirv::Deserializer::processSpecConstantOperation(ArrayRef<uint32_t> operands) {
1490 if (operands.size() < 3)
1494 uint32_t resultTypeID = operands[0];
1500 uint32_t resultID = operands[1];
1501 spirv::Opcode enclosedOpcode = static_cast<spirv::Opcode>(operands[2]);
1506 SmallVector<uint32_t>{operands.begin() + 3, operands.end()}});
1573 spirv::Deserializer::processConstantNull(ArrayRef<uint32_t> operands) {
1574 if (operands.size() != 2) {
1579 Type resultType = getType(operands[0]);
1582 << operands[0];
1585 auto resultID = operands[1];
1618 LogicalResult spirv::Deserializer::processBranch(ArrayRef<uint32_t> operands) {
1623 if (operands.size() != 1) {
1627 auto *target = getOrCreateBlock(operands[0]);
1639 spirv::Deserializer::processBranchConditional(ArrayRef<uint32_t> operands) {
1645 if (operands.size() != 3 && operands.size() != 5) {
1651 auto condition = getValue(operands[0]);
1652 auto *trueBlock = getOrCreateBlock(operands[1]);
1653 auto *falseBlock = getOrCreateBlock(operands[2]);
1656 if (operands.size() == 5) {
1657 weights = std::make_pair(operands[3], operands[4]);
1672 LogicalResult spirv::Deserializer::processLabel(ArrayRef<uint32_t> operands) {
1677 if (operands.size() != 1) {
1681 auto labelID = operands[0];
1696 spirv::Deserializer::processSelectionMerge(ArrayRef<uint32_t> operands) {
1701 if (operands.size() < 2) {
1707 auto *mergeBlock = getOrCreateBlock(operands[0]);
1709 auto selectionControl = operands[1];
1722 spirv::Deserializer::processLoopMerge(ArrayRef<uint32_t> operands) {
1727 if (operands.size() < 3) {
1732 auto *mergeBlock = getOrCreateBlock(operands[0]);
1733 auto *continueBlock = getOrCreateBlock(operands[1]);
1735 uint32_t loopControl = operands[2];
1748 LogicalResult spirv::Deserializer::processPhi(ArrayRef<uint32_t> operands) {
1753 if (operands.size() < 4) {
1759 Type blockArgType = getType(operands[0]);
1761 valueMap[operands[1]] = blockArg;
1764 << " id = " << operands[1] << " of type " << blockArgType << "\n");
1768 for (unsigned i = 2, e = operands.size(); i < e; i += 2) {
1769 uint32_t value = operands[i];
1770 Block *predecessor = getOrCreateBlock(operands[i + 1]);
1944 // Go through all ops and remap the operands.
1998 // First we need to drop all operands' references inside all blocks. This is
2233 spirv::Deserializer::processDebugLine(ArrayRef<uint32_t> operands) {
2239 if (operands.size() != 3)
2240 return emitError(unknownLoc, "OpLine must have 3 operands");
2241 debugLine = DebugLine{operands[0], operands[1], operands[2]};
2248 spirv::Deserializer::processDebugString(ArrayRef<uint32_t> operands) {
2249 if (operands.size() < 2)
2250 return emitError(unknownLoc, "OpString needs at least 2 operands");
2252 if (!debugInfoMap.lookup(operands[0]).empty())
2255 << operands[0];
2258 StringRef debugString = decodeStringLiteral(operands, wordIndex);
2259 if (wordIndex != operands.size())
2263 debugInfoMap[operands[0]] = debugString;