diff options
Diffstat (limited to 'tools/autodebugger.py')
-rw-r--r-- | tools/autodebugger.py | 18 |
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] |