Skip to content

Commit 9de2f72

Browse files
committed
---
yaml --- r: 345949 b: refs/heads/master c: abe703a h: refs/heads/master i: 345947: 2375b64
1 parent d6da747 commit 9de2f72

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 635eef202f6ca5ea62f0360767ad0cf2aaaef06b
2+
refs/heads/master: abe703a4fd50a909198ed13d7c8c3ce8a8f605f5
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/lib/SILOptimizer/UtilityPasses/CFGPrinter.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,37 @@ using namespace swift;
2929
// Options
3030
//===----------------------------------------------------------------------===//
3131

32+
llvm::cl::opt<std::string> SILViewCFGOnlyFun(
33+
"sil-view-cfg-only-function", llvm::cl::init(""),
34+
llvm::cl::desc("Only produce a graphviz file for this function"));
35+
36+
llvm::cl::opt<std::string> SILViewCFGOnlyFuns(
37+
"sil-view-cfg-only-functions", llvm::cl::init(""),
38+
llvm::cl::desc("Only produce a graphviz file for the sil for the functions "
39+
"whose name contains this substring"));
40+
3241
//===----------------------------------------------------------------------===//
3342
// Top Level Driver
3443
//===----------------------------------------------------------------------===//
3544

3645
namespace {
46+
3747
class SILCFGPrinter : public SILFunctionTransform {
3848
/// The entry point to the transformation.
3949
void run() override {
4050
SILFunction *F = getFunction();
4151

52+
// If we are not supposed to dump view this cfg, return.
53+
if (!SILViewCFGOnlyFun.empty() && F && F->getName() != SILViewCFGOnlyFun)
54+
return;
55+
if (!SILViewCFGOnlyFuns.empty() && F &&
56+
F->getName().find(SILViewCFGOnlyFuns, 0) == StringRef::npos)
57+
return;
58+
4259
F->viewCFG();
4360
}
4461
};
62+
4563
} // end anonymous namespace
4664

4765
SILTransform *swift::createCFGPrinter() {

0 commit comments

Comments
 (0)