13#ifndef LLVM_PASSES_PASSPLUGIN_H
14#define LLVM_PASSES_PASSPLUGIN_H
36#define LLVM_PLUGIN_API_VERSION 2
94 if (Info.RegisterPassBuilderCallbacks)
95 Info.RegisterPassBuilderCallbacks(
PB);
102 if (Info.PreCodeGenCallback)
103 return Info.PreCodeGenCallback(M, TM, CGFT, OS);
109 : Filename(Filename), Library(Library),
Info() {}
111 std::string Filename;
112 sys::DynamicLibrary Library;
113 PassPluginLibraryInfo
Info;
119#pragma clang diagnostic push
120#pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
139#pragma clang diagnostic pop
Analysis containing CSE Info
#define LLVM_ATTRIBUTE_WEAK
PassBuilder PB(Machine, PassOpts->PTO, std::nullopt, &PIC)
::llvm::PassPluginLibraryInfo LLVM_ATTRIBUTE_WEAK llvmGetPassPluginInfo()
The public entry point for a pass plugin.
Tagged union holding either a T or a Error.
A Module instance is used to store all the information related to an LLVM module.
This class provides access to building LLVM's passes.
bool invokePreCodeGenCallback(Module &M, TargetMachine &TM, CodeGenFileType CGFT, raw_pwrite_stream &OS) const
Invoke the pre-codegen callback.
static LLVM_ABI Expected< PassPlugin > Load(const std::string &Filename)
Attempts to load a pass plugin from a given file.
uint32_t getAPIVersion() const
Get the plugin API version.
void registerPassBuilderCallbacks(PassBuilder &PB) const
Invoke the PassBuilder callback registration.
StringRef getPluginVersion() const
Get the plugin version.
StringRef getPluginName() const
Get the plugin name.
StringRef getFilename() const
Get the filename of the loaded plugin.
StringRef - Represent a constant reference to a string, i.e.
Primary interface to the complete machine description for the target machine.
An abstract base class for streams implementations that also support a pwrite operation.
This class provides a portable interface to dynamic libraries which also might be known as shared lib...
This is an optimization pass for GlobalISel generic memory operations.
CodeGenFileType
These enums are meant to be passed into addPassesToEmitFile to indicate what type of file to emit,...
Information about the plugin required to load its passes.
const char * PluginName
A meaningful name of the plugin.
uint32_t APIVersion
The API version understood by this plugin, usually LLVM_PLUGIN_API_VERSION.
bool(* PreCodeGenCallback)(Module &, TargetMachine &, CodeGenFileType, raw_pwrite_stream &OS)
Callback called before running the back-end passes on the module.
void(* RegisterPassBuilderCallbacks)(PassBuilder &)
The callback for registering plugin passes with a PassBuilder instance.
const char * PluginVersion
The version of the plugin.