brintos

brintos / llvm-project-archived public Read only

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