21 cl::desc(
"Embed PDB in shader container"));
38 uint64_t SectionSize = Part.Data.size();
39 assert(SectionSize < std::numeric_limits<uint32_t>::max() &&
40 "Section size too large for DXContainer");
50 assert(PartOffset < std::numeric_limits<uint32_t>::max() &&
51 "Part data too large for DXContainer");
55 uint64_t FileSize = PartStart + PartOffset;
56 assert(FileSize < std::numeric_limits<uint32_t>::max() &&
57 "File size too large for DXContainer");
60 W.write<
char>({
'D',
'X',
'B',
'C'});
75 uint64_t SectionSize = Part.Data.size();
76 unsigned Start = W.OS.tell();
97 if (TT.hasEnvironment())
103 memcpy(Header.Bitcode.Magic,
"DXIL", 4);
105 Header.Bitcode.MajorVersion = DXILVersion.
getMajor();
106 Header.Bitcode.MinorVersion = DXILVersion.
getMinor().value_or(0);
108 Header.Bitcode.Size = SectionSize;
114 W.write<
char>(Part.Data);
115 unsigned Size = W.OS.tell() - Start;
120void DXContainerObjectWriter::clearParts() {
122 SectionBuffers.clear();
131 SectionBuffers.emplace_back();
133 Asm->writeSectionData(OS, &Sec);
134 Parts.push_back({Sec.getName(),
StringRef(SectionBuffers.back())});
140 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"))
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.
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...
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.