21 cl::desc(
"Embed PDB in shader container"));
24 cl::desc(
"Strip debug information from shader bytecode"));
26 cl::desc(
"Generate slim PDB without ILDB part"));
52 bool HasPrivate =
false;
56 "PRIV must be the last section in a DXContainer");
57 if (Part.Name ==
"PRIV")
60 uint64_t SectionSize = Part.Data.size();
61 assert(SectionSize < std::numeric_limits<uint32_t>::max() &&
62 "Section size too large for DXContainer");
73 assert(PartOffset < std::numeric_limits<uint32_t>::max() &&
74 "Part data too large for DXContainer");
78 uint64_t FileSize = PartStart + PartOffset;
79 assert(FileSize < std::numeric_limits<uint32_t>::max() &&
80 "File size too large for DXContainer");
83 W.write<
char>({
'D',
'X',
'B',
'C'});
98 uint64_t SectionSize = Part.Data.size();
99 unsigned Start = W.OS.tell();
108 bool IsPrivate = Part.Name ==
"PRIV";
122 if (TT.hasEnvironment())
128 memcpy(Header.Bitcode.Magic,
"DXIL", 4);
130 Header.Bitcode.MajorVersion = DXILVersion.
getMajor();
131 Header.Bitcode.MinorVersion = DXILVersion.
getMinor().value_or(0);
133 Header.Bitcode.Size = SectionSize;
139 W.write<
char>(Part.Data);
141 unsigned Size = W.OS.tell() - Start;
147void DXContainerObjectWriter::clearParts() {
149 SectionBuffers.clear();
158 SectionBuffers.emplace_back();
160 Asm->writeSectionData(OS, &Sec);
161 Parts.push_back({Sec.getName(),
StringRef(SectionBuffers.back())});
167 size_t SectionSize) {
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
cl::opt< bool > EmbedDebug("dx-embed-debug", cl::desc("Embed PDB in shader container"))
cl::opt< bool > StripDebug("dx-strip-debug", cl::desc("Strip debug information from shader bytecode"))
cl::opt< bool > SlimDebug("dx-slim-debug", cl::desc("Generate slim PDB without ILDB part"))
Represent a constant reference to an array (0 or more elements consecutively in memory),...
uint64_t writeObject() override
Write the object file and returns the number of bytes written.
bool shouldSkipSection(StringRef SectionName, size_t SectionSize) override
ArrayRef< MCDXContainerPart > collectParts() override
void write(raw_ostream &OS, const Triple &TT)
virtual ArrayRef< MCDXContainerPart > collectParts()
virtual ~MCDXContainerBaseWriter()
virtual bool shouldSkipSection(StringRef SectionName, size_t SectionSize)
~MCDXContainerTargetWriter() override
MCContext & getContext() const
Instances of this class represent a uniqued identifier for a section in the current translation unit.
void push_back(const T &Elt)
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.
Triple - Helper class for working with autoconf configuration names.
Represents a version number in the form major[.minor[.subminor[.build]]].
unsigned getMajor() const
Retrieve the major version number.
std::optional< unsigned > getMinor() const
Retrieve the minor version number, if provided.
This class implements an extremely fast bulk output stream that can only output to a stream.
A raw_ostream that writes to an SmallVector or SmallString.
LLVM_ABI bool isProgramPart(StringRef PartName)
constexpr bool IsBigEndianHost
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI void reportFatalInternalError(Error Err)
Report a fatal error that indicates a bug in LLVM.
static constexpr StringLiteral ModuleHashSectionName
Contains module hash.
constexpr uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
uint64_t offsetToAlignment(uint64_t Value, Align Alignment)
Returns the offset to the next integer (mod 2**64) that is greater than or equal to Value and is a mu...
static constexpr StringLiteral PdbFileNameSectionName
Contains PDB output file name.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Adapter to write values to a stream in a particular byte order.