[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
================
@@ -134,6 +134,27 @@ class Instrument {
StringRef getData() const { return Data; }
};
+class LatencyInstrument : public Instrument {
+ std::optional<unsigned> Latency;
+
+public:
+ static const llvm::StringRef DESC_NAME;
+ LatencyInstrument(StringRef Data) : Instrument(DESC_NAME, Data) {
+ // Skip spaces and tabs.
+ unsigned Position = Data.find_first_not_of(" \t");
+ if (Position >= Data.size())
+ // We reached the end of the comment. Bail out.
+ return;
+ Data = Data.drop_front(Position);
+ unsigned L = 0;
+ if (!Data.getAsInteger(10, L))
+ Latency = L;
+ }
+
+ bool hasValue() const { return bool(Latency); }
+ unsigned getLatency() { return *Latency; }
----------------
mshockwave wrote:
I believe this should also be `const`
https://github.com/llvm/llvm-project/pull/155420
More information about the llvm-commits
mailing list