LLVM: lib/MC/DXContainerPSVInfo.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
14
15using namespace llvm;
18
20
23 if (Buffer.size() < Sequence.size())
25 for (size_t Idx = 0; Idx <= Buffer.size() - Sequence.size(); ++Idx) {
26 if (0 == memcmp(static_cast<const void *>(&Buffer[Idx]),
27 static_cast<const void *>(Sequence.begin()),
28 Sequence.size() * sizeof(uint32_t)))
29 return Idx;
30 }
32}
33
34static void
40 for (const auto &El : Elements) {
41
42 StrTabBuilder.add(El.Name);
44
47 FinalElement.Rows = static_cast<uint8_t>(El.Indices.size());
48 FinalElement.StartRow = El.StartRow;
49 FinalElement.Cols = El.Cols;
50 FinalElement.StartCol = El.StartCol;
51 FinalElement.Allocated = El.Allocated;
52 FinalElement.Kind = El.Kind;
53 FinalElement.Type = El.Type;
54 FinalElement.Mode = El.Mode;
55 FinalElement.DynamicMask = El.DynamicMask;
56 FinalElement.Stream = El.Stream;
57
61 IndexBuffer.insert(IndexBuffer.end(), El.Indices.begin(),
62 El.Indices.end());
63 } else
65 FinalElements.push_back(FinalElement);
66 }
67}
68
71
75 case 0:
78 break;
79 case 1:
82 break;
83 case 2:
86 break;
87 case 3:
88 default:
91 }
92
93
95
96
97 OS.write(reinterpret_cast<const char *>(&BaseData), InfoSize);
98
100
102 if (ResourceCount > 0)
104
105 for (const auto &Res : Resources)
106 OS.write(reinterpret_cast<const char *>(&Res), BindingSize);
107
108
110 return;
111
115
116
117 DXConStrTabBuilder.write(OS);
118
119
122 for (auto I : IndexBuffer)
124
125 if (SignatureElements.size() > 0) {
126
130
131
132 OS.write(reinterpret_cast<const char *>(&SignatureElements[0]),
134 }
135
148}
149
156
158
159
160
161 ProcessElementList(DXConStrTabBuilder, IndexBuffer, SignatureElements,
163 ProcessElementList(DXConStrTabBuilder, IndexBuffer, SignatureElements,
165 ProcessElementList(DXConStrTabBuilder, IndexBuffer, SignatureElements,
167
169
170 DXConStrTabBuilder.finalize();
171 for (auto ElAndName : zip(SignatureElements, SemanticNames)) {
177 }
178
181
183 return;
187 Res.swapBytes();
188}
189
194
195
196
199
200 for (const auto &P : Params) {
201
204 FinalElement.Stream = P.Stream;
206 static_cast<uint32_t>(StrTabBuilder.add(P.Name)) + TableStart;
207 FinalElement.Index = P.Index;
209 FinalElement.CompType = P.CompType;
210 FinalElement.Register = P.Register;
211 FinalElement.Mask = P.Mask;
214 SigParams.push_back(FinalElement);
215 }
216
220 return std::tie(L.Stream, L.Register, L.NameOffset) <
221 std::tie(R.Stream, R.Register, R.NameOffset);
222 });
224 for (auto &El : SigParams)
225 El.swapBytes();
226
231 OS.write(reinterpret_cast<const char *>(&Header),
233 OS.write(reinterpret_cast<const char *>(SigParams.data()),
236}
static constexpr size_t npos
static void ProcessElementList(StringTableBuilder &StrTabBuilder, SmallVectorImpl< uint32_t > &IndexBuffer, SmallVectorImpl< v0::SignatureElement > &FinalElements, SmallVectorImpl< StringRef > &SemanticNames, ArrayRef< PSVSignatureElement > Elements)
static size_t FindSequence(ArrayRef< uint32_t > Buffer, ArrayRef< uint32_t > Sequence)
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
Merge contiguous icmps into a memcmp
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void reserve(size_type N)
iterator insert(iterator I, T &&Elt)
void push_back(const T &Elt)
pointer data()
Return a pointer to the vector's buffer, even if empty().
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
static constexpr size_t npos
Utility for building string tables with deduplicated suffixes.
void finalizeInOrder()
Finalize the string table without reording it.
size_t getOffset(CachedHashStringRef S) const
Get the offest of a string in the string table.
void write(raw_ostream &OS) const
size_t add(CachedHashStringRef S)
Add a string to the builder.
void finalize()
Analyze the strings and build the final table.
void write(raw_ostream &OS)
This class implements an extremely fast bulk output stream that can only output to a stream.
raw_ostream & write(unsigned char C)
void write_array(raw_ostream &os, ArrayRef< value_type > values, endianness endian)
void write(void *memory, value_type value, endianness endian)
Write a value to memory with a particular endianness.
constexpr bool IsBigEndianHost
This is an optimization pass for GlobalISel generic memory operations.
detail::zippy< detail::zip_shortest, T, U, Args... > zip(T &&t, U &&u, Args &&...args)
zip iterator for two or more iteratable types.
void stable_sort(R &&Range)
uint8_t SigPatchOrPrimElements
uint8_t SigOutputElements
SigMinPrecision MinPrecision
D3DSystemValue SystemValue
SigComponentType CompType
dxbc::PSV::v3::RuntimeInfo BaseData
llvm::StringRef EntryName
SmallVector< uint32_t > PatchOrPrimMasks
SmallVector< uint32_t > PatchOutputMap
SmallVector< dxbc::PSV::v2::ResourceBindInfo > Resources
void finalize(Triple::EnvironmentType Stage)
SmallVector< PSVSignatureElement > InputElements
SmallVector< uint32_t > InputPatchMap
SmallVector< PSVSignatureElement > OutputElements
SmallVector< PSVSignatureElement > PatchOrPrimElements
void write(raw_ostream &OS, uint32_t Version=std::numeric_limits< uint32_t >::max()) const
std::array< SmallVector< uint32_t >, 4 > OutputVectorMasks
std::array< SmallVector< uint32_t >, 4 > InputOutputMap