File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
lib/SILOptimizer/UtilityPasses Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -29,19 +29,37 @@ using namespace swift;
29
29
// Options
30
30
// ===----------------------------------------------------------------------===//
31
31
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
+
32
41
// ===----------------------------------------------------------------------===//
33
42
// Top Level Driver
34
43
// ===----------------------------------------------------------------------===//
35
44
36
45
namespace {
46
+
37
47
class SILCFGPrinter : public SILFunctionTransform {
38
48
// / The entry point to the transformation.
39
49
void run () override {
40
50
SILFunction *F = getFunction ();
41
51
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
+
42
59
F->viewCFG ();
43
60
}
44
61
};
62
+
45
63
} // end anonymous namespace
46
64
47
65
SILTransform *swift::createCFGPrinter () {
You can’t perform that action at this time.
0 commit comments