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

Side by Side Diff: pydir/szbuild.py

Issue 1147023007: Subzero: Basic Block Profiler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Named constants; fflush; clang-format. Created 5 years, 6 months 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
« no previous file with comments | « pydir/build-runtime.py ('k') | runtime/szrt_profiler.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python2 1 #!/usr/bin/env python2
2 2
3 import argparse 3 import argparse
4 import os 4 import os
5 import pipes 5 import pipes
6 import re 6 import re
7 import sys 7 import sys
8 8
9 from utils import shellcmd 9 from utils import shellcmd
10 from utils import FindBaseNaCl 10 from utils import FindBaseNaCl
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 help='Output executable. Default %(default)s.') 77 help='Output executable. Default %(default)s.')
78 argparser.add_argument('-O', default='2', dest='optlevel', 78 argparser.add_argument('-O', default='2', dest='optlevel',
79 choices=['m1', '-1', '0', '1', '2'], 79 choices=['m1', '-1', '0', '1', '2'],
80 help='Optimization level ' + 80 help='Optimization level ' +
81 '(m1 and -1 are equivalent).' + 81 '(m1 and -1 are equivalent).' +
82 ' Default %(default)s.') 82 ' Default %(default)s.')
83 argparser.add_argument('--filetype', default='iasm', dest='filetype', 83 argparser.add_argument('--filetype', default='iasm', dest='filetype',
84 choices=['obj', 'asm', 'iasm'], 84 choices=['obj', 'asm', 'iasm'],
85 help='Output file type. Default %(default)s.') 85 help='Output file type. Default %(default)s.')
86 argparser.add_argument('--sandbox', dest='sandbox', action='store_true', 86 argparser.add_argument('--sandbox', dest='sandbox', action='store_true',
87 help='Enabled sandboxing in the translator') 87 help='Enable sandboxing in the translator')
88 argparser.add_argument('--enable-block-profile',
89 dest='enable_block_profile', action='store_true',
90 help='Enable basic block profiling.')
88 argparser.add_argument('--verbose', '-v', dest='verbose', 91 argparser.add_argument('--verbose', '-v', dest='verbose',
89 action='store_true', 92 action='store_true',
90 help='Display some extra debugging output') 93 help='Display some extra debugging output')
91 argparser.add_argument('--sz', dest='sz_args', action='append', default=[], 94 argparser.add_argument('--sz', dest='sz_args', action='append', default=[],
92 help='Extra arguments for Subzero') 95 help='Extra arguments for Subzero')
93 argparser.add_argument('--llc', dest='llc_args', action='append', 96 argparser.add_argument('--llc', dest='llc_args', action='append',
94 default=[], help='Extra arguments for llc') 97 default=[], help='Extra arguments for llc')
95 98
96 def main(): 99 def main():
97 """Create a hybrid translation from Subzero and llc. 100 """Create a hybrid translation from Subzero and llc.
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 # Run pnacl-sz regardless of hybrid mode. 213 # Run pnacl-sz regardless of hybrid mode.
211 shellcmd([pnacl_sz, 214 shellcmd([pnacl_sz,
212 '-O' + opt_level, 215 '-O' + opt_level,
213 '-bitcode-format=pnacl', 216 '-bitcode-format=pnacl',
214 '-filetype=' + args.filetype, 217 '-filetype=' + args.filetype,
215 '-o', obj_sz if args.filetype == 'obj' else asm_sz] + 218 '-o', obj_sz if args.filetype == 'obj' else asm_sz] +
216 (['-externalize', 219 (['-externalize',
217 '-ffunction-sections', 220 '-ffunction-sections',
218 '-fdata-sections'] if hybrid else []) + 221 '-fdata-sections'] if hybrid else []) +
219 (['-sandbox'] if args.sandbox else []) + 222 (['-sandbox'] if args.sandbox else []) +
223 (['-enable-block-profile'] if
224 args.enable_block_profile and not args.sandbox else []) +
220 args.sz_args + 225 args.sz_args +
221 [pexe], 226 [pexe],
222 echo=args.verbose) 227 echo=args.verbose)
223 if args.filetype != 'obj': 228 if args.filetype != 'obj':
224 shellcmd(( 229 shellcmd((
225 'llvm-mc -triple={triple} -filetype=obj -o {obj} {asm}' 230 'llvm-mc -triple={triple} -filetype=obj -o {obj} {asm}'
226 ).format(asm=asm_sz, obj=obj_sz, 231 ).format(asm=asm_sz, obj=obj_sz,
227 triple='i686-nacl' if args.sandbox else 'i686'), 232 triple='i686-nacl' if args.sandbox else 'i686'),
228 echo=args.verbose) 233 echo=args.verbose)
229 if not args.sandbox: 234 if not args.sandbox:
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 if args.verbose: 325 if args.verbose:
321 print 'PATH: {path}'.format(path=path_addition) 326 print 'PATH: {path}'.format(path=path_addition)
322 if hybrid: 327 if hybrid:
323 print 'include={regex}'.format(regex=re_include_str) 328 print 'include={regex}'.format(regex=re_include_str)
324 print 'exclude={regex}'.format(regex=re_exclude_str) 329 print 'exclude={regex}'.format(regex=re_exclude_str)
325 print 'default_match={dm}'.format(dm=default_match) 330 print 'default_match={dm}'.format(dm=default_match)
326 print 'Number of Subzero syms = {num}'.format(num=len(sz_syms)) 331 print 'Number of Subzero syms = {num}'.format(num=len(sz_syms))
327 332
328 if __name__ == '__main__': 333 if __name__ == '__main__':
329 main() 334 main()
OLDNEW
« no previous file with comments | « pydir/build-runtime.py ('k') | runtime/szrt_profiler.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698