Skip to content

Commit 5357a1d

Browse files
authored
Merge pull request swiftlang#39048 from meg-gupta/viewcfgfix
Add a flag to only view the shape of the cfg and disable instruction printing in viewcfg
2 parents a35ae7a + 37e9c7b commit 5357a1d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

utils/viewcfg

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def parse_args():
8282
Simple regex based transform of SIL and LLVM-IR into graphviz form.
8383
""")
8484
parser.add_argument("output_suffix", nargs='?')
85+
parser.add_argument("--disable_inst_dump", action='store_true')
8586
parser.add_argument("--input_file", type=argparse.FileType('r'),
8687
default=sys.stdin)
8788
parser.add_argument("--renderer", choices=["Graphviz", "dot"],
@@ -159,15 +160,15 @@ def main():
159160
node [fontname = "{font}"];
160161
edge [fontname = "{font}"];""".format(font=fontname))
161162
for block in block_list:
162-
if block.content is not None:
163+
if block.content is None or args.disable_inst_dump:
163164
out_file.write(
164165
"\tNode" + str(block.index) +
165-
" [shape=record,label=\"{" + block.content + "}\"];\n")
166+
" [shape=record,color=gray,fontcolor=gray,label=\"{" +
167+
block.name + "}\"];\n")
166168
else:
167169
out_file.write(
168170
"\tNode" + str(block.index) +
169-
" [shape=record,color=gray,fontcolor=gray,label=\"{" +
170-
block.name + "}\"];\n")
171+
" [shape=record,label=\"{" + block.content + "}\"];\n")
171172

172173
for succ_name in block.get_succs():
173174
succ_block = block_map[succ_name]

0 commit comments

Comments
 (0)