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