Lines Matching refs:Id
92 spv::Id getStringId(const std::string& str)
97 spv::Id strId = getUniqueId();
106 spv::Id getSourceFile() const
149 spv::Id incId = getStringId(name);
152 Id import(const char*);
162 Id getUniqueId() { return ++uniqueId; }
165 Id getUniqueIds(int numIds)
167 Id id = uniqueId + 1;
183 void addLine(Id fileName, int line, int column);
184 void addDebugScopeAndLine(Id fileName, int line, int column);
187 Id makeVoidType();
188 Id makeBoolType();
189 Id makePointer(StorageClass, Id pointee);
190 Id makeForwardPointer(StorageClass);
191 Id makePointerFromForwardPointer(StorageClass, Id forwardPointerType, Id pointee);
192 Id makeIntegerType(int width, bool hasSign); // generic
193 Id makeIntType(int width) { return makeIntegerType(width, true); }
194 Id makeUintType(int width) { return makeIntegerType(width, false); }
195 Id makeFloatType(int width);
196 Id makeStructType(const std::vector<Id>& members, const char* name, bool const compilerGenerated = true);
197 Id makeStructResultType(Id type0, Id type1);
198 Id makeVectorType(Id component, int size);
199 Id makeMatrixType(Id component, int cols, int rows);
200 Id makeArrayType(Id element, Id sizeId, int stride); // 0 stride means no stride decoration
201 Id makeRuntimeArray(Id element);
202 Id makeFunctionType(Id returnType, const std::vector<Id>& paramTypes);
203 Id makeImageType(Id sampledType, Dim, bool depth, bool arrayed, bool ms, unsigned sampled, ImageFormat format);
204 Id makeSamplerType();
205 Id makeSampledImageType(Id imageType);
206 Id makeCooperativeMatrixTypeKHR(Id component, Id scope, Id rows, Id cols, Id use);
207 Id makeCooperativeMatrixTypeNV(Id component, Id scope, Id rows, Id cols);
208 Id makeCooperativeMatrixTypeWithSameShape(Id component, Id otherType);
209 Id makeGenericType(spv::Op opcode, std::vector<spv::IdImmediate>& operands);
217 std::unordered_map<Id, DebugTypeLoc> debugTypeLocs;
218 Id makeDebugInfoNone();
219 Id makeBoolDebugType(int const size);
220 Id makeIntegerDebugType(int const width, bool const hasSign);
221 Id makeFloatDebugType(int const width);
222 Id makeSequentialDebugType(Id const baseType, Id const componentCount, NonSemanticShaderDebugInfo100Instructions const sequenceType);
223 Id makeArrayDebugType(Id const baseType, Id const componentCount);
224 Id makeVectorDebugType(Id const baseType, int const componentCount);
225 Id makeMatrixDebugType(Id const vectorType, int const vectorCount, bool columnMajor = true);
226 Id makeMemberDebugType(Id const memberType, DebugTypeLoc const& debugTypeLoc);
227 Id makeCompositeDebugType(std::vector<Id> const& memberTypes, char const*const name,
229 Id makeDebugSource(const Id fileName);
230 Id makeDebugCompilationUnit();
231 Id createDebugGlobalVariable(Id const type, char const*const name, Id const variable);
232 Id createDebugLocalVariable(Id type, char const*const name, size_t const argNumber = 0);
233 Id makeDebugExpression();
234 Id makeDebugDeclare(Id const debugLocalVariable, Id const pointer);
235 Id makeDebugValue(Id const debugLocalVariable, Id const value);
236 Id makeDebugFunctionType(Id returnType, const std::vector<Id>& paramTypes);
237 Id makeDebugFunction(Function* function, Id nameId, Id funcTypeId);
238 Id makeDebugLexicalBlock(uint32_t line);
241 const std::vector<Id>& paramTypes,
245 Id makeAccelerationStructureType();
247 Id makeRayQueryType();
249 Id makeHitObjectNVType();
252 Id getTypeId(Id resultId) const { return module.getTypeId(resultId); }
253 Id getDerefTypeId(Id resultId) const;
254 Op getOpCode(Id id) const { return module.getInstruction(id)->getOpCode(); }
255 Op getTypeClass(Id typeId) const { return getOpCode(typeId); }
256 Op getMostBasicTypeClass(Id typeId) const;
257 int getNumComponents(Id resultId) const { return getNumTypeComponents(getTypeId(resultId)); }
258 int getNumTypeConstituents(Id typeId) const;
259 int getNumTypeComponents(Id typeId) const { return getNumTypeConstituents(typeId); }
260 Id getScalarTypeId(Id typeId) const;
261 Id getContainedTypeId(Id typeId) const;
262 Id getContainedTypeId(Id typeId, int) const;
263 StorageClass getTypeStorageClass(Id typeId) const { return module.getStorageClass(typeId); }
264 ImageFormat getImageTypeFormat(Id typeId) const
266 Id getResultingAccessChainType() const;
267 Id getIdOperand(Id resultId, int idx) { return module.getInstruction(resultId)->getIdOperand(idx); }
269 bool isPointer(Id resultId) const { return isPointerType(getTypeId(resultId)); }
270 bool isScalar(Id resultId) const { return isScalarType(getTypeId(resultId)); }
271 bool isVector(Id resultId) const { return isVectorType(getTypeId(resultId)); }
272 bool isMatrix(Id resultId) const { return isMatrixType(getTypeId(resultId)); }
273 bool isCooperativeMatrix(Id resultId)const { return isCooperativeMatrixType(getTypeId(resultId)); }
274 bool isAggregate(Id resultId) const { return isAggregateType(getTypeId(resultId)); }
275 bool isSampledImage(Id resultId) const { return isSampledImageType(getTypeId(resultId)); }
277 bool isBoolType(Id typeId)
279 bool isIntType(Id typeId) const
281 bool isUintType(Id typeId) const
283 bool isFloatType(Id typeId) const { return getTypeClass(typeId) == OpTypeFloat; }
284 bool isPointerType(Id typeId) const { return getTypeClass(typeId) == OpTypePointer; }
285 bool isScalarType(Id typeId) const
288 bool isVectorType(Id typeId) const { return getTypeClass(typeId) == OpTypeVector; }
289 bool isMatrixType(Id typeId) const { return getTypeClass(typeId) == OpTypeMatrix; }
290 bool isStructType(Id typeId) const { return getTypeClass(typeId) == OpTypeStruct; }
291 bool isArrayType(Id typeId) const { return getTypeClass(typeId) == OpTypeArray; }
292 bool isCooperativeMatrixType(Id typeId)const
296 bool isAggregateType(Id typeId) const
298 bool isImageType(Id typeId) const { return getTypeClass(typeId) == OpTypeImage; }
299 bool isSamplerType(Id typeId) const { return getTypeClass(typeId) == OpTypeSampler; }
300 bool isSampledImageType(Id typeId) const { return getTypeClass(typeId) == OpTypeSampledImage; }
301 bool containsType(Id typeId, Op typeOp, unsigned int width) const;
302 bool containsPhysicalStorageBufferOrArray(Id typeId) const;
306 bool isConstant(Id resultId) const { return isConstantOpCode(getOpCode(resultId)); }
307 bool isConstantScalar(Id resultId) const { return getOpCode(resultId) == OpConstant; }
308 bool isSpecConstant(Id resultId) const { return isSpecConstantOpCode(getOpCode(resultId)); }
309 unsigned int getConstantScalar(Id resultId) const
311 StorageClass getStorageClass(Id resultId) const { return getTypeStorageClass(getTypeId(resultId)); }
314 bool isVariable(Id resultId) const { return isVariableOpCode(getOpCode(resultId)); }
315 bool isGlobalStorage(Id resultId) const { return getStorageClass(resultId) != StorageClassFunction; }
316 bool isGlobalVariable(Id resultId) const { return isVariable(resultId) && isGlobalStorage(resultId); }
318 bool isValidInitializer(Id resultId) const { return isConstant(resultId) || isGlobalVariable(resultId); }
322 int getScalarTypeWidth(Id typeId) const
324 Id scalarTypeId = getScalarTypeId(typeId);
329 int getTypeNumColumns(Id typeId) const
334 int getNumColumns(Id resultId) const { return getTypeNumColumns(getTypeId(resultId)); }
335 int getTypeNumRows(Id typeId) const
340 int getNumRows(Id resultId) const { return getTypeNumRows(getTypeId(resultId)); }
342 Dim getTypeDimensionality(Id typeId) const
347 Id getImageType(Id resultId) const
349 Id typeId = getTypeId(resultId);
353 bool isArrayedImageType(Id typeId) const
360 Id makeNullConstant(Id typeId);
361 Id makeBoolConstant(bool b, bool specConstant = false);
362 Id makeInt8Constant(int i, bool specConstant = false)
364 Id makeUint8Constant(unsigned u, bool specConstant = false)
366 Id makeInt16Constant(int i, bool specConstant = false)
368 Id makeUint16Constant(unsigned u, bool specConstant = false)
370 Id makeIntConstant(int i, bool specConstant = false)
372 Id makeUintConstant(unsigned u, bool specConstant = false)
374 Id makeInt64Constant(long long i, bool specConstant = false)
376 Id makeUint64Constant(unsigned long long u, bool specConstant = false)
378 Id makeFloatConstant(float f, bool specConstant = false);
379 Id makeDoubleConstant(double d, bool specConstant = false);
380 Id makeFloat16Constant(float f16, bool specConstant = false);
381 Id makeFpConstant(Id type, double d, bool specConstant = false);
383 Id importNonSemanticShaderDebugInfoInstructions();
386 Id makeCompositeConstant(Id type, const std::vector<Id>& comps, bool specConst = false);
392 void addExecutionModeId(Function*, ExecutionMode mode, const std::vector<Id>& operandIds);
393 void addName(Id, const char* name);
394 void addMemberName(Id, int member, const char* name);
395 void addDecoration(Id, Decoration, int num = -1);
396 void addDecoration(Id, Decoration, const char*);
397 void addDecoration(Id, Decoration, const std::vector<unsigned>& literals);
398 void addDecoration(Id, Decoration, const std::vector<const char*>& strings);
399 void addLinkageDecoration(Id id, const char* name, spv::LinkageType linkType);
400 void addDecorationId(Id id, Decoration, Id idDecoration);
401 void addDecorationId(Id id, Decoration, const std::vector<Id>& operandIds);
402 void addMemberDecoration(Id, unsigned int member, Decoration, int num = -1);
403 void addMemberDecoration(Id, unsigned int member, Decoration, const char*);
404 void addMemberDecoration(Id, unsigned int member, Decoration, const std::vector<unsigned>& literals);
405 void addMemberDecoration(Id, unsigned int member, Decoration, const std::vector<const char*>& strings);
423 Function* makeFunctionEntry(Decoration precision, Id returnType, const char* name, LinkageType linkType,
424 const std::vector<Id>& paramTypes,
429 void makeReturn(bool implicit, Id retVal = 0);
449 void makeStatementTerminator(spv::Op opcode, const std::vector<Id>& operands, const char* name);
452 Id createVariable(Decoration precision, StorageClass storageClass, Id type, const char* name = nullptr,
453 Id initializer = NoResult, bool const compilerGenerated = true);
456 Id createUndefined(Id type);
458 // Store into an Id and return the l-value
459 void createStore(Id rValue, Id lValue, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone,
462 // Load from an Id and return it
463 Id createLoad(Id lValue, spv::Decoration precision,
468 Id createAccessChain(StorageClass, Id base, const std::vector<Id>& offsets);
471 Id createArrayLength(Id base, unsigned int member);
474 Id createCooperativeMatrixLengthKHR(Id type);
476 Id createCooperativeMatrixLengthNV(Id type);
479 Id createCompositeExtract(Id composite, Id typeId, unsigned index);
480 Id createCompositeExtract(Id composite, Id typeId, const std::vector<unsigned>& indexes);
481 Id createCompositeInsert(Id object, Id composite, Id typeId, unsigned index);
482 Id createCompositeInsert(Id object, Id composite, Id typeId, const std::vector<unsigned>& indexes);
484 Id createVectorExtractDynamic(Id vector, Id typeId, Id componentIndex);
485 Id createVectorInsertDynamic(Id vector, Id typeId, Id component, Id componentIndex);
488 void createNoResultOp(Op, Id operand);
489 void createNoResultOp(Op, const std::vector<Id>& operands);
493 Id createUnaryOp(Op, Id typeId, Id operand);
494 Id createBinOp(Op, Id typeId, Id operand1, Id operand2);
495 Id createTriOp(Op, Id typeId, Id operand1, Id operand2, Id operand3);
496 Id createOp(Op, Id typeId, const std::vector<Id>& operands);
497 Id createOp(Op, Id typeId, const std::vector<IdImmediate>& operands);
498 Id createFunctionCall(spv::Function*, const std::vector<spv::Id>&);
499 Id createSpecConstantOp(Op, Id typeId, const std::vector<spv::Id>& operands, const std::vector<unsigned>& literals);
503 Id createRvalueSwizzle(Decoration precision, Id typeId, Id source, const std::vector<unsigned>& channels);
509 Id createLvalueSwizzle(Id typeId, Id target, Id source, const std::vector<unsigned>& channels);
514 Id setPrecision(Id id, Decoration precision)
534 void promoteScalar(Decoration precision, Id& left, Id& right);
539 Id smearScalar(Decoration precision, Id scalarVal, Id vectorType);
542 Id createBuiltinCall(Id resultType, Id builtins, int entryPoint, const std::vector<Id>& args);
546 Id sampler;
547 Id coords;
548 Id bias;
549 Id lod;
550 Id Dref;
551 Id offset;
552 Id offsets;
553 Id gradX;
554 Id gradY;
555 Id sample;
556 Id component;
557 Id texelOut;
558 Id lodClamp;
559 Id granularity;
560 Id coarse;
566 Id createTextureCall(Decoration precision, Id resultType, bool sparse, bool fetch, bool proj, bool gather,
571 Id createTextureQueryCall(Op, const TextureParameters&, bool isUnsignedResult);
573 Id createSamplePositionCall(Decoration precision, Id, Id);
575 Id createBitFieldExtractCall(Decoration precision, Id, Id, Id, bool isSigned);
576 Id createBitFieldInsertCall(Decoration precision, Id, Id, Id, Id);
579 Id createCompositeCompare(Decoration precision, Id, Id, bool /* true if for equal, false if for not-equal */);
582 Id createCompositeConstruct(Id typeId, const std::vector<Id>& constituents);
585 Id createConstructor(Decoration precision, const std::vector<Id>& sources, Id resultTypeId);
588 Id createMatrixConstructor(Decoration precision, const std::vector<Id>& sources, Id constructee);
593 If(Id condition, unsigned int ctrl, Builder& builder);
604 Id condition;
625 void makeSwitch(Id condition, unsigned int control, int numSegments, const std::vector<int>& caseValues,
696 Id base; // for l-values, pointer to the base object, for r-values, the base object
697 std::vector<Id> indexChain;
698 Id instr; // cache the instruction that generates this access chain
700 Id component; // a dynamic component index, can coexist with a swizzle,
702 Id preSwizzleBaseType; // dereferenced type, before swizzle or component is applied;
772 void setAccessChainLValue(Id lValue)
779 void setAccessChainRValue(Id rValue)
786 void accessChainPush(Id offset, AccessChain::CoherentFlags coherentFlags, unsigned int alignment)
794 void accessChainPushSwizzle(std::vector<unsigned>& swizzle, Id preSwizzleBaseType,
799 void accessChainPushComponent(Id component, Id preSwizzleBaseType, AccessChain::CoherentFlags coherentFlags,
812 void accessChainStore(Id rvalue, Decoration nonUniform,
817 Id accessChainLoad(Decoration precision, Decoration l_nonUniform, Decoration r_nonUniform, Id ResultType,
827 Id accessChainGetLValue();
831 Id accessChainGetInferredType();
845 void postProcessType(const Instruction&, spv::Id typeId);
850 void createConditionalBranch(Id condition, Block* thenBlock, Block* elseBlock);
862 Id makeIntConstant(Id typeId, unsigned value, bool specConstant);
863 Id makeInt64Constant(Id typeId, unsigned long long value, bool specConstant);
864 Id findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned value);
865 Id findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned v1, unsigned v2);
866 Id findCompositeConstant(Op typeClass, Id typeId, const std::vector<Id>& comps);
867 Id findStructConstant(Id typeId, const std::vector<Id>& comps);
868 Id collapseAccessChain();
875 void dumpSourceInstructions(const spv::Id fileId, const std::string& text, std::vector<unsigned int>&) const;
884 spv::Id sourceFileStringId;
885 spv::Id nonSemanticShaderCompilationUnitId {0};
886 spv::Id nonSemanticShaderDebugInfo {0};
887 spv::Id debugInfoNone {0};
888 spv::Id debugExpression {0}; // Debug expression with zero operations.
892 spv::Id currentFileId;
893 std::stack<spv::Id> currentDebugScopeId;
894 spv::Id lastDebugScopeId;
908 Id uniqueId;
944 std::unordered_map<std::string, spv::Id> stringIds;
947 std::map<spv::Id, const std::string*> includeFiles;
950 std::map <spv::Id, spv::Id> debugId;
953 std::unordered_map<spv::Id, spv::Id> debugSourceId;