20 return Name ==
"ISG1" || Name ==
"OSG1" || Name ==
"PSG1";
43 uint64_t PartOffset = 0;
44 bool HasPrivate =
false;
48 "PRIV must be the last section in a DXContainer");
49 if (Part.Name ==
"PRIV")
52 uint64_t SectionSize = Part.Data.size();
53 assert(SectionSize < std::numeric_limits<uint32_t>::max() &&
54 "Section size too large for DXContainer");
67 assert(PartOffset < std::numeric_limits<uint32_t>::max() &&
68 "Part data too large for DXContainer");
72 uint64_t FileSize = PartStart + PartOffset;
73 assert(FileSize < std::numeric_limits<uint32_t>::max() &&
74 "File size too large for DXContainer");
77 W.write<
char>({
'D',
'X',
'B',
'C'});
81 W.write<uint16_t>(1u);
82 W.write<uint16_t>(0u);
88 for (uint64_t
Offset : PartOffsets)
92 uint64_t SectionSize = Part.Data.size();
93 unsigned Start = W.OS.tell();
97 uint64_t PartSize = SectionSize;
102 bool IsPrivate = Part.Name ==
"PRIV";
104 if (!IsPrivate && !IsSignature)
117 if (TT.hasEnvironment())
123 memcpy(Header.Bitcode.Magic,
"DXIL", 4);
125 Header.Bitcode.MajorVersion = DXILVersion.
getMajor();
126 Header.Bitcode.MinorVersion = DXILVersion.
getMinor().value_or(0);
128 Header.Bitcode.Size = SectionSize;
134 W.write<
char>(Part.Data);
135 if (!IsPrivate && !IsSignature) {
136 unsigned Size = W.OS.tell() - Start;
142void DXContainerObjectWriter::clearParts() {
144 SectionBuffers.clear();
153 SectionBuffers.emplace_back();
155 Asm->writeSectionData(OS, &Sec);
156 Parts.push_back({Sec.getName(),
StringRef(SectionBuffers.back())});
162 size_t SectionSize) {
163 if (TargetObjectWriter->shouldSkipSection(
SectionName))
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static bool isSignaturePart(StringRef Name)
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.
LLVM_ABI void reportFatalInternalError(Error Err)
Report a fatal error that indicates a bug in LLVM.
static constexpr StringLiteral ModuleHashSectionName
Contains module hash.
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...
static constexpr StringLiteral PdbFileNameSectionName
Contains PDB output file name.
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.