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