OLD | NEW |
1 #!/usr/bin/env python2 | 1 #!/usr/bin/env python2 |
2 | 2 |
3 import argparse | 3 import argparse |
4 import itertools | 4 import itertools |
5 import os | 5 import os |
6 import re | 6 import re |
7 import subprocess | 7 import subprocess |
8 import sys | 8 import sys |
9 | 9 |
10 sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'pydir')) | |
11 | |
12 from utils import shellcmd | 10 from utils import shellcmd |
13 | 11 |
14 if __name__ == '__main__': | 12 if __name__ == '__main__': |
15 desc = 'Run llvm2ice on llvm file to produce ICE instructions.' | 13 desc = 'Run llvm2ice on llvm file to produce ICE instructions.' |
16 argparser = argparse.ArgumentParser( | 14 argparser = argparse.ArgumentParser( |
17 description=desc, | 15 description=desc, |
18 formatter_class=argparse.ArgumentDefaultsHelpFormatter, | 16 formatter_class=argparse.ArgumentDefaultsHelpFormatter, |
19 epilog=''' | 17 epilog=''' |
20 Runs in two modes, depending on whether the flag '--pnacl' is specified. | 18 Runs in two modes, depending on whether the flag '--pnacl' is specified. |
21 | 19 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 '--allow-local-symbol-tables', '|'] | 54 '--allow-local-symbol-tables', '|'] |
57 cmd += [args.llvm2ice, '-verbose', 'inst', '-notranslate'] | 55 cmd += [args.llvm2ice, '-verbose', 'inst', '-notranslate'] |
58 if args.pnacl: | 56 if args.pnacl: |
59 cmd += ['--allow-local-symbol-tables', '--bitcode-format=pnacl'] | 57 cmd += ['--allow-local-symbol-tables', '--bitcode-format=pnacl'] |
60 else: | 58 else: |
61 cmd.append(llfile) | 59 cmd.append(llfile) |
62 | 60 |
63 stdout_result = shellcmd(cmd, echo=args.echo_cmd) | 61 stdout_result = shellcmd(cmd, echo=args.echo_cmd) |
64 if not args.echo_cmd: | 62 if not args.echo_cmd: |
65 sys.stdout.write(stdout_result) | 63 sys.stdout.write(stdout_result) |
OLD | NEW |