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

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 27 09:56:30 PDT 2025


================
@@ -42,19 +43,91 @@ CustomBehaviour::getEndViews(llvm::MCInstPrinter &IP,
   return std::vector<std::unique_ptr<View>>();
 }
 
+class CustomInstrument : public Instrument {
----------------
mshockwave wrote:

I think this can be solved in a much simpler way: given a line "LLVM-MCA-LATENCY: 100", the default `Instrument` could already provide you `Desc` and `Data` of "LLVM-MCA-LATENCY:" and "100" respectively. So I don't think you need the `CustomInstrument` here. 
And then for `supportsInstrumentType`, `canCustomize` and `customize` -- you could just put the implementation directly in the function, and call this base implementation for the target-specific override, if a target overrides it. Such that you don't need the slightly confusing `TargetIM` indirection.

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


More information about the llvm-commits mailing list