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::parsePrivateData(StringRef Part) {
132 return parseFailed(
"more than one PRIV part is present in the file");
133 PrivateData.emplace(Part);
137Error DXContainer::parseShaderFeatureFlags(StringRef Part) {
138 if (ShaderFeatureFlags)
139 return parseFailed(
"More than one SFI0 part is present in the file");
140 uint64_t FlagValue = 0;
143 ShaderFeatureFlags = FlagValue;
147Error DXContainer::parseHash(StringRef Part) {
149 return parseFailed(
"More than one HASH part is present in the file");
150 dxbc::ShaderHash ReadHash;
157Error DXContainer::parseRootSignature(StringRef Part) {
159 return parseFailed(
"More than one RTS0 part is present in the file");
160 RootSignature = DirectX::RootSignature(Part);
161 if (
Error Err = RootSignature->parse())
166Error DXContainer::parsePSVInfo(StringRef Part) {
168 return parseFailed(
"More than one PSV0 part is present in the file");
169 PSVInfo = DirectX::PSVRuntimeInfo(Part);
182 return parseFailed(
"Signature parameters extend beyond the part boundary");
189 for (
const auto &Param : Parameters) {
190 if (Param.NameOffset < StringTableOffset)
191 return parseFailed(
"Invalid parameter name offset: name starts before "
192 "the first name offset");
193 if (Param.NameOffset - StringTableOffset > StringTable.size())
194 return parseFailed(
"Invalid parameter name offset: name starts after the "
195 "end of the part data");
202 return parseFailed(
"more than one VERS part is present in the file");
203 const char *Current = Part.
begin();
207 Current +=
sizeof(Header);
210 return parseFailed(
"Incorrect shader compiler version flags combination");
213 const char *Prev = Current;
215 CommitSha,
"CommitSha"))
219 Header.ContentSizeInBytes - (Current - Prev),
220 CustomVersionString,
"CustomVersionString"))
223 VersionInfo.emplace();
224 VersionInfo->Parameters = Header;
225 VersionInfo->CommitSha = CommitSha;
226 VersionInfo->CustomVersionString = CustomVersionString;
232 const char *Current = Section.begin();
233 dxbc::SourceInfo::Names::HeaderOnDisk HeaderOnDisk;
234 if (
Error Err =
readStruct<
decltype(HeaderOnDisk),
false>(Section, Current,
238 Current +=
sizeof(HeaderOnDisk);
241 return parseFailed(
"SRCI Names header flags must be zero");
244 "SRCI Names section content ends beyond the section boundary");
252 const char *
Next = Current + Entry.Parameters.AlignedSizeInBytes;
253 if (
Next > Section.end())
255 formatv(
"SRCI Names entry {0} ends beyond the section boundary",
I));
256 if (Entry.Parameters.Flags)
259 const char *FileName = Current +
sizeof(Entry.Parameters);
261 Section, FileName, Entry.Parameters.NameSizeInBytes, Entry.FileName,
266 "SRCI Names entry {0} file name ends beyond the entry boundary",
I));
270 return Current - Section.begin();
273static Expected<size_t>
276 const char *Current = Entries.
begin();
284 const char *
Next = Current + Entry.Parameters.AlignedSizeInBytes;
287 "SRCI Contents entry {0} ends beyond the section boundary",
I));
288 if (Entry.Parameters.Flags)
290 formatv(
"SRCI Contents entry {0} flags must be zero",
I));
292 const char *FileContentPtr = Current +
sizeof(Entry.Parameters);
293 const char *FileContentEndPtr = FileContentPtr;
296 Entry.Parameters.ContentSizeInBytes, FileContent,
298 Twine(
" file content")))
300 if (FileContentEndPtr - FileContentPtr !=
301 Entry.Parameters.ContentSizeInBytes)
303 formatv(
"file size from header ({0} bytes) does not match content "
304 "size in SRCI Contents entry {1} ({2} bytes)",
305 FileContentEndPtr - FileContentPtr,
I,
306 Entry.Parameters.ContentSizeInBytes));
307 if (FileContentEndPtr >
Next)
309 "SRCI Contents entry {0} file content ends beyond the entry boundary",
312 Entry.FileContent = std::string(FileContent.
data(),
313 Entry.Parameters.ContentSizeInBytes - 1);
318 return Current - Entries.
begin();
321static Expected<size_t>
328 return parseFailed(
"SRCI Contents section uses unknown compression type");
332 case CompressionType::None: {
336 "SRCI Contents is not compressed, but compressed size ({0} bytes) "
337 "doesn't match uncompressed size ({1} bytes) in section header",
343 case CompressionType::Zlib: {
346 "SRCI Contents is compressed with Zlib, but {0}",
351 UncompressedEntriesData,
355 if (UncompressedEntriesData.
size() !=
357 return parseFailed(
"SRCI Contents uncompressed size from header does not "
358 "match with actual content size");
361 StringRef(
reinterpret_cast<const char *
>(
362 UncompressedEntriesData.
data()),
363 UncompressedEntriesData.
size()),
374static Expected<size_t>
376 const char *Current = Section.begin();
379 size_t BytesRead =
sizeof(Contents.
Parameters);
380 Current += BytesRead;
384 formatv(
"SRCI Contents section ends beyond the section boundary"));
386 return parseFailed(
"SRCI Contents header flags must be zero");
389 formatv(
"SRCI Contents entries end beyond the section boundary"));
391 size_t BodyBytesRead = 0;
393 .moveInto(BodyBytesRead))
395 return BytesRead + BodyBytesRead;
400 const char *Current = Section.begin();
403 Current +=
sizeof(Args.Parameters);
405 if (Args.Parameters.Flags)
406 return parseFailed(
"SRCI Args header flags must be zero");
407 if (Current + Args.Parameters.SizeInBytes > Section.end())
409 formatv(
"SRCI Args entries end beyond the section boundary", Section));
411 Args.Args.reserve(Args.Parameters.Count);
412 for (
size_t I :
llvm::seq(Args.Parameters.Count)) {
413 auto &Entry = Args.Args.emplace_back();
415 readString(Section, Current, Section.end() - Current, Entry.first,
419 readString(Section, Current, Section.end() - Current, Entry.second,
424 return Current - Section.begin();
427static Expected<size_t>
431 switch (Header.Type) {
432 case SectionType::SourceNames: {
433 SourceInfo.Names.GenericHeader = Header;
434 return parseNames(SectionData, SourceInfo.Names);
436 case SectionType::SourceContents: {
437 SourceInfo.Contents.GenericHeader = Header;
440 case SectionType::Args: {
441 SourceInfo.Args.GenericHeader = Header;
442 return parseArgs(SectionData, SourceInfo.Args);
449Error DXContainer::parseSourceInfo(StringRef Part) {
453 return parseFailed(
"more than one SRCI part is present in the file");
454 SourceInfo.emplace();
456 const char *Current = Part.
begin();
459 Current +=
sizeof(SourceInfo->Parameters);
461 if (SourceInfo->Parameters.AlignedSizeInBytes > Part.
size())
463 "greater than SRCI part size ({1} bytes)",
464 SourceInfo->Parameters.AlignedSizeInBytes,
466 if (SourceInfo->Parameters.Flags)
467 return parseFailed(
"SRCI header flags must be zero");
468 if (SourceInfo->Parameters.SectionCount != 3)
469 return parseFailed(
"SRCI part must contain 3 sections");
472 SectionType::LLVM_BITMASK_LARGEST_ENUMERATOR) +
474 std::fill(IsSectionPresent,
476 sizeof(IsSectionPresent) /
sizeof(*IsSectionPresent),
478 for (uint32_t Section = 0;
Section < SourceInfo->Parameters.SectionCount;
489 formatv(
"SRCI section {0} (#{1}) extends beyond the part boundary",
490 SectionName, Section));
493 formatv(
"SRCI section {0} (#{1}) header flags must be zero",
494 SectionName, Section));
499 formatv(
"unknown SRCI section type {0}", SectionTypeIdx));
500 if (IsSectionPresent[SectionTypeIdx])
502 "more than one {0} section is present in SRCI part", SectionName));
503 IsSectionPresent[SectionTypeIdx] =
true;
505 size_t SectionBytesRead = 0;
511 .moveInto(SectionBytesRead))
513 BytesRead += SectionBytesRead;
518 "size of SRCI section {0} (#{1} - {2} bytes) does not match size "
519 "specified in generic header ({3} bytes)",
520 SectionName, Section, BytesRead,
SectionHeader.AlignedSizeInBytes));
524 if (SourceInfo->Contents.Parameters.Count !=
525 SourceInfo->Names.Parameters.Count)
527 "SRCI Contents entries count is not equal to SRCI Names entries count");
529 for (
size_t I :
llvm::seq(SourceInfo->Contents.Parameters.Count))
530 if (SourceInfo->Contents.Entries[
I].Parameters.ContentSizeInBytes !=
531 SourceInfo->Names.Entries[
I].Parameters.ContentSizeInBytes)
533 "content size for entry {0} ({1} bytes) in SRCI Contents section "
534 "does not match with size in SRCI Names section ({2} bytes)",
535 I, SourceInfo->Contents.Entries[
I].Parameters.ContentSizeInBytes,
536 SourceInfo->Names.Entries[
I].Parameters.ContentSizeInBytes));
541Error DXContainer::parsePartOffsets() {
542 uint32_t LastOffset =
543 sizeof(dxbc::Header) + (Header.PartCount *
sizeof(uint32_t));
544 const char *Current =
Data.getBuffer().data() +
sizeof(dxbc::Header);
545 for (uint32_t Part = 0; Part < Header.PartCount; ++Part) {
549 if (PartOffset < LastOffset)
552 "Part offset for part {0} begins before the previous part ends",
555 Current +=
sizeof(uint32_t);
556 if (PartOffset >=
Data.getBufferSize())
557 return parseFailed(
"Part offset points beyond boundary of the file");
564 return parseFailed(
"File not large enough to read part name");
565 PartOffsets.push_back(PartOffset);
569 uint32_t PartDataStart = PartOffset +
sizeof(dxbc::PartHeader);
572 Data.getBufferStart() + PartOffset + 4,
573 PartSize,
"part size"))
575 StringRef PartData =
Data.getBuffer().substr(PartDataStart, PartSize);
576 LastOffset = PartOffset + PartSize;
578 case dxbc::PartType::DXIL:
579 case dxbc::PartType::ILDB:
580 if (
Error Err = parseDXILHeader(PT, PartData))
583 case dxbc::PartType::ILDN:
584 if (
Error Err = parseDebugName(PartData))
587 case dxbc::PartType::PRIV:
588 if (
Error Err = parsePrivateData(PartData))
591 case dxbc::PartType::SFI0:
592 if (
Error Err = parseShaderFeatureFlags(PartData))
595 case dxbc::PartType::HASH:
596 if (
Error Err = parseHash(PartData))
599 case dxbc::PartType::PSV0:
600 if (
Error Err = parsePSVInfo(PartData))
603 case dxbc::PartType::ISG1:
604 if (
Error Err = InputSignature.initialize(PartData))
607 case dxbc::PartType::OSG1:
608 if (
Error Err = OutputSignature.initialize(PartData))
611 case dxbc::PartType::PSG1:
612 if (
Error Err = PatchConstantSignature.initialize(PartData))
617 case dxbc::PartType::RTS0:
618 if (
Error Err = parseRootSignature(PartData))
621 case dxbc::PartType::SRCI:
622 if (
Error Err = parseSourceInfo(PartData))
625 case dxbc::PartType::VERS:
626 if (
Error Err = parseCompilerVersionInfo(PartData))
632 if (DXIL && DebugDXIL &&
633 DXIL->first.ShaderKind != DebugDXIL->first.ShaderKind)
635 "ILDB part shader kind does not match DXIL part shader kind");
640 std::optional<uint16_t> ShaderKind = getShaderKind();
642 return parseFailed(
"cannot fully parse pipeline state validation "
643 "information without DXIL or ILDB part");
644 if (
Error Err = PSVInfo->parse(*ShaderKind))
651 DXContainer Container(Object);
652 if (
Error Err = Container.parseHeader())
653 return std::move(Err);
654 if (
Error Err = Container.parsePartOffsets())
655 return std::move(Err);
659void DXContainer::PartIterator::updateIteratorImpl(
const uint32_t Offset) {
660 StringRef Buffer = Container.Data.getBuffer();
667 IteratorState.Offset =
Offset;
671 const char *Current = PartData.begin();
674 if (PartData.size() < 6 *
sizeof(
uint32_t))
676 "Invalid root signature, insufficient space for header.");
685 RootParametersOffset =
693 StaticSamplersOffset =
700 ParametersHeaders.Data = PartData.substr(
701 RootParametersOffset,
704 StaticSamplers.Stride = (Version <= 2)
708 StaticSamplers.Data = PartData.substr(StaticSamplersOffset,
709 static_cast<size_t>(NumStaticSamplers) *
710 StaticSamplers.Stride);
718 const char *Current = Data.begin();
725 if (PSVInfoData.
size() < Size)
727 "Pipeline state data extends beyond the bounds of the part");
734 if (PSVVersion == 3) {
735 v3::RuntimeInfo Info;
739 Info.swapBytes(ShaderStage);
741 }
else if (PSVVersion == 2) {
742 v2::RuntimeInfo Info;
746 Info.swapBytes(ShaderStage);
748 }
else if (PSVVersion == 1) {
749 v1::RuntimeInfo Info;
753 Info.swapBytes(ShaderStage);
755 }
else if (PSVVersion == 0) {
756 v0::RuntimeInfo Info;
760 Info.swapBytes(ShaderStage);
764 "Cannot read PSV Runtime Info, unsupported PSV version.");
773 if (ResourceCount > 0) {
778 size_t BindingDataSize = Resources.Stride * ResourceCount;
779 Resources.Data = Data.substr(Current - Data.begin(), BindingDataSize);
781 if (Resources.Data.size() < BindingDataSize)
783 "Resource binding data extends beyond the bounds of the part");
785 Current += BindingDataSize;
787 Resources.Stride =
sizeof(v2::ResourceBindInfo);
794 Current =
reinterpret_cast<const char *
>(
801 if (StringTableSize % 4 != 0)
804 StringTable =
StringRef(Current, StringTableSize);
806 Current += StringTableSize;
808 uint32_t SemanticIndexTableSize = 0;
813 SemanticIndexTable.reserve(SemanticIndexTableSize);
814 for (
uint32_t I = 0;
I < SemanticIndexTableSize; ++
I) {
819 SemanticIndexTable.push_back(Index);
833 SigOutputElements.Stride = SigPatchOrPrimElements.Stride =
834 SigInputElements.Stride;
836 if (Data.end() - Current <
839 "Signature elements extend beyond the size of the part");
841 size_t InputSize = SigInputElements.Stride * InputCount;
842 SigInputElements.Data = Data.substr(Current - Data.begin(), InputSize);
843 Current += InputSize;
845 size_t OutputSize = SigOutputElements.Stride * OutputCount;
846 SigOutputElements.Data = Data.substr(Current - Data.begin(), OutputSize);
847 Current += OutputSize;
849 size_t PSize = SigPatchOrPrimElements.Stride * PatchOrPrimCount;
850 SigPatchOrPrimElements.Data = Data.substr(Current - Data.begin(), PSize);
863 return maskDwordSize(
Y) *
X * 4;
872 maskDwordSize(
static_cast<uint32_t>(OutputVectorCounts[
I]));
873 size_t NumBytes = NumDwords *
sizeof(
uint32_t);
874 OutputVectorMasks[
I].Data = Data.substr(Current - Data.begin(), NumBytes);
878 if (ShaderStage ==
Triple::Hull && PatchConstOrPrimVectorCount > 0) {
879 uint32_t NumDwords = maskDwordSize(PatchConstOrPrimVectorCount);
880 size_t NumBytes = NumDwords *
sizeof(
uint32_t);
881 PatchOrPrimMasks.Data = Data.substr(Current - Data.begin(), NumBytes);
888 if (InputVectorCount == 0 || OutputVectorCounts[
I] == 0)
890 uint32_t NumDwords = mapTableSize(InputVectorCount, OutputVectorCounts[
I]);
891 size_t NumBytes = NumDwords *
sizeof(
uint32_t);
892 InputOutputMap[
I].Data = Data.substr(Current - Data.begin(), NumBytes);
897 if (ShaderStage ==
Triple::Hull && PatchConstOrPrimVectorCount > 0 &&
898 InputVectorCount > 0) {
900 mapTableSize(InputVectorCount, PatchConstOrPrimVectorCount);
901 size_t NumBytes = NumDwords *
sizeof(
uint32_t);
902 InputPatchMap.Data = Data.substr(Current - Data.begin(), NumBytes);
907 if (ShaderStage ==
Triple::Domain && PatchConstOrPrimVectorCount > 0 &&
908 OutputVectorCounts[0] > 0) {
910 mapTableSize(PatchConstOrPrimVectorCount, OutputVectorCounts[0]);
911 size_t NumBytes = NumDwords *
sizeof(
uint32_t);
912 PatchOutputMap.Data = Data.substr(Current - Data.begin(), NumBytes);
920 if (
const auto *
P = std::get_if<dxbc::PSV::v3::RuntimeInfo>(&BasicInfo))
921 return P->SigInputElements;
922 if (
const auto *
P = std::get_if<dxbc::PSV::v2::RuntimeInfo>(&BasicInfo))
923 return P->SigInputElements;
924 if (
const auto *
P = std::get_if<dxbc::PSV::v1::RuntimeInfo>(&BasicInfo))
925 return P->SigInputElements;
930 if (
const auto *
P = std::get_if<dxbc::PSV::v3::RuntimeInfo>(&BasicInfo))
931 return P->SigOutputElements;
932 if (
const auto *
P = std::get_if<dxbc::PSV::v2::RuntimeInfo>(&BasicInfo))
933 return P->SigOutputElements;
934 if (
const auto *
P = std::get_if<dxbc::PSV::v1::RuntimeInfo>(&BasicInfo))
935 return P->SigOutputElements;
940 if (
const auto *
P = std::get_if<dxbc::PSV::v3::RuntimeInfo>(&BasicInfo))
941 return P->SigPatchOrPrimElements;
942 if (
const auto *
P = std::get_if<dxbc::PSV::v2::RuntimeInfo>(&BasicInfo))
943 return P->SigPatchOrPrimElements;
944 if (
const auto *
P = std::get_if<dxbc::PSV::v1::RuntimeInfo>(&BasicInfo))
945 return P->SigPatchOrPrimElements;
956 OS <<
"DXContainer does not support " << FeatureString;
969Expected<section_iterator>
997 PartIterator It =
reinterpret_cast<PartIterator
>(Sec.
p);
998 if (It == Parts.end())
1007 PartIterator It =
reinterpret_cast<PartIterator
>(Sec.
p);
1012 PartIterator It =
reinterpret_cast<PartIterator
>(Sec.
p);
1017 return (Sec.
p -
reinterpret_cast<uintptr_t>(Parts.begin())) /
1018 sizeof(PartIterator);
1022 PartIterator It =
reinterpret_cast<PartIterator
>(Sec.
p);
1023 return It->Data.size();
1027 PartIterator It =
reinterpret_cast<PartIterator
>(Sec.
p);
1089 Sec.
p =
reinterpret_cast<uintptr_t>(Parts.begin());
1094 Sec.
p =
reinterpret_cast<uintptr_t>(Parts.end());
1101 return "DirectX Container";
1124 return ExC.takeError();
1126 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.
ArrayRef(const T &OneElt) -> ArrayRef< T >
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Next
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