llvm-mca
Macros to generate marker comments for LLVM's Machine Code Analyzer.
The llvm_mca_begin!
and llvm_mca_end!
macros will emit LLVM-MCA-BEGIN
and LLVM-MCA-END
markers, respectively.
If you want to automatically add markers to the beginning and end of a function, you can use the llvm-mca-macros
crate instead.
Usage
For example, this:
use ;
will generate the equivalent of:
Naming regions
Regions can also be named. This:
use ;
will generated the equivalent of:
See the Using Markers to Analyze Specific Code Blocks section of the LLVM docs for details about naming regions and how to nest them.
Generating assembly
You must set the RUSTFLAGS="--emit asm"
option when building your project with cargo
. For example:
RUSTFLAGS="--emit asm"
This will output assembly files in target/*/deps
.