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,
231 Current +=
sizeof(HeaderOnDisk);
234 return parseFailed(
"SRCI Names header flags must be zero");
237 "SRCI Names section content ends beyond the section boundary");
245 const char *
Next = Current + Entry.Parameters.AlignedSizeInBytes;
246 if (
Next > Section.end())
248 formatv(
"SRCI Names entry {0} ends beyond the section boundary",
I));
249 if (Entry.Parameters.Flags)
252 const char *FileName = Current +
sizeof(Entry.Parameters);
254 Section, FileName, Entry.Parameters.NameSizeInBytes, Entry.FileName,
259 "SRCI Names entry {0} file name ends beyond the entry boundary",
I));
263 return Current - Section.begin();
266static Expected<size_t>
269 const char *Current = Entries.
begin();
277 const char *
Next = Current + Entry.Parameters.AlignedSizeInBytes;
280 "SRCI Contents entry {0} ends beyond the section boundary",
I));
281 if (Entry.Parameters.Flags)
283 formatv(
"SRCI Contents entry {0} flags must be zero",
I));
285 const char *FileContentPtr = Current +
sizeof(Entry.Parameters);
286 const char *FileContentEndPtr = FileContentPtr;
289 Entry.Parameters.ContentSizeInBytes, FileContent,
291 Twine(
" file content")))
293 if (FileContentEndPtr - FileContentPtr !=
294 Entry.Parameters.ContentSizeInBytes)
296 formatv(
"file size from header ({0} bytes) does not match content "
297 "size in SRCI Contents entry {1} ({2} bytes)",
298 FileContentEndPtr - FileContentPtr,
I,
299 Entry.Parameters.ContentSizeInBytes));
300 if (FileContentEndPtr >
Next)
302 "SRCI Contents entry {0} file content ends beyond the entry boundary",
305 Entry.FileContent = std::string(FileContent.
data(),
306 Entry.Parameters.ContentSizeInBytes - 1);
311 return Current - Entries.
begin();
314static Expected<size_t>
321 return parseFailed(
"SRCI Contents section uses unknown compression type");
325 case CompressionType::None: {
329 "SRCI Contents is not compressed, but compressed size ({0} bytes) "
330 "doesn't match uncompressed size ({1} bytes) in section header",
336 case CompressionType::Zlib: {
339 "SRCI Contents is compressed with Zlib, but {0}",
344 UncompressedEntriesData,
348 if (UncompressedEntriesData.
size() !=
350 return parseFailed(
"SRCI Contents uncompressed size from header does not "
351 "match with actual content size");
354 StringRef(
reinterpret_cast<const char *
>(
355 UncompressedEntriesData.
data()),
356 UncompressedEntriesData.
size()),
367static Expected<size_t>
369 const char *Current = Section.begin();
372 size_t BytesRead =
sizeof(Contents.
Parameters);
373 Current += BytesRead;
377 formatv(
"SRCI Contents section ends beyond the section boundary"));
379 return parseFailed(
"SRCI Contents header flags must be zero");
382 formatv(
"SRCI Contents entries end beyond the section boundary"));
384 size_t BodyBytesRead = 0;
386 .moveInto(BodyBytesRead))
388 return BytesRead + BodyBytesRead;
393 const char *Current = Section.begin();
396 Current +=
sizeof(Args.Parameters);
398 if (Args.Parameters.Flags)
399 return parseFailed(
"SRCI Args header flags must be zero");
400 if (Current + Args.Parameters.SizeInBytes > Section.end())
402 formatv(
"SRCI Args entries end beyond the section boundary", Section));
404 Args.Args.reserve(Args.Parameters.Count);
405 for (
size_t I :
llvm::seq(Args.Parameters.Count)) {
406 auto &Entry = Args.Args.emplace_back();
408 readString(Section, Current, Section.end() - Current, Entry.first,
412 readString(Section, Current, Section.end() - Current, Entry.second,
417 return Current - Section.begin();
420static Expected<size_t>
424 switch (Header.Type) {
425 case SectionType::SourceNames: {
426 SourceInfo.Names.GenericHeader = Header;
427 return parseNames(SectionData, SourceInfo.Names);
429 case SectionType::SourceContents: {
430 SourceInfo.Contents.GenericHeader = Header;
433 case SectionType::Args: {
434 SourceInfo.Args.GenericHeader = Header;
435 return parseArgs(SectionData, SourceInfo.Args);
442Error DXContainer::parseSourceInfo(StringRef Part) {
446 return parseFailed(
"more than one SRCI part is present in the file");
447 SourceInfo.emplace();
449 const char *Current = Part.
begin();
452 Current +=
sizeof(SourceInfo->Parameters);
454 if (SourceInfo->Parameters.AlignedSizeInBytes != Part.
size())
456 "match SRCI part size ({1} bytes)",
457 SourceInfo->Parameters.AlignedSizeInBytes,
459 if (SourceInfo->Parameters.Flags)
460 return parseFailed(
"SRCI header flags must be zero");
461 if (SourceInfo->Parameters.SectionCount != 3)
462 return parseFailed(
"SRCI part must contain 3 sections");
465 SectionType::LLVM_BITMASK_LARGEST_ENUMERATOR) +
467 std::fill(IsSectionPresent,
469 sizeof(IsSectionPresent) /
sizeof(*IsSectionPresent),
471 for (uint32_t Section = 0;
Section < SourceInfo->Parameters.SectionCount;
482 formatv(
"SRCI section {0} (#{1}) extends beyond the part boundary",
483 SectionName, Section));
486 formatv(
"SRCI section {0} (#{1}) header flags must be zero",
487 SectionName, Section));
492 formatv(
"unknown SRCI section type {0}", SectionTypeIdx));
493 if (IsSectionPresent[SectionTypeIdx])
495 "more than one {0} section is present in SRCI part", SectionName));
496 IsSectionPresent[SectionTypeIdx] =
true;
498 size_t SectionBytesRead = 0;
504 .moveInto(SectionBytesRead))
506 BytesRead += SectionBytesRead;
511 "size of SRCI section {0} (#{1} - {2} bytes) does not match size "
512 "specified in generic header ({3} bytes)",
513 SectionName, Section, BytesRead,
SectionHeader.AlignedSizeInBytes));
517 if (SourceInfo->Contents.Parameters.Count !=
518 SourceInfo->Names.Parameters.Count)
520 "SRCI Contents entries count is not equal to SRCI Names entries count");
522 for (
size_t I :
llvm::seq(SourceInfo->Contents.Parameters.Count))
523 if (SourceInfo->Contents.Entries[
I].Parameters.ContentSizeInBytes !=
524 SourceInfo->Names.Entries[
I].Parameters.ContentSizeInBytes)
526 "content size for entry {0} ({1} bytes) in SRCI Contents section "
527 "does not match with size in SRCI Names section ({2} bytes)",
528 I, SourceInfo->Contents.Entries[
I].Parameters.ContentSizeInBytes,
529 SourceInfo->Names.Entries[
I].Parameters.ContentSizeInBytes));
534Error DXContainer::parsePartOffsets() {
535 uint32_t LastOffset =
536 sizeof(dxbc::Header) + (Header.PartCount *
sizeof(uint32_t));
537 const char *Current =
Data.getBuffer().data() +
sizeof(dxbc::Header);
538 for (uint32_t Part = 0; Part < Header.PartCount; ++Part) {
542 if (PartOffset < LastOffset)
545 "Part offset for part {0} begins before the previous part ends",
548 Current +=
sizeof(uint32_t);
549 if (PartOffset >=
Data.getBufferSize())
550 return parseFailed(
"Part offset points beyond boundary of the file");
557 return parseFailed(
"File not large enough to read part name");
558 PartOffsets.push_back(PartOffset);
562 uint32_t PartDataStart = PartOffset +
sizeof(dxbc::PartHeader);
565 Data.getBufferStart() + PartOffset + 4,
566 PartSize,
"part size"))
568 StringRef PartData =
Data.getBuffer().substr(PartDataStart, PartSize);
569 LastOffset = PartOffset + PartSize;
571 case dxbc::PartType::DXIL:
572 case dxbc::PartType::ILDB:
573 if (
Error Err = parseDXILHeader(PT, PartData))
576 case dxbc::PartType::ILDN:
577 if (
Error Err = parseDebugName(PartData))
580 case dxbc::PartType::SFI0:
581 if (
Error Err = parseShaderFeatureFlags(PartData))
584 case dxbc::PartType::HASH:
585 if (
Error Err = parseHash(PartData))
588 case dxbc::PartType::PSV0:
589 if (
Error Err = parsePSVInfo(PartData))
592 case dxbc::PartType::ISG1:
593 if (
Error Err = InputSignature.initialize(PartData))
596 case dxbc::PartType::OSG1:
597 if (
Error Err = OutputSignature.initialize(PartData))
600 case dxbc::PartType::PSG1:
601 if (
Error Err = PatchConstantSignature.initialize(PartData))
606 case dxbc::PartType::RTS0:
607 if (
Error Err = parseRootSignature(PartData))
610 case dxbc::PartType::SRCI:
611 if (
Error Err = parseSourceInfo(PartData))
614 case dxbc::PartType::VERS:
615 if (
Error Err = parseCompilerVersionInfo(PartData))
621 if (DXIL && DebugDXIL &&
622 DXIL->first.ShaderKind != DebugDXIL->first.ShaderKind)
624 "ILDB part shader kind does not match DXIL part shader kind");
629 std::optional<uint16_t> ShaderKind = getShaderKind();
631 return parseFailed(
"cannot fully parse pipeline state validation "
632 "information without DXIL or ILDB part");
633 if (
Error Err = PSVInfo->parse(*ShaderKind))
640 DXContainer Container(Object);
641 if (
Error Err = Container.parseHeader())
642 return std::move(Err);
643 if (
Error Err = Container.parsePartOffsets())
644 return std::move(Err);
648void DXContainer::PartIterator::updateIteratorImpl(
const uint32_t Offset) {
649 StringRef Buffer = Container.Data.getBuffer();
656 IteratorState.Offset =
Offset;
660 const char *Current = PartData.begin();
663 if (PartData.size() < 6 *
sizeof(
uint32_t))
665 "Invalid root signature, insufficient space for header.");
674 RootParametersOffset =
682 StaticSamplersOffset =
689 ParametersHeaders.Data = PartData.substr(
690 RootParametersOffset,
693 StaticSamplers.Stride = (Version <= 2)
697 StaticSamplers.Data = PartData.substr(StaticSamplersOffset,
698 static_cast<size_t>(NumStaticSamplers) *
699 StaticSamplers.Stride);
707 const char *Current = Data.begin();
714 if (PSVInfoData.
size() < Size)
716 "Pipeline state data extends beyond the bounds of the part");
723 if (PSVVersion == 3) {
724 v3::RuntimeInfo Info;
728 Info.swapBytes(ShaderStage);
730 }
else if (PSVVersion == 2) {
731 v2::RuntimeInfo Info;
735 Info.swapBytes(ShaderStage);
737 }
else if (PSVVersion == 1) {
738 v1::RuntimeInfo Info;
742 Info.swapBytes(ShaderStage);
744 }
else if (PSVVersion == 0) {
745 v0::RuntimeInfo Info;
749 Info.swapBytes(ShaderStage);
753 "Cannot read PSV Runtime Info, unsupported PSV version.");
762 if (ResourceCount > 0) {
767 size_t BindingDataSize = Resources.Stride * ResourceCount;
768 Resources.Data = Data.substr(Current - Data.begin(), BindingDataSize);
770 if (Resources.Data.size() < BindingDataSize)
772 "Resource binding data extends beyond the bounds of the part");
774 Current += BindingDataSize;
776 Resources.Stride =
sizeof(v2::ResourceBindInfo);
783 Current =
reinterpret_cast<const char *
>(
785 reinterpret_cast<uintptr_t
>(Current)));
790 if (StringTableSize % 4 != 0)
793 StringTable =
StringRef(Current, StringTableSize);
795 Current += StringTableSize;
797 uint32_t SemanticIndexTableSize = 0;
802 SemanticIndexTable.reserve(SemanticIndexTableSize);
803 for (
uint32_t I = 0;
I < SemanticIndexTableSize; ++
I) {
808 SemanticIndexTable.push_back(Index);
822 SigOutputElements.Stride = SigPatchOrPrimElements.Stride =
823 SigInputElements.Stride;
825 if (Data.end() - Current <
828 "Signature elements extend beyond the size of the part");
830 size_t InputSize = SigInputElements.Stride * InputCount;
831 SigInputElements.Data = Data.substr(Current - Data.begin(), InputSize);
832 Current += InputSize;
834 size_t OutputSize = SigOutputElements.Stride * OutputCount;
835 SigOutputElements.Data = Data.substr(Current - Data.begin(), OutputSize);
836 Current += OutputSize;
838 size_t PSize = SigPatchOrPrimElements.Stride * PatchOrPrimCount;
839 SigPatchOrPrimElements.Data = Data.substr(Current - Data.begin(), PSize);
852 return maskDwordSize(
Y) *
X * 4;
861 maskDwordSize(
static_cast<uint32_t>(OutputVectorCounts[
I]));
862 size_t NumBytes = NumDwords *
sizeof(
uint32_t);
863 OutputVectorMasks[
I].Data = Data.substr(Current - Data.begin(), NumBytes);
867 if (ShaderStage ==
Triple::Hull && PatchConstOrPrimVectorCount > 0) {
868 uint32_t NumDwords = maskDwordSize(PatchConstOrPrimVectorCount);
869 size_t NumBytes = NumDwords *
sizeof(
uint32_t);
870 PatchOrPrimMasks.Data = Data.substr(Current - Data.begin(), NumBytes);
877 if (InputVectorCount == 0 || OutputVectorCounts[
I] == 0)
879 uint32_t NumDwords = mapTableSize(InputVectorCount, OutputVectorCounts[
I]);
880 size_t NumBytes = NumDwords *
sizeof(
uint32_t);
881 InputOutputMap[
I].Data = Data.substr(Current - Data.begin(), NumBytes);
886 if (ShaderStage ==
Triple::Hull && PatchConstOrPrimVectorCount > 0 &&
887 InputVectorCount > 0) {
889 mapTableSize(InputVectorCount, PatchConstOrPrimVectorCount);
890 size_t NumBytes = NumDwords *
sizeof(
uint32_t);
891 InputPatchMap.Data = Data.substr(Current - Data.begin(), NumBytes);
896 if (ShaderStage ==
Triple::Domain && PatchConstOrPrimVectorCount > 0 &&
897 OutputVectorCounts[0] > 0) {
899 mapTableSize(PatchConstOrPrimVectorCount, OutputVectorCounts[0]);
900 size_t NumBytes = NumDwords *
sizeof(
uint32_t);
901 PatchOutputMap.Data = Data.substr(Current - Data.begin(), NumBytes);
909 if (
const auto *
P = std::get_if<dxbc::PSV::v3::RuntimeInfo>(&BasicInfo))
910 return P->SigInputElements;
911 if (
const auto *
P = std::get_if<dxbc::PSV::v2::RuntimeInfo>(&BasicInfo))
912 return P->SigInputElements;
913 if (
const auto *
P = std::get_if<dxbc::PSV::v1::RuntimeInfo>(&BasicInfo))
914 return P->SigInputElements;
919 if (
const auto *
P = std::get_if<dxbc::PSV::v3::RuntimeInfo>(&BasicInfo))
920 return P->SigOutputElements;
921 if (
const auto *
P = std::get_if<dxbc::PSV::v2::RuntimeInfo>(&BasicInfo))
922 return P->SigOutputElements;
923 if (
const auto *
P = std::get_if<dxbc::PSV::v1::RuntimeInfo>(&BasicInfo))
924 return P->SigOutputElements;
929 if (
const auto *
P = std::get_if<dxbc::PSV::v3::RuntimeInfo>(&BasicInfo))
930 return P->SigPatchOrPrimElements;
931 if (
const auto *
P = std::get_if<dxbc::PSV::v2::RuntimeInfo>(&BasicInfo))
932 return P->SigPatchOrPrimElements;
933 if (
const auto *
P = std::get_if<dxbc::PSV::v1::RuntimeInfo>(&BasicInfo))
934 return P->SigPatchOrPrimElements;
945 OS <<
"DXContainer does not support " << FeatureString;
958Expected<section_iterator>
986 PartIterator It =
reinterpret_cast<PartIterator
>(Sec.
p);
987 if (It == Parts.end())
991 Sec.
p =
reinterpret_cast<uintptr_t
>(It);
996 PartIterator It =
reinterpret_cast<PartIterator
>(Sec.
p);
1001 PartIterator It =
reinterpret_cast<PartIterator
>(Sec.
p);
1006 return (Sec.
p -
reinterpret_cast<uintptr_t
>(Parts.begin())) /
1007 sizeof(PartIterator);
1011 PartIterator It =
reinterpret_cast<PartIterator
>(Sec.
p);
1012 return It->Data.size();
1016 PartIterator It =
reinterpret_cast<PartIterator
>(Sec.
p);
1078 Sec.
p =
reinterpret_cast<uintptr_t
>(Parts.begin());
1083 Sec.
p =
reinterpret_cast<uintptr_t
>(Parts.end());
1090 return "DirectX Container";
1113 return ExC.takeError();
1115 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)
LLVM_ABI 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)
LLVM_ABI bool isDebugProgramPart(PartType PT)
LLVM_ABI bool isValidCompilerVersionFlags(uint32_t V)
LLVM_ABI 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