Skip to content

Commit d30e6e9

Browse files
committed
Address review comments.
Make the some helper funcs to static methods.
1 parent 46175f5 commit d30e6e9

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

mlir/include/mlir/Dialect/XeGPU/uArch/uArchBase.h

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,6 @@ enum class InstructionKind {
3737
// @TODO: Add more instructions as needed
3838
};
3939

40-
static llvm::StringRef toString(InstructionKind name) {
41-
switch (name) {
42-
case InstructionKind::DPAS:
43-
return "dpas";
44-
}
45-
llvm_unreachable("Unknown InstructionKind");
46-
}
47-
48-
static std::optional<InstructionKind>
49-
parseInstructionKind(llvm::StringRef str) {
50-
if (str.equals_insensitive("dpas"))
51-
return InstructionKind::DPAS;
52-
return std::nullopt;
53-
}
54-
5540
// A struct to represent basic information about an instruction.
5641
// The primary purpose of the Instruction struct is to provide a generic way to
5742
// represent information about an instruction and to use this information to
@@ -65,6 +50,20 @@ struct Instruction {
6550
// Get methods
6651
InstructionKind getInstructionKind() { return instKind; }
6752
InstructionScope getScope() { return scope; }
53+
static llvm::StringRef toString(InstructionKind instKind) {
54+
switch (instKind) {
55+
case InstructionKind::DPAS:
56+
return "dpas";
57+
}
58+
llvm_unreachable("Unknown InstructionKind");
59+
}
60+
61+
static std::optional<InstructionKind>
62+
parseInstructionKind(llvm::StringRef str) {
63+
if (str.equals_insensitive("dpas"))
64+
return InstructionKind::DPAS;
65+
return std::nullopt;
66+
}
6867

6968
protected:
7069
InstructionKind instKind; // Specific InstructionKind (e.g., DPAS)
@@ -168,7 +167,7 @@ struct uArch {
168167
llvm::SmallVector<StringRef, 8> getSupportedInstructionNames() const {
169168
llvm::SmallVector<StringRef, 8> instructionNames;
170169
for (const auto &inst : instructions) {
171-
instructionNames.push_back(toString(inst.first));
170+
instructionNames.push_back(Instruction::toString(inst.first));
172171
}
173172
return instructionNames;
174173
}

0 commit comments

Comments
 (0)