[llvm] [MCA] New option -scheduling-info (PR #130574)
Min-Yih Hsu via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 17 10:42:27 PDT 2025
================
@@ -225,10 +225,51 @@ static cl::opt<unsigned> StoreQueueSize("squeue",
cl::desc("Size of the store queue"),
cl::cat(ToolOptions), cl::init(0));
-static cl::opt<bool>
- PrintInstructionTables("instruction-tables",
- cl::desc("Print instruction tables"),
- cl::cat(ToolOptions), cl::init(false));
+enum class InstructionTablesType { NONE, NORMAL, FULL };
+
+class InstructionTablesOptionParser
+ : public cl::parser<enum InstructionTablesType> {
+public:
+ explicit InstructionTablesOptionParser(cl::Option &O)
+ : cl::parser<enum InstructionTablesType>(O) {}
+
+ bool parse(cl::Option &O, StringRef ArgName, StringRef Arg,
+ enum InstructionTablesType &Value) {
+ if (Arg.empty()) {
+ Value = InstructionTablesType::NORMAL;
+ return false;
+ }
+ return cl::parser<enum InstructionTablesType>::parse(O, ArgName, Arg,
+ Value);
+ }
+};
+
+static cl::opt<enum InstructionTablesType, false, InstructionTablesOptionParser>
+ InstructionTablesOption(
+ "instruction-tables", cl::desc("Print instruction tables"),
+ cl::values(clEnumValN(InstructionTablesType::NONE, "none",
+ "Do not print instruction tables"),
+ clEnumValN(InstructionTablesType::NORMAL, "normal",
+ "Print instruction tables"),
+ clEnumValN(InstructionTablesType::FULL, "full",
+ "Print instruction tables with additional"
+ " information: bypass latency, LLVM opcode,"
+ " used resources")),
+ cl::cat(ToolOptions), cl::init(InstructionTablesType::NONE));
+
+bool PrintInstructionTables() {
+ if (InstructionTablesOption == InstructionTablesType::NONE)
+ return false;
+
+ return true;
+}
----------------
mshockwave wrote:
```suggestion
bool PrintInstructionTables() {
return PrintInstructionTables(InstructionTablesType::NONE);
}
```
https://github.com/llvm/llvm-project/pull/130574
More information about the llvm-commits
mailing list