summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/lib/Transforms/IPO/InferFunctionAttrs.cpp
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2020-08-03 15:06:44 +0000
committerpatrick <patrick@openbsd.org>2020-08-03 15:06:44 +0000
commitb64793999546ed8adebaeebd9d8345d18db8927d (patch)
tree4357c27b561d73b0e089727c6ed659f2ceff5f47 /gnu/llvm/lib/Transforms/IPO/InferFunctionAttrs.cpp
parentAdd support for UTF-8 DISPLAY-HINTs with octet length. For now only (diff)
downloadwireguard-openbsd-b64793999546ed8adebaeebd9d8345d18db8927d.tar.xz
wireguard-openbsd-b64793999546ed8adebaeebd9d8345d18db8927d.zip
Remove LLVM 8.0.1 files.
Diffstat (limited to 'gnu/llvm/lib/Transforms/IPO/InferFunctionAttrs.cpp')
-rw-r--r--gnu/llvm/lib/Transforms/IPO/InferFunctionAttrs.cpp79
1 files changed, 0 insertions, 79 deletions
diff --git a/gnu/llvm/lib/Transforms/IPO/InferFunctionAttrs.cpp b/gnu/llvm/lib/Transforms/IPO/InferFunctionAttrs.cpp
deleted file mode 100644
index 470f97b8ba6..00000000000
--- a/gnu/llvm/lib/Transforms/IPO/InferFunctionAttrs.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-//===- InferFunctionAttrs.cpp - Infer implicit function attributes --------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/Transforms/IPO/InferFunctionAttrs.h"
-#include "llvm/Analysis/TargetLibraryInfo.h"
-#include "llvm/IR/Function.h"
-#include "llvm/IR/LLVMContext.h"
-#include "llvm/IR/Module.h"
-#include "llvm/Support/Debug.h"
-#include "llvm/Support/raw_ostream.h"
-#include "llvm/Transforms/Utils/BuildLibCalls.h"
-using namespace llvm;
-
-#define DEBUG_TYPE "inferattrs"
-
-static bool inferAllPrototypeAttributes(Module &M,
- const TargetLibraryInfo &TLI) {
- bool Changed = false;
-
- for (Function &F : M.functions())
- // We only infer things using the prototype and the name; we don't need
- // definitions.
- if (F.isDeclaration() && !F.hasFnAttribute((Attribute::OptimizeNone)))
- Changed |= inferLibFuncAttributes(F, TLI);
-
- return Changed;
-}
-
-PreservedAnalyses InferFunctionAttrsPass::run(Module &M,
- ModuleAnalysisManager &AM) {
- auto &TLI = AM.getResult<TargetLibraryAnalysis>(M);
-
- if (!inferAllPrototypeAttributes(M, TLI))
- // If we didn't infer anything, preserve all analyses.
- return PreservedAnalyses::all();
-
- // Otherwise, we may have changed fundamental function attributes, so clear
- // out all the passes.
- return PreservedAnalyses::none();
-}
-
-namespace {
-struct InferFunctionAttrsLegacyPass : public ModulePass {
- static char ID; // Pass identification, replacement for typeid
- InferFunctionAttrsLegacyPass() : ModulePass(ID) {
- initializeInferFunctionAttrsLegacyPassPass(
- *PassRegistry::getPassRegistry());
- }
-
- void getAnalysisUsage(AnalysisUsage &AU) const override {
- AU.addRequired<TargetLibraryInfoWrapperPass>();
- }
-
- bool runOnModule(Module &M) override {
- if (skipModule(M))
- return false;
-
- auto &TLI = getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
- return inferAllPrototypeAttributes(M, TLI);
- }
-};
-}
-
-char InferFunctionAttrsLegacyPass::ID = 0;
-INITIALIZE_PASS_BEGIN(InferFunctionAttrsLegacyPass, "inferattrs",
- "Infer set function attributes", false, false)
-INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
-INITIALIZE_PASS_END(InferFunctionAttrsLegacyPass, "inferattrs",
- "Infer set function attributes", false, false)
-
-Pass *llvm::createInferFunctionAttrsLegacyPass() {
- return new InferFunctionAttrsLegacyPass();
-}