pacak /cargo-show-asm

cargo subcommand showing the assembly, LLVM-IR and MIR generated for Rust code

★ 998⑂ 52👁 4⑃ 364● 126▤ 0◈ 12
RustApache-2.0Created 2022-03-04
998
stars
52
forks
4
watchers
364
prs
126
issues
0
releases
12
discussions

README

cargo-show-asm

A cargo subcommand that displays the Assembly, LLVM-IR, MIR and WASM generated for Rust source code.

 Install

console
$ cargo install cargo-show-asm


 Features

- Platform support:

  - OS: Linux and macOS. Limited support for Windows
  - Rust: nightly and stable.
  - Architectures: x86, x86_64, aarch64, etc.
  - Cross-compilation support.

- Displaying:

  - Assembly in Intel or AT&T syntax.
  - Corresponding Rust source code alongside assembly.
  - llvm-ir.
  - rustc MIR
  - Wasm code
  - llvm-mca analysis

 cargo asm

Show the code rustc generates for any function

Usage: cargo asm \[-p=_SPEC_\] \[_ARTIFACT_\] \[-M=_ARG_\]... \[_TARGET-CPU_\] \[--rust\] \[-c=_COUNT_\] \[--simplify\] \[--include-constants\] \[--json\] \[--this-workspace | --all-crates | --all-sources\] _OUTPUT-FORMAT_ \[--callers-of _REGEX_ \[_DEPTH_\]\] (--everything | \[_FUNCTION_\]... \[_INDEX_\])

 Usage:
 1. Focus on a single assembly producing target:

  text
   % cargo asm -p isin --lib    here we are targeting lib in isin crate


  
 2. Narrow down a function:

  text
   % cargo asm -p isin --lib from_  here "from_" is part of the function you are interested intel


  
 3. Get the full results:

  text
   % cargo asm -p isin --lib isin::base36::from_alphanum
  


Pick artifact for analysis:
-     --lib — 
  Show results from library code
-     --test=_TEST_ — 
  Show results from an integration test
-     --bench=_BENCH_ — 
  Show results from a benchmark
-     --example=_EXAMPLE_ — 
  Show results from an example
-     --bin=_BIN_ — 
  Show results from a binary



Cargo options
-     --manifest-path=_PATH_ — 
  Path to Cargo.toml, defaults to one in current folder
-     --config=__ — 
  Override a cargo configuration value
-     --target-dir=_DIR_ — 
  Use custom target directory for generated artifacts, create if missing
   
  Uses environment variable CARGO_TARGET_DIR
-     --dry — 
  Produce a build plan instead of actually building
-     --frozen — 
  Requires Cargo.lock and cache to be up-to-date
-     --locked — 
  Requires Cargo.lock to be up-to-date
-     --offline — 
  Run without accessing the network
- -q, --quiet — 
  Do not print cargo log messages
-     --no-default-features — 
  Do not activate default feature
-     --all-features — 
  Activate all available features
- -F, --features=_FEATURE_ — 
  A feature to activate, can be used multiple times
-     --release — 
  Compile in release mode (default)
-     --dev — 
  Compile in dev mode
-     --profile=_PROFILE_ — 
  Build for this specific profile, you can also use dev and release here
   
  Uses environment variable CARGO_SHOW_ASM_PROFILE
-     --target=_TRIPLE_ — 
  Build for the target triple
- -C=_FLAG_ — 
  Codegen flags to rustc, see 'rustc -C help' for details
- -Z=_FLAG_ — 
  Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for detail

Top issues

Discussions

Snapshot: 2026-11-11T21:00:35Z · Data license Apache-2.0 · JSON