1
- // ===- HLSLRootSignature.cpp - HLSL Root Signature helper objects ----------===//
1
+ // ===- HLSLRootSignature.cpp - HLSL Root Signature helper objects
2
+ // ----------===//
2
3
//
3
4
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
5
// See https://llvm.org/LICENSE.txt for license information.
@@ -49,16 +50,15 @@ template <class... Ts> OverloadBuilds(Ts...) -> OverloadBuilds<Ts...>;
49
50
MDNode *MetadataBuilder::BuildRootSignature () {
50
51
for (const RootElement &Element : Elements) {
51
52
MDNode *ElementMD =
52
- std::visit (
53
- OverloadBuilds{
54
- [&](DescriptorTable Table) -> MDNode * {
55
- return BuildDescriptorTable (Table);
56
- },
57
- [&](DescriptorTableClause Clause) -> MDNode * {
58
- return BuildDescriptorTableClause (Clause);
59
- },
60
- },
61
- Element);
53
+ std::visit (OverloadBuilds{
54
+ [&](DescriptorTable Table) -> MDNode * {
55
+ return BuildDescriptorTable (Table);
56
+ },
57
+ [&](DescriptorTableClause Clause) -> MDNode * {
58
+ return BuildDescriptorTableClause (Clause);
59
+ },
60
+ },
61
+ Element);
62
62
GeneratedMetadata.push_back (ElementMD);
63
63
}
64
64
@@ -70,33 +70,39 @@ MDNode *MetadataBuilder::BuildDescriptorTable(const DescriptorTable &Table) {
70
70
SmallVector<Metadata *> TableOperands;
71
71
// Set the mandatory arguments
72
72
TableOperands.push_back (MDString::get (Ctx, " DescriptorTable" ));
73
- TableOperands.push_back (ConstantAsMetadata::get (B.getInt32 (llvm::to_underlying (Table.Visibility ))));
73
+ TableOperands.push_back (ConstantAsMetadata::get (
74
+ B.getInt32 (llvm::to_underlying (Table.Visibility ))));
74
75
75
76
// Remaining operands are references to the table's clauses. The in-memory
76
77
// representation of the Root Elements created from parsing will ensure that
77
78
// the previous N elements are the clauses for this table.
78
- assert (Table.NumClauses <= GeneratedMetadata.size () && " Table expected all owned clauses to be generated already" );
79
+ assert (Table.NumClauses <= GeneratedMetadata.size () &&
80
+ " Table expected all owned clauses to be generated already" );
79
81
// So, add a refence to each clause to our operands
80
- TableOperands.append (GeneratedMetadata.end () - Table.NumClauses , GeneratedMetadata.end ());
82
+ TableOperands.append (GeneratedMetadata.end () - Table.NumClauses ,
83
+ GeneratedMetadata.end ());
81
84
// Then, remove those clauses from the general list of Root Elements
82
85
GeneratedMetadata.pop_back_n (Table.NumClauses );
83
86
84
87
return MDNode::get (Ctx, TableOperands);
85
88
}
86
89
87
- MDNode *MetadataBuilder::BuildDescriptorTableClause (const DescriptorTableClause &Clause) {
90
+ MDNode *MetadataBuilder::BuildDescriptorTableClause (
91
+ const DescriptorTableClause &Clause) {
88
92
IRBuilder<> B (Ctx);
89
- return MDNode::get (Ctx, {
90
- ClauseTypeToName (Ctx, Clause.Type ),
91
- ConstantAsMetadata::get (B.getInt32 (Clause.NumDescriptors )),
92
- ConstantAsMetadata::get (B.getInt32 (Clause.Register .Number )),
93
- ConstantAsMetadata::get (B.getInt32 (Clause.Space )),
94
- ConstantAsMetadata::get (B.getInt32 (llvm::to_underlying (Clause.Offset ))),
95
- ConstantAsMetadata::get (B.getInt32 (llvm::to_underlying (Clause.Flags ))),
96
- });
93
+ return MDNode::get (
94
+ Ctx, {
95
+ ClauseTypeToName (Ctx, Clause.Type ),
96
+ ConstantAsMetadata::get (B.getInt32 (Clause.NumDescriptors )),
97
+ ConstantAsMetadata::get (B.getInt32 (Clause.Register .Number )),
98
+ ConstantAsMetadata::get (B.getInt32 (Clause.Space )),
99
+ ConstantAsMetadata::get (
100
+ B.getInt32 (llvm::to_underlying (Clause.Offset ))),
101
+ ConstantAsMetadata::get (
102
+ B.getInt32 (llvm::to_underlying (Clause.Flags ))),
103
+ });
97
104
}
98
105
99
106
} // namespace root_signature
100
107
} // namespace hlsl
101
108
} // namespace llvm
102
-
0 commit comments