28 uint64_t SectionSize = Asm.getSectionAddressSize(Sec);
33 assert(SectionSize < std::numeric_limits<uint32_t>::max() &&
34 "Section size too large for DXContainer");
41 if (Sec.getName() ==
"DXIL")
44 assert(PartOffset < std::numeric_limits<uint32_t>::max() &&
45 "Part data too large for DXContainer");
49 uint64_t FileSize = PartStart + PartOffset;
50 assert(FileSize < std::numeric_limits<uint32_t>::max() &&
51 "File size too large for DXContainer");
54 W.
write<
char>({
'D',
'X',
'B',
'C'});
69 uint64_t SectionSize = Asm.getSectionAddressSize(Sec);
74 unsigned Start = W.
OS.
tell();
80 if (Sec.getName() ==
"DXIL")
85 if (Sec.getName() ==
"DXIL") {
89 const Triple &TT = Asm.getContext().getTargetTriple();
96 if (TT.hasEnvironment())
102 memcpy(Header.Bitcode.Magic,
"DXIL", 4);
104 Header.Bitcode.MajorVersion = DXILVersion.
getMajor();
105 Header.Bitcode.MinorVersion = DXILVersion.
getMinor().value_or(0);
107 Header.Bitcode.Size = SectionSize;
113 Asm.writeSectionData(W.
OS, &Sec);
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
uint64_t writeObject(MCAssembler &Asm) override
Write the object file and returns the number of bytes written.
virtual ~MCDXContainerTargetWriter()
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.
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.
raw_ostream & write_zeros(unsigned NumZeros)
write_zeros - Insert 'NumZeros' nulls.
uint64_t tell() const
tell - Return the current offset with the file.
constexpr bool IsBigEndianHost
This is an optimization pass for GlobalISel generic memory operations.
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...
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
This struct is a compact representation of a valid (non-zero power of two) alignment.
void write(ArrayRef< value_type > Val)