aboutsummaryrefslogtreecommitdiff
path: root/tools/autodebugger.py
diff options
context:
space:
mode:
authorEhsan Akhgari <ehsan.akhgari@gmail.com>2012-04-12 18:08:45 -0400
committerEhsan Akhgari <ehsan.akhgari@gmail.com>2012-04-12 18:08:45 -0400
commit3f72c46133128715d7dd30f4bc89f82e78344cb4 (patch)
tree20142671a0a56be135af13818c697b25c86349f4 /tools/autodebugger.py
parent67570a7c4d00b8da556c6c2993ec201283388861 (diff)
parent53015391802b686bc6b18aad0e1ccada684a5317 (diff)
Merge remote-tracking branch 'upstream/incoming' into glmatrix
Conflicts: src/library_gl.js
Diffstat (limited to 'tools/autodebugger.py')
-rw-r--r--tools/autodebugger.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/autodebugger.py b/tools/autodebugger.py
index 51661ec7..943ff043 100644
--- a/tools/autodebugger.py
+++ b/tools/autodebugger.py
@@ -11,6 +11,7 @@ Warning: You probably want to compile with SKIP_STACK_IN_SMALL=0! Otherwise
import os, sys, re
ALLOW_POINTERS = False
+ALLOW_MISC = True
MEMCPY = False
POSTAMBLE = '''
@@ -242,6 +243,23 @@ for i in range(len(lines)):
index = i+1+lines_added
lines[i] += '\n call void @emscripten_autodebug_%s(i32 %d, %s %%%s)' % (m.group('type'), index, m.group('type'), m.group('var'))
lines_added += 1
+ continue
+ if ALLOW_MISC:
+ m = re.match(' %(?P<var>[\w_.]+) = (call|mul|add) (nsw )?(?P<type>i64|i32|i16|i8|float|double+) .*', lines[i])
+ if m:
+ index = i+1+lines_added
+ lines[i] += '\n call void @emscripten_autodebug_%s(i32 %d, %s %%%s)' % (m.group('type'), index, m.group('type'), m.group('var'))
+ lines_added += 1
+ continue
+ m = re.match(' call void @llvm\.memcpy\.p0i8\.p0i8\.i32\(i8\* %(?P<dst>[\w_.]+), i8\* %(?P<src>[\w_.]+), i32 8, i32 (?P<align>\d+),.*', lines[i])
+ if m:
+ index = i+1+lines_added
+ lines[i] += '\n %%adpretemp%d = bitcast i8* %%%s to i64*' % (index, m.group('src')) + \
+ '\n %%adtemp%d = load i64* %%adpretemp%d, align %s' % (index, index, m.group('align')) + \
+ '\n call void @emscripten_autodebug_%s(i32 %d, %s %%adtemp%d)' % ('i64', index, 'i64', index)
+ lines_added += 3
+ continue
+
finally:
if len(pre) > 0:
lines[i] = pre + '\n' + lines[i]