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

Side by Side Diff: pydir/run-pnacl-sz.py

Issue 1210013005: Fixes case where terminator instruction is missing at end of function. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: fix nits. Created 5 years, 5 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 | « no previous file | src/PNaClTranslator.cpp » ('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 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 import tempfile 9 import tempfile
10 10
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 help='Add a disassembler flag') 71 help='Add a disassembler flag')
72 argparser.add_argument('--filetype', default='iasm', dest='filetype', 72 argparser.add_argument('--filetype', default='iasm', dest='filetype',
73 choices=['obj', 'asm', 'iasm'], 73 choices=['obj', 'asm', 'iasm'],
74 help='Output file type. Default %(default)s.') 74 help='Output file type. Default %(default)s.')
75 argparser.add_argument('--target', default='x8632', dest='target', 75 argparser.add_argument('--target', default='x8632', dest='target',
76 choices=['x8632','arm32'], 76 choices=['x8632','arm32'],
77 help='Target architecture. Default %(default)s.') 77 help='Target architecture. Default %(default)s.')
78 argparser.add_argument('--echo-cmd', required=False, 78 argparser.add_argument('--echo-cmd', required=False,
79 action='store_true', 79 action='store_true',
80 help='Trace command that generates ICE instructions') 80 help='Trace command that generates ICE instructions')
81 argparser.add_argument('--tbc', required=False, action='store_true',
82 help='Input is textual bitcode (not .ll)')
83 argparser.add_argument('--expect-fail', required=False, action='store_true',
84 help='Negate success of run by using LLVM not')
81 argparser.add_argument('--args', '-a', nargs=argparse.REMAINDER, 85 argparser.add_argument('--args', '-a', nargs=argparse.REMAINDER,
82 default=[], 86 default=[],
83 help='Remaining arguments are passed to pnacl-sz') 87 help='Remaining arguments are passed to pnacl-sz')
84 88
85 args = argparser.parse_args() 89 args = argparser.parse_args()
86 pnacl_bin_path = args.pnacl_bin_path 90 pnacl_bin_path = args.pnacl_bin_path
87 llfile = args.input 91 llfile = args.input
88 92
89 if args.llvm and args.llvm_source: 93 if args.llvm and args.llvm_source:
90 raise RuntimeError("Can't specify both '--llvm' and '--llvm-source'") 94 raise RuntimeError("Can't specify both '--llvm' and '--llvm-source'")
91 95
92 if args.llvm_source and args.no_local_syms: 96 if args.llvm_source and args.no_local_syms:
93 raise RuntimeError("Can't specify both '--llvm-source' and " + 97 raise RuntimeError("Can't specify both '--llvm-source' and " +
94 "'--no-local-syms'") 98 "'--no-local-syms'")
95 99
100 if args.llvm_source and args.tbc:
101 raise RuntimeError("Can't specify both '--tbc' and '--llvm-source'")
102
103 if args.llvm and args.tbc:
104 raise RuntimeError("Can't specify both '--tbc' and '--llvm'")
105
96 cmd = [] 106 cmd = []
97 if not args.llvm_source: 107 if args.tbc:
108 cmd = [os.path.join(pnacl_bin_path, 'pnacl-bcfuzz'), llfile,
109 '-bitcode-as-text', '-output', '-', '|']
110 elif not args.llvm_source:
98 cmd = [os.path.join(pnacl_bin_path, 'llvm-as'), llfile, '-o', '-', '|', 111 cmd = [os.path.join(pnacl_bin_path, 'llvm-as'), llfile, '-o', '-', '|',
99 os.path.join(pnacl_bin_path, 'pnacl-freeze')] 112 os.path.join(pnacl_bin_path, 'pnacl-freeze')]
100 if not args.no_local_syms: 113 if not args.no_local_syms:
101 cmd += ['--allow-local-symbol-tables'] 114 cmd += ['--allow-local-symbol-tables']
102 cmd += ['|'] 115 cmd += ['|']
116 if args.expect_fail:
117 cmd += [os.path.join(pnacl_bin_path, 'not')]
103 cmd += [args.pnacl_sz] 118 cmd += [args.pnacl_sz]
104 cmd += ['--target', args.target] 119 cmd += ['--target', args.target]
105 if args.insts: 120 if args.insts:
106 # If the tests are based on '-verbose inst' output, force 121 # If the tests are based on '-verbose inst' output, force
107 # single-threaded translation because dump output does not get 122 # single-threaded translation because dump output does not get
108 # reassembled into order. 123 # reassembled into order.
109 cmd += ['-verbose', 'inst', '-notranslate', '-threads=0'] 124 cmd += ['-verbose', 'inst', '-notranslate', '-threads=0']
110 if not args.llvm_source: 125 if not args.llvm_source:
111 cmd += ['--bitcode-format=pnacl'] 126 cmd += ['--bitcode-format=pnacl']
112 if not args.no_local_syms: 127 if not args.no_local_syms:
(...skipping 27 matching lines...) Expand all
140 [asm_temp.name]) 155 [asm_temp.name])
141 156
142 stdout_result = shellcmd(cmd, echo=args.echo_cmd) 157 stdout_result = shellcmd(cmd, echo=args.echo_cmd)
143 if not args.echo_cmd: 158 if not args.echo_cmd:
144 sys.stdout.write(stdout_result) 159 sys.stdout.write(stdout_result)
145 if asm_temp: 160 if asm_temp:
146 os.remove(asm_temp.name) 161 os.remove(asm_temp.name)
147 162
148 if __name__ == '__main__': 163 if __name__ == '__main__':
149 main() 164 main()
OLDNEW
« no previous file with comments | « no previous file | src/PNaClTranslator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698