aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/jumper/build_stages.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/jumper/build_stages.py')
-rwxr-xr-xsrc/jumper/build_stages.py57
1 files changed, 24 insertions, 33 deletions
diff --git a/src/jumper/build_stages.py b/src/jumper/build_stages.py
index 4670382476..106e2e989c 100755
--- a/src/jumper/build_stages.py
+++ b/src/jumper/build_stages.py
@@ -9,8 +9,6 @@ import re
import subprocess
import sys
-sys.stdout = open('src/jumper/SkJumper_generated.h', 'w')
-
ndk = '/Users/mtklein/brew/opt/android-ndk/'
objdump = 'gobjdump'
@@ -52,30 +50,23 @@ subprocess.check_call(['clang++'] + cflags + armv7 +
['-c', 'src/jumper/SkJumper_stages.cpp'] +
['-o', 'armv7.o'])
-def parse_object_file(dot_o, array_type, target=None):
- prefix = dot_o.replace('.o', '_')
+def parse_object_file(dot_o, target=None):
cmd = [ objdump, '-d', '--insn-width=9', dot_o]
if target:
cmd += ['--target', target]
- active = False
for line in subprocess.check_output(cmd).split('\n'):
line = line.strip()
- if line.startswith(dot_o) or line.startswith('Disassembly'):
- continue
-
- if not line:
- if active:
- print '};'
- active = False
+ if not line or line.startswith(dot_o) or line.startswith('Disassembly'):
continue
# E.g. 00000000000003a4 <_load_f16>:
m = re.match('''[0-9a-f]+ <_?(.*)>:''', line)
if m:
- print 'static const', array_type, prefix + m.group(1) + '[] = {'
- active = True
+ print
+ print '.globl _' + m.group(1)
+ print '_' + m.group(1) + ':'
continue
columns = line.split('\t')
@@ -93,26 +84,26 @@ def parse_object_file(dot_o, array_type, target=None):
for arg in args:
assert 'rip' not in arg # TODO: detect on aarch64 too
- hexed = ''.join('0x'+x+',' for x in code.split(' '))
- print ' ' + hexed + ' '*(48-len(hexed)) + \
- '// ' + inst + (' '*(14-len(inst)) + args if args else '')
+ hexed = ','.join('0x'+x for x in code.split(' '))
-print '''/*
- * Copyright 2017 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
+ print ' ' + '.byte ' + hexed + ' '*(48-len(hexed)) + \
+ '# ' + inst + (' '*(14-len(inst)) + args if args else '')
-#ifndef SkJumper_generated_DEFINED
-#define SkJumper_generated_DEFINED
+sys.stdout = open('src/jumper/SkJumper_generated_x86_64.s', 'w')
-// This file is generated semi-automatically with this command:
-// $ src/jumper/build_stages.py
+print '''# Copyright 2017 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This file is generated semi-automatically with this command:
+# $ src/jumper/build_stages.py
'''
-parse_object_file('aarch64.o', 'unsigned int')
-parse_object_file('armv7.o', 'unsigned int', target='elf32-littlearm')
-parse_object_file('hsw.o', 'unsigned char')
-parse_object_file('sse41.o', 'unsigned char')
-parse_object_file('sse2.o', 'unsigned char')
-print '#endif//SkJumper_generated_DEFINED'
+
+print '.text'
+parse_object_file('hsw.o')
+parse_object_file('sse41.o')
+parse_object_file('sse2.o')
+
+#parse_object_file('aarch64.o')
+#parse_object_file('armv7.o', target='elf32-littlearm')