10 #include "llvm/Support/raw_ostream.h"
19 llvm::sys::DynamicLibrary::getPermanentLibrary(filename.c_str(), &error);
20 if (!library.isValid())
21 return llvm::make_error<llvm::StringError>(
22 Twine(
"Could not load library '") + filename +
"': " + error,
23 llvm::inconvertibleErrorCode());
29 intptr_t getDetailsFn =
30 (intptr_t)library.getAddressOfSymbol(
"mlirGetDialectPluginInfo");
33 return llvm::make_error<llvm::StringError>(
34 Twine(
"Plugin entry point not found in '") + filename,
35 llvm::inconvertibleErrorCode());
41 return llvm::make_error<llvm::StringError>(
42 Twine(
"Wrong API version on plugin '") + filename +
"'. Got version " +
43 Twine(plugin.info.apiVersion) +
", supported version is " +
45 llvm::inconvertibleErrorCode());
47 if (!plugin.info.registerDialectRegistryCallbacks)
48 return llvm::make_error<llvm::StringError>(
49 Twine(
"Empty entry callback in plugin '") + filename +
"'.'",
50 llvm::inconvertibleErrorCode());
::mlir::DialectPluginLibraryInfo LLVM_ATTRIBUTE_WEAK mlirGetDialectPluginInfo()
The public entry point for a dialect plugin.
#define MLIR_PLUGIN_API_VERSION
\macro MLIR_PLUGIN_API_VERSION Identifies the API version understood by this plugin.
static llvm::Expected< DialectPlugin > load(const std::string &filename)
Attempts to load a dialect plugin from a given file.
Include the generated interface declarations.