[llvm] [llvm-mca] Add optional identifier field to mca::Instruction (PR #97867)

Chinmay Deshpande via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 16 17:59:02 PDT 2024


chinmaydd wrote:

@michaelmaitland thanks for your comments. I understand that getting MCAD to work with upstream LLVM _without_ the metadata changes is possible. In fact, the version we have been maintaining has a branch that implements this.

But, we have been working on other use cases that may benefit from _not providing, but receiving_, metadata from MCAD. Consider the following disassembly sample - 

![image](https://github.com/user-attachments/assets/16642aef-1e65-445e-beed-8d3b077b6b3f)

This is part of the BinaryNinja (a reverse engineering framework) UI annotated with llvm-mca provided cycle counts. The red annotations highlight instructions that llvm-mca reports a `StallEvent` for. To facilitate this, we have the Broker register `HardwareEvent` listener. In the listener, we get the identifier for the instruction through the `InstRef` and update local storage to reflect this information.

We've had multiple folks be interested in using MCAD like this. Integrating timing information as part of a disassembler UI aids in quickly iterating over and understanding timing changes for different versions of the generated binary (maybe optimizations, patches, etc.) 
 

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


More information about the llvm-commits mailing list