28 std::unique_ptr<MCDXContainerTargetWriter> TargetObjectWriter;
31 DXContainerObjectWriter(std::unique_ptr<MCDXContainerTargetWriter> MOTW,
33 : W(
OS, support::little), TargetObjectWriter(
std::
move(MOTW)) {}
35 ~DXContainerObjectWriter()
override {}
62 assert(SectionSize < std::numeric_limits<uint32_t>::max() &&
63 "Section size too large for DXContainer");
70 if (Sec.getName() ==
"DXIL")
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'});
100 if (SectionSize == 0)
103 unsigned Start =
W.OS.tell();
109 if (Sec.getName() ==
"DXIL")
114 if (Sec.getName() ==
"DXIL") {
118 const Triple &
TT =
Asm.getContext().getTargetTriple();
120 Header.MajorVersion =
static_cast<uint8_t
>(
Version.getMajor());
122 Header.MinorVersion =
static_cast<uint8_t
>(*
Version.getMinor());
123 if (
TT.hasEnvironment())
129 memcpy(Header.Bitcode.Magic,
"DXIL", 4);
137 Asm.writeSectionData(
W.OS, &Sec, Layout);
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),...
Encapsulates the layout of an assembly file at a particular point in time.
uint64_t getSectionAddressSize(const MCSection *Sec) const
Get the address space size of the given section, as it effects layout.
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]]].
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.