7 from xform
import foreach_inst
8 from asmprinter
import AsmPrinter
12 argp
= argparse
.ArgumentParser(description
="Parse and dump PseudoC program")
13 argp
.add_argument("file", help="Input file in PseudoC format")
14 argp
.add_argument("--repr", action
="store_true", help="Dump __repr__ format of instructions")
15 argp
.add_argument("--roundtrip", action
="store_true", help="Dump PseudoC asm")
16 argp
.add_argument("--addr-width", type=int, default
=8, help="Width of address field (%(default)d)")
17 argp
.add_argument("--inst-indent", type=int, default
=4, help="Indent of instructions (%(default)d)")
18 args
= argp
.parse_args()
26 p
.addr_width
= args
.addr_width
27 p
.inst_indent
= args
.inst_indent
31 print("Labels:", p
.labels
)
33 core
.SimpleExpr
.simple_repr
= False
35 print("Basic blocks:")
36 dump_bblocks(cfg
, printer
=repr if args
.repr else str)
38 with
open(sys
.argv
[1] + ".0.dot", "w") as f
: dot
.dot(cfg
, f
)
41 if __name__
== "__main__":