[llvm] [MCA] Enable customization of individual instructions (PR #155420)
Min-Yih Hsu via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 17 10:19:47 PDT 2025
================
@@ -42,8 +43,45 @@ 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;
+}
+
+bool InstrumentManager::canCustomize(
+ const llvm::SmallVector<Instrument *> &IVec) const {
+ for (const auto I : IVec) {
+ if (I->getDesc() == LatencyInstrument::DESC_NAME) {
+ auto LatInst = static_cast<LatencyInstrument *>(I);
+ return LatInst->hasValue();
+ }
+ }
+ return false;
+}
+
+void InstrumentManager::customize(const llvm::SmallVector<Instrument *> &IVec,
+ InstrDesc &ID) const {
+ for (const auto I : IVec) {
+ if (I->getDesc() == LatencyInstrument::DESC_NAME) {
+ auto LatInst = static_cast<LatencyInstrument *>(I);
+ if (LatInst->hasValue()) {
+ auto Latency = LatInst->getLatency();
----------------
mshockwave wrote:
please spell out the type
https://github.com/llvm/llvm-project/pull/155420
More information about the llvm-commits
mailing list