Crates.io | llvm-mca-macros |
lib.rs | llvm-mca-macros |
version | |
source | src |
created_at | 2024-11-07 22:54:05.184319 |
updated_at | 2024-11-07 22:54:05.184319 |
description | Procedural macros for generating `llvm-mca` marker comments |
homepage | https://github.com/philipturnbull/llvm-mca |
repository | https://github.com/philipturnbull/llvm-mca |
max_upload_size | |
id | 1440401 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
llvm-mca-macros
Procedural macros to generate marker comments for LLVM's Machine Code Analyzer.
These macros generate markers after the function epilogue and before the function prologue. If more granularity is needed, you can use the llvm-mca
crate instead.
By default, llvm_mca
will disable inlining. For example, this:
use llvm_mca_macros::llvm_mca;
#[llvm_mca]
fn quadruple(x: u32) -> u32 {
let doubled = x + x;
doubled + doubled
}
will generate the equivalent of:
#[inline(never)]
fn quadruple(x: u32) -> u32 {
// emit `LLVM-MCA-BEGIN` marker
let ret = {
let doubled = x + x;
doubled + doubled
};
// emit `LLVM-MCA-END` marker
ret
}
If inlining is desired, the allow_inline
attribute can be specified:
use llvm_mca_macros::llvm_mca;
#[llvm_mca(allow_inline)]
fn quadruple(x: u32) -> u32 {
let doubled = x + x;
doubled + doubled
}
This will generate the equivalent of:
fn quadruple(x: u32) -> u32 {
// emit `LLVM-MCA-BEGIN` marker
let ret = {
let doubled = x + x;
doubled + doubled
};
// emit `LLVM-MCA-END` marker
ret
}
You must set the RUSTFLAGS="--emit asm"
option when building your project with cargo
. For example:
RUSTFLAGS="--emit asm" cargo build --release
This will output assembly files in target/*/deps