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
37
39
41 void setVersionString(StringRef VersionString);
42 void write(raw_ostream &OS) const;
43
44private:
45 void updateContentSize();
46};
47
48struct SourceInfo {
55
56 struct SourceContents : public Section {
57 struct Entry {
59 std::string FileContent;
60
61 /// Compute Parameters based on FileContent.
62 void compute();
63 };
64
67
68 /// Compute Parameters based on the content of Args.
69 /// Sizes are computed assuming CompressionType == None.
71 /// Update Parameters based on the compressed size of section content.
72 void computeFinalSize(uint32_t CompressedSize);
73 };
74
75 struct SourceNames : public Section {
76 struct Header {
80
81 Header() {}
82 Header(const dxbc::SourceInfo::Names::HeaderOnDisk &H);
83
89 };
90
91 struct Entry {
94
95 /// Compute Parameters based on FileName and FileContent.
96 void compute(uint32_t ContentSize);
97 };
98
101
102 /// Compute headers based on the content of entries.
103 void compute();
104 };
105
106 struct ProgramArgs : public Section {
107 using Entry = std::pair<StringRef, StringRef>;
108
111
112 /// Compute Parameters based on Args.
113 void compute();
114 };
115
120
121 /// Compute Parameters based on the content of sections.
122 void compute();
123};
124
125/// This data structure is a helper for reading and writing SourceInfo data.
126/// This structure is used to represent the extracted data in an inspectable and
127/// modifiable format, and can be used to serialize the data back into valid
128/// SourceInfo.
130 bool IsFilled = false;
131 bool IsFinalized = false;
134
138
139 void addFile(StringRef Name, StringRef Content) {
140 FileNamesAndContents.emplace_back(Name, Content);
141 }
143 Args.emplace_back(Name, Value);
144 }
145
146 void computeEntries();
147 void finalize();
148 void write(raw_ostream &OS) const;
149
150private:
151 std::optional<dxbc::SourceInfo::Contents::CompressionType> CompressionType;
154
155 void recomputeAfterCompression(uint32_t CompressedSize);
156};
157
158} // namespace mcdxbc
159} // namespace llvm
160
161#endif // LLVM_MC_DXCONTAINERINFO_H
#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.
void setCommitSha(StringRef CommitSha)
void setVersionString(StringRef VersionString)
void write(raw_ostream &OS) const
dxbc::CompilerVersionHeader Parameters
dxbc::DebugNameHeader Parameters
void setFilename(StringRef DebugFilename)
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
void write(raw_ostream &OS) const
void addFile(StringRef Name, StringRef Content)
std::pair< StringRef, StringRef > Entry
void compute()
Compute Parameters based on Args.
dxbc::SourceInfo::Args::Header Parameters
void computeGenericHeader(uint32_t ContentSize, dxbc::SourceInfo::SectionType Type)
dxbc::SourceInfo::SectionHeader GenericHeader
void compute()
Compute Parameters based on FileContent.
dxbc::SourceInfo::Contents::Entry Parameters
void computeUncompressed(dxbc::SourceInfo::Contents::CompressionType Type)
Compute Parameters based on the content of Args.
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
void compute()
Compute headers based on the content of entries.
void compute()
Compute Parameters based on the content of sections.
dxbc::SourceInfo::Header Parameters