LLVM: lib/Passes/PassPlugin.cpp Source File (original) (raw)
Go to the documentation of this file.
1
2
3
4
5
6
7
8
11
12#include
13
14using namespace llvm;
15
17 std::string Error;
18 auto Library =
20 if (!Library.isValid())
22 Filename + "': " + Error,
24
25 PassPlugin P{Filename, Library};
26
27
28
29 intptr_t getDetailsFn =
30 (intptr_t)Library.getAddressOfSymbol("llvmGetPassPluginInfo");
31
32 if (!getDetailsFn)
33
34
36 Filename + "'. Is this a legacy plugin?",
38
40
43 Twine("Wrong API version on plugin '") + Filename + "'. Got version " +
44 Twine(P.Info.APIVersion) + ", supported version is " +
47
48 if (.Info.RegisterPassBuilderCallbacks)
50 Filename + "'.'",
52
53 return P;
54}
::llvm::PassPluginLibraryInfo LLVM_ATTRIBUTE_WEAK llvmGetPassPluginInfo()
The public entry point for a pass plugin.
#define LLVM_PLUGIN_API_VERSION
\macro LLVM_PLUGIN_API_VERSION Identifies the API version understood by this plugin.
Lightweight error class with error context and mandatory checking.
Tagged union holding either a T or a Error.
static LLVM_ABI Expected< PassPlugin > Load(const std::string &Filename)
Attempts to load a pass plugin from a given file.
Definition PassPlugin.cpp:16
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
static LLVM_ABI DynamicLibrary getPermanentLibrary(const char *filename, std::string *errMsg=nullptr)
This function permanently loads the dynamic library at the given path using the library load operatio...
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.