| 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 for p in sys.path: | 10 sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'pydir')) |
| 11 if p.endswith('/toolchain_build/src/pnacl-subzero'): | |
| 12 sys.path.insert(0, p + '/pydir') | |
| 13 break | |
| 14 | 11 |
| 15 from utils import shellcmd | 12 from utils import shellcmd |
| 16 | 13 |
| 17 if __name__ == '__main__': | 14 if __name__ == '__main__': |
| 18 desc = 'Run llvm2ice on llvm file to produce ICE instructions.' | 15 desc = 'Run llvm2ice on llvm file to produce ICE instructions.' |
| 19 argparser = argparse.ArgumentParser( | 16 argparser = argparse.ArgumentParser( |
| 20 description=desc, | 17 description=desc, |
| 21 formatter_class=argparse.ArgumentDefaultsHelpFormatter, | 18 formatter_class=argparse.ArgumentDefaultsHelpFormatter, |
| 22 epilog=''' | 19 epilog=''' |
| 23 Runs in two modes, depending on whether the flag '--pnacl' is specified. | 20 Runs in two modes, depending on whether the flag '--pnacl' is specified. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 '--allow-local-symbol-tables', '|'] | 56 '--allow-local-symbol-tables', '|'] |
| 60 cmd += [args.llvm2ice, '-verbose', 'inst', '-notranslate'] | 57 cmd += [args.llvm2ice, '-verbose', 'inst', '-notranslate'] |
| 61 if args.pnacl: | 58 if args.pnacl: |
| 62 cmd += ['--allow-local-symbol-tables', '--bitcode-format=pnacl'] | 59 cmd += ['--allow-local-symbol-tables', '--bitcode-format=pnacl'] |
| 63 else: | 60 else: |
| 64 cmd.append(llfile) | 61 cmd.append(llfile) |
| 65 | 62 |
| 66 stdout_result = shellcmd(cmd, echo=args.echo_cmd) | 63 stdout_result = shellcmd(cmd, echo=args.echo_cmd) |
| 67 if not args.echo_cmd: | 64 if not args.echo_cmd: |
| 68 sys.stdout.write(stdout_result) | 65 sys.stdout.write(stdout_result) |
| OLD | NEW |