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

Side by Side Diff: szdiff.py

Issue 539743002: Subzero: Render constants in dump() to be more like LLVM. (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years, 3 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 | « src/IceTargetLoweringX8632.cpp ('k') | tests_lit/llvm2ice_tests/64bit.pnacl.ll » ('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 re 5 import re
6 6
7 if __name__ == '__main__': 7 if __name__ == '__main__':
8 """Compares a LLVM file with a subzero file for differences. 8 """Compares a LLVM file with a subzero file for differences.
9 9
10 Before comparing, the LLVM file is massaged to remove comments, 10 Before comparing, the LLVM file is massaged to remove comments,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 prev_line = line 65 prev_line = line
66 continue 66 continue
67 llc_out.append(line) 67 llc_out.append(line)
68 68
69 # Compare sz_out and llc_out line by line, but ignore pairs of 69 # Compare sz_out and llc_out line by line, but ignore pairs of
70 # lines where the llc line matches a certain pattern. 70 # lines where the llc line matches a certain pattern.
71 return_code = 0 71 return_code = 0
72 lines_total = 0 72 lines_total = 0
73 lines_diff = 0 73 lines_diff = 0
74 ignore_pattern = re.compile( 74 ignore_pattern = re.compile(
75 '|'.join([' -[0-9]', # negative constants 75 '|'.join(['[ (](float|double) [-0-9]', # FP constants
76 ' (float|double) [-0-9]', # FP constants 76 '[ (](float|double) %\w+, [-0-9]',
77 ' (float|double) %\w+, [-0-9]',
78 ' @llvm\..*i\d+\*', # intrinsic calls w/ pointer args 77 ' @llvm\..*i\d+\*', # intrinsic calls w/ pointer args
79 ' i\d+\* @llvm\.', # intrinsic calls w/ pointer ret 78 ' i\d+\* @llvm\.', # intrinsic calls w/ pointer ret
80 ' inttoptr ', # inttoptr pointer types 79 ' inttoptr ', # inttoptr pointer types
81 ' ptrtoint ', # ptrtoint pointer types 80 ' ptrtoint ', # ptrtoint pointer types
82 ' bitcast .*\* .* to .*\*' # bitcast pointer types 81 ' bitcast .*\* .* to .*\*' # bitcast pointer types
83 ])) 82 ]))
84 for (sz_line, llc_line) in itertools.izip_longest(sz_out, llc_out): 83 for (sz_line, llc_line) in itertools.izip_longest(sz_out, llc_out):
85 lines_total += 1 84 lines_total += 1
86 if sz_line == llc_line: 85 if sz_line == llc_line:
87 continue 86 continue
88 if llc_line and ignore_pattern.search(llc_line): 87 if llc_line and ignore_pattern.search(llc_line):
89 lines_diff += 1 88 lines_diff += 1
90 continue 89 continue
91 if sz_line: print 'SZ (%d)> %s' % (lines_total, sz_line) 90 if sz_line: print 'SZ (%d)> %s' % (lines_total, sz_line)
92 if llc_line: print 'LL (%d)> %s' % (lines_total, llc_line) 91 if llc_line: print 'LL (%d)> %s' % (lines_total, llc_line)
93 return_code = 1 92 return_code = 1
94 93
95 if return_code == 0: 94 if return_code == 0:
96 message = 'Success (ignored %d diffs out of %d lines)' 95 message = 'Success (ignored %d diffs out of %d lines)'
97 print message % (lines_diff, lines_total) 96 print message % (lines_diff, lines_total)
98 exit(return_code) 97 exit(return_code)
OLDNEW
« no previous file with comments | « src/IceTargetLoweringX8632.cpp ('k') | tests_lit/llvm2ice_tests/64bit.pnacl.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698