21#include "llvm/ADT/STLExtras.h"
22#include "llvm/ADT/SmallVector.h"
23#include "llvm/Support/Debug.h"
28#define DEBUG_TYPE "spirv-deserialization"
36 return static_cast<spirv::Opcode
>(word & 0xffff);
54 return spirv::ConstantOp::create(opBuilder, loc, constInfo->second,
57 if (std::optional<std::pair<Attribute, Type>> constCompositeReplicateInfo =
59 return spirv::EXTConstantCompositeReplicateOp::create(
60 opBuilder, unknownLoc, constCompositeReplicateInfo->second,
61 constCompositeReplicateInfo->first);
65 spirv::AddressOfOp::create(opBuilder, unknownLoc, varOp.getType(),
66 SymbolRefAttr::get(varOp.getOperation()));
67 return addressOfOp.getPointer();
70 auto referenceOfOp = spirv::ReferenceOfOp::create(
71 opBuilder, unknownLoc, constOp.getDefaultValue().getType(),
72 SymbolRefAttr::get(constOp.getOperation()));
73 return referenceOfOp.getReference();
75 if (SpecConstantCompositeOp specConstCompositeOp =
77 auto referenceOfOp = spirv::ReferenceOfOp::create(
78 opBuilder, unknownLoc, specConstCompositeOp.getType(),
79 SymbolRefAttr::get(specConstCompositeOp.getOperation()));
80 return referenceOfOp.getReference();
82 if (
auto specConstCompositeReplicateOp =
84 auto referenceOfOp = spirv::ReferenceOfOp::create(
85 opBuilder, unknownLoc, specConstCompositeReplicateOp.getType(),
86 SymbolRefAttr::get(specConstCompositeReplicateOp.getOperation()));
87 return referenceOfOp.getReference();
91 id, specConstOperationInfo->enclodesOpcode,
92 specConstOperationInfo->resultTypeID,
93 specConstOperationInfo->enclosedOpOperands);
96 return spirv::UndefOp::create(opBuilder, unknownLoc, undef);
98 if (std::optional<spirv::GraphConstantARMOpMaterializationInfo>
100 IntegerAttr graphConstantID = graphConstantARMInfo->graphConstantID;
101 Type resultType = graphConstantARMInfo->resultType;
102 return spirv::GraphConstantARMOp::create(opBuilder, unknownLoc, resultType,
105 return valueMap.lookup(
id);
110 std::optional<spirv::Opcode> expectedOpcode) {
111 auto binarySize = binary.size();
112 if (curOffset >= binarySize) {
113 return emitError(unknownLoc,
"expected ")
114 << (expectedOpcode ? spirv::stringifyOpcode(*expectedOpcode)
122 uint32_t wordCount = binary[curOffset] >> 16;
125 return emitError(unknownLoc,
"word count cannot be zero");
127 uint32_t nextOffset = curOffset + wordCount;
128 if (nextOffset > binarySize)
129 return emitError(unknownLoc,
"insufficient words for the last instruction");
132 operands = binary.slice(curOffset + 1, wordCount - 1);
133 curOffset = nextOffset;
144 size_t binarySize = binary.size();
145 auto isNextContinuation = [&]() {
146 if (curOffset >= binarySize)
148 uint32_t wordCount = binary[curOffset] >> 16;
149 if (wordCount == 0 || curOffset + wordCount > binarySize)
154 if (!isNextContinuation())
157 mergedStorage.assign(operands);
159 spirv::Opcode contOpcode;
163 llvm::append_range(mergedStorage, contOperands);
164 }
while (isNextContinuation());
165 operands = mergedStorage;
170 LLVM_DEBUG(logger.startLine() <<
"[inst] processing instruction "
171 << spirv::stringifyOpcode(opcode) <<
"\n");
179 case spirv::Opcode::OpCapability:
180 return processCapability(operands);
181 case spirv::Opcode::OpExtension:
182 return processExtension(operands);
183 case spirv::Opcode::OpExtInst: {
185 operands.size() >= 4 ? extendedInstSets.find(operands[2])
186 : extendedInstSets.end();
187 if (setIt != extendedInstSets.end() && setIt->second ==
extDebugInfo)
191 case spirv::Opcode::OpExtInstImport:
192 return processExtInstImport(operands);
193 case spirv::Opcode::OpMemberName:
194 return processMemberName(operands);
195 case spirv::Opcode::OpMemoryModel:
196 return processMemoryModel(operands);
197 case spirv::Opcode::OpEntryPoint:
198 case spirv::Opcode::OpExecutionMode:
199 case spirv::Opcode::OpExecutionModeId:
200 if (deferInstructions) {
201 deferredInstructions.emplace_back(opcode, operands);
205 case spirv::Opcode::OpVariable:
206 if (isa<spirv::ModuleOp>(opBuilder.getBlock()->getParentOp())) {
210 case spirv::Opcode::OpLine:
212 case spirv::Opcode::OpNoLine:
215 case spirv::Opcode::OpName:
216 return processName(operands);
217 case spirv::Opcode::OpString:
219 case spirv::Opcode::OpModuleProcessed:
220 case spirv::Opcode::OpSource:
221 case spirv::Opcode::OpSourceContinued:
222 case spirv::Opcode::OpSourceExtension:
226 case spirv::Opcode::OpTypeVoid:
227 case spirv::Opcode::OpTypeBool:
228 case spirv::Opcode::OpTypeInt:
229 case spirv::Opcode::OpTypeFloat:
230 case spirv::Opcode::OpTypeVector:
231 case spirv::Opcode::OpTypeMatrix:
232 case spirv::Opcode::OpTypeArray:
233 case spirv::Opcode::OpTypeFunction:
234 case spirv::Opcode::OpTypeImage:
235 case spirv::Opcode::OpTypeSampler:
236 case spirv::Opcode::OpTypeNamedBarrier:
237 case spirv::Opcode::OpTypeSampledImage:
238 case spirv::Opcode::OpTypeRuntimeArray:
239 case spirv::Opcode::OpTypeStruct:
240 case spirv::Opcode::OpTypePointer:
241 case spirv::Opcode::OpTypeTensorARM:
242 case spirv::Opcode::OpTypeGraphARM:
243 case spirv::Opcode::OpTypeCooperativeMatrixKHR:
245 case spirv::Opcode::OpTypeForwardPointer:
247 case spirv::Opcode::OpConstant:
249 case spirv::Opcode::OpSpecConstant:
251 case spirv::Opcode::OpConstantComposite:
253 case spirv::Opcode::OpConstantCompositeReplicateEXT:
255 case spirv::Opcode::OpSpecConstantComposite:
257 case spirv::Opcode::OpSpecConstantCompositeReplicateEXT:
259 case spirv::Opcode::OpSpecConstantOp:
261 case spirv::Opcode::OpConstantTrue:
263 case spirv::Opcode::OpSpecConstantTrue:
265 case spirv::Opcode::OpConstantFalse:
267 case spirv::Opcode::OpSpecConstantFalse:
269 case spirv::Opcode::OpConstantNull:
271 case spirv::Opcode::OpGraphConstantARM:
273 case spirv::Opcode::OpDecorate:
274 case spirv::Opcode::OpDecorateId:
275 return processDecoration(operands);
276 case spirv::Opcode::OpMemberDecorate:
277 return processMemberDecoration(operands);
278 case spirv::Opcode::OpFunction:
280 case spirv::Opcode::OpGraphEntryPointARM:
281 if (deferInstructions) {
282 deferredInstructions.emplace_back(opcode, operands);
286 case spirv::Opcode::OpGraphARM:
288 case spirv::Opcode::OpGraphSetOutputARM:
290 case spirv::Opcode::OpGraphEndARM:
292 case spirv::Opcode::OpLabel:
294 case spirv::Opcode::OpBranch:
296 case spirv::Opcode::OpBranchConditional:
298 case spirv::Opcode::OpSelectionMerge:
300 case spirv::Opcode::OpLoopMerge:
302 case spirv::Opcode::OpPhi:
304 case spirv::Opcode::OpSwitch:
306 case spirv::Opcode::OpUndef:
316 unsigned numOperands) {
318 uint32_t valueID = 0;
320 size_t wordIndex = 0;
322 if (wordIndex >= words.size())
324 "expected result type <id> while deserializing for ")
328 auto type =
getType(words[wordIndex]);
330 return emitError(unknownLoc,
"unknown type result <id>: ")
332 resultTypes.push_back(type);
336 if (wordIndex >= words.size())
338 "expected result <id> while deserializing for ")
340 valueID = words[wordIndex];
348 size_t operandIndex = 0;
349 for (; operandIndex < numOperands && wordIndex < words.size();
350 ++operandIndex, ++wordIndex) {
351 auto arg =
getValue(words[wordIndex]);
353 return emitError(unknownLoc,
"unknown result <id>: ") << words[wordIndex];
354 operands.push_back(arg);
356 if (operandIndex != numOperands) {
359 "found less operands than expected when deserializing for ")
360 << opName <<
"; only " << operandIndex <<
" of " << numOperands
363 if (wordIndex != words.size()) {
366 "found more operands than expected when deserializing for ")
367 << opName <<
"; only " << wordIndex <<
" of " << words.size()
372 if (decorations.count(valueID)) {
373 auto attrs = decorations[valueID].getAttrs();
374 attributes.append(attrs.begin(), attrs.end());
395 if (operands.size() != 2) {
396 return emitError(unknownLoc,
"OpUndef instruction must have two operands");
398 auto type =
getType(operands[0]);
400 return emitError(unknownLoc,
"unknown type <id> with OpUndef instruction");
402 undefMap[operands[1]] = type;
408 bool deferInstructions) {
409 if (deferInstructions) {
410 deferredInstructions.emplace_back(spirv::Opcode::OpExtInst, operands);
414 if (operands.size() < 4) {
416 "OpExtInst must have at least 4 operands, result type "
417 "<id>, result <id>, set <id> and instruction opcode");
423 "DebugInfo instructions must have OpTypeVoid result type");
425 auto getDebugLoc = [&](uint32_t stringID) -> FailureOr<Location> {
427 debugInfoMap.find(stringID);
428 if (stringIt == debugInfoMap.end()) {
429 return emitError(unknownLoc,
"undefined string <id> ")
430 << stringID <<
" in DebugInfo";
436 return emitError(unknownLoc,
"unknown DebugInfo instruction opcode: ")
440 switch (instructionID) {
442 if (operands.size() < 6)
443 return emitError(unknownLoc,
"DebugGraph must have graph and string IDs");
444 uint32_t graphID = operands[4];
445 uint32_t stringID = operands[5];
447 graphMap.find(graphID);
448 if (graphIt == graphMap.end())
449 return emitError(unknownLoc,
"undefined graph <id> ")
450 << graphID <<
" in DebugGraph";
451 FailureOr<Location> loc = getDebugLoc(stringID);
454 graphIt->second->setLoc(*loc);
458 if (operands.size() < 7)
459 return emitError(unknownLoc,
"DebugOperation must have graph, string and "
461 uint32_t stringID = operands[5];
462 FailureOr<Location> loc = getDebugLoc(stringID);
466 operationIDs.append(std::next(operands.begin(), 6), operands.end());
467 for (uint32_t operationID : operationIDs) {
469 if (valueIt == valueMap.end())
470 return emitError(unknownLoc,
"undefined operation <id> ")
471 << operationID <<
" in DebugOperation";
472 valueIt->second.setLoc(*loc);
477 if (operands.size() < 6)
479 "DebugTensor must have tensor and string IDs");
480 uint32_t stringID = operands[5];
481 uint32_t tensorID = operands[4];
482 FailureOr<Location> loc = getDebugLoc(stringID);
485 if (constantMap.contains(tensorID)) {
486 constantLocMap[tensorID] = *loc;
490 if (valueIt == valueMap.end())
491 return emitError(unknownLoc,
"undefined tensor <id> ")
492 << tensorID <<
" in DebugTensor";
493 valueIt->second.setLoc(*loc);
502 if (operands.size() < 4) {
504 "OpExtInst must have at least 4 operands, result type "
505 "<id>, result <id>, set <id> and instruction opcode");
507 if (!extendedInstSets.count(operands[2])) {
508 return emitError(unknownLoc,
"undefined set <id> in OpExtInst");
511 slicedOperands.append(operands.begin(), std::next(operands.begin(), 2));
512 slicedOperands.append(std::next(operands.begin(), 4), operands.end());
514 extendedInstSets[operands[2]], operands[3], slicedOperands);
523 unsigned wordIndex = 0;
524 if (wordIndex >= words.size()) {
526 "missing Execution Model specification in OpEntryPoint");
528 auto execModel = spirv::ExecutionModelAttr::get(
529 context,
static_cast<spirv::ExecutionModel
>(words[wordIndex++]));
530 if (wordIndex >= words.size()) {
531 return emitError(unknownLoc,
"missing <id> in OpEntryPoint");
534 auto fnID = words[wordIndex++];
538 auto parsedFunc = getFunction(fnID);
540 return emitError(unknownLoc,
"no function matching <id> ") << fnID;
542 if (parsedFunc.getName() != fnName) {
546 if (!parsedFunc.getName().starts_with(
"spirv_fn_"))
548 "function name mismatch between OpEntryPoint "
549 "and OpFunction with <id> ")
550 << fnID <<
": " << fnName <<
" vs. " << parsedFunc.getName();
551 parsedFunc.setName(fnName);
554 while (wordIndex < words.size()) {
555 auto arg = getGlobalVariable(words[wordIndex]);
557 return emitError(unknownLoc,
"undefined result <id> ")
558 << words[wordIndex] <<
" while decoding OpEntryPoint";
560 interface.push_back(SymbolRefAttr::get(arg.getOperation()));
563 spirv::EntryPointOp::create(
564 opBuilder, unknownLoc, execModel,
565 SymbolRefAttr::get(opBuilder.getContext(), fnName),
566 opBuilder.getArrayAttr(interface));
573 unsigned wordIndex = 0;
574 if (wordIndex >= words.size()) {
576 "missing function result <id> in OpExecutionMode");
579 auto fnID = words[wordIndex++];
580 auto fn = getFunction(fnID);
582 return emitError(unknownLoc,
"no function matching <id> ") << fnID;
585 if (wordIndex >= words.size()) {
586 return emitError(unknownLoc,
"missing Execution Mode in OpExecutionMode");
588 auto execMode = spirv::ExecutionModeAttr::get(
589 context,
static_cast<spirv::ExecutionMode
>(words[wordIndex++]));
593 while (wordIndex < words.size()) {
594 attrListElems.push_back(opBuilder.getI32IntegerAttr(words[wordIndex++]));
596 auto values = opBuilder.getArrayAttr(attrListElems);
597 spirv::ExecutionModeOp::create(
598 opBuilder, unknownLoc,
599 SymbolRefAttr::get(opBuilder.getContext(), fn.getName()), execMode,
607 unsigned wordIndex = 0;
608 unsigned const wordsSize = words.size();
609 if (wordIndex >= wordsSize)
611 "missing function result <id> in OpExecutionModeId");
614 uint32_t fnID = words[wordIndex++];
615 FuncOp fn = getFunction(fnID);
617 return emitError(unknownLoc,
"no function matching <id> ") << fnID;
620 if (wordIndex >= wordsSize)
621 return emitError(unknownLoc,
"missing Execution Mode in OpExecutionModeId");
623 ExecutionModeAttr execMode = spirv::ExecutionModeAttr::get(
624 context,
static_cast<spirv::ExecutionMode
>(words[wordIndex++]));
628 while (wordIndex < words.size()) {
629 std::string
id = getSpecConstantSymbol(words[wordIndex++]);
632 ArrayAttr values = opBuilder.getArrayAttr(attrListElems);
633 spirv::ExecutionModeIdOp::create(
634 opBuilder, unknownLoc,
635 SymbolRefAttr::get(opBuilder.getContext(), fn.getName()), execMode,
643 if (operands.size() < 3) {
645 "OpFunctionCall must have at least 3 operands");
650 return emitError(unknownLoc,
"undefined result type from <id> ")
655 if (isVoidType(resultType))
656 resultType =
nullptr;
658 auto resultID = operands[1];
659 auto functionID = operands[2];
661 auto functionName = getFunctionSymbol(functionID);
664 for (
auto operand : llvm::drop_begin(operands, 3)) {
665 auto value = getValue(operand);
667 return emitError(unknownLoc,
"unknown <id> ")
668 << operand <<
" used by OpFunctionCall";
670 arguments.push_back(value);
673 auto opFunctionCall = spirv::FunctionCallOp::create(
674 opBuilder, unknownLoc, resultType,
675 SymbolRefAttr::get(opBuilder.getContext(), functionName), arguments);
678 valueMap[resultID] = opFunctionCall.getResult(0);
686 size_t wordIndex = 0;
690 if (wordIndex < words.size()) {
691 auto arg = getValue(words[wordIndex]);
694 return emitError(unknownLoc,
"unknown result <id> : ")
698 operands.push_back(arg);
702 if (wordIndex < words.size()) {
703 auto arg = getValue(words[wordIndex]);
706 return emitError(unknownLoc,
"unknown result <id> : ")
710 operands.push_back(arg);
714 bool isAlignedAttr =
false;
716 if (wordIndex < words.size()) {
717 auto attrValue = words[wordIndex++];
718 auto attr = opBuilder.getAttr<spirv::MemoryAccessAttr>(
719 static_cast<spirv::MemoryAccess
>(attrValue));
720 attributes.push_back(
722 isAlignedAttr = (attrValue == 2);
725 if (isAlignedAttr && wordIndex < words.size()) {
726 attributes.push_back(opBuilder.getNamedAttr(
727 "alignment", opBuilder.getI32IntegerAttr(words[wordIndex++])));
730 if (wordIndex < words.size()) {
731 auto attrValue = words[wordIndex++];
732 auto attr = opBuilder.getAttr<spirv::MemoryAccessAttr>(
733 static_cast<spirv::MemoryAccess
>(attrValue));
734 attributes.push_back(opBuilder.getNamedAttr(
"source_memory_access", attr));
737 if (wordIndex < words.size()) {
738 attributes.push_back(opBuilder.getNamedAttr(
739 "source_alignment", opBuilder.getI32IntegerAttr(words[wordIndex++])));
742 if (wordIndex != words.size()) {
744 "found more operands than expected when deserializing "
745 "spirv::CopyMemoryOp, only ")
746 << wordIndex <<
" of " << words.size() <<
" processed";
749 Location loc = createFileLineColLoc(opBuilder);
750 spirv::CopyMemoryOp::create(opBuilder, loc, resultTypes, operands,
759 if (words.size() != 4) {
761 "expected 4 words in GenericCastToPtrExplicitOp"
767 uint32_t valueID = 0;
771 return emitError(unknownLoc,
"unknown type result <id> : ") << words[0];
772 resultTypes.push_back(type);
776 auto arg = getValue(words[2]);
778 return emitError(unknownLoc,
"unknown result <id> : ") << words[2];
779 operands.push_back(arg);
781 Location loc = createFileLineColLoc(opBuilder);
782 Operation *op = spirv::GenericCastToPtrExplicitOp::create(
783 opBuilder, loc, resultTypes, operands);
790#define GET_DESERIALIZATION_FNS
791#include "mlir/Dialect/SPIRV/IR/SPIRVSerialization.inc"
static spirv::Opcode extractOpcode(uint32_t word)
Extracts the opcode from the given first word of a SPIR-V instruction.
static NameLoc getLocFromDebugInfoString(OpBuilder &builder, StringRef source)
Returns a NameLoc location from the given debug info string.
StringAttr getStringAttr(const Twine &bytes)
static FlatSymbolRefAttr get(StringAttr value)
Construct a symbol reference for the given value name.
Location objects represent source locations information in MLIR.
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
This class helps build Operations.
This class provides the API for ops that are known to be terminators.
Operation is the basic unit of execution within MLIR.
bool hasTrait()
Returns true if the operation was registered with a particular trait, e.g.
OpResult getResult(unsigned idx)
Get the 'idx'th result of this operation.
static Operation * create(Location location, OperationName name, TypeRange resultTypes, ValueRange operands, NamedAttrList &&attributes, PropertyRef properties, BlockRange successors, unsigned numRegions)
Create a new Operation with the specific fields.
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
Value materializeSpecConstantOperation(uint32_t resultID, spirv::Opcode enclosedOpcode, uint32_t resultTypeID, ArrayRef< uint32_t > enclosedOpOperands)
Materializes/emits an OpSpecConstantOp instruction.
Value getValue(uint32_t id)
Get the Value associated with a result <id>.
LogicalResult processGlobalVariable(ArrayRef< uint32_t > operands)
Processes the OpVariable instructions at current offset into binary.
std::optional< SpecConstOperationMaterializationInfo > getSpecConstantOperation(uint32_t id)
Gets the info needed to materialize the spec constant operation op associated with the given <id>.
LogicalResult processDebugInfoExtInst(ArrayRef< uint32_t > operands, bool deferInstructions)
Processes a SPIR-V OpExtInst with given operands for a DebugInfo extension instruction.
LogicalResult processConstantNull(ArrayRef< uint32_t > operands)
Processes a SPIR-V OpConstantNull instruction with the given operands.
LogicalResult processSpecConstantComposite(ArrayRef< uint32_t > operands)
Processes a SPIR-V OpSpecConstantComposite instruction with the given operands.
LogicalResult processInstruction(spirv::Opcode opcode, ArrayRef< uint32_t > operands, bool deferInstructions=true)
Processes a SPIR-V instruction with the given opcode and operands.
LogicalResult processBranchConditional(ArrayRef< uint32_t > operands)
spirv::GlobalVariableOp getGlobalVariable(uint32_t id)
Gets the global variable associated with a result <id> of OpVariable.
LogicalResult processGraphARM(ArrayRef< uint32_t > operands)
LogicalResult processLabel(ArrayRef< uint32_t > operands)
Processes a SPIR-V OpLabel instruction with the given operands.
LogicalResult processExtInst(ArrayRef< uint32_t > operands)
Processes a SPIR-V OpExtInst with given operands.
std::optional< spirv::GraphConstantARMOpMaterializationInfo > getGraphConstantARM(uint32_t id)
Gets the GraphConstantARM ID attribute and result type with the given result <id>.
std::optional< std::pair< Attribute, Type > > getConstant(uint32_t id)
Gets the constant's attribute and type associated with the given <id>.
LogicalResult processType(spirv::Opcode opcode, ArrayRef< uint32_t > operands)
Processes a SPIR-V type instruction with given opcode and operands and registers the type into module...
LogicalResult processLoopMerge(ArrayRef< uint32_t > operands)
Processes a SPIR-V OpLoopMerge instruction with the given operands.
LogicalResult dispatchToExtensionSetAutogenDeserialization(StringRef extensionSetName, uint32_t instructionID, ArrayRef< uint32_t > words)
Dispatches the deserialization of extended instruction set operation based on the extended instructio...
LogicalResult sliceInstruction(spirv::Opcode &opcode, ArrayRef< uint32_t > &operands, std::optional< spirv::Opcode > expectedOpcode=std::nullopt)
Slices the first instruction out of binary and returns its opcode and operands via opcode and operand...
spirv::SpecConstantCompositeOp getSpecConstantComposite(uint32_t id)
Gets the composite specialization constant with the given result <id>.
spirv::EXTSpecConstantCompositeReplicateOp getSpecConstantCompositeReplicate(uint32_t id)
Gets the replicated composite specialization constant with the given result <id>.
LogicalResult processOp(ArrayRef< uint32_t > words)
Method to deserialize an operation in the SPIR-V dialect that is a mirror of an instruction in the SP...
Type getUndefType(uint32_t id)
Get the type associated with the result <id> of an OpUndef.
LogicalResult processSpecConstantCompositeReplicateEXT(ArrayRef< uint32_t > operands)
Processes a SPIR-V OpSpecConstantCompositeReplicateEXT instruction with the given operands.
LogicalResult processGraphEntryPointARM(ArrayRef< uint32_t > operands)
LogicalResult processFunction(ArrayRef< uint32_t > operands)
Creates a deserializer for the given SPIR-V binary module.
bool isVoidType(Type type) const
Returns true if the given type is for SPIR-V void type.
LogicalResult processDebugString(ArrayRef< uint32_t > operands)
Processes a SPIR-V OpString instruction with the given operands.
LogicalResult processPhi(ArrayRef< uint32_t > operands)
Processes a SPIR-V OpPhi instruction with the given operands.
void clearDebugLine()
Discontinues any source-level location information that might be active from a previous OpLine instru...
void mergeLongCompositeContinuations(spirv::Opcode opcode, ArrayRef< uint32_t > &operands, SmallVectorImpl< uint32_t > &mergedStorage)
If opcode is a SPV_INTEL_long_composites splittable opcode and the next binary instruction(s) are mat...
LogicalResult processTypeForwardPointer(ArrayRef< uint32_t > operands)
LogicalResult processSwitch(ArrayRef< uint32_t > operands)
Processes a SPIR-V OpSwitch instruction with the given operands.
LogicalResult dispatchToAutogenDeserialization(spirv::Opcode opcode, ArrayRef< uint32_t > words)
Method to dispatch to the specialized deserialization function for an operation in SPIR-V dialect tha...
LogicalResult processOpWithoutGrammarAttr(ArrayRef< uint32_t > words, StringRef opName, bool hasResult, unsigned numOperands)
Processes a SPIR-V instruction from the given operands.
LogicalResult processGraphEndARM(ArrayRef< uint32_t > operands)
LogicalResult processConstantComposite(ArrayRef< uint32_t > operands)
Processes a SPIR-V OpConstantComposite instruction with the given operands.
LogicalResult processBranch(ArrayRef< uint32_t > operands)
std::optional< std::pair< Attribute, Type > > getConstantCompositeReplicate(uint32_t id)
Gets the replicated composite constant's attribute and type associated with the given <id>.
LogicalResult processUndef(ArrayRef< uint32_t > operands)
Processes a OpUndef instruction.
LogicalResult processSpecConstantOperation(ArrayRef< uint32_t > operands)
Processes a SPIR-V OpSpecConstantOp instruction with the given operands.
LogicalResult processConstant(ArrayRef< uint32_t > operands, bool isSpec)
Processes a SPIR-V Op{|Spec}Constant instruction with the given operands.
Location createFileLineColLoc(OpBuilder opBuilder)
Creates a FileLineColLoc with the OpLine location information.
LogicalResult processGraphConstantARM(ArrayRef< uint32_t > operands)
Processes a SPIR-V OpGraphConstantARM instruction with the given operands.
LogicalResult processConstantBool(bool isTrue, ArrayRef< uint32_t > operands, bool isSpec)
Processes a SPIR-V Op{|Spec}Constant{True|False} instruction with the given operands.
spirv::SpecConstantOp getSpecConstant(uint32_t id)
Gets the specialization constant with the given result <id>.
LogicalResult processConstantCompositeReplicateEXT(ArrayRef< uint32_t > operands)
Processes a SPIR-V OpConstantCompositeReplicateEXT instruction with the given operands.
LogicalResult processSelectionMerge(ArrayRef< uint32_t > operands)
Processes a SPIR-V OpSelectionMerge instruction with the given operands.
LogicalResult processOpGraphSetOutputARM(ArrayRef< uint32_t > operands)
LogicalResult processDebugLine(ArrayRef< uint32_t > operands)
Processes a SPIR-V OpLine instruction with the given operands.
constexpr llvm::StringLiteral extDebugInfo
Extension set name for non-semantic graph debug info.
std::optional< spirv::Opcode > getContinuationOpcode(spirv::Opcode parent)
Returns the SPV_INTEL_long_composites continuation opcode that may follow parent, or std::nullopt if ...
constexpr bool isValidGraphDebugInfoExtInst(uint32_t opcode)
constexpr StringRef attributeName()
StringRef decodeStringLiteral(ArrayRef< uint32_t > words, unsigned &wordIndex)
Decodes a string literal in words starting at wordIndex.
GraphDebugInfoExtInst
Instruction opcodes in the NonSemantic.Graph.DebugInfo.1 extended instruction set.
Include the generated interface declarations.
Type getType(OpFoldResult ofr)
Returns the int type of the integer in ofr.
InFlightDiagnostic emitError(Location loc)
Utility method to emit an error message using this location.
llvm::DenseMap< KeyT, ValueT, KeyInfoT, BucketT > DenseMap
This represents an operation in an abstracted form, suitable for use with the builder APIs.
void addOperands(ValueRange newOperands)
void addAttributes(ArrayRef< NamedAttribute > newAttributes)
Add an array of named attributes.
void addTypes(ArrayRef< Type > newTypes)