[ARM] Masked load and store and predicate tests. NFC
[llvm-complete.git] / unittests / Passes / TestPlugin.cpp
blobe0ae861f16fc153a9934b45eab12e055f5fffe47
1 //===- unittests/Passes/Plugins/Plugin.cpp --------------------------------===//
2 //
3 // Part of the LLVM Project, 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 "llvm/Passes/PassBuilder.h"
10 #include "llvm/Passes/PassPlugin.h"
12 #include "TestPlugin.h"
14 using namespace llvm;
16 struct TestModulePass : public PassInfoMixin<TestModulePass> {
17 PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM) {
18 return PreservedAnalyses::all();
22 void registerCallbacks(PassBuilder &PB) {
23 PB.registerPipelineParsingCallback(
24 [](StringRef Name, ModulePassManager &PM,
25 ArrayRef<PassBuilder::PipelineElement> InnerPipeline) {
26 if (Name == "plugin-pass") {
27 PM.addPass(TestModulePass());
28 return true;
30 return false;
31 });
34 extern "C" ::llvm::PassPluginLibraryInfo LLVM_ATTRIBUTE_WEAK
35 llvmGetPassPluginInfo() {
36 return {LLVM_PLUGIN_API_VERSION, TEST_PLUGIN_NAME, TEST_PLUGIN_VERSION,
37 registerCallbacks};