llvm-ir-analysis: Static analysis of LLVM IR

This crate provides several simple static analyses of LLVM IR. In particular, this crate computes the following on an [llvm-ir] Module:

All of the above analyses are provided by an [Analysis] object which lazily computes each of these structures on demand and caches the results.

Getting started

llvm-ir-analysis is on crates.io, so you can simply add it as a dependency in your Cargo.toml, selecting the feature corresponding to the LLVM version you want: toml [dependencies] llvm-ir-analysis = { version = "0.1.0", features = ["llvm-10"] } Currently, the supported LLVM versions are llvm-8, llvm-9, and llvm-10. The corresponding LLVM library must be available on your system; see the [llvm-sys] README for more details and instructions.

You'll also need some LLVM IR to analyze, in the form of an [llvm-ir] [Module]. This can be easily generated from an LLVM bitcode file; for more detailed instructions, see llvm-ir's README.

Then, you can construct an [Analysis] object: rust let module = Module::from_bc_path(...)?; let analysis = Analysis::new(&module); and you can get, e.g., the call graph via analysis.call_graph().