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

58 size_t Idx = FindSequence(IndexBuffer, El.Indices);

59 if (Idx == npos) {

62 } else

64 FinalElements.push_back(FinalElement);

65 }

66}

67

70

74 case 0:

77 break;

78 case 1:

81 break;

82 case 2:

85 break;

86 case 3:

87 default:

90 }

91

92

94

95

96 OS.write(reinterpret_cast<const char *>(&BaseData), InfoSize);

97

99

101 if (ResourceCount > 0)

103

104 for (const auto &Res : Resources)

105 OS.write(reinterpret_cast<const char *>(&Res), BindingSize);

106

107

109 return;

110

112 static_cast<uint32_t>(DXConStrTabBuilder.getSize()),

114

115

116 DXConStrTabBuilder.write(OS);

117

118

121 for (auto I : IndexBuffer)

123

124 if (SignatureElements.size() > 0) {

125

129

130

131 OS.write(reinterpret_cast<const char *>(&SignatureElements[0]),

133 }

134

147}

148

153 BaseData.SigPatchOrPrimElements =

155

157

158

159

160 ProcessElementList(DXConStrTabBuilder, IndexBuffer, SignatureElements,

162 ProcessElementList(DXConStrTabBuilder, IndexBuffer, SignatureElements,

164 ProcessElementList(DXConStrTabBuilder, IndexBuffer, SignatureElements,

166

167 DXConStrTabBuilder.add(EntryName);

168

169 DXConStrTabBuilder.finalize();

170 for (auto ElAndName : zip(SignatureElements, SemanticNames)) {

172 StringRef Name = std::get<1>(ElAndName);

173 El.NameOffset = static_cast<uint32_t>(DXConStrTabBuilder.getOffset(Name));

176 }

177

180

182 return;

186 Res.swapBytes();

187}

188

191 SigParams.reserve(Params.size());

193

194

195

198

199 for (const auto &P : Params) {

200

203 FinalElement.Stream = P.Stream;

205 static_cast<uint32_t>(StrTabBuilder.add(P.Name)) + TableStart;

206 FinalElement.Index = P.Index;

208 FinalElement.CompType = P.CompType;

209 FinalElement.Register = P.Register;

210 FinalElement.Mask = P.Mask;

213 SigParams.push_back(FinalElement);

214 }

215

219 return std::tie(L.Stream, L.Register, L.NameOffset) <

220 std::tie(R.Stream, R.Register, R.NameOffset);

221 });

223 for (auto &El : SigParams)

224 El.swapBytes();

225

230 OS.write(reinterpret_cast<const char *>(&Header),

232 OS.write(reinterpret_cast<const char *>(SigParams.data()),

234 StrTabBuilder.write(OS);

235}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

static constexpr size_t npos

Definition DXContainerPSVInfo.cpp:19

static void ProcessElementList(StringTableBuilder &StrTabBuilder, SmallVectorImpl< uint32_t > &IndexBuffer, SmallVectorImpl< v0::SignatureElement > &FinalElements, SmallVectorImpl< StringRef > &SemanticNames, ArrayRef< PSVSignatureElement > Elements)

Definition DXContainerPSVInfo.cpp:35

static size_t FindSequence(ArrayRef< uint32_t > Buffer, ArrayRef< uint32_t > Sequence)

Definition DXContainerPSVInfo.cpp:21

Merge contiguous icmps into a memcmp

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)

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.

LLVM_ABI void finalizeInOrder()

Finalize the string table without reording it.

LLVM_ABI size_t add(CachedHashStringRef S, uint8_t Priority=0)

Add a string to the builder.

LLVM_ABI void write(raw_ostream &OS) const

void write(raw_ostream &OS)

Definition DXContainerPSVInfo.cpp:189

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)

void append_range(Container &C, Range &&R)

Wrapper function to append range R to container C.

FunctionAddr VTableAddr uintptr_t uintptr_t Version

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)

Definition DXContainerPSVInfo.cpp:149

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

Definition DXContainerPSVInfo.cpp:68

std::array< SmallVector< uint32_t >, 4 > OutputVectorMasks

std::array< SmallVector< uint32_t >, 4 > InputOutputMap