LLVM 24.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();
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 static_cast<size_t>(Table.NumRanges) *
214 Table.Ranges.Stride);
215 return Table;
216 }
217};
218
222
224private:
225 uint32_t Version;
226 uint32_t NumParameters;
227 uint32_t RootParametersOffset;
228 uint32_t NumStaticSamplers;
229 uint32_t StaticSamplersOffset;
230 uint32_t Flags;
232 StringRef PartData;
234
235 using param_header_iterator =
238
239public:
240 RootSignature(StringRef PD) : PartData(PD) {}
241
243 uint32_t getVersion() const { return Version; }
244 uint32_t getNumParameters() const { return NumParameters; }
245 uint32_t getRootParametersOffset() const { return RootParametersOffset; }
246 uint32_t getNumStaticSamplers() const { return NumStaticSamplers; }
247 uint32_t getStaticSamplersOffset() const { return StaticSamplersOffset; }
248 uint32_t getNumRootParameters() const { return ParametersHeaders.size(); }
250 return ParametersHeaders;
251 }
253 return StaticSamplers;
254 }
255 uint32_t getFlags() const { return Flags; }
256
259 size_t DataSize;
260 size_t EndOfSectionByte = getNumStaticSamplers() == 0
261 ? PartData.size()
263
264 if (!dxbc::isValidParameterType(Header.ParameterType))
265 return parseFailed("invalid parameter type");
266
267 switch (static_cast<dxbc::RootParameterType>(Header.ParameterType)) {
268 case dxbc::RootParameterType::Constants32Bit:
269 DataSize = sizeof(dxbc::RTS0::v1::RootConstants);
270 break;
271 case dxbc::RootParameterType::CBV:
272 case dxbc::RootParameterType::SRV:
273 case dxbc::RootParameterType::UAV:
274 if (Version == 1)
275 DataSize = sizeof(dxbc::RTS0::v1::RootDescriptor);
276 else
277 DataSize = sizeof(dxbc::RTS0::v2::RootDescriptor);
278 break;
279 case dxbc::RootParameterType::DescriptorTable:
280 if (Header.ParameterOffset + sizeof(uint32_t) > EndOfSectionByte)
281 return parseFailed("Reading structure out of file bounds");
282
283 uint32_t NumRanges =
285 PartData.begin() + Header.ParameterOffset);
286 if (Version == 1)
287 DataSize = sizeof(dxbc::RTS0::v1::DescriptorRange) * NumRanges;
288 else
289 DataSize = sizeof(dxbc::RTS0::v2::DescriptorRange) * NumRanges;
290
291 // 4 bytes for the number of ranges in table and
292 // 4 bytes for the ranges offset
293 DataSize += 2 * sizeof(uint32_t);
294 break;
295 }
296 if (Header.ParameterOffset + DataSize > EndOfSectionByte)
297 return parseFailed("Reading structure out of file bounds");
298
299 StringRef Buff = PartData.substr(Header.ParameterOffset, DataSize);
300 RootParameterView View = RootParameterView(Header, Buff);
301 return View;
302 }
303};
304
306
307 using ResourceArray = ViewArray<dxbc::PSV::v2::ResourceBindInfo>;
308 using SigElementArray = ViewArray<dxbc::PSV::v0::SignatureElement>;
309
310 StringRef Data;
311 uint32_t Size;
312 using InfoStruct =
313 std::variant<std::monostate, dxbc::PSV::v0::RuntimeInfo,
316 InfoStruct BasicInfo;
317 ResourceArray Resources;
318 StringRef StringTable;
319 SmallVector<uint32_t> SemanticIndexTable;
320 SigElementArray SigInputElements;
321 SigElementArray SigOutputElements;
322 SigElementArray SigPatchOrPrimElements;
323
324 std::array<ViewArray<uint32_t>, 4> OutputVectorMasks;
325 ViewArray<uint32_t> PatchOrPrimMasks;
326 std::array<ViewArray<uint32_t>, 4> InputOutputMap;
327 ViewArray<uint32_t> InputPatchMap;
328 ViewArray<uint32_t> PatchOutputMap;
329
330public:
331 PSVRuntimeInfo(StringRef D) : Data(D), Size(0) {}
332
333 // Parsing depends on the shader kind
334 LLVM_ABI Error parse(uint16_t ShaderKind);
335
336 uint32_t getSize() const { return Size; }
337 uint32_t getResourceCount() const { return Resources.size(); }
338 ResourceArray getResources() const { return Resources; }
339
341 return Size >= sizeof(dxbc::PSV::v3::RuntimeInfo)
342 ? 3
343 : (Size >= sizeof(dxbc::PSV::v2::RuntimeInfo) ? 2
344 : (Size >= sizeof(dxbc::PSV::v1::RuntimeInfo)) ? 1
345 : 0);
346 }
347
348 uint32_t getResourceStride() const { return Resources.Stride; }
349
350 const InfoStruct &getInfo() const { return BasicInfo; }
351
352 template <typename T> const T *getInfoAs() const {
353 if (const auto *P = std::get_if<dxbc::PSV::v3::RuntimeInfo>(&BasicInfo))
354 return static_cast<const T *>(P);
355 if (std::is_same<T, dxbc::PSV::v3::RuntimeInfo>::value)
356 return nullptr;
357
358 if (const auto *P = std::get_if<dxbc::PSV::v2::RuntimeInfo>(&BasicInfo))
359 return static_cast<const T *>(P);
360 if (std::is_same<T, dxbc::PSV::v2::RuntimeInfo>::value)
361 return nullptr;
362
363 if (const auto *P = std::get_if<dxbc::PSV::v1::RuntimeInfo>(&BasicInfo))
364 return static_cast<const T *>(P);
365 if (std::is_same<T, dxbc::PSV::v1::RuntimeInfo>::value)
366 return nullptr;
367
368 if (const auto *P = std::get_if<dxbc::PSV::v0::RuntimeInfo>(&BasicInfo))
369 return static_cast<const T *>(P);
370 return nullptr;
371 }
372
373 StringRef getStringTable() const { return StringTable; }
375 return SemanticIndexTable;
376 }
377
381
382 SigElementArray getSigInputElements() const { return SigInputElements; }
383 SigElementArray getSigOutputElements() const { return SigOutputElements; }
384 SigElementArray getSigPatchOrPrimElements() const {
385 return SigPatchOrPrimElements;
386 }
387
389 assert(Idx < 4);
390 return OutputVectorMasks[Idx];
391 }
392
393 ViewArray<uint32_t> getPatchOrPrimMasks() const { return PatchOrPrimMasks; }
394
396 assert(Idx < 4);
397 return InputOutputMap[Idx];
398 }
399
400 ViewArray<uint32_t> getInputPatchMap() const { return InputPatchMap; }
401 ViewArray<uint32_t> getPatchOutputMap() const { return PatchOutputMap; }
402
403 uint32_t getSigElementStride() const { return SigInputElements.Stride; }
404
405 bool usesViewID() const {
406 if (const auto *P = getInfoAs<dxbc::PSV::v1::RuntimeInfo>())
407 return P->UsesViewID != 0;
408 return false;
409 }
410
412 if (const auto *P = getInfoAs<dxbc::PSV::v1::RuntimeInfo>())
413 return P->SigInputVectors;
414 return 0;
415 }
416
418 if (const auto *P = getInfoAs<dxbc::PSV::v1::RuntimeInfo>())
419 return ArrayRef<uint8_t>(P->SigOutputVectors);
420 return ArrayRef<uint8_t>();
421 }
422
424 if (const auto *P = getInfoAs<dxbc::PSV::v1::RuntimeInfo>())
425 return P->GeomData.SigPatchConstOrPrimVectors;
426 return 0;
427 }
428};
429
432 uint32_t StringTableOffset;
433 StringRef StringTable;
434
435public:
437 return Parameters.begin();
438 }
439
441 return Parameters.end();
442 }
443
445 assert(Offset >= StringTableOffset &&
446 Offset < StringTableOffset + StringTable.size() &&
447 "Offset out of range.");
448 // Name offsets are from the start of the signature data, not from the start
449 // of the string table. The header encodes the start offset of the sting
450 // table, so we convert the offset here.
451 uint32_t TableOffset = Offset - StringTableOffset;
452 return StringTable.slice(TableOffset, StringTable.find('\0', TableOffset));
453 }
454
455 bool isEmpty() const { return Parameters.isEmpty(); }
456
458};
459
460} // namespace DirectX
461
462class DXContainer {
463public:
464 using DXILData = std::pair<dxbc::ProgramHeader, const char *>;
465
466private:
467 DXContainer(MemoryBufferRef O);
468
469 MemoryBufferRef Data;
470 dxbc::Header Header;
471 SmallVector<uint32_t, 4> PartOffsets;
472 std::optional<DXILData> DXIL;
473 std::optional<DXILData> DebugDXIL;
474 std::optional<uint64_t> ShaderFeatureFlags;
475 std::optional<dxbc::ShaderHash> Hash;
476 std::optional<DirectX::PSVRuntimeInfo> PSVInfo;
477 std::optional<DirectX::RootSignature> RootSignature;
478 DirectX::Signature InputSignature;
479 DirectX::Signature OutputSignature;
480 DirectX::Signature PatchConstantSignature;
481 std::optional<mcdxbc::DebugName> DebugName;
482 std::optional<mcdxbc::CompilerVersion> VersionInfo;
483 std::optional<mcdxbc::SourceInfo> SourceInfo;
484 std::optional<StringRef> PrivateData;
485
486 Error parseHeader();
487 Error parsePartOffsets();
488 Error parseDXILHeader(dxbc::PartType PT, StringRef Part);
489 Error parseDebugName(StringRef Part);
490 Error parseShaderFeatureFlags(StringRef Part);
491 Error parseHash(StringRef Part);
492 Error parseRootSignature(StringRef Part);
493 Error parsePSVInfo(StringRef Part);
494 Error parseCompilerVersionInfo(StringRef Part);
495 Error parseSourceInfo(StringRef Part);
496 Error parsePrivateData(StringRef Part);
497 friend class PartIterator;
498
499public:
500 // The PartIterator is a wrapper around the iterator for the PartOffsets
501 // member of the DXContainer. It contains a refernce to the container, and the
502 // current iterator value, as well as storage for a parsed part header.
503 class PartIterator {
504 const DXContainer &Container;
506 struct PartData {
507 dxbc::PartHeader Part;
509 StringRef Data;
510 } IteratorState;
511
512 friend class DXContainer;
514
517 : Container(C), OffsetIt(It) {
518 if (OffsetIt == Container.PartOffsets.end())
519 updateIteratorImpl(Container.PartOffsets.back());
520 else
521 updateIterator();
522 }
523
524 // Updates the iterator's state data. This results in copying the part
525 // header into the iterator and handling any required byte swapping. This is
526 // called when incrementing or decrementing the iterator.
527 void updateIterator() {
528 if (OffsetIt != Container.PartOffsets.end())
529 updateIteratorImpl(*OffsetIt);
530 }
531
532 // Implementation for updating the iterator state based on a specified
533 // offest.
534 LLVM_ABI void updateIteratorImpl(const uint32_t Offset);
535
536 public:
537 PartIterator &operator++() {
538 if (OffsetIt == Container.PartOffsets.end())
539 return *this;
540 ++OffsetIt;
541 updateIterator();
542 return *this;
543 }
544
545 PartIterator operator++(int) {
546 PartIterator Tmp = *this;
547 ++(*this);
548 return Tmp;
549 }
550
551 bool operator==(const PartIterator &RHS) const {
552 return OffsetIt == RHS.OffsetIt;
553 }
554
555 bool operator!=(const PartIterator &RHS) const {
556 return OffsetIt != RHS.OffsetIt;
557 }
558
559 const PartData &operator*() { return IteratorState; }
560 const PartData *operator->() { return &IteratorState; }
561 };
562
564 return PartIterator(*this, PartOffsets.begin());
565 }
566
567 PartIterator end() const { return PartIterator(*this, PartOffsets.end()); }
568
569 StringRef getData() const { return Data.getBuffer(); }
571
572 const dxbc::Header &getHeader() const { return Header; }
573
574 const std::optional<DXILData> &getDXIL(bool Debug) const {
575 return Debug ? DebugDXIL : DXIL;
576 }
577
578 std::optional<uint16_t> getShaderKind() const {
579 const auto &ProgramPart = DXIL ? DXIL : DebugDXIL;
580 if (!ProgramPart)
581 return std::nullopt;
582 return ProgramPart->first.ShaderKind;
583 }
584
585 const std::optional<mcdxbc::DebugName> getDebugName() const {
586 return DebugName;
587 }
588
589 std::optional<uint64_t> getShaderFeatureFlags() const {
590 return ShaderFeatureFlags;
591 }
592
593 std::optional<dxbc::ShaderHash> getShaderHash() const { return Hash; }
594
595 std::optional<DirectX::RootSignature> getRootSignature() const {
596 return RootSignature;
597 }
598
599 const std::optional<DirectX::PSVRuntimeInfo> &getPSVInfo() const {
600 return PSVInfo;
601 };
602
603 const DirectX::Signature &getInputSignature() const { return InputSignature; }
605 return OutputSignature;
606 }
608 return PatchConstantSignature;
609 }
610
611 const std::optional<mcdxbc::CompilerVersion> &getCompilerVersionInfo() const {
612 return VersionInfo;
613 }
614
615 const std::optional<mcdxbc::SourceInfo> &getSourceInfo() const {
616 return SourceInfo;
617 }
618
619 const std::optional<StringRef> &getPrivateData() const { return PrivateData; }
620};
621
622class LLVM_ABI DXContainerObjectFile : public ObjectFile {
623private:
624 friend class ObjectFile;
625 DXContainer Container;
626
627 using PartData = DXContainer::PartIterator::PartData;
629 using PartIterator = llvm::SmallVector<PartData>::iterator;
630
631 DXContainerObjectFile(DXContainer C)
633 Container(C) {
634 for (auto &P : C)
635 Parts.push_back(P);
636 }
637
638public:
639 const DXContainer &getDXContainer() const { return Container; }
640
641 static bool classof(const Binary *v) { return v->isDXContainer(); }
642
643 const dxbc::Header &getHeader() const { return Container.getHeader(); }
644
645 Expected<StringRef> getSymbolName(DataRefImpl) const override;
646 Expected<uint64_t> getSymbolAddress(DataRefImpl Symb) const override;
647 uint64_t getSymbolValueImpl(DataRefImpl Symb) const override;
648 uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const override;
649
651 Expected<section_iterator> getSymbolSection(DataRefImpl Symb) const override;
652 void moveSectionNext(DataRefImpl &Sec) const override;
654 uint64_t getSectionAddress(DataRefImpl Sec) const override;
655 uint64_t getSectionIndex(DataRefImpl Sec) const override;
656 uint64_t getSectionSize(DataRefImpl Sec) const override;
658 getSectionContents(DataRefImpl Sec) const override;
659
660 uint64_t getSectionAlignment(DataRefImpl Sec) const override;
661 bool isSectionCompressed(DataRefImpl Sec) const override;
662 bool isSectionText(DataRefImpl Sec) const override;
663 bool isSectionData(DataRefImpl Sec) const override;
664 bool isSectionBSS(DataRefImpl Sec) const override;
665 bool isSectionVirtual(DataRefImpl Sec) const override;
666
667 relocation_iterator section_rel_begin(DataRefImpl Sec) const override;
668 relocation_iterator section_rel_end(DataRefImpl Sec) const override;
669
670 void moveRelocationNext(DataRefImpl &Rel) const override;
671 uint64_t getRelocationOffset(DataRefImpl Rel) const override;
672 symbol_iterator getRelocationSymbol(DataRefImpl Rel) const override;
673 uint64_t getRelocationType(DataRefImpl Rel) const override;
674 void getRelocationTypeName(DataRefImpl Rel,
675 SmallVectorImpl<char> &Result) const override;
676
677 section_iterator section_begin() const override;
678 section_iterator section_end() const override;
679
680 uint8_t getBytesInAddress() const override;
681 StringRef getFileFormatName() const override;
682 Triple::ArchType getArch() const override;
684
685 void moveSymbolNext(DataRefImpl &Symb) const override {}
686 Error printSymbolName(raw_ostream &OS, DataRefImpl Symb) const override;
687 Expected<uint32_t> getSymbolFlags(DataRefImpl Symb) const override;
690 }
693 }
694 bool is64Bit() const override { return false; }
695
696 bool isRelocatableObject() const override { return false; }
697};
698
699} // namespace object
700} // namespace llvm
701
702#endif // LLVM_OBJECT_DXCONTAINER_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
unsigned uint64_t
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
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")
#define LLVM_ABI
Definition Compiler.h:215
static FeatureBitset getFeatures(MCSubtargetInfo &STI, StringRef CPU, StringRef TuneCPU, StringRef FS, StringTable 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)
const char * Msg
This file defines the SmallVector class.
static std::unique_ptr< PDBSymbol > getSymbolType(const PDBSymbol &Symbol)
Definition UDTLayout.cpp:34
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:597
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition Twine.h:82
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
const std::optional< mcdxbc::SourceInfo > & getSourceInfo() const
const std::optional< mcdxbc::CompilerVersion > & getCompilerVersionInfo() 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)
const std::optional< StringRef > & getPrivateData() const
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
static constexpr const StringLiteral & getSectionName(DebugSectionKind SectionKind)
Return the name of the section.
LLVM_ABI 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:53
constexpr bool IsBigEndianHost
void swapByteOrder(T &Value)
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:577
@ Debug
Register 'use' is for debugging purpose.
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.
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