aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm/lib/IR/Pass.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-08-21 18:13:02 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-08-21 18:13:02 +0000
commit54db30ce18663e6c2991958f3b5d18362e8e93c4 (patch)
tree4aa6442802570767398cc83ba484e97b1309bdc2 /contrib/llvm/lib/IR/Pass.cpp
parent35284c22e9c8348159b7ce032ea45f2cdeb65298 (diff)
parente6d1592492a3a379186bfb02bd0f4eda0669c0d5 (diff)
downloadsrc-54db30ce18663e6c2991958f3b5d18362e8e93c4.tar.gz
src-54db30ce18663e6c2991958f3b5d18362e8e93c4.zip
Merge llvm trunk r366426, resolve conflicts, and update FREEBSD-Xlist.
Notes
Notes: svn path=/projects/clang900-import/; revision=351344
Diffstat (limited to 'contrib/llvm/lib/IR/Pass.cpp')
-rw-r--r--contrib/llvm/lib/IR/Pass.cpp33
1 files changed, 24 insertions, 9 deletions
diff --git a/contrib/llvm/lib/IR/Pass.cpp b/contrib/llvm/lib/IR/Pass.cpp
index a1dc17882493..699a7e17c0cb 100644
--- a/contrib/llvm/lib/IR/Pass.cpp
+++ b/contrib/llvm/lib/IR/Pass.cpp
@@ -1,9 +1,8 @@
//===- Pass.cpp - LLVM Pass Infrastructure Implementation -----------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -56,8 +55,13 @@ PassManagerType ModulePass::getPotentialPassManagerType() const {
return PMT_ModulePassManager;
}
+static std::string getDescription(const Module &M) {
+ return "module (" + M.getName().str() + ")";
+}
+
bool ModulePass::skipModule(Module &M) const {
- return !M.getContext().getOptPassGate().shouldRunPass(this, M);
+ OptPassGate &Gate = M.getContext().getOptPassGate();
+ return Gate.isEnabled() && !Gate.shouldRunPass(this, getDescription(M));
}
bool Pass::mustPreserveAnalysisID(char &AID) const {
@@ -155,11 +159,16 @@ PassManagerType FunctionPass::getPotentialPassManagerType() const {
return PMT_FunctionPassManager;
}
+static std::string getDescription(const Function &F) {
+ return "function (" + F.getName().str() + ")";
+}
+
bool FunctionPass::skipFunction(const Function &F) const {
- if (!F.getContext().getOptPassGate().shouldRunPass(this, F))
+ OptPassGate &Gate = F.getContext().getOptPassGate();
+ if (Gate.isEnabled() && !Gate.shouldRunPass(this, getDescription(F)))
return true;
- if (F.hasFnAttribute(Attribute::OptimizeNone)) {
+ if (F.hasOptNone()) {
LLVM_DEBUG(dbgs() << "Skipping pass '" << getPassName() << "' on function "
<< F.getName() << "\n");
return true;
@@ -186,13 +195,19 @@ bool BasicBlockPass::doFinalization(Function &) {
return false;
}
+static std::string getDescription(const BasicBlock &BB) {
+ return "basic block (" + BB.getName().str() + ") in function (" +
+ BB.getParent()->getName().str() + ")";
+}
+
bool BasicBlockPass::skipBasicBlock(const BasicBlock &BB) const {
const Function *F = BB.getParent();
if (!F)
return false;
- if (!F->getContext().getOptPassGate().shouldRunPass(this, BB))
+ OptPassGate &Gate = F->getContext().getOptPassGate();
+ if (Gate.isEnabled() && !Gate.shouldRunPass(this, getDescription(BB)))
return true;
- if (F->hasFnAttribute(Attribute::OptimizeNone)) {
+ if (F->hasOptNone()) {
// Report this only once per function.
if (&BB == &F->getEntryBlock())
LLVM_DEBUG(dbgs() << "Skipping pass '" << getPassName()