summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/LegacyPassManager.cpp
diff options
context:
space:
mode:
authorWeiming Zhao <weimingz@codeaurora.org>2016-01-06 22:55:03 +0000
committerWeiming Zhao <weimingz@codeaurora.org>2016-01-06 22:55:03 +0000
commit0f1762caf97f72ba2dbc3696de51e9c3894e80c4 (patch)
tree05eba76fa9b23c10913edc256c94e983ba727d9a /llvm/lib/IR/LegacyPassManager.cpp
parentcf07a311072ce67f6c32050dc608d0cf1b0184da (diff)
downloadbcm5719-llvm-0f1762caf97f72ba2dbc3696de51e9c3894e80c4.tar.gz
bcm5719-llvm-0f1762caf97f72ba2dbc3696de51e9c3894e80c4.zip
Recommit r256952 "Filtering IR printing for print-after-all/print-before-all"
Fix lit test fail due to outputting an extra line. Differential Revision: http://reviews.llvm.org/D15776 llvm-svn: 256987
Diffstat (limited to 'llvm/lib/IR/LegacyPassManager.cpp')
-rw-r--r--llvm/lib/IR/LegacyPassManager.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/IR/LegacyPassManager.cpp b/llvm/lib/IR/LegacyPassManager.cpp
index f2e0c7d32c0..63d89f21b35 100644
--- a/llvm/lib/IR/LegacyPassManager.cpp
+++ b/llvm/lib/IR/LegacyPassManager.cpp
@@ -28,6 +28,7 @@
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <map>
+#include <unordered_set>
using namespace llvm;
using namespace llvm::legacy;
@@ -83,6 +84,13 @@ PrintAfterAll("print-after-all",
llvm::cl::desc("Print IR after each pass"),
cl::init(false));
+static cl::list<std::string>
+ PrintFuncsList("filter-print-funcs", cl::value_desc("function names"),
+ cl::desc("Only print IR for functions whose name "
+ "match this for all print-[before|after][-all] "
+ "options"),
+ cl::CommaSeparated);
+
/// This is a helper to determine whether to print IR before or
/// after a pass.
@@ -109,6 +117,11 @@ static bool ShouldPrintAfterPass(const PassInfo *PI) {
return PrintAfterAll || ShouldPrintBeforeOrAfterPass(PI, PrintAfter);
}
+bool llvm::isFunctionInPrintList(StringRef FunctionName) {
+ static std::unordered_set<std::string> PrintFuncNames(PrintFuncsList.begin(),
+ PrintFuncsList.end());
+ return PrintFuncNames.empty() || PrintFuncNames.count(FunctionName);
+}
/// isPassDebuggingExecutionsOrMore - Return true if -debug-pass=Executions
/// or higher is specified.
bool PMDataManager::isPassDebuggingExecutionsOrMore() const {
OpenPOWER on IntegriCloud