27 std::unique_ptr<MCDXContainerTargetWriter> TargetObjectWriter;
30 DXContainerObjectWriter(std::unique_ptr<MCDXContainerTargetWriter> MOTW,
34 ~DXContainerObjectWriter()
override {}
57 assert(SectionSize < std::numeric_limits<uint32_t>::max() &&
58 "Section size too large for DXContainer");
65 if (Sec.getName() ==
"DXIL")
68 assert(PartOffset < std::numeric_limits<uint32_t>::max() &&
69 "Part data too large for DXContainer");
73 uint64_t FileSize = PartStart + PartOffset;
74 assert(FileSize < std::numeric_limits<uint32_t>::max() &&
75 "File size too large for DXContainer");
78 W.write<
char>({
'D',
'X',
'B',
'C'});
98 unsigned Start =
W.OS.tell();
104 if (Sec.getName() ==
"DXIL")
109 if (Sec.getName() ==
"DXIL") {
113 const Triple &
TT =
Asm.getContext().getTargetTriple();
115 uint8_t MajorVersion =
static_cast<uint8_t
>(
Version.getMajor());
116 uint8_t MinorVersion =
117 static_cast<uint8_t
>(
Version.getMinor().value_or(0));
120 if (
TT.hasEnvironment())
126 memcpy(Header.Bitcode.Magic,
"DXIL", 4);
128 Header.Bitcode.MajorVersion = DXILVersion.
getMajor();
129 Header.Bitcode.MinorVersion = DXILVersion.
getMinor().value_or(0);
137 Asm.writeSectionData(
W.OS, &Sec);
138 unsigned Size =
W.OS.tell() - Start;
146 return std::make_unique<DXContainerObjectWriter>(std::move(MOTW),
OS);
PowerPC TLS Dynamic Call Fixup
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
virtual ~MCDXContainerTargetWriter()
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Defines the object file and target independent interfaces used by the assembler backend to write nati...
Instances of this class represent a uniqued identifier for a section in the current translation unit.
This represents an "assembler immediate".
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Target - Wrapper for Target specific information.
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.
An abstract base class for streams implementations that also support a pwrite operation.
constexpr bool IsBigEndianHost
This is an optimization pass for GlobalISel generic memory operations.
std::unique_ptr< MCObjectWriter > createDXContainerObjectWriter(std::unique_ptr< MCDXContainerTargetWriter > MOTW, raw_pwrite_stream &OS)
Construct a new DXContainer writer instance.
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.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Implement std::hash so that hash_code can be used in STL containers.
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.