LLVM 22.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"
22#include "llvm/Object/Error.h"
25#include "llvm/Support/Endian.h"
26#include "llvm/Support/Error.h"
29#include <array>
30#include <cstddef>
31#include <cstdint>
32#include <variant>
33
34namespace llvm {
35namespace object {
36
37namespace detail {
38template <typename T>
39std::enable_if_t<std::is_arithmetic<T>::value, void> swapBytes(T &value) {
41}
42
43template <typename T>
44std::enable_if_t<std::is_class<T>::value, void> swapBytes(T &value) {
45 value.swapBytes();
46}
47} // namespace detail
48
49// This class provides a view into the underlying resource array. The Resource
50// data is little-endian encoded and may not be properly aligned to read
51// directly from. The dereference operator creates a copy of the data and byte
52// swaps it as appropriate.
53template <typename T> struct ViewArray {
55 uint32_t Stride = sizeof(T); // size of each element in the list.
56
57 ViewArray() = default;
58 ViewArray(StringRef D, size_t S) : Data(D), Stride(S) {}
59
60 using value_type = T;
61 static constexpr uint32_t MaxStride() {
62 return static_cast<uint32_t>(sizeof(value_type));
63 }
64
65 struct iterator {
67 uint32_t Stride; // size of each element in the list.
68 const char *Current;
69
70 iterator(const ViewArray &A, const char *C)
71 : Data(A.Data), Stride(A.Stride), Current(C) {}
72 iterator(const iterator &) = default;
73
75 // Explicitly zero the structure so that unused fields are zeroed. It is
76 // up to the user to know if the fields are used by verifying the PSV
77 // version.
78 value_type Val;
79 std::memset(&Val, 0, sizeof(value_type));
80 if (Current >= Data.end())
81 return Val;
82 memcpy(static_cast<void *>(&Val), Current, std::min(Stride, MaxStride()));
85 return Val;
86 }
87
89 if (Current < Data.end())
90 Current += Stride;
91 return *this;
92 }
93
95 iterator Tmp = *this;
96 ++*this;
97 return Tmp;
98 }
99
101 if (Current > Data.begin())
102 Current -= Stride;
103 return *this;
104 }
105
107 iterator Tmp = *this;
108 --*this;
109 return Tmp;
110 }
111
112 bool operator==(const iterator I) { return I.Current == Current; }
113 bool operator!=(const iterator I) { return !(*this == I); }
114 };
115
116 iterator begin() const { return iterator(*this, Data.begin()); }
117
118 iterator end() const { return iterator(*this, Data.end()); }
119
120 size_t size() const { return Data.size() / Stride; }
121
122 bool isEmpty() const { return Data.empty(); }
123};
124
125namespace DirectX {
129
131 : Header(H), ParamData(P) {}
132
133 template <typename T> Expected<T> readParameter() {
134 T Struct;
135 if (sizeof(T) != ParamData.size())
136 return make_error<GenericBinaryError>(
137 "Reading structure out of file bounds", object_error::parse_failed);
138
139 memcpy(&Struct, ParamData.data(), sizeof(T));
140 // DXContainer is always little endian
142 Struct.swapBytes();
143 return Struct;
144 }
145};
146
148 static bool classof(const RootParameterView *V) {
149 return V->Header.ParameterType ==
150 (uint32_t)dxbc::RootParameterType::Constants32Bit;
151 }
152
154 return readParameter<dxbc::RTS0::v1::RootConstants>();
155 }
156};
157
159 static bool classof(const RootParameterView *V) {
160 return (V->Header.ParameterType ==
161 llvm::to_underlying(dxbc::RootParameterType::CBV) ||
162 V->Header.ParameterType ==
163 llvm::to_underlying(dxbc::RootParameterType::SRV) ||
164 V->Header.ParameterType ==
165 llvm::to_underlying(dxbc::RootParameterType::UAV));
166 }
167
169 if (Version == 1) {
170 auto Descriptor = readParameter<dxbc::RTS0::v1::RootDescriptor>();
171 if (Error E = Descriptor.takeError())
172 return E;
173 return dxbc::RTS0::v2::RootDescriptor(*Descriptor);
174 }
175 if (Version != 2)
176 return make_error<GenericBinaryError>("Invalid Root Signature version: " +
177 Twine(Version),
179 return readParameter<dxbc::RTS0::v2::RootDescriptor>();
180 }
181};
182template <typename T> struct DescriptorTable {
186
187 typename ViewArray<T>::iterator begin() const { return Ranges.begin(); }
188
189 typename ViewArray<T>::iterator end() const { return Ranges.end(); }
190};
191
193 static bool classof(const RootParameterView *V) {
194 return (V->Header.ParameterType ==
195 llvm::to_underlying(dxbc::RootParameterType::DescriptorTable));
196 }
197
198 // Define a type alias to access the template parameter from inside classof
199 template <typename T> llvm::Expected<DescriptorTable<T>> read() {
200 const char *Current = ParamData.begin();
201 DescriptorTable<T> Table;
202
203 Table.NumRanges =
204 support::endian::read<uint32_t, llvm::endianness::little>(Current);
205 Current += sizeof(uint32_t);
206
207 Table.RangesOffset =
208 support::endian::read<uint32_t, llvm::endianness::little>(Current);
209 Current += sizeof(uint32_t);
210
211 Table.Ranges.Data = ParamData.substr(2 * sizeof(uint32_t),
212 Table.NumRanges * Table.Ranges.Stride);
213 return Table;
214 }
215};
216
217static Error parseFailed(const Twine &Msg) {
218 return make_error<GenericBinaryError>(Msg.str(), object_error::parse_failed);
219}
220
222private:
223 uint32_t Version;
224 uint32_t NumParameters;
225 uint32_t RootParametersOffset;
226 uint32_t NumStaticSamplers;
227 uint32_t StaticSamplersOffset;
228 uint32_t Flags;
230 StringRef PartData;
232
236
237public:
238 RootSignature(StringRef PD) : PartData(PD) {}
239
241 uint32_t getVersion() const { return Version; }
242 uint32_t getNumParameters() const { return NumParameters; }
243 uint32_t getRootParametersOffset() const { return RootParametersOffset; }
244 uint32_t getNumStaticSamplers() const { return NumStaticSamplers; }
245 uint32_t getStaticSamplersOffset() const { return StaticSamplersOffset; }
246 uint32_t getNumRootParameters() const { return ParametersHeaders.size(); }
248 return llvm::make_range(ParametersHeaders.begin(), ParametersHeaders.end());
249 }
251 return llvm::make_range(StaticSamplers.begin(), StaticSamplers.end());
252 }
253 uint32_t getFlags() const { return Flags; }
254
257 size_t DataSize;
258 size_t EndOfSectionByte = getNumStaticSamplers() == 0
259 ? PartData.size()
261
262 if (!dxbc::isValidParameterType(Header.ParameterType))
263 return parseFailed("invalid parameter type");
264
265 switch (static_cast<dxbc::RootParameterType>(Header.ParameterType)) {
266 case dxbc::RootParameterType::Constants32Bit:
267 DataSize = sizeof(dxbc::RTS0::v1::RootConstants);
268 break;
269 case dxbc::RootParameterType::CBV:
270 case dxbc::RootParameterType::SRV:
271 case dxbc::RootParameterType::UAV:
272 if (Version == 1)
273 DataSize = sizeof(dxbc::RTS0::v1::RootDescriptor);
274 else
275 DataSize = sizeof(dxbc::RTS0::v2::RootDescriptor);
276 break;
277 case dxbc::RootParameterType::DescriptorTable:
278 if (Header.ParameterOffset + sizeof(uint32_t) > EndOfSectionByte)
279 return parseFailed("Reading structure out of file bounds");
280
281 uint32_t NumRanges =
282 support::endian::read<uint32_t, llvm::endianness::little>(
283 PartData.begin() + Header.ParameterOffset);
284 if (Version == 1)
285 DataSize = sizeof(dxbc::RTS0::v1::DescriptorRange) * NumRanges;
286 else
287 DataSize = sizeof(dxbc::RTS0::v2::DescriptorRange) * NumRanges;
288
289 // 4 bytes for the number of ranges in table and
290 // 4 bytes for the ranges offset
291 DataSize += 2 * sizeof(uint32_t);
292 break;
293 }
294 if (Header.ParameterOffset + DataSize > EndOfSectionByte)
295 return parseFailed("Reading structure out of file bounds");
296
297 StringRef Buff = PartData.substr(Header.ParameterOffset, DataSize);
298 RootParameterView View = RootParameterView(Header, Buff);
299 return View;
300 }
301};
302
304
307
308 StringRef Data;
309 uint32_t Size;
310 using InfoStruct =
311 std::variant<std::monostate, dxbc::PSV::v0::RuntimeInfo,
314 InfoStruct BasicInfo;
315 ResourceArray Resources;
317 SmallVector<uint32_t> SemanticIndexTable;
318 SigElementArray SigInputElements;
319 SigElementArray SigOutputElements;
320 SigElementArray SigPatchOrPrimElements;
321
322 std::array<ViewArray<uint32_t>, 4> OutputVectorMasks;
323 ViewArray<uint32_t> PatchOrPrimMasks;
324 std::array<ViewArray<uint32_t>, 4> InputOutputMap;
325 ViewArray<uint32_t> InputPatchMap;
326 ViewArray<uint32_t> PatchOutputMap;
327
328public:
329 PSVRuntimeInfo(StringRef D) : Data(D), Size(0) {}
330
331 // Parsing depends on the shader kind
332 LLVM_ABI Error parse(uint16_t ShaderKind);
333
334 uint32_t getSize() const { return Size; }
335 uint32_t getResourceCount() const { return Resources.size(); }
336 ResourceArray getResources() const { return Resources; }
337
339 return Size >= sizeof(dxbc::PSV::v3::RuntimeInfo)
340 ? 3
341 : (Size >= sizeof(dxbc::PSV::v2::RuntimeInfo) ? 2
342 : (Size >= sizeof(dxbc::PSV::v1::RuntimeInfo)) ? 1
343 : 0);
344 }
345
346 uint32_t getResourceStride() const { return Resources.Stride; }
347
348 const InfoStruct &getInfo() const { return BasicInfo; }
349
350 template <typename T> const T *getInfoAs() const {
351 if (const auto *P = std::get_if<dxbc::PSV::v3::RuntimeInfo>(&BasicInfo))
352 return static_cast<const T *>(P);
353 if (std::is_same<T, dxbc::PSV::v3::RuntimeInfo>::value)
354 return nullptr;
355
356 if (const auto *P = std::get_if<dxbc::PSV::v2::RuntimeInfo>(&BasicInfo))
357 return static_cast<const T *>(P);
358 if (std::is_same<T, dxbc::PSV::v2::RuntimeInfo>::value)
359 return nullptr;
360
361 if (const auto *P = std::get_if<dxbc::PSV::v1::RuntimeInfo>(&BasicInfo))
362 return static_cast<const T *>(P);
363 if (std::is_same<T, dxbc::PSV::v1::RuntimeInfo>::value)
364 return nullptr;
365
366 if (const auto *P = std::get_if<dxbc::PSV::v0::RuntimeInfo>(&BasicInfo))
367 return static_cast<const T *>(P);
368 return nullptr;
369 }
370
373 return SemanticIndexTable;
374 }
375
379
380 SigElementArray getSigInputElements() const { return SigInputElements; }
381 SigElementArray getSigOutputElements() const { return SigOutputElements; }
383 return SigPatchOrPrimElements;
384 }
385
387 assert(Idx < 4);
388 return OutputVectorMasks[Idx];
389 }
390
391 ViewArray<uint32_t> getPatchOrPrimMasks() const { return PatchOrPrimMasks; }
392
394 assert(Idx < 4);
395 return InputOutputMap[Idx];
396 }
397
398 ViewArray<uint32_t> getInputPatchMap() const { return InputPatchMap; }
399 ViewArray<uint32_t> getPatchOutputMap() const { return PatchOutputMap; }
400
401 uint32_t getSigElementStride() const { return SigInputElements.Stride; }
402
403 bool usesViewID() const {
404 if (const auto *P = getInfoAs<dxbc::PSV::v1::RuntimeInfo>())
405 return P->UsesViewID != 0;
406 return false;
407 }
408
410 if (const auto *P = getInfoAs<dxbc::PSV::v1::RuntimeInfo>())
411 return P->SigInputVectors;
412 return 0;
413 }
414
416 if (const auto *P = getInfoAs<dxbc::PSV::v1::RuntimeInfo>())
417 return ArrayRef<uint8_t>(P->SigOutputVectors);
418 return ArrayRef<uint8_t>();
419 }
420
422 if (const auto *P = getInfoAs<dxbc::PSV::v1::RuntimeInfo>())
423 return P->GeomData.SigPatchConstOrPrimVectors;
424 return 0;
425 }
426};
427
432
433public:
435 return Parameters.begin();
436 }
437
439 return Parameters.end();
440 }
441
445 "Offset out of range.");
446 // Name offsets are from the start of the signature data, not from the start
447 // of the string table. The header encodes the start offset of the sting
448 // table, so we convert the offset here.
449 uint32_t TableOffset = Offset - StringTableOffset;
450 return StringTable.slice(TableOffset, StringTable.find('\0', TableOffset));
451 }
452
453 bool isEmpty() const { return Parameters.isEmpty(); }
454
456};
457
458} // namespace DirectX
459
461public:
462 using DXILData = std::pair<dxbc::ProgramHeader, const char *>;
463
464private:
466
467 MemoryBufferRef Data;
468 dxbc::Header Header;
469 SmallVector<uint32_t, 4> PartOffsets;
470 std::optional<DXILData> DXIL;
471 std::optional<uint64_t> ShaderFeatureFlags;
472 std::optional<dxbc::ShaderHash> Hash;
473 std::optional<DirectX::PSVRuntimeInfo> PSVInfo;
474 std::optional<DirectX::RootSignature> RootSignature;
475 DirectX::Signature InputSignature;
476 DirectX::Signature OutputSignature;
477 DirectX::Signature PatchConstantSignature;
478
479 Error parseHeader();
480 Error parsePartOffsets();
481 Error parseDXILHeader(StringRef Part);
482 Error parseShaderFeatureFlags(StringRef Part);
483 Error parseHash(StringRef Part);
484 Error parseRootSignature(StringRef Part);
485 Error parsePSVInfo(StringRef Part);
486 Error parseSignature(StringRef Part, DirectX::Signature &Array);
487 friend class PartIterator;
488
489public:
490 // The PartIterator is a wrapper around the iterator for the PartOffsets
491 // member of the DXContainer. It contains a refernce to the container, and the
492 // current iterator value, as well as storage for a parsed part header.
494 const DXContainer &Container;
496 struct PartData {
497 dxbc::PartHeader Part;
498 uint32_t Offset;
499 StringRef Data;
500 } IteratorState;
501
502 friend class DXContainer;
504
507 : Container(C), OffsetIt(It) {
508 if (OffsetIt == Container.PartOffsets.end())
509 updateIteratorImpl(Container.PartOffsets.back());
510 else
511 updateIterator();
512 }
513
514 // Updates the iterator's state data. This results in copying the part
515 // header into the iterator and handling any required byte swapping. This is
516 // called when incrementing or decrementing the iterator.
517 void updateIterator() {
518 if (OffsetIt != Container.PartOffsets.end())
519 updateIteratorImpl(*OffsetIt);
520 }
521
522 // Implementation for updating the iterator state based on a specified
523 // offest.
524 LLVM_ABI void updateIteratorImpl(const uint32_t Offset);
525
526 public:
528 if (OffsetIt == Container.PartOffsets.end())
529 return *this;
530 ++OffsetIt;
531 updateIterator();
532 return *this;
533 }
534
536 PartIterator Tmp = *this;
537 ++(*this);
538 return Tmp;
539 }
540
541 bool operator==(const PartIterator &RHS) const {
542 return OffsetIt == RHS.OffsetIt;
543 }
544
545 bool operator!=(const PartIterator &RHS) const {
546 return OffsetIt != RHS.OffsetIt;
547 }
548
549 const PartData &operator*() { return IteratorState; }
550 const PartData *operator->() { return &IteratorState; }
551 };
552
554 return PartIterator(*this, PartOffsets.begin());
555 }
556
557 PartIterator end() const { return PartIterator(*this, PartOffsets.end()); }
558
559 StringRef getData() const { return Data.getBuffer(); }
561
562 const dxbc::Header &getHeader() const { return Header; }
563
564 const std::optional<DXILData> &getDXIL() const { return DXIL; }
565
566 std::optional<uint64_t> getShaderFeatureFlags() const {
567 return ShaderFeatureFlags;
568 }
569
570 std::optional<dxbc::ShaderHash> getShaderHash() const { return Hash; }
571
572 std::optional<DirectX::RootSignature> getRootSignature() const {
573 return RootSignature;
574 }
575
576 const std::optional<DirectX::PSVRuntimeInfo> &getPSVInfo() const {
577 return PSVInfo;
578 };
579
580 const DirectX::Signature &getInputSignature() const { return InputSignature; }
582 return OutputSignature;
583 }
585 return PatchConstantSignature;
586 }
587};
588
590private:
591 friend class ObjectFile;
592 DXContainer Container;
593
594 using PartData = DXContainer::PartIterator::PartData;
597
599 : ObjectFile(ID_DXContainer, MemoryBufferRef(C.getData(), "")),
600 Container(C) {
601 for (auto &P : C)
602 Parts.push_back(P);
603 }
604
605public:
606 const DXContainer &getDXContainer() const { return Container; }
607
608 static bool classof(const Binary *v) { return v->isDXContainer(); }
609
610 const dxbc::Header &getHeader() const { return Container.getHeader(); }
611
613 Expected<uint64_t> getSymbolAddress(DataRefImpl Symb) const override;
614 uint64_t getSymbolValueImpl(DataRefImpl Symb) const override;
615 uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const override;
616
618 Expected<section_iterator> getSymbolSection(DataRefImpl Symb) const override;
619 void moveSectionNext(DataRefImpl &Sec) const override;
620 Expected<StringRef> getSectionName(DataRefImpl Sec) const override;
621 uint64_t getSectionAddress(DataRefImpl Sec) const override;
622 uint64_t getSectionIndex(DataRefImpl Sec) const override;
623 uint64_t getSectionSize(DataRefImpl Sec) const override;
625 getSectionContents(DataRefImpl Sec) const override;
626
627 uint64_t getSectionAlignment(DataRefImpl Sec) const override;
628 bool isSectionCompressed(DataRefImpl Sec) const override;
629 bool isSectionText(DataRefImpl Sec) const override;
630 bool isSectionData(DataRefImpl Sec) const override;
631 bool isSectionBSS(DataRefImpl Sec) const override;
632 bool isSectionVirtual(DataRefImpl Sec) const override;
633
634 relocation_iterator section_rel_begin(DataRefImpl Sec) const override;
635 relocation_iterator section_rel_end(DataRefImpl Sec) const override;
636
637 void moveRelocationNext(DataRefImpl &Rel) const override;
638 uint64_t getRelocationOffset(DataRefImpl Rel) const override;
639 symbol_iterator getRelocationSymbol(DataRefImpl Rel) const override;
640 uint64_t getRelocationType(DataRefImpl Rel) const override;
641 void getRelocationTypeName(DataRefImpl Rel,
642 SmallVectorImpl<char> &Result) const override;
643
644 section_iterator section_begin() const override;
645 section_iterator section_end() const override;
646
647 uint8_t getBytesInAddress() const override;
648 StringRef getFileFormatName() const override;
649 Triple::ArchType getArch() const override;
651
652 void moveSymbolNext(DataRefImpl &Symb) const override {}
653 Error printSymbolName(raw_ostream &OS, DataRefImpl Symb) const override;
654 Expected<uint32_t> getSymbolFlags(DataRefImpl Symb) const override;
657 }
660 }
661 bool is64Bit() const override { return false; }
662
663 bool isRelocatableObject() const override { return false; }
664};
665
666} // namespace object
667} // namespace llvm
668
669#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< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
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
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
Given that RA is a live value
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:58
#define H(x, y, z)
Definition: MD5.cpp:57
#define T
#define P(N)
raw_pwrite_stream & OS
This file defines the SmallVector class.
@ Struct
static std::unique_ptr< PDBSymbol > getSymbolType(const PDBSymbol &Symbol)
Definition: UDTLayout.cpp:35
Value * RHS
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
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...
Definition: SmallVector.h:574
typename SuperClass::const_iterator const_iterator
Definition: SmallVector.h:579
void push_back(const T &Elt)
Definition: SmallVector.h:414
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1197
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:55
constexpr StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
Definition: StringRef.h:581
constexpr bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:151
iterator begin() const
Definition: StringRef.h:120
constexpr size_t size() const
size - Get the string size.
Definition: StringRef.h:154
constexpr const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Definition: StringRef.h:148
iterator end() const
Definition: StringRef.h:122
A table of densely packed, null-terminated strings indexed by offset.
Definition: StringTable.h:33
constexpr size_t size() const
Returns the byte size of the table.
Definition: StringTable.h:101
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.
basic_symbol_iterator symbol_end() const override
Definition: DXContainer.h:658
static bool classof(const Binary *v)
Definition: DXContainer.h:608
const dxbc::Header & getHeader() const
Definition: DXContainer.h:610
bool isRelocatableObject() const override
True if this is a relocatable object (.o/.obj).
Definition: DXContainer.h:663
void moveSymbolNext(DataRefImpl &Symb) const override
Definition: DXContainer.h:652
const DXContainer & getDXContainer() const
Definition: DXContainer.h:606
bool is64Bit() const override
Definition: DXContainer.h:661
basic_symbol_iterator symbol_begin() const override
Definition: DXContainer.h:655
bool operator!=(const PartIterator &RHS) const
Definition: DXContainer.h:545
bool operator==(const PartIterator &RHS) const
Definition: DXContainer.h:541
PartIterator end() const
Definition: DXContainer.h:557
std::optional< uint64_t > getShaderFeatureFlags() const
Definition: DXContainer.h:566
const std::optional< DXILData > & getDXIL() const
Definition: DXContainer.h:564
const std::optional< DirectX::PSVRuntimeInfo > & getPSVInfo() const
Definition: DXContainer.h:576
const dxbc::Header & getHeader() const
Definition: DXContainer.h:562
const DirectX::Signature & getInputSignature() const
Definition: DXContainer.h:580
std::pair< dxbc::ProgramHeader, const char * > DXILData
Definition: DXContainer.h:462
std::optional< DirectX::RootSignature > getRootSignature() const
Definition: DXContainer.h:572
StringRef getData() const
Definition: DXContainer.h:559
PartIterator begin() const
Definition: DXContainer.h:553
static LLVM_ABI Expected< DXContainer > create(MemoryBufferRef Object)
std::optional< dxbc::ShaderHash > getShaderHash() const
Definition: DXContainer.h:570
const DirectX::Signature & getOutputSignature() const
Definition: DXContainer.h:581
const DirectX::Signature & getPatchConstantSignature() const
Definition: DXContainer.h:584
ArrayRef< uint8_t > getOutputVectorCounts() const
Definition: DXContainer.h:415
ArrayRef< uint32_t > getSemanticIndexTable() const
Definition: DXContainer.h:372
ResourceArray getResources() const
Definition: DXContainer.h:336
ViewArray< uint32_t > getInputOutputMap(size_t Idx) const
Definition: DXContainer.h:393
uint8_t getPatchConstOrPrimVectorCount() const
Definition: DXContainer.h:421
LLVM_ABI uint8_t getSigInputCount() const
ViewArray< uint32_t > getPatchOrPrimMasks() const
Definition: DXContainer.h:391
LLVM_ABI uint8_t getSigPatchOrPrimCount() const
ViewArray< uint32_t > getInputPatchMap() const
Definition: DXContainer.h:398
ViewArray< uint32_t > getOutputVectorMasks(size_t Idx) const
Definition: DXContainer.h:386
SigElementArray getSigPatchOrPrimElements() const
Definition: DXContainer.h:382
SigElementArray getSigInputElements() const
Definition: DXContainer.h:380
LLVM_ABI uint8_t getSigOutputCount() const
SigElementArray getSigOutputElements() const
Definition: DXContainer.h:381
const InfoStruct & getInfo() const
Definition: DXContainer.h:348
ViewArray< uint32_t > getPatchOutputMap() const
Definition: DXContainer.h:399
llvm::Expected< RootParameterView > getParameter(const dxbc::RTS0::v1::RootParameterHeader &Header) const
Definition: DXContainer.h:256
llvm::iterator_range< samplers_iterator > samplers() const
Definition: DXContainer.h:250
uint32_t getStaticSamplersOffset() const
Definition: DXContainer.h:245
uint32_t getRootParametersOffset() const
Definition: DXContainer.h:243
llvm::iterator_range< param_header_iterator > param_headers() const
Definition: DXContainer.h:247
ViewArray< dxbc::ProgramSignatureElement >::iterator begin() const
Definition: DXContainer.h:434
LLVM_ABI Error initialize(StringRef Part)
ViewArray< dxbc::ProgramSignatureElement >::iterator end() const
Definition: DXContainer.h:438
StringRef getName(uint32_t Offset) const
Definition: DXContainer.h:442
This class is the base class for all object file types.
Definition: ObjectFile.h:231
This is a value type class that represents a single symbol in the list of symbols in the object file.
Definition: ObjectFile.h:170
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
bool isValidParameterType(uint32_t V)
Definition: DXContainer.h:205
static Error parseFailed(const Twine &Msg)
Definition: DXContainer.h:217
std::enable_if_t< std::is_arithmetic< T >::value, void > swapBytes(T &value)
Definition: DXContainer.h:39
constexpr bool IsBigEndianHost
Definition: SwapByteOrder.h:26
void swapByteOrder(T &Value)
Definition: SwapByteOrder.h:61
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Offset
Definition: DWP.cpp:477
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
constexpr std::underlying_type_t< Enum > to_underlying(Enum E)
Returns underlying integer value of an enum.
Use this type to describe the size and type of a DXIL container part.
Definition: DXContainer.h:99
llvm::Expected< DescriptorTable< T > > read()
Definition: DXContainer.h:199
static bool classof(const RootParameterView *V)
Definition: DXContainer.h:193
ViewArray< T >::iterator begin() const
Definition: DXContainer.h:187
ViewArray< T >::iterator end() const
Definition: DXContainer.h:189
static bool classof(const RootParameterView *V)
Definition: DXContainer.h:148
llvm::Expected< dxbc::RTS0::v1::RootConstants > read()
Definition: DXContainer.h:153
llvm::Expected< dxbc::RTS0::v2::RootDescriptor > read(uint32_t Version)
Definition: DXContainer.h:168
static bool classof(const RootParameterView *V)
Definition: DXContainer.h:159
RootParameterView(const dxbc::RTS0::v1::RootParameterHeader &H, StringRef P)
Definition: DXContainer.h:130
const dxbc::RTS0::v1::RootParameterHeader & Header
Definition: DXContainer.h:127
bool operator!=(const iterator I)
Definition: DXContainer.h:113
iterator(const ViewArray &A, const char *C)
Definition: DXContainer.h:70
bool operator==(const iterator I)
Definition: DXContainer.h:112
iterator(const iterator &)=default
static constexpr uint32_t MaxStride()
Definition: DXContainer.h:61
iterator end() const
Definition: DXContainer.h:118
ViewArray(StringRef D, size_t S)
Definition: DXContainer.h:58
size_t size() const
Definition: DXContainer.h:120
iterator begin() const
Definition: DXContainer.h:116
Definition: regcomp.c:186