[llvm] [MCA] Enable customization of individual instructions (PR #155420)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 16 10:33:57 PDT 2025


================
@@ -42,8 +43,35 @@ CustomBehaviour::getEndViews(llvm::MCInstPrinter &IP,
   return std::vector<std::unique_ptr<View>>();
 }
 
+const llvm::StringRef LatencyInstrument::DESC_NAME = "LATENCY";
+
+bool InstrumentManager::supportsInstrumentType(StringRef Type) const {
+  return EnableInstruments && Type == LatencyInstrument::DESC_NAME;
----------------
mshockwave wrote:

assuming a target-specific InstrumentManager also wants to support latency instrument, then I don't think it can do something like this right?
``` c++
bool MyTargetInstrumentManager::supportsInstrumentType(StirngRef Type) const override {
  // target-specific logics
  return InstrumentManager::supportsInstrumentType(Type);
}
```
is there a more ergonomic way to use latency instrument (or any default instruments added in the future) from a target IM? Should we set `EnableInstruments` default to true?

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


More information about the llvm-commits mailing list