1- // ===- DXILRootSignature.cpp - DXIL Root Signature helper objects ---------------===//
1+ // ===- DXILRootSignature.cpp - DXIL Root Signature helper objects
2+ // ---------------===//
23//
34// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
45// See https://llvm.org/LICENSE.txt for license information.
@@ -28,15 +29,17 @@ static bool parseRootFlags(ModuleRootSignature *MRS, MDNode *RootFlagNode) {
2829 auto *Flag = mdconst::extract<ConstantInt>(RootFlagNode->getOperand (1 ));
2930 auto Value = Flag->getZExtValue ();
3031
31- // Root Element validation, as specified: https://github.com/llvm/wg-hlsl/blob/main/proposals/0002-root-signature-in-clang.md#validations-during-dxil-generation
32+ // Root Element validation, as specified:
33+ // https://github.com/llvm/wg-hlsl/blob/main/proposals/0002-root-signature-in-clang.md#validations-during-dxil-generation
3234 if ((Value & ~0x80000fff ) != 0 )
3335 return true ;
3436
3537 MRS->Flags = Value;
3638 return false ;
3739}
3840
39- static bool parseRootSignatureElement (ModuleRootSignature *MRS, MDNode *Element) {
41+ static bool parseRootSignatureElement (ModuleRootSignature *MRS,
42+ MDNode *Element) {
4043 MDString *ElementText = cast<MDString>(Element->getOperand (0 ));
4144
4245 assert (ElementText != nullptr && " First preoperty of element is not " );
@@ -72,8 +75,7 @@ static bool parseRootSignatureElement(ModuleRootSignature *MRS, MDNode *Element)
7275 return true ;
7376}
7477
75- bool ModuleRootSignature::parse ( int32_t Version,
76- NamedMDNode *Root) {
78+ bool ModuleRootSignature::parse (int32_t Version, NamedMDNode *Root) {
7779 this ->Version = Version;
7880 bool HasError = false ;
7981
@@ -103,37 +105,35 @@ void ModuleRootSignature::write(raw_ostream &OS) {
103105 Out.swapBytes ();
104106 }
105107
106- OS.write (reinterpret_cast <const char *>(&Out), sizeof (dxbc::RootSignatureDesc));
108+ OS.write (reinterpret_cast <const char *>(&Out),
109+ sizeof (dxbc::RootSignatureDesc));
107110}
108111
109112AnalysisKey RootSignatureAnalysis::Key;
110113
111114ModuleRootSignature RootSignatureAnalysis::run (Module &M,
112- ModuleAnalysisManager &AM) {
113- ModuleRootSignature MRSI;
115+ ModuleAnalysisManager &AM) {
116+ ModuleRootSignature MRSI;
114117
115- NamedMDNode *RootSignatureNode = M.getNamedMetadata (" dx.rootsignatures" );
116- if (RootSignatureNode) {
117- MRSI.parse (1 , RootSignatureNode);
118- }
119-
120- return MRSI;
118+ NamedMDNode *RootSignatureNode = M.getNamedMetadata (" dx.rootsignatures" );
119+ if (RootSignatureNode) {
120+ MRSI.parse (1 , RootSignatureNode);
121+ }
121122
123+ return MRSI;
122124}
123125
124-
125126// ===----------------------------------------------------------------------===//
126127bool RootSignatureAnalysisWrapper::runOnModule (Module &M) {
127128 ModuleRootSignature MRS;
128129
129- NamedMDNode *RootSignatureNode = M.getNamedMetadata (" dx.rootsignatures" );
130- if (RootSignatureNode) {
131- MRS.parse (1 , RootSignatureNode);
132- this ->MRS = MRS;
133- }
134-
130+ NamedMDNode *RootSignatureNode = M.getNamedMetadata (" dx.rootsignatures" );
131+ if (RootSignatureNode) {
132+ MRS.parse (1 , RootSignatureNode);
133+ this ->MRS = MRS;
134+ }
135135
136- return false ;
136+ return false ;
137137}
138138
139139void RootSignatureAnalysisWrapper::getAnalysisUsage (AnalysisUsage &AU) const {
@@ -142,5 +142,5 @@ void RootSignatureAnalysisWrapper::getAnalysisUsage(AnalysisUsage &AU) const {
142142
143143char RootSignatureAnalysisWrapper::ID = 0 ;
144144
145- INITIALIZE_PASS (RootSignatureAnalysisWrapper, " dx-root-signature-analysis" ,
146- " DXIL Root Signature Analysis" , true , true )
145+ INITIALIZE_PASS (RootSignatureAnalysisWrapper, " dx-root-signature-analysis" ,
146+ " DXIL Root Signature Analysis" , true , true )
0 commit comments