| 1 | //===- RuntimeLibcallInfo.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 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "llvm/Analysis/RuntimeLibcallInfo.h" |
| 10 | #include "llvm/InitializePasses.h" |
| 11 | |
| 12 | using namespace llvm; |
| 13 | |
| 14 | AnalysisKey RuntimeLibraryAnalysis::Key; |
| 15 | |
| 16 | RTLIB::RuntimeLibcallsInfo |
| 17 | RuntimeLibraryAnalysis::run(const Module &M, ModuleAnalysisManager &) { |
| 18 | return RTLIB::RuntimeLibcallsInfo(M, ABIName, VecLib); |
| 19 | } |
| 20 | |
| 21 | INITIALIZE_PASS(RuntimeLibraryInfoWrapper, "runtime-library-info" , |
| 22 | "Runtime Library Function Analysis" , false, true) |
| 23 | |
| 24 | RuntimeLibraryInfoWrapper::RuntimeLibraryInfoWrapper() : ImmutablePass(ID) {} |
| 25 | |
| 26 | RuntimeLibraryInfoWrapper::RuntimeLibraryInfoWrapper(StringRef ABIName, |
| 27 | VectorLibrary VecLib) |
| 28 | : ImmutablePass(ID), RTLA(ABIName, VecLib) {} |
| 29 | |
| 30 | char RuntimeLibraryInfoWrapper::ID = 0; |
| 31 | |
| 32 | ModulePass *llvm::createRuntimeLibraryInfoWrapperPass() { |
| 33 | return new RuntimeLibraryInfoWrapper(); |
| 34 | } |
| 35 | |
| 36 | void RuntimeLibraryInfoWrapper::getAnalysisUsage(AnalysisUsage &AU) const { |
| 37 | AU.setPreservesAll(); |
| 38 | } |
| 39 | |
| 40 | // Assume this is stable unless explicitly invalidated. |
| 41 | bool RTLIB::RuntimeLibcallsInfo::invalidate( |
| 42 | Module &M, const PreservedAnalyses &PA, |
| 43 | ModuleAnalysisManager::Invalidator &) { |
| 44 | auto PAC = PA.getChecker<RuntimeLibraryAnalysis>(); |
| 45 | return !PAC.preservedWhenStateless(); |
| 46 | } |
| 47 | |