aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-09-13 10:24:49 -0700
committerAlon Zakai <alonzakai@gmail.com>2011-09-13 10:24:49 -0700
commitd2a5ea9e13a1830a478cee86ed79f58a98491083 (patch)
tree4daec8538a332025ca0aed812c05f144bb61153c
parent3dba21acf3bbbdf448bf79ef2794f12eb5c92a97 (diff)
read_auto_optimize utility
-rw-r--r--tools/shared.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/shared.py b/tools/shared.py
index cb0d0691..93c417a1 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -145,3 +145,26 @@ def pick_llvm_opts(optimization_level, optimize_size, allow_nonportable=False, q
if optimization_level > 1: opts.append('-constmerge')
return opts
+
+def read_auto_optimize_data(filename):
+ '''
+ Reads the output of AUTO_OPTIMIZE and generates proper information for CORRECT_* == 2 's *_LINES options
+ '''
+ signs_lines = []
+ overflows_lines = []
+
+ for line in open(filename, 'r'):
+ if line.rstrip() == '': continue
+ if '%0 failures' in line: continue
+ left, right = line.split(' : ')
+ signature = left.split('|')[1]
+ if 'Sign' in left:
+ signs_lines.append(signature)
+ elif 'Overflow' in left:
+ overflows_lines.append(signature)
+
+ return {
+ 'signs_lines': signs_lines,
+ 'overflows_lines': overflows_lines
+ }
+