Skip to content

Commit 3edcce5

Browse files
author
joaosaffran
committed
formating
1 parent 5360947 commit 3edcce5

File tree

4 files changed

+64
-68
lines changed

4 files changed

+64
-68
lines changed

llvm/lib/Analysis/DXILMetadataAnalysis.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
using namespace llvm;
2525
using namespace dxil;
2626

27-
28-
2927
static ModuleMetadataInfo collectMetadataInfo(Module &M) {
3028
ModuleMetadataInfo MMDAI;
3129
Triple TT(Triple(M.getTargetTriple()));

llvm/lib/Target/DirectX/DXContainerGlobals.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#include "DXILShaderFlags.h"
1413
#include "DXILRootSignature.h"
14+
#include "DXILShaderFlags.h"
1515
#include "DirectX.h"
1616
#include "llvm/ADT/SmallVector.h"
1717
#include "llvm/ADT/StringExtras.h"
@@ -153,8 +153,7 @@ void DXContainerGlobals::addRootSignature(Module &M,
153153
SmallVector<GlobalValue *> &Globals) {
154154

155155
std::optional<ModuleRootSignature> MRS =
156-
getAnalysis<RootSignatureAnalysisWrapper>()
157-
.getRootSignature();
156+
getAnalysis<RootSignatureAnalysisWrapper>().getRootSignature();
158157
if (!MRS.has_value())
159158
return;
160159

llvm/lib/Target/DirectX/DXILRootSignature.cpp

+24-24
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
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

109112
AnalysisKey RootSignatureAnalysis::Key;
110113

111114
ModuleRootSignature 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
//===----------------------------------------------------------------------===//
126127
bool 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

139139
void RootSignatureAnalysisWrapper::getAnalysisUsage(AnalysisUsage &AU) const {
@@ -142,5 +142,5 @@ void RootSignatureAnalysisWrapper::getAnalysisUsage(AnalysisUsage &AU) const {
142142

143143
char 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)
+38-39
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
//===- DXILRootSignature.h - DXIL Root Signature helper objects ---------------===//
1+
//===- DXILRootSignature.h - 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.
@@ -11,7 +12,6 @@
1112
///
1213
//===----------------------------------------------------------------------===//
1314

14-
1515
#include "llvm/IR/Metadata.h"
1616
#include "llvm/IR/PassManager.h"
1717
#include "llvm/Pass.h"
@@ -20,56 +20,55 @@
2020
namespace llvm {
2121
namespace dxil {
2222

23+
enum class RootSignatureElementKind {
24+
None = 0,
25+
RootFlags = 1,
26+
RootConstants = 2,
27+
RootDescriptor = 3,
28+
DescriptorTable = 4,
29+
StaticSampler = 5
30+
};
2331

24-
enum class RootSignatureElementKind {
25-
None = 0,
26-
RootFlags = 1,
27-
RootConstants = 2,
28-
RootDescriptor = 3,
29-
DescriptorTable = 4,
30-
StaticSampler = 5
31-
};
32-
33-
struct ModuleRootSignature {
34-
uint32_t Version;
35-
uint32_t Flags;
32+
struct ModuleRootSignature {
33+
uint32_t Version;
34+
uint32_t Flags;
3635

37-
ModuleRootSignature() = default;
36+
ModuleRootSignature() = default;
3837

39-
bool parse( int32_t Version, NamedMDNode *Root);
40-
void write(raw_ostream &OS);
41-
};
38+
bool parse(int32_t Version, NamedMDNode *Root);
39+
void write(raw_ostream &OS);
40+
};
4241

43-
class RootSignatureAnalysis : public AnalysisInfoMixin<RootSignatureAnalysis> {
44-
friend AnalysisInfoMixin<RootSignatureAnalysis>;
45-
static AnalysisKey Key;
42+
class RootSignatureAnalysis : public AnalysisInfoMixin<RootSignatureAnalysis> {
43+
friend AnalysisInfoMixin<RootSignatureAnalysis>;
44+
static AnalysisKey Key;
4645

47-
public:
48-
RootSignatureAnalysis() = default;
46+
public:
47+
RootSignatureAnalysis() = default;
4948

50-
using Result = ModuleRootSignature;
49+
using Result = ModuleRootSignature;
5150

52-
ModuleRootSignature run(Module &M, ModuleAnalysisManager &AM);
53-
};
51+
ModuleRootSignature run(Module &M, ModuleAnalysisManager &AM);
52+
};
5453

55-
/// Wrapper pass for the legacy pass manager.
56-
///
57-
/// This is required because the passes that will depend on this are codegen
58-
/// passes which run through the legacy pass manager.
59-
class RootSignatureAnalysisWrapper : public ModulePass {
60-
std::optional<ModuleRootSignature> MRS;
54+
/// Wrapper pass for the legacy pass manager.
55+
///
56+
/// This is required because the passes that will depend on this are codegen
57+
/// passes which run through the legacy pass manager.
58+
class RootSignatureAnalysisWrapper : public ModulePass {
59+
std::optional<ModuleRootSignature> MRS;
6160

62-
public:
63-
static char ID;
61+
public:
62+
static char ID;
6463

65-
RootSignatureAnalysisWrapper() : ModulePass(ID) {}
64+
RootSignatureAnalysisWrapper() : ModulePass(ID) {}
6665

67-
const std::optional<ModuleRootSignature> &getRootSignature() { return MRS; }
66+
const std::optional<ModuleRootSignature> &getRootSignature() { return MRS; }
6867

69-
bool runOnModule(Module &M) override;
68+
bool runOnModule(Module &M) override;
7069

71-
void getAnalysisUsage(AnalysisUsage &AU) const override;
72-
};
70+
void getAnalysisUsage(AnalysisUsage &AU) const override;
71+
};
7372

7473
} // namespace dxil
7574
} // namespace llvm

0 commit comments

Comments
 (0)