34 uint64_t SectionSize = Part.Data.size();
35 assert(SectionSize < std::numeric_limits<uint32_t>::max() &&
36 "Section size too large for DXContainer");
46 assert(PartOffset < std::numeric_limits<uint32_t>::max() &&
47 "Part data too large for DXContainer");
51 uint64_t FileSize = PartStart + PartOffset;
52 assert(FileSize < std::numeric_limits<uint32_t>::max() &&
53 "File size too large for DXContainer");
56 W.write<
char>({
'D',
'X',
'B',
'C'});
71 uint64_t SectionSize = Part.Data.size();
72 unsigned Start = W.OS.tell();
93 if (TT.hasEnvironment())
99 memcpy(Header.Bitcode.Magic,
"DXIL", 4);
101 Header.Bitcode.MajorVersion = DXILVersion.
getMajor();
102 Header.Bitcode.MinorVersion = DXILVersion.
getMinor().value_or(0);
104 Header.Bitcode.Size = SectionSize;
110 W.write<
char>(Part.Data);
111 unsigned Size = W.OS.tell() - Start;
116void DXContainerObjectWriter::clearParts() {
118 SectionBuffers.clear();
127 SectionBuffers.emplace_back();
129 Asm->writeSectionData(OS, &Sec);
130 Parts.push_back({Sec.getName(),
StringRef(SectionBuffers.back())});
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
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.
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.
FunctionAddr VTableAddr uintptr_t uintptr_t Version
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.