Fix GCC build problem with 288f05f related to SmallVector. (#116958)
[llvm-project.git] / mlir / examples / standalone / standalone-plugin / standalone-plugin.cpp
blobd2dcdc96b3cce3377e633134a32a4430252897f1
1 //===- standalone-plugin.cpp ------------------------------------*- C++ -*-===//
2 //
3 // This file is licensed under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "mlir/IR/MLIRContext.h"
10 #include "mlir/InitAllDialects.h"
11 #include "mlir/Tools/Plugins/DialectPlugin.h"
13 #include "Standalone/StandaloneDialect.h"
14 #include "Standalone/StandalonePasses.h"
15 #include "mlir/Tools/Plugins/PassPlugin.h"
16 #include "llvm/Config/llvm-config.h"
17 #include "llvm/Support/Compiler.h"
19 using namespace mlir;
21 /// Dialect plugin registration mechanism.
22 /// Observe that it also allows to register passes.
23 /// Necessary symbol to register the dialect plugin.
24 extern "C" LLVM_ATTRIBUTE_WEAK DialectPluginLibraryInfo
25 mlirGetDialectPluginInfo() {
26 return {MLIR_PLUGIN_API_VERSION, "Standalone", LLVM_VERSION_STRING,
27 [](DialectRegistry *registry) {
28 registry->insert<mlir::standalone::StandaloneDialect>();
29 mlir::standalone::registerPasses();
30 }};
33 /// Pass plugin registration mechanism.
34 /// Necessary symbol to register the pass plugin.
35 extern "C" LLVM_ATTRIBUTE_WEAK PassPluginLibraryInfo mlirGetPassPluginInfo() {
36 return {MLIR_PLUGIN_API_VERSION, "StandalonePasses", LLVM_VERSION_STRING,
37 []() { mlir::standalone::registerPasses(); }};