LLVM 23.0.0git
DXContainerInfo.h
Go to the documentation of this file.
1//===----- llvm/MC/DXContainerInfo.h - DXContainer Info ---------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_MC_DXCONTAINERINFO_H
10#define LLVM_MC_DXCONTAINERINFO_H
11
14
15namespace llvm {
16
17class raw_ostream;
18
19namespace mcdxbc {
20
32
47
48struct SourceInfo {
55
56 struct SourceContents : public Section {
57 struct Entry {
59 std::string FileContent;
60
61 /// Compute Parameters based on FileContent.
62 LLVM_ABI void compute();
63 };
64
67
68 /// Compute Parameters based on the content of Args.
69 /// Sizes are computed assuming CompressionType == None.
70 LLVM_ABI void
72 /// Update Parameters based on the compressed size of section content.
73 LLVM_ABI void computeFinalSize(uint32_t CompressedSize);
74 };
75
76 struct SourceNames : public Section {
77 struct Header {
81
82 Header() {}
83 LLVM_ABI Header(const dxbc::SourceInfo::Names::HeaderOnDisk &H);
84
90 };
91
92 struct Entry {
95
96 /// Compute Parameters based on FileName and FileContent.
97 LLVM_ABI void compute(uint32_t ContentSize);
98 };
99
102
103 /// Compute headers based on the content of entries.
104 LLVM_ABI void compute();
105 };
106
107 struct ProgramArgs : public Section {
108 using Entry = std::pair<StringRef, StringRef>;
109
112
113 /// Compute Parameters based on Args.
114 LLVM_ABI void compute();
115 };
116
121
122 /// Compute Parameters based on the content of sections.
123 LLVM_ABI void compute();
124};
125
126/// This data structure is a helper for reading and writing SourceInfo data.
127/// This structure is used to represent the extracted data in an inspectable and
128/// modifiable format, and can be used to serialize the data back into valid
129/// SourceInfo.
131 bool IsFilled = false;
132 bool IsFinalized = false;
135
139
140 void addFile(StringRef Name, StringRef Content) {
141 FileNamesAndContents.emplace_back(Name, Content);
142 }
144 Args.emplace_back(Name, Value);
145 }
146
148 LLVM_ABI void finalize();
149 LLVM_ABI void write(raw_ostream &OS) const;
150
151private:
152 std::optional<dxbc::SourceInfo::Contents::CompressionType> CompressionType;
155
156 void recomputeAfterCompression(uint32_t CompressedSize);
157};
158
159} // namespace mcdxbc
160} // namespace llvm
161
162#endif // LLVM_MC_DXCONTAINERINFO_H
#define LLVM_ABI
Definition Compiler.h:215
#define H(x, y, z)
Definition MD5.cpp:56
This file defines the SmallString class.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition SmallString.h:26
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.
Definition StringRef.h:56
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:46
LLVM Value Representation.
Definition Value.h:75
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
void swapByteOrder(T &Value)
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI void setCommitSha(StringRef CommitSha)
LLVM_ABI void setVersionString(StringRef VersionString)
LLVM_ABI void write(raw_ostream &OS) const
dxbc::CompilerVersionHeader Parameters
dxbc::DebugNameHeader Parameters
LLVM_ABI void setFilename(StringRef DebugFilename)
LLVM_ABI void write(raw_ostream &OS) const
DebugName(dxbc::DebugNameHeader &Parameters, StringRef Filename)
This data structure is a helper for reading and writing SourceInfo data.
void addArg(StringRef Name, StringRef Value)
void setCompressionType(dxbc::SourceInfo::Contents::CompressionType Type)
SmallString< 128 > CompressedContents
LLVM_ABI void write(raw_ostream &OS) const
void addFile(StringRef Name, StringRef Content)
std::pair< StringRef, StringRef > Entry
LLVM_ABI void compute()
Compute Parameters based on Args.
dxbc::SourceInfo::Args::Header Parameters
LLVM_ABI void computeGenericHeader(uint32_t ContentSize, dxbc::SourceInfo::SectionType Type)
dxbc::SourceInfo::SectionHeader GenericHeader
LLVM_ABI void compute()
Compute Parameters based on FileContent.
dxbc::SourceInfo::Contents::Entry Parameters
LLVM_ABI void computeUncompressed(dxbc::SourceInfo::Contents::CompressionType Type)
Compute Parameters based on the content of Args.
LLVM_ABI void computeFinalSize(uint32_t CompressedSize)
Update Parameters based on the compressed size of section content.
dxbc::SourceInfo::Contents::Header Parameters
dxbc::SourceInfo::Names::Entry Parameters
LLVM_ABI void compute()
Compute headers based on the content of entries.
LLVM_ABI void compute()
Compute Parameters based on the content of sections.
dxbc::SourceInfo::Header Parameters