1- // ===- DXILRootSignature.cpp - DXIL Root Signature helper objects ----===//
1+ // ===- DXILRootSignature.cpp - DXIL Root Signature helper objects ------- ===//
22//
33// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44// See https://llvm.org/LICENSE.txt for license information.
@@ -68,8 +68,8 @@ static bool parseRootSignatureElement(LLVMContext *Ctx,
6868 case RootSignatureElementKind::RootFlags:
6969 return parseRootFlags (Ctx, MRS, Element);
7070 case RootSignatureElementKind::None:
71- return reportError (Ctx,
72- " Invalid Root Element: " + ElementText->getString ());
71+ return reportError (Ctx, " Invalid Root Signature Element: " +
72+ ElementText->getString ());
7373 }
7474
7575 llvm_unreachable (" Root signature element kind not expected." );
@@ -78,20 +78,6 @@ static bool parseRootSignatureElement(LLVMContext *Ctx,
7878static bool parse (LLVMContext *Ctx, ModuleRootSignature &MRS, MDNode *Node) {
7979 bool HasError = false ;
8080
81- /* * Root Signature are specified as following in the metadata:
82-
83- !dx.rootsignatures = !{!2} ; list of function/root signature pairs
84- !2 = !{ ptr @main, !3 } ; function, root signature
85- !3 = !{ !4, !5, !6, !7 } ; list of root signature elements
86-
87- So for each MDNode inside dx.rootsignatures NamedMDNode
88- (the Root parameter of this function), the parsing process needs
89- to loop through each of its operands and process the function,
90- signature pair.
91- */
92-
93- // Get the Root Signature Description from the function signature pair.
94-
9581 // Loop through the Root Elements of the root signature.
9682 for (const auto &Operand : Node->operands ()) {
9783 MDNode *Element = dyn_cast<MDNode>(Operand);
@@ -114,6 +100,18 @@ static bool validate(LLVMContext *Ctx, const ModuleRootSignature &MRS) {
114100static SmallDenseMap<const Function *, ModuleRootSignature>
115101analyzeModule (Module &M) {
116102
103+ /* * Root Signature are specified as following in the metadata:
104+
105+ !dx.rootsignatures = !{!2} ; list of function/root signature pairs
106+ !2 = !{ ptr @main, !3 } ; function, root signature
107+ !3 = !{ !4, !5, !6, !7 } ; list of root signature elements
108+
109+ So for each MDNode inside dx.rootsignatures NamedMDNode
110+ (the Root parameter of this function), the parsing process needs
111+ to loop through each of its operands and process the function,
112+ signature pair.
113+ */
114+
117115 LLVMContext *Ctx = &M.getContext ();
118116
119117 SmallDenseMap<const Function *, ModuleRootSignature> MRSMap;
@@ -129,22 +127,22 @@ analyzeModule(Module &M) {
129127 continue ;
130128 }
131129
130+ // Function was pruned during compilation.
132131 const MDOperand &FunctionPointerMdNode = RSDefNode->getOperand (0 );
133132 if (FunctionPointerMdNode == nullptr ) {
134- // Function was pruned during compilation.
135133 continue ;
136134 }
137135
138136 ValueAsMetadata *VAM =
139137 llvm::dyn_cast<ValueAsMetadata>(FunctionPointerMdNode.get ());
140138 if (VAM == nullptr ) {
141- reportError (Ctx, " First element of root signature is not a value " );
139+ reportError (Ctx, " First element of root signature is not a Value " );
142140 continue ;
143141 }
144142
145143 Function *F = dyn_cast<Function>(VAM->getValue ());
146144 if (F == nullptr ) {
147- reportError (Ctx, " First element of root signature is not a function " );
145+ reportError (Ctx, " First element of root signature is not a Function " );
148146 continue ;
149147 }
150148
0 commit comments