[llvm] Remark Util introduce remark count (PR #66214)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 25 05:50:02 PDT 2023


================
@@ -0,0 +1,339 @@
+//===- RemarkCounter.cpp --------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// Generic tool to count remarks based on properties
+//
+//===----------------------------------------------------------------------===//
+#include "RemarkCounter.h"
+#include "RemarkUtilRegistry.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Regex.h"
+
+using namespace llvm;
+using namespace remarks;
+using namespace llvm::remarkutil;
+
+static cl::SubCommand CountSub("count",
+                               "Collect remarks based on specified criteria.");
+
+INPUT_FORMAT_COMMAND_LINE_OPTIONS(CountSub)
+INPUT_OUTPUT_COMMAND_LINE_OPTIONS(CountSub)
+
+static cl::list<std::string>
+    Keys("args", cl::desc("Specify remark argument/s to count by."),
+         cl::value_desc("arguments"), cl::sub(CountSub), cl::ValueOptional);
+static cl::list<std::string> RKeys(
+    "rargs",
+    cl::desc(
+        "Specify remark argument/s to count by. using regular expressions"),
+    cl::value_desc("arguments"), cl::sub(CountSub), cl::ValueOptional);
+static cl::opt<std::string>
+    RemarkNameOpt("remark-name",
+                  cl::desc("optional remark name to filter collection by."),
+                  cl::ValueOptional, cl::sub(CountSub));
+static cl::opt<std::string>
+    PassNameOpt("pass-name", cl::ValueOptional,
+                cl::desc("optional remark pass name to filter collection by."),
+                cl::sub(CountSub));
+
+static cl::opt<std::string> RemarkFilterArgByOpt(
+    "filter-arg-by", cl::desc("optional remark arg to filter collection by."),
+    cl::ValueOptional, cl::sub(CountSub));
+static cl::opt<std::string>
+    RemarkNameOptRE("rremark-name",
+                    cl::desc("optional remark name to filter collection by "
+                             "(accepts regular expressions)."),
+                    cl::ValueOptional, cl::sub(CountSub));
+static cl::opt<std::string>
+    RemarkArgFilterOptRE("rfilter-arg-by",
+                         cl::desc("optional remark arg to filter collection by "
----------------
fhahn wrote:

```suggestion
                         cl::desc("Optional remark arg to filter collection by "
```

https://github.com/llvm/llvm-project/pull/66214


More information about the llvm-commits mailing list