LLVM 23.0.0git
DXContainer.h
Go to the documentation of this file.
1//===- DXContainer.h - DXContainer file implementation ----------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file declares the DXContainerFile class, which implements the ObjectFile
10// interface for DXContainer files.
11//
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_OBJECT_DXCONTAINER_H
16#define LLVM_OBJECT_DXCONTAINER_H
17
19#include "llvm/ADT/StringRef.h"
20#include "llvm/ADT/Twine.h"
23#include "llvm/Object/Error.h"
26#include "llvm/Support/Endian.h"
27#include "llvm/Support/Error.h"
30#include <array>
31#include <cstddef>
32#include <cstdint>
33#include <variant>
34
35namespace llvm {
36namespace object {
37
38namespace detail {
39template <typename T>
40std::enable_if_t<std::is_arithmetic<T>::value, void> swapBytes(T &value) {
41 sys::swapByteOrder(value);
42}
43
44template <typename T>
45std::enable_if_t<std::is_class<T>::value, void> swapBytes(T &value) {
46 value.swapBytes();
47}
48} // namespace detail
49
50// This class provides a view into the underlying resource array. The Resource
51// data is little-endian encoded and may not be properly aligned to read
52// directly from. The dereference operator creates a copy of the data and byte
53// swaps it as appropriate.
54template <typename T> struct ViewArray {
56 uint32_t Stride = sizeof(T); // size of each element in the list.
57
58 ViewArray() = default;
59 ViewArray(StringRef D, size_t S) : Data(D), Stride(S) {}
60
61 using value_type = T;
62 static constexpr uint32_t MaxStride() {
63 return static_cast<uint32_t>(sizeof(value_type));
64 }
65
66 struct iterator {
68 uint32_t Stride; // size of each element in the list.
69 const char *Current;
70
71 iterator(const ViewArray &A, const char *C)
72 : Data(A.Data), Stride(A.Stride), Current(C) {}
73 iterator(const iterator &) = default;
74
76 // Explicitly zero the structure so that unused fields are zeroed. It is
77 // up to the user to know if the fields are used by verifying the PSV
78 // version.
79 value_type Val;
80 std::memset(&Val, 0, sizeof(value_type));
81 if (Current >= Data.end())
82 return Val;
83 memcpy(static_cast<void *>(&Val), Current, std::min(Stride, MaxStride()));
86 return Val;
87 }
88
90 if (Current < Data.end())
91 Current += Stride;
92 return *this;
93 }
94
96 iterator Tmp = *this;
97 ++*this;
98 return Tmp;
99 }
100
102 if (Current > Data.begin())
103 Current -= Stride;
104 return *this;
105 }
106
108 iterator Tmp = *this;
109 --*this;
110 return Tmp;
111 }
112
113 bool operator==(const iterator I) { return I.Current == Current; }
114 bool operator!=(const iterator I) { return !(*this == I); }
115 };
116
117 iterator begin() const { return iterator(*this, Data.begin()); }
118
119 iterator end() const { return iterator(*this, Data.end()); }
120
121 size_t size() const { return Data.size() / Stride; }
122
123 bool isEmpty() const { return Data.empty(); }
124};
125
126namespace DirectX {
130
133
134 template <typename T> Expected<T> readParameter() {
135 T Struct;
136 if (sizeof(T) != ParamData.size())
138 "Reading structure out of file bounds", object_error::parse_failed);
139
140 memcpy(&Struct, ParamData.data(), sizeof(T));
141 // DXContainer is always little endian
143 Struct.swapBytes();
144 return Struct;
145 }
146};
147
149 static bool classof(const RootParameterView *V) {
150 return V->Header.ParameterType ==
151 (uint32_t)dxbc::RootParameterType::Constants32Bit;
152 }
153
157};
158
160 static bool classof(const RootParameterView *V) {
161 return (V->Header.ParameterType ==
162 llvm::to_underlying(dxbc::RootParameterType::CBV) ||
163 V->Header.ParameterType ==
164 llvm::to_underlying(dxbc::RootParameterType::SRV) ||
165 V->Header.ParameterType ==
166 llvm::to_underlying(dxbc::RootParameterType::UAV));
167 }
168
170 if (Version == 1) {
172 if (Error E = Descriptor.takeError())
173 return E;
174 return dxbc::RTS0::v2::RootDescriptor(*Descriptor);
175 }
176 if (Version != 2)
177 return make_error<GenericBinaryError>("Invalid Root Signature version: " +
178 Twine(Version),
181 }
182};
183template <typename T> struct DescriptorTable {
187
188 typename ViewArray<T>::iterator begin() const { return Ranges.begin(); }
189
190 typename ViewArray<T>::iterator end() const { return Ranges.end(); }
191};
192
194 static bool classof(const RootParameterView *V) {
195 return (V->Header.ParameterType ==
196 llvm::to_underlying(dxbc::RootParameterType::DescriptorTable));
197 }
198
199 // Define a type alias to access the template parameter from inside classof
200 template <typename T> llvm::Expected<DescriptorTable<T>> read() {
201 const char *Current = ParamData.begin();
202 DescriptorTable<T> Table;
203
204 Table.NumRanges =
206 Current += sizeof(uint32_t);
207
208 Table.RangesOffset =
210 Current += sizeof(uint32_t);
211
212 Table.Ranges.Data = ParamData.substr(2 * sizeof(uint32_t),
213 Table.NumRanges * Table.Ranges.Stride);
214 return Table;
215 }
216};
217
221
223private:
224 uint32_t Version;
225 uint32_t NumParameters;
226 uint32_t RootParametersOffset;
227 uint32_t NumStaticSamplers;
228 uint32_t StaticSamplersOffset;
229 uint32_t Flags;
231 StringRef PartData;
233
234 using param_header_iterator =
237
238public:
239 RootSignature(StringRef PD) : PartData(PD) {}
240
242 uint32_t getVersion() const { return Version; }
243 uint32_t getNumParameters() const { return NumParameters; }
244 uint32_t getRootParametersOffset() const { return RootParametersOffset; }
245 uint32_t getNumStaticSamplers() const { return NumStaticSamplers; }
246 uint32_t getStaticSamplersOffset() const { return StaticSamplersOffset; }
247 uint32_t getNumRootParameters() const { return ParametersHeaders.size(); }
249 return ParametersHeaders;
250 }
252 return StaticSamplers;
253 }
254 uint32_t getFlags() const { return Flags; }
255
258 size_t DataSize;
259 size_t EndOfSectionByte = getNumStaticSamplers() == 0
260 ? PartData.size()
262
263 if (!dxbc::isValidParameterType(Header.ParameterType))
264 return parseFailed("invalid parameter type");
265
266 switch (static_cast<dxbc::RootParameterType>(Header.ParameterType)) {
267 case dxbc::RootParameterType::Constants32Bit:
269 break;
270 case dxbc::RootParameterType::CBV:
271 case dxbc::RootParameterType::SRV:
272 case dxbc::RootParameterType::UAV:
273 if (Version == 1)
275 else
277 break;
278 case dxbc::RootParameterType::DescriptorTable:
279 if (Header.ParameterOffset + sizeof(uint32_t) > EndOfSectionByte)
280 return parseFailed("Reading structure out of file bounds");
281
282 uint32_t NumRanges =
284 PartData.begin() + Header.ParameterOffset);
285 if (Version == 1)
286 DataSize = sizeof(dxbc::RTS0::v1::DescriptorRange) * NumRanges;
287 else
288 DataSize = sizeof(dxbc::RTS0::v2::DescriptorRange) * NumRanges;
289
290 // 4 bytes for the number of ranges in table and
291 // 4 bytes for the ranges offset
292 DataSize += 2 * sizeof(uint32_t);
293 break;
294 }
295 if (Header.ParameterOffset + DataSize > EndOfSectionByte)
296 return parseFailed("Reading structure out of file bounds");
297
298 StringRef Buff = PartData.substr(Header.ParameterOffset, DataSize);
299 RootParameterView View = RootParameterView(Header, Buff);
300 return View;
301 }
302};
303
305
306 using ResourceArray = ViewArray<dxbc::PSV::v2::ResourceBindInfo>;
307 using SigElementArray = ViewArray<dxbc::PSV::v0::SignatureElement>;
308
309 StringRef Data;
310 uint32_t Size;
311 using InfoStruct =
312 std::variant<std::monostate, dxbc::PSV::v0::RuntimeInfo,
315 InfoStruct BasicInfo;
316 ResourceArray Resources;
317 StringRef StringTable;
318 SmallVector<uint32_t> SemanticIndexTable;
319 SigElementArray SigInputElements;
320 SigElementArray SigOutputElements;
321 SigElementArray SigPatchOrPrimElements;
322
323 std::array<ViewArray<uint32_t>, 4> OutputVectorMasks;
324 ViewArray<uint32_t> PatchOrPrimMasks;
325 std::array<ViewArray<uint32_t>, 4> InputOutputMap;
326 ViewArray<uint32_t> InputPatchMap;
327 ViewArray<uint32_t> PatchOutputMap;
328
329public:
330 PSVRuntimeInfo(StringRef D) : Data(D), Size(0) {}
331
332 // Parsing depends on the shader kind
333 LLVM_ABI Error parse(uint16_t ShaderKind);
334
335 uint32_t getSize() const { return Size; }
336 uint32_t getResourceCount() const { return Resources.size(); }
337 ResourceArray getResources() const { return Resources; }
338
340 return Size >= sizeof(dxbc::PSV::v3::RuntimeInfo)
341 ? 3
342 : (Size >= sizeof(dxbc::PSV::v2::RuntimeInfo) ? 2
343 : (Size >= sizeof(dxbc::PSV::v1::RuntimeInfo)) ? 1
344 : 0);
345 }
346
347 uint32_t getResourceStride() const { return Resources.Stride; }
348
349 const InfoStruct &getInfo() const { return BasicInfo; }
350
351 template <typename T> const T *getInfoAs() const {
352 if (const auto *P = std::get_if<dxbc::PSV::v3::RuntimeInfo>(&BasicInfo))
353 return static_cast<const T *>(P);
354 if (std::is_same<T, dxbc::PSV::v3::RuntimeInfo>::value)
355 return nullptr;
356
357 if (const auto *P = std::get_if<dxbc::PSV::v2::RuntimeInfo>(&BasicInfo))
358 return static_cast<const T *>(P);
359 if (std::is_same<T, dxbc::PSV::v2::RuntimeInfo>::value)
360 return nullptr;
361
362 if (const auto *P = std::get_if<dxbc::PSV::v1::RuntimeInfo>(&BasicInfo))
363 return static_cast<const T *>(P);
364 if (std::is_same<T, dxbc::PSV::v1::RuntimeInfo>::value)
365 return nullptr;
366
367 if (const auto *P = std::get_if<dxbc::PSV::v0::RuntimeInfo>(&BasicInfo))
368 return static_cast<const T *>(P);
369 return nullptr;
370 }
371
372 StringRef getStringTable() const { return StringTable; }
374 return SemanticIndexTable;
375 }
376
380
381 SigElementArray getSigInputElements() const { return SigInputElements; }
382 SigElementArray getSigOutputElements() const { return SigOutputElements; }
383 SigElementArray getSigPatchOrPrimElements() const {
384 return SigPatchOrPrimElements;
385 }
386
388 assert(Idx < 4);
389 return OutputVectorMasks[Idx];
390 }
391
392 ViewArray<uint32_t> getPatchOrPrimMasks() const { return PatchOrPrimMasks; }
393
395 assert(Idx < 4);
396 return InputOutputMap[Idx];
397 }
398
399 ViewArray<uint32_t> getInputPatchMap() const { return InputPatchMap; }
400 ViewArray<uint32_t> getPatchOutputMap() const { return PatchOutputMap; }
401
402 uint32_t getSigElementStride() const { return SigInputElements.Stride; }
403
404 bool usesViewID() const {
405 if (const auto *P = getInfoAs<dxbc::PSV::v1::RuntimeInfo>())
406 return P->UsesViewID != 0;
407 return false;
408 }
409
411 if (const auto *P = getInfoAs<dxbc::PSV::v1::RuntimeInfo>())
412 return P->SigInputVectors;
413 return 0;
414 }
415
417 if (const auto *P = getInfoAs<dxbc::PSV::v1::RuntimeInfo>())
418 return ArrayRef<uint8_t>(P->SigOutputVectors);
419 return ArrayRef<uint8_t>();
420 }
421
423 if (const auto *P = getInfoAs<dxbc::PSV::v1::RuntimeInfo>())
424 return P->GeomData.SigPatchConstOrPrimVectors;
425 return 0;
426 }
427};
428
431 uint32_t StringTableOffset;
432 StringRef StringTable;
433
434public:
436 return Parameters.begin();
437 }
438
440 return Parameters.end();
441 }
442
444 assert(Offset >= StringTableOffset &&
445 Offset < StringTableOffset + StringTable.size() &&
446 "Offset out of range.");
447 // Name offsets are from the start of the signature data, not from the start
448 // of the string table. The header encodes the start offset of the sting
449 // table, so we convert the offset here.
450 uint32_t TableOffset = Offset - StringTableOffset;
451 return StringTable.slice(TableOffset, StringTable.find('\0', TableOffset));
452 }
453
454 bool isEmpty() const { return Parameters.isEmpty(); }
455
457};
458
459} // namespace DirectX
460
461class DXContainer {
462public:
463 using DXILData = std::pair<dxbc::ProgramHeader, const char *>;
464
465private:
466 DXContainer(MemoryBufferRef O);
467
468 MemoryBufferRef Data;
469 dxbc::Header Header;
470 SmallVector<uint32_t, 4> PartOffsets;
471 std::optional<DXILData> DXIL;
472 std::optional<DXILData> DebugDXIL;
473 std::optional<uint64_t> ShaderFeatureFlags;
474 std::optional<dxbc::ShaderHash> Hash;
475 std::optional<DirectX::PSVRuntimeInfo> PSVInfo;
476 std::optional<DirectX::RootSignature> RootSignature;
477 DirectX::Signature InputSignature;
478 DirectX::Signature OutputSignature;
479 DirectX::Signature PatchConstantSignature;
480 std::optional<mcdxbc::DebugName> DebugName;
481
482 Error parseHeader();
483 Error parsePartOffsets();
484 Error parseDXILHeader(dxbc::PartType PT, StringRef Part);
485 Error parseDebugName(StringRef Part);
486 Error parseShaderFeatureFlags(StringRef Part);
487 Error parseHash(StringRef Part);
488 Error parseRootSignature(StringRef Part);
489 Error parsePSVInfo(StringRef Part);
490 Error parseSignature(StringRef Part, DirectX::Signature &Array);
491 friend class PartIterator;
492
493public:
494 // The PartIterator is a wrapper around the iterator for the PartOffsets
495 // member of the DXContainer. It contains a refernce to the container, and the
496 // current iterator value, as well as storage for a parsed part header.
497 class PartIterator {
498 const DXContainer &Container;
500 struct PartData {
501 dxbc::PartHeader Part;
503 StringRef Data;
504 } IteratorState;
505
506 friend class DXContainer;
508
511 : Container(C), OffsetIt(It) {
512 if (OffsetIt == Container.PartOffsets.end())
513 updateIteratorImpl(Container.PartOffsets.back());
514 else
515 updateIterator();
516 }
517
518 // Updates the iterator's state data. This results in copying the part
519 // header into the iterator and handling any required byte swapping. This is
520 // called when incrementing or decrementing the iterator.
521 void updateIterator() {
522 if (OffsetIt != Container.PartOffsets.end())
523 updateIteratorImpl(*OffsetIt);
524 }
525
526 // Implementation for updating the iterator state based on a specified
527 // offest.
528 LLVM_ABI void updateIteratorImpl(const uint32_t Offset);
529
530 public:
531 PartIterator &operator++() {
532 if (OffsetIt == Container.PartOffsets.end())
533 return *this;
534 ++OffsetIt;
535 updateIterator();
536 return *this;
537 }
538
539 PartIterator operator++(int) {
540 PartIterator Tmp = *this;
541 ++(*this);
542 return Tmp;
543 }
544
545 bool operator==(const PartIterator &RHS) const {
546 return OffsetIt == RHS.OffsetIt;
547 }
548
549 bool operator!=(const PartIterator &RHS) const {
550 return OffsetIt != RHS.OffsetIt;
551 }
552
553 const PartData &operator*() { return IteratorState; }
554 const PartData *operator->() { return &IteratorState; }
555 };
556
558 return PartIterator(*this, PartOffsets.begin());
559 }
560
561 PartIterator end() const { return PartIterator(*this, PartOffsets.end()); }
562
563 StringRef getData() const { return Data.getBuffer(); }
565
566 const dxbc::Header &getHeader() const { return Header; }
567
568 const std::optional<DXILData> &getDXIL(bool Debug) const {
569 return Debug ? DebugDXIL : DXIL;
570 }
571
572 std::optional<uint16_t> getShaderKind() const {
573 const auto &ProgramPart = DXIL ? DXIL : DebugDXIL;
574 if (!ProgramPart)
575 return std::nullopt;
576 return ProgramPart->first.ShaderKind;
577 }
578
579 const std::optional<mcdxbc::DebugName> getDebugName() const {
580 return DebugName;
581 }
582
583 std::optional<uint64_t> getShaderFeatureFlags() const {
584 return ShaderFeatureFlags;
585 }
586
587 std::optional<dxbc::ShaderHash> getShaderHash() const { return Hash; }
588
589 std::optional<DirectX::RootSignature> getRootSignature() const {
590 return RootSignature;
591 }
592
593 const std::optional<DirectX::PSVRuntimeInfo> &getPSVInfo() const {
594 return PSVInfo;
595 };
596
597 const DirectX::Signature &getInputSignature() const { return InputSignature; }
599 return OutputSignature;
600 }
602 return PatchConstantSignature;
603 }
604};
605
606class LLVM_ABI DXContainerObjectFile : public ObjectFile {
607private:
608 friend class ObjectFile;
609 DXContainer Container;
610
611 using PartData = DXContainer::PartIterator::PartData;
613 using PartIterator = llvm::SmallVector<PartData>::iterator;
614
615 DXContainerObjectFile(DXContainer C)
617 Container(C) {
618 for (auto &P : C)
619 Parts.push_back(P);
620 }
621
622public:
623 const DXContainer &getDXContainer() const { return Container; }
624
625 static bool classof(const Binary *v) { return v->isDXContainer(); }
626
627 const dxbc::Header &getHeader() const { return Container.getHeader(); }
628
630 Expected<uint64_t> getSymbolAddress(DataRefImpl Symb) const override;
631 uint64_t getSymbolValueImpl(DataRefImpl Symb) const override;
632 uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const override;
633
635 Expected<section_iterator> getSymbolSection(DataRefImpl Symb) const override;
636 void moveSectionNext(DataRefImpl &Sec) const override;
638 uint64_t getSectionAddress(DataRefImpl Sec) const override;
639 uint64_t getSectionIndex(DataRefImpl Sec) const override;
640 uint64_t getSectionSize(DataRefImpl Sec) const override;
642 getSectionContents(DataRefImpl Sec) const override;
643
644 uint64_t getSectionAlignment(DataRefImpl Sec) const override;
645 bool isSectionCompressed(DataRefImpl Sec) const override;
646 bool isSectionText(DataRefImpl Sec) const override;
647 bool isSectionData(DataRefImpl Sec) const override;
648 bool isSectionBSS(DataRefImpl Sec) const override;
649 bool isSectionVirtual(DataRefImpl Sec) const override;
650
651 relocation_iterator section_rel_begin(DataRefImpl Sec) const override;
652 relocation_iterator section_rel_end(DataRefImpl Sec) const override;
653
654 void moveRelocationNext(DataRefImpl &Rel) const override;
655 uint64_t getRelocationOffset(DataRefImpl Rel) const override;
656 symbol_iterator getRelocationSymbol(DataRefImpl Rel) const override;
657 uint64_t getRelocationType(DataRefImpl Rel) const override;
658 void getRelocationTypeName(DataRefImpl Rel,
659 SmallVectorImpl<char> &Result) const override;
660
661 section_iterator section_begin() const override;
662 section_iterator section_end() const override;
663
664 uint8_t getBytesInAddress() const override;
665 StringRef getFileFormatName() const override;
666 Triple::ArchType getArch() const override;
668
669 void moveSymbolNext(DataRefImpl &Symb) const override {}
670 Error printSymbolName(raw_ostream &OS, DataRefImpl Symb) const override;
671 Expected<uint32_t> getSymbolFlags(DataRefImpl Symb) const override;
674 }
677 }
678 bool is64Bit() const override { return false; }
679
680 bool isRelocatableObject() const override { return false; }
681};
682
683} // namespace object
684} // namespace llvm
685
686#endif // LLVM_OBJECT_DXCONTAINER_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static StringRef getSymbolName(SymbolKind SymKind)
#define LLVM_ABI
Definition Compiler.h:213
static FeatureBitset getFeatures(MCSubtargetInfo &STI, StringRef CPU, StringRef TuneCPU, StringRef FS, ArrayRef< StringRef > ProcNames, ArrayRef< SubtargetSubTypeKV > ProcDesc, ArrayRef< SubtargetFeatureKV > ProcFeatures)
#define I(x, y, z)
Definition MD5.cpp:57
#define H(x, y, z)
Definition MD5.cpp:56
#define T
#define P(N)
This file defines the SmallVector class.
static std::unique_ptr< PDBSymbol > getSymbolType(const PDBSymbol &Symbol)
Definition UDTLayout.cpp:35
Value * RHS
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
Tagged union holding either a T or a Error.
Definition Error.h:485
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
typename SuperClass::const_iterator const_iterator
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
constexpr StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
Definition StringRef.h:591
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition Twine.h:82
LLVM_ABI std::string str() const
Return the twine contents as a std::string.
Definition Twine.cpp:17
A range adaptor for a pair of iterators.
StringRef getData() const
Definition Binary.cpp:39
basic_symbol_iterator symbol_end() const override
static bool classof(const Binary *v)
const dxbc::Header & getHeader() const
bool isRelocatableObject() const override
True if this is a relocatable object (.o/.obj).
void moveSymbolNext(DataRefImpl &Symb) const override
const DXContainer & getDXContainer() const
basic_symbol_iterator symbol_begin() const override
bool operator!=(const PartIterator &RHS) const
bool operator==(const PartIterator &RHS) const
const std::optional< DXILData > & getDXIL(bool Debug) const
PartIterator end() const
std::optional< uint64_t > getShaderFeatureFlags() const
const std::optional< DirectX::PSVRuntimeInfo > & getPSVInfo() const
std::optional< uint16_t > getShaderKind() const
const dxbc::Header & getHeader() const
const DirectX::Signature & getInputSignature() const
std::pair< dxbc::ProgramHeader, const char * > DXILData
std::optional< DirectX::RootSignature > getRootSignature() const
StringRef getData() const
const std::optional< mcdxbc::DebugName > getDebugName() const
PartIterator begin() const
static LLVM_ABI Expected< DXContainer > create(MemoryBufferRef Object)
std::optional< dxbc::ShaderHash > getShaderHash() const
const DirectX::Signature & getOutputSignature() const
const DirectX::Signature & getPatchConstantSignature() const
ArrayRef< uint8_t > getOutputVectorCounts() const
ArrayRef< uint32_t > getSemanticIndexTable() const
ViewArray< uint32_t > getInputOutputMap(size_t Idx) const
LLVM_ABI uint8_t getSigInputCount() const
ViewArray< uint32_t > getPatchOrPrimMasks() const
LLVM_ABI uint8_t getSigPatchOrPrimCount() const
ViewArray< uint32_t > getInputPatchMap() const
ViewArray< uint32_t > getOutputVectorMasks(size_t Idx) const
SigElementArray getSigPatchOrPrimElements() const
LLVM_ABI Error parse(uint16_t ShaderKind)
SigElementArray getSigInputElements() const
LLVM_ABI uint8_t getSigOutputCount() const
SigElementArray getSigOutputElements() const
const InfoStruct & getInfo() const
ViewArray< uint32_t > getPatchOutputMap() const
llvm::Expected< RootParameterView > getParameter(const dxbc::RTS0::v1::RootParameterHeader &Header) const
llvm::iterator_range< samplers_iterator > samplers() const
llvm::iterator_range< param_header_iterator > param_headers() const
ViewArray< dxbc::ProgramSignatureElement >::iterator begin() const
LLVM_ABI Error initialize(StringRef Part)
ViewArray< dxbc::ProgramSignatureElement >::iterator end() const
StringRef getName(uint32_t Offset) const
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
@ C
The default llvm calling convention, compatible with C.
Definition CallingConv.h:34
static constexpr const StringLiteral & getSectionName(DebugSectionKind SectionKind)
Return the name of the section.
LLVM_ABI_FOR_TEST bool isValidParameterType(uint32_t V)
static Error parseFailed(const Twine &Msg)
std::enable_if_t< std::is_arithmetic< T >::value, void > swapBytes(T &value)
Definition DXContainer.h:40
content_iterator< SectionRef > section_iterator
Definition ObjectFile.h:49
content_iterator< BasicSymbolRef > basic_symbol_iterator
content_iterator< RelocationRef > relocation_iterator
Definition ObjectFile.h:79
value_type read(const void *memory, endianness endian)
Read a value of a particular endianness from memory.
Definition Endian.h:60
constexpr bool IsBigEndianHost
void swapByteOrder(T &Value)
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:557
@ Debug
Register 'use' is for debugging purpose.
FunctionAddr VTableAddr uintptr_t uintptr_t DataSize
Definition InstrProf.h:299
FunctionAddr VTableAddr uintptr_t uintptr_t Version
Definition InstrProf.h:334
constexpr std::underlying_type_t< Enum > to_underlying(Enum E)
Returns underlying integer value of an enum.
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
Definition Error.h:340
Use this type to describe the size and type of a DXIL container part.
Definition DXContainer.h:99
llvm::Expected< DescriptorTable< T > > read()
static bool classof(const RootParameterView *V)
ViewArray< T >::iterator begin() const
ViewArray< T >::iterator end() const
static bool classof(const RootParameterView *V)
llvm::Expected< dxbc::RTS0::v1::RootConstants > read()
llvm::Expected< dxbc::RTS0::v2::RootDescriptor > read(uint32_t Version)
static bool classof(const RootParameterView *V)
RootParameterView(const dxbc::RTS0::v1::RootParameterHeader &H, StringRef P)
const dxbc::RTS0::v1::RootParameterHeader & Header
bool operator!=(const iterator I)
iterator(const ViewArray &A, const char *C)
Definition DXContainer.h:71
bool operator==(const iterator I)
iterator(const iterator &)=default
static constexpr uint32_t MaxStride()
Definition DXContainer.h:62
iterator end() const
ViewArray(StringRef D, size_t S)
Definition DXContainer.h:59
iterator begin() const