13#ifndef LLVM_PLUGINS_PASSPLUGIN_H
14#define LLVM_PLUGINS_PASSPLUGIN_H
37#define LLVM_PLUGIN_API_VERSION 3
102 if (Info.RegisterPassBuilderCallbacks)
103 Info.RegisterPassBuilderCallbacks(
PB);
110 if (Info.PreCodeGenCallback)
111 return Info.PreCodeGenCallback(M, TM, CGFT, OS);
120 sys::DynamicLibrary Library;
121 PassPluginLibraryInfo Info;
133#pragma clang diagnostic push
134#pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
150extern "C" LLVM_ABI_NOT_EXPORTED ::llvm::PassPluginLibraryInfo
154#pragma clang diagnostic pop
AMDGPU Mark last scratch load
#define LLVM_ATTRIBUTE_WEAK
static constexpr StringLiteral Filename
PassBuilder PB(Machine, PassOpts->PTO, std::nullopt, &PIC)
LLVM_ABI_NOT_EXPORTED::llvm::PassPluginLibraryInfo LLVM_ATTRIBUTE_WEAK llvmGetPassPluginInfo()
The public entry point for a pass plugin.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Lightweight error class with error context and mandatory checking.
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.
uint32_t getAPIVersion() const
Get the plugin API version.
void registerPassBuilderCallbacks(PassBuilder &PB) const
Invoke the PassBuilder callback registration.
const PassPluginLibraryInfo & getInfo() const
StringRef getPluginVersion() const
Get the plugin version.
StringRef getPluginName() const
Get the plugin name.
StringRef getFilename() const
Get the filename of the loaded plugin.
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.
LLVM_ABI Error passPluginArguments(ArrayRef< PassPluginLibraryInfo > Infos, ArrayRef< std::string > Args)
Passes each "<PluginName>,<arg>" in Args to the ParseArguments callback of the extension in Infos wit...
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.
Error(* ParseArguments)(ArrayRef< const char * > Args)
Callback receiving the arguments given to the plugin, e.g.
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.