26 return !Src ||
Size >
static_cast<size_t>(Buffer.
end() - Src);
29template <
typename T,
bool FixEndianness = true>
33 return parseFailed(
"Reading structure out of file bounds");
35 memcpy(&Struct, Src,
sizeof(
T));
37 if constexpr (FixEndianness)
45 Twine Str =
"structure") {
46 static_assert(std::is_integral_v<T>,
47 "Cannot call readInteger on non-integral type.");
55 if (
reinterpret_cast<uintptr_t
>(Src) %
alignof(
T) != 0)
56 memcpy(
reinterpret_cast<char *
>(&Val), Src,
sizeof(
T));
58 Val = *
reinterpret_cast<const T *
>(Src);
74 Buffer = Buffer.
substr(Src - Buffer.
data(), MaxSize);
86Error DXContainer::parseHeader() {
87 if (
Error Err =
readStruct(Data.getBuffer(), Data.getBuffer().data(), Header))
89 if (StringRef(
reinterpret_cast<char *
>(Header.Magic), 4) !=
"DXBC")
96 std::optional<DXILData> &DXIL = IsDebug ? this->DebugDXIL : this->DXIL;
101 const char *Current = Part.
begin();
102 dxbc::ProgramHeader Header;
105 Current +=
offsetof(dxbc::ProgramHeader,
Bitcode) + Header.Bitcode.Offset;
106 DXIL.emplace(std::make_pair(Header, Current));
110Error DXContainer::parseDebugName(StringRef Part) {
112 return parseFailed(
"more than one ILDN part is present in the file");
113 const char *Current = Part.
begin();
114 dxbc::DebugNameHeader Header;
117 Current +=
sizeof(Header);
123 if (
Name.size() != Header.NameLength)
124 return parseFailed(
"debug file name length mismatch");
125 DebugName.emplace(Header,
Name.data());
130Error DXContainer::parseShaderFeatureFlags(StringRef Part) {
131 if (ShaderFeatureFlags)
132 return parseFailed(
"More than one SFI0 part is present in the file");
133 uint64_t FlagValue = 0;
136 ShaderFeatureFlags = FlagValue;
140Error DXContainer::parseHash(StringRef Part) {
142 return parseFailed(
"More than one HASH part is present in the file");
143 dxbc::ShaderHash ReadHash;
150Error DXContainer::parseRootSignature(StringRef Part) {
152 return parseFailed(
"More than one RTS0 part is present in the file");
153 RootSignature = DirectX::RootSignature(Part);
154 if (
Error Err = RootSignature->parse())
159Error DXContainer::parsePSVInfo(StringRef Part) {
161 return parseFailed(
"More than one PSV0 part is present in the file");
162 PSVInfo = DirectX::PSVRuntimeInfo(Part);
175 return parseFailed(
"Signature parameters extend beyond the part boundary");
182 for (
const auto &Param : Parameters) {
183 if (Param.NameOffset < StringTableOffset)
184 return parseFailed(
"Invalid parameter name offset: name starts before "
185 "the first name offset");
186 if (Param.NameOffset - StringTableOffset > StringTable.size())
187 return parseFailed(
"Invalid parameter name offset: name starts after the "
188 "end of the part data");
195 return parseFailed(
"more than one VERS part is present in the file");
196 const char *Current = Part.
begin();
200 Current +=
sizeof(Header);
203 return parseFailed(
"Incorrect shader compiler version flags combination");
206 const char *Prev = Current;
208 CommitSha,
"CommitSha"))
212 Header.ContentSizeInBytes - (Current - Prev),
213 CustomVersionString,
"CustomVersionString"))
216 VersionInfo.emplace();
217 VersionInfo->Parameters = Header;
218 VersionInfo->CommitSha = CommitSha;
219 VersionInfo->CustomVersionString = CustomVersionString;
225 const char *Current = Section.begin();
226 dxbc::SourceInfo::Names::HeaderOnDisk HeaderOnDisk;
227 if (
Error Err =
readStruct<
decltype(HeaderOnDisk),
false>(Section, Current,
233 Current +=
sizeof(HeaderOnDisk);
236 return parseFailed(
"SRCI Names header flags must be zero");
239 "SRCI Names section content ends beyond the section boundary");
247 const char *
Next = Current + Entry.Parameters.AlignedSizeInBytes;
248 if (
Next > Section.end())
250 formatv(
"SRCI Names entry {0} ends beyond the section boundary",
I));
251 if (Entry.Parameters.Flags)
254 const char *FileName = Current +
sizeof(Entry.Parameters);
256 Section, FileName, Entry.Parameters.NameSizeInBytes, Entry.FileName,
261 "SRCI Names entry {0} file name ends beyond the entry boundary",
I));
265 return Current - Section.begin();
268static Expected<size_t>
271 const char *Current = Entries.
begin();
279 const char *
Next = Current + Entry.Parameters.AlignedSizeInBytes;
282 "SRCI Contents entry {0} ends beyond the section boundary",
I));
283 if (Entry.Parameters.Flags)
285 formatv(
"SRCI Contents entry {0} flags must be zero",
I));
287 const char *FileContentPtr = Current +
sizeof(Entry.Parameters);
288 const char *FileContentEndPtr = FileContentPtr;
291 Entry.Parameters.ContentSizeInBytes, FileContent,
293 Twine(
" file content")))
295 if (FileContentEndPtr - FileContentPtr !=
296 Entry.Parameters.ContentSizeInBytes)
298 formatv(
"file size from header ({0} bytes) does not match content "
299 "size in SRCI Contents entry {1} ({2} bytes)",
300 FileContentEndPtr - FileContentPtr,
I,
301 Entry.Parameters.ContentSizeInBytes));
302 if (FileContentEndPtr >
Next)
304 "SRCI Contents entry {0} file content ends beyond the entry boundary",
307 Entry.FileContent = std::string(FileContent.
data(),
308 Entry.Parameters.ContentSizeInBytes - 1);
313 return Current - Entries.
begin();
316static Expected<size_t>
323 return parseFailed(
"SRCI Contents section uses unknown compression type");
327 case CompressionType::None: {
331 "SRCI Contents is not compressed, but compressed size ({0} bytes) "
332 "doesn't match uncompressed size ({1} bytes) in section header",
338 case CompressionType::Zlib: {
341 "SRCI Contents is compressed with Zlib, but {0}",
346 UncompressedEntriesData,
350 if (UncompressedEntriesData.
size() !=
352 return parseFailed(
"SRCI Contents uncompressed size from header does not "
353 "match with actual content size");
356 StringRef(
reinterpret_cast<const char *
>(
357 UncompressedEntriesData.
data()),
358 UncompressedEntriesData.
size()),
368static Expected<size_t>
370 const char *Current = Section.begin();
373 size_t BytesRead =
sizeof(Contents.
Parameters);
374 Current += BytesRead;
378 formatv(
"SRCI Contents section ends beyond the section boundary"));
380 return parseFailed(
"SRCI Contents header flags must be zero");
383 formatv(
"SRCI Contents entries end beyond the section boundary"));
385 size_t BodyBytesRead = 0;
387 .moveInto(BodyBytesRead))
389 return BytesRead + BodyBytesRead;
394 const char *Current = Section.begin();
397 Current +=
sizeof(Args.Parameters);
399 if (Args.Parameters.Flags)
400 return parseFailed(
"SRCI Args header flags must be zero");
401 if (Current + Args.Parameters.SizeInBytes > Section.end())
403 formatv(
"SRCI Args entries end beyond the section boundary", Section));
405 Args.Args.reserve(Args.Parameters.Count);
406 for (
size_t I :
llvm::seq(Args.Parameters.Count)) {
407 auto &Entry = Args.Args.emplace_back();
409 readString(Section, Current, Section.end() - Current, Entry.first,
413 readString(Section, Current, Section.end() - Current, Entry.second,
418 return Current - Section.begin();
421static Expected<size_t>
425 switch (Header.Type) {
426 case SectionType::SourceNames: {
427 SourceInfo.Names.GenericHeader = Header;
428 return parseNames(SectionData, SourceInfo.Names);
430 case SectionType::SourceContents: {
431 SourceInfo.Contents.GenericHeader = Header;
434 case SectionType::Args: {
435 SourceInfo.Args.GenericHeader = Header;
436 return parseArgs(SectionData, SourceInfo.Args);
443Error DXContainer::parseSourceInfo(StringRef Part) {
447 return parseFailed(
"more than one SRCI part is present in the file");
448 SourceInfo.emplace();
450 const char *Current = Part.
begin();
453 Current +=
sizeof(SourceInfo->Parameters);
455 if (SourceInfo->Parameters.AlignedSizeInBytes != Part.
size())
457 "match SRCI part size ({1} bytes)",
458 SourceInfo->Parameters.AlignedSizeInBytes,
460 if (SourceInfo->Parameters.Flags)
461 return parseFailed(
"SRCI header flags must be zero");
462 if (SourceInfo->Parameters.SectionCount != 3)
463 return parseFailed(
"SRCI part must contain 3 sections");
466 SectionType::LLVM_BITMASK_LARGEST_ENUMERATOR) +
468 std::fill(IsSectionPresent,
470 sizeof(IsSectionPresent) /
sizeof(*IsSectionPresent),
472 for (uint32_t Section = 0;
Section < SourceInfo->Parameters.SectionCount;
483 formatv(
"SRCI section {0} (#{1}) extends beyond the part boundary",
484 SectionName, Section));
487 formatv(
"SRCI section {0} (#{1}) header flags must be zero",
488 SectionName, Section));
493 formatv(
"unknown SRCI section type {0}", SectionTypeIdx));
494 if (IsSectionPresent[SectionTypeIdx])
496 "more than one {0} section is present in SRCI part", SectionName));
497 IsSectionPresent[SectionTypeIdx] =
true;
499 size_t SectionBytesRead = 0;
505 .moveInto(SectionBytesRead))
507 BytesRead += SectionBytesRead;
512 "size of SRCI section {0} (#{1} - {2} bytes) does not match size "
513 "specified in generic header ({3} bytes)",
514 SectionName, Section, BytesRead,
SectionHeader.AlignedSizeInBytes));
518 if (SourceInfo->Contents.Parameters.Count !=
519 SourceInfo->Names.Parameters.Count)
521 "SRCI Contents entries count is not equal to SRCI Names entries count");
523 for (
size_t I :
llvm::seq(SourceInfo->Contents.Parameters.Count))
524 if (SourceInfo->Contents.Entries[
I].Parameters.ContentSizeInBytes !=
525 SourceInfo->Names.Entries[
I].Parameters.ContentSizeInBytes)
527 "content size for entry {0} ({1} bytes) in SRCI Contents section "
528 "does not match with size in SRCI Names section ({2} bytes)",
529 I, SourceInfo->Contents.Entries[
I].Parameters.ContentSizeInBytes,
530 SourceInfo->Names.Entries[
I].Parameters.ContentSizeInBytes));
535Error DXContainer::parsePartOffsets() {
536 uint32_t LastOffset =
537 sizeof(dxbc::Header) + (Header.PartCount *
sizeof(uint32_t));
538 const char *Current =
Data.getBuffer().data() +
sizeof(dxbc::Header);
539 for (uint32_t Part = 0; Part < Header.PartCount; ++Part) {
543 if (PartOffset < LastOffset)
546 "Part offset for part {0} begins before the previous part ends",
549 Current +=
sizeof(uint32_t);
550 if (PartOffset >=
Data.getBufferSize())
551 return parseFailed(
"Part offset points beyond boundary of the file");
558 return parseFailed(
"File not large enough to read part name");
559 PartOffsets.push_back(PartOffset);
563 uint32_t PartDataStart = PartOffset +
sizeof(dxbc::PartHeader);
566 Data.getBufferStart() + PartOffset + 4,
567 PartSize,
"part size"))
569 StringRef PartData =
Data.getBuffer().substr(PartDataStart, PartSize);
570 LastOffset = PartOffset + PartSize;
572 case dxbc::PartType::DXIL:
573 case dxbc::PartType::ILDB:
574 if (
Error Err = parseDXILHeader(PT, PartData))
577 case dxbc::PartType::ILDN:
578 if (
Error Err = parseDebugName(PartData))
581 case dxbc::PartType::SFI0:
582 if (
Error Err = parseShaderFeatureFlags(PartData))
585 case dxbc::PartType::HASH:
586 if (
Error Err = parseHash(PartData))
589 case dxbc::PartType::PSV0:
590 if (
Error Err = parsePSVInfo(PartData))
593 case dxbc::PartType::ISG1:
594 if (
Error Err = InputSignature.initialize(PartData))
597 case dxbc::PartType::OSG1:
598 if (
Error Err = OutputSignature.initialize(PartData))
601 case dxbc::PartType::PSG1:
602 if (
Error Err = PatchConstantSignature.initialize(PartData))
607 case dxbc::PartType::RTS0:
608 if (
Error Err = parseRootSignature(PartData))
611 case dxbc::PartType::SRCI:
612 if (
Error Err = parseSourceInfo(PartData))
615 case dxbc::PartType::VERS:
616 if (
Error Err = parseCompilerVersionInfo(PartData))
622 if (DXIL && DebugDXIL &&
623 DXIL->first.ShaderKind != DebugDXIL->first.ShaderKind)
625 "ILDB part shader kind does not match DXIL part shader kind");
630 std::optional<uint16_t> ShaderKind = getShaderKind();
632 return parseFailed(
"cannot fully parse pipeline state validation "
633 "information without DXIL or ILDB part");
634 if (
Error Err = PSVInfo->parse(*ShaderKind))
641 DXContainer Container(Object);
642 if (
Error Err = Container.parseHeader())
643 return std::move(Err);
644 if (
Error Err = Container.parsePartOffsets())
645 return std::move(Err);
649void DXContainer::PartIterator::updateIteratorImpl(
const uint32_t Offset) {
650 StringRef Buffer = Container.Data.getBuffer();
657 IteratorState.Offset =
Offset;
661 const char *Current = PartData.begin();
664 if (PartData.size() < 6 *
sizeof(
uint32_t))
666 "Invalid root signature, insufficient space for header.");
675 RootParametersOffset =
683 StaticSamplersOffset =
690 ParametersHeaders.Data = PartData.substr(
691 RootParametersOffset,
694 StaticSamplers.Stride = (Version <= 2)
698 StaticSamplers.Data = PartData.substr(StaticSamplersOffset,
699 static_cast<size_t>(NumStaticSamplers) *
700 StaticSamplers.Stride);
708 const char *Current = Data.begin();
715 if (PSVInfoData.
size() < Size)
717 "Pipeline state data extends beyond the bounds of the part");
724 if (PSVVersion == 3) {
725 v3::RuntimeInfo Info;
729 Info.swapBytes(ShaderStage);
731 }
else if (PSVVersion == 2) {
732 v2::RuntimeInfo Info;
736 Info.swapBytes(ShaderStage);
738 }
else if (PSVVersion == 1) {
739 v1::RuntimeInfo Info;
743 Info.swapBytes(ShaderStage);
745 }
else if (PSVVersion == 0) {
746 v0::RuntimeInfo Info;
750 Info.swapBytes(ShaderStage);
754 "Cannot read PSV Runtime Info, unsupported PSV version.");
763 if (ResourceCount > 0) {
768 size_t BindingDataSize = Resources.Stride * ResourceCount;
769 Resources.Data = Data.substr(Current - Data.begin(), BindingDataSize);
771 if (Resources.Data.size() < BindingDataSize)
773 "Resource binding data extends beyond the bounds of the part");
775 Current += BindingDataSize;
777 Resources.Stride =
sizeof(v2::ResourceBindInfo);
784 Current =
reinterpret_cast<const char *
>(
786 reinterpret_cast<uintptr_t
>(Current)));
791 if (StringTableSize % 4 != 0)
794 StringTable =
StringRef(Current, StringTableSize);
796 Current += StringTableSize;
798 uint32_t SemanticIndexTableSize = 0;
803 SemanticIndexTable.reserve(SemanticIndexTableSize);
804 for (
uint32_t I = 0;
I < SemanticIndexTableSize; ++
I) {
809 SemanticIndexTable.push_back(Index);
823 SigOutputElements.Stride = SigPatchOrPrimElements.Stride =
824 SigInputElements.Stride;
826 if (Data.end() - Current <
829 "Signature elements extend beyond the size of the part");
831 size_t InputSize = SigInputElements.Stride * InputCount;
832 SigInputElements.Data = Data.substr(Current - Data.begin(), InputSize);
833 Current += InputSize;
835 size_t OutputSize = SigOutputElements.Stride * OutputCount;
836 SigOutputElements.Data = Data.substr(Current - Data.begin(), OutputSize);
837 Current += OutputSize;
839 size_t PSize = SigPatchOrPrimElements.Stride * PatchOrPrimCount;
840 SigPatchOrPrimElements.Data = Data.substr(Current - Data.begin(), PSize);
853 return maskDwordSize(
Y) *
X * 4;
862 maskDwordSize(
static_cast<uint32_t>(OutputVectorCounts[
I]));
863 size_t NumBytes = NumDwords *
sizeof(
uint32_t);
864 OutputVectorMasks[
I].Data = Data.substr(Current - Data.begin(), NumBytes);
868 if (ShaderStage ==
Triple::Hull && PatchConstOrPrimVectorCount > 0) {
869 uint32_t NumDwords = maskDwordSize(PatchConstOrPrimVectorCount);
870 size_t NumBytes = NumDwords *
sizeof(
uint32_t);
871 PatchOrPrimMasks.Data = Data.substr(Current - Data.begin(), NumBytes);
878 if (InputVectorCount == 0 || OutputVectorCounts[
I] == 0)
880 uint32_t NumDwords = mapTableSize(InputVectorCount, OutputVectorCounts[
I]);
881 size_t NumBytes = NumDwords *
sizeof(
uint32_t);
882 InputOutputMap[
I].Data = Data.substr(Current - Data.begin(), NumBytes);
887 if (ShaderStage ==
Triple::Hull && PatchConstOrPrimVectorCount > 0 &&
888 InputVectorCount > 0) {
890 mapTableSize(InputVectorCount, PatchConstOrPrimVectorCount);
891 size_t NumBytes = NumDwords *
sizeof(
uint32_t);
892 InputPatchMap.Data = Data.substr(Current - Data.begin(), NumBytes);
897 if (ShaderStage ==
Triple::Domain && PatchConstOrPrimVectorCount > 0 &&
898 OutputVectorCounts[0] > 0) {
900 mapTableSize(PatchConstOrPrimVectorCount, OutputVectorCounts[0]);
901 size_t NumBytes = NumDwords *
sizeof(
uint32_t);
902 PatchOutputMap.Data = Data.substr(Current - Data.begin(), NumBytes);
910 if (
const auto *
P = std::get_if<dxbc::PSV::v3::RuntimeInfo>(&BasicInfo))
911 return P->SigInputElements;
912 if (
const auto *
P = std::get_if<dxbc::PSV::v2::RuntimeInfo>(&BasicInfo))
913 return P->SigInputElements;
914 if (
const auto *
P = std::get_if<dxbc::PSV::v1::RuntimeInfo>(&BasicInfo))
915 return P->SigInputElements;
920 if (
const auto *
P = std::get_if<dxbc::PSV::v3::RuntimeInfo>(&BasicInfo))
921 return P->SigOutputElements;
922 if (
const auto *
P = std::get_if<dxbc::PSV::v2::RuntimeInfo>(&BasicInfo))
923 return P->SigOutputElements;
924 if (
const auto *
P = std::get_if<dxbc::PSV::v1::RuntimeInfo>(&BasicInfo))
925 return P->SigOutputElements;
930 if (
const auto *
P = std::get_if<dxbc::PSV::v3::RuntimeInfo>(&BasicInfo))
931 return P->SigPatchOrPrimElements;
932 if (
const auto *
P = std::get_if<dxbc::PSV::v2::RuntimeInfo>(&BasicInfo))
933 return P->SigPatchOrPrimElements;
934 if (
const auto *
P = std::get_if<dxbc::PSV::v1::RuntimeInfo>(&BasicInfo))
935 return P->SigPatchOrPrimElements;
946 OS <<
"DXContainer does not support " << FeatureString;
959Expected<section_iterator>
987 PartIterator It =
reinterpret_cast<PartIterator
>(Sec.
p);
988 if (It == Parts.end())
992 Sec.
p =
reinterpret_cast<uintptr_t
>(It);
997 PartIterator It =
reinterpret_cast<PartIterator
>(Sec.
p);
1002 PartIterator It =
reinterpret_cast<PartIterator
>(Sec.
p);
1007 return (Sec.
p -
reinterpret_cast<uintptr_t
>(Parts.begin())) /
1008 sizeof(PartIterator);
1012 PartIterator It =
reinterpret_cast<PartIterator
>(Sec.
p);
1013 return It->Data.size();
1017 PartIterator It =
reinterpret_cast<PartIterator
>(Sec.
p);
1079 Sec.
p =
reinterpret_cast<uintptr_t
>(Parts.begin());
1084 Sec.
p =
reinterpret_cast<uintptr_t
>(Parts.end());
1091 return "DirectX Container";
1114 return ExC.takeError();
1116 return std::move(Obj);
#define offsetof(TYPE, MEMBER)
static Error readString(StringRef Buffer, const char *&Src, size_t MaxSize, StringRef &Val, Twine Desc)
Read a null-terminated string at the position Src from Buffer, with maximum byte size of MaxSize (inc...
static Expected< size_t > parseArgs(StringRef Section, mcdxbc::SourceInfo::ProgramArgs &Args)
static Error readStruct(StringRef Buffer, const char *Src, T &Struct)
static Error parseFailed(const Twine &Msg)
static Expected< size_t > parseContents(StringRef Section, mcdxbc::SourceInfo::SourceContents &Contents)
static Expected< size_t > parseSourceInfoSection(const dxbc::SourceInfo::SectionHeader &Header, StringRef SectionData, mcdxbc::SourceInfo &SourceInfo)
static Expected< size_t > parseContentsEntries(StringRef Entries, mcdxbc::SourceInfo::SourceContents &Contents)
static bool readIsOutOfBounds(StringRef Buffer, const char *Src, size_t Size)
static Error readInteger(StringRef Buffer, const char *Src, T &Val, Twine Str="structure")
static Expected< size_t > parseNames(StringRef Section, mcdxbc::SourceInfo::SourceNames &Names)
static Expected< size_t > parseUncompressedContentsEntries(StringRef Entries, mcdxbc::SourceInfo::SourceContents &Contents)
Provides some synthesis utilities to produce sequences of values.
static TableGen::Emitter::Opt Y("gen-skeleton-entry", EmitSkeleton, "Generate example skeleton entry")
std::error_code convertToErrorCode() const override
Convert this error to a std::error_code.
DXNotSupportedError(StringRef S)
void log(raw_ostream &OS) const override
Print an error message to an output stream.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
Get the array size.
Base class for user error types.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
reference emplace_back(ArgTypes &&... Args)
void reserve(size_type N)
pointer data()
Return a pointer to the vector's buffer, even if empty().
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.
static constexpr size_t npos
constexpr StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
constexpr size_t size() const
Get the string size.
constexpr const char * data() const
Get a pointer to the start of the string (which may not be null terminated).
size_t find(char C, size_t From=0) const
Search for the first character C in the string.
Manages the enabling and disabling of subtarget specific features.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM_ABI std::string str() const
Return the twine contents as a std::string.
Expected< SymbolRef::Type > getSymbolType(DataRefImpl Symb) const override
uint64_t getRelocationOffset(DataRefImpl Rel) const override
uint64_t getSectionSize(DataRefImpl Sec) const override
relocation_iterator section_rel_begin(DataRefImpl Sec) const override
Triple::ArchType getArch() const override
bool isSectionCompressed(DataRefImpl Sec) const override
section_iterator section_end() const override
void getRelocationTypeName(DataRefImpl Rel, SmallVectorImpl< char > &Result) const override
uint64_t getSectionIndex(DataRefImpl Sec) const override
Expected< section_iterator > getSymbolSection(DataRefImpl Symb) const override
Expected< StringRef > getSectionName(DataRefImpl Sec) const override
uint64_t getSectionAddress(DataRefImpl Sec) const override
Expected< ArrayRef< uint8_t > > getSectionContents(DataRefImpl Sec) const override
section_iterator section_begin() const override
bool isSectionVirtual(DataRefImpl Sec) const override
void moveRelocationNext(DataRefImpl &Rel) const override
relocation_iterator section_rel_end(DataRefImpl Sec) const override
void moveSectionNext(DataRefImpl &Sec) const override
bool isSectionData(DataRefImpl Sec) const override
symbol_iterator getRelocationSymbol(DataRefImpl Rel) const override
StringRef getFileFormatName() const override
uint64_t getSectionAlignment(DataRefImpl Sec) const override
Error printSymbolName(raw_ostream &OS, DataRefImpl Symb) const override
uint8_t getBytesInAddress() const override
The number of bytes used to represent an address in this object file format.
uint64_t getRelocationType(DataRefImpl Rel) const override
Expected< uint64_t > getSymbolAddress(DataRefImpl Symb) const override
bool isSectionBSS(DataRefImpl Sec) const override
uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const override
uint64_t getSymbolValueImpl(DataRefImpl Symb) const override
Expected< uint32_t > getSymbolFlags(DataRefImpl Symb) const override
bool isSectionText(DataRefImpl Sec) const override
Expected< SubtargetFeatures > getFeatures() const override
Expected< StringRef > getSymbolName(DataRefImpl) const override
static LLVM_ABI Expected< DXContainer > create(MemoryBufferRef Object)
ArrayRef< uint8_t > getOutputVectorCounts() const
uint8_t getPatchConstOrPrimVectorCount() const
LLVM_ABI uint8_t getSigInputCount() const
LLVM_ABI uint8_t getSigPatchOrPrimCount() const
uint32_t getVersion() const
LLVM_ABI Error parse(uint16_t ShaderKind)
uint8_t getInputVectorCount() const
LLVM_ABI uint8_t getSigOutputCount() const
LLVM_ABI Error initialize(StringRef Part)
static Expected< std::unique_ptr< DXContainerObjectFile > > createDXContainerObjectFile(MemoryBufferRef Object)
friend class RelocationRef
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
LLVM_ABI Error decompress(ArrayRef< uint8_t > Input, uint8_t *Output, size_t &UncompressedSize)
LLVM_ABI bool isAvailable()
LLVM_ABI const char * getReasonIfUnsupported(Format F)
bool isValidCompressionType(uint16_t V)
LLVM_ABI bool isValidSectionType(uint16_t V)
LLVM_ABI StringRef getSectionName(SectionType Type)
LLVM_ABI PartType parsePartType(StringRef S)
Triple::EnvironmentType getShaderStage(uint32_t Kind)
bool isDebugProgramPart(PartType PT)
bool isValidCompilerVersionFlags(uint32_t V)
const char * getProgramPartName(bool IsDebug)
static Error parseFailed(const Twine &Msg)
content_iterator< SectionRef > section_iterator
content_iterator< RelocationRef > relocation_iterator
value_type read(const void *memory, endianness endian)
Read a value of a particular endianness from memory.
constexpr bool IsBigEndianHost
void swapByteOrder(T &Value)
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
constexpr uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
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.
void cantFail(Error Err, const char *Msg=nullptr)
Report a fatal error if Err is a failure value.
FunctionAddr VTableAddr uintptr_t uintptr_t Data
FunctionAddr VTableAddr Next
ArrayRef(const T &OneElt) -> ArrayRef< T >
auto seq(T Begin, T End)
Iterate over an integral type from Begin up to - but not including - End.
SmallVector< Entry > Entries
dxbc::SourceInfo::Contents::Header Parameters
SmallVector< Entry > Entries