Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Side by Side Diff: pydir/run-llvm2ice.py

Issue 696383004: Disable Subzero IR generation for performance testing. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix issues in patch set 2, and add tests. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 from utils import shellcmd 10 from utils import shellcmd
(...skipping 29 matching lines...) Expand all
40 '--llvm2ice', required=False, default='./llvm2ice', metavar='LLVM2ICE', 40 '--llvm2ice', required=False, default='./llvm2ice', metavar='LLVM2ICE',
41 help="Subzero translator 'llvm2ice'") 41 help="Subzero translator 'llvm2ice'")
42 argparser.add_argument('--llvm-bin-path', required=False, 42 argparser.add_argument('--llvm-bin-path', required=False,
43 default=None, metavar='LLVM_BIN_PATH', 43 default=None, metavar='LLVM_BIN_PATH',
44 help='Path to LLVM executables ' + 44 help='Path to LLVM executables ' +
45 '(for building PEXE files)') 45 '(for building PEXE files)')
46 argparser.add_argument('--echo-cmd', required=False, 46 argparser.add_argument('--echo-cmd', required=False,
47 action='store_true', 47 action='store_true',
48 help='Trace command that generates ICE instructions') 48 help='Trace command that generates ICE instructions')
49 argparser.add_argument('--args', '-a', nargs=argparse.REMAINDER, 49 argparser.add_argument('--args', '-a', nargs=argparse.REMAINDER,
50 default=[],
50 help='Remaining arguments are passed to llvm2ice') 51 help='Remaining arguments are passed to llvm2ice')
51 52
52 args = argparser.parse_args() 53 args = argparser.parse_args()
53 llvm_bin_path = args.llvm_bin_path 54 llvm_bin_path = args.llvm_bin_path
54 llfile = args.input 55 llfile = args.input
55 56
56 if args.llvm and args.llvm_source: 57 if args.llvm and args.llvm_source:
57 raise RuntimeError("Can't specify both '--llvm' and '--llvm-source'") 58 raise RuntimeError("Can't specify both '--llvm' and '--llvm-source'")
58 59
59 if args.llvm_source and args.no_local_syms: 60 if args.llvm_source and args.no_local_syms:
60 raise RuntimeError("Can't specify both '--llvm-source' and " + 61 raise RuntimeError("Can't specify both '--llvm-source' and " +
61 "'--no-local-syms'") 62 "'--no-local-syms'")
62 63
64 if '-noIRgen' in args.args or '--noIRgen' in args.args:
jvoung (off chromium) 2014/11/05 23:55:08 Is it possible to do: %if ... --command %p2i ...
Karl 2014/11/06 17:06:10 Done and Done.
65 # Short circuit if not allowed by llvm2ice
66 atts_cmd = [args.llvm2ice, '--build-atts']
67 build_atts = shellcmd(atts_cmd, echo=False).split()
68 if 'no_disable_ir_gen' in build_atts:
69 return
70
63 cmd = [] 71 cmd = []
64 if not args.llvm_source: 72 if not args.llvm_source:
65 cmd = [os.path.join(llvm_bin_path, 'llvm-as'), llfile, '-o', '-', '|', 73 cmd = [os.path.join(llvm_bin_path, 'llvm-as'), llfile, '-o', '-', '|',
66 os.path.join(llvm_bin_path, 'pnacl-freeze')] 74 os.path.join(llvm_bin_path, 'pnacl-freeze')]
67 if not args.no_local_syms: 75 if not args.no_local_syms:
68 cmd += ['--allow-local-symbol-tables'] 76 cmd += ['--allow-local-symbol-tables']
69 cmd += ['|'] 77 cmd += ['|']
70 cmd += [args.llvm2ice] 78 cmd += [args.llvm2ice]
71 if args.insts: 79 if args.insts:
72 cmd += ['-verbose', 'inst', '-notranslate'] 80 cmd += ['-verbose', 'inst', '-notranslate']
73 if not args.llvm_source: 81 if not args.llvm_source:
74 cmd += ['--bitcode-format=pnacl'] 82 cmd += ['--bitcode-format=pnacl']
75 if not args.no_local_syms: 83 if not args.no_local_syms:
76 cmd += ['--allow-local-symbol-tables'] 84 cmd += ['--allow-local-symbol-tables']
77 if args.llvm or args.llvm_source: 85 if args.llvm or args.llvm_source:
78 cmd += ['--build-on-read=0'] 86 cmd += ['--build-on-read=0']
79 else: 87 else:
80 cmd += ['--build-on-read=1'] 88 cmd += ['--build-on-read=1']
81 if args.args: 89 cmd += args.args
82 cmd += args.args
83 if args.llvm_source: 90 if args.llvm_source:
84 cmd += [llfile] 91 cmd += [llfile]
85 92
86 stdout_result = shellcmd(cmd, echo=args.echo_cmd) 93 stdout_result = shellcmd(cmd, echo=args.echo_cmd)
87 if not args.echo_cmd: 94 if not args.echo_cmd:
88 sys.stdout.write(stdout_result) 95 sys.stdout.write(stdout_result)
89 96
90 if __name__ == '__main__': 97 if __name__ == '__main__':
91 main() 98 main()
OLDNEW
« no previous file with comments | « Makefile.standalone ('k') | src/IceCfg.cpp » ('j') | src/PNaClTranslator.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698