Expand description
Plugin API for creating LLVM pass plugins.
This module provides types for building LLVM plugins that can be loaded by
opt, clang, or other LLVM tools via --load-pass-plugin.
§Usage
Create a cdylib crate and use the plugin attribute macro:
ⓘ
#[llvm_pm::plugin(name = "my_plugin", version = "0.1")]
fn plugin_registrar(builder: &mut llvm_pm::plugin::PassBuilder) {
builder.add_module_pipeline_parsing_callback(|name, mpm| {
if name == "my-pass" {
mpm.add_pass(MyPass);
llvm_pm::plugin::PipelineParsing::Parsed
} else {
llvm_pm::plugin::PipelineParsing::NotParsed
}
});
}Structs§
- Pass
Builder - Handle to LLVM’s
PassBuilder, received by plugin registrar functions. - Pass
Plugin Library Info - Information returned by
llvmGetPassPluginInfo. - Plugin
Function Pass Manager - A borrowed function pass manager received in plugin pipeline parsing callbacks.
- Plugin
Module Pass Manager - A borrowed module pass manager received in plugin pipeline parsing callbacks.
Enums§
- Pipeline
Parsing - Enum describing whether a pipeline parsing callback successfully parsed its given pipeline element.
Functions§
- plugin_
api_ version - Return the LLVM plugin API version.
Attribute Macros§
- plugin
- Attribute macro for defining an LLVM plugin.