diff options
author | 2017-08-23 18:16:25 -0400 | |
---|---|---|
committer | 2017-08-24 12:47:16 +0000 | |
commit | 81da18c427145f48a99093323dcf311e330e676c (patch) | |
tree | b67606a35a204e724bd1723cdf2b547c9fdcb278 /src/jumper/build_stages.py | |
parent | af720ca907461bdd282b3bafbffd723d47fc3039 (diff) |
merge object files before parsing into assembly
This extra ld pass can merge all our many redundant constants,
both within an instruction set and across them.
This should save a bunch of code size on x86-64, with no other impact.
It cuts 12K off my local build of ok.
Change-Id: Ib2bb4adf88564aca45e55ee53dcf6584265c7dbe
Reviewed-on: https://skia-review.googlesource.com/37940
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'src/jumper/build_stages.py')
-rwxr-xr-x | src/jumper/build_stages.py | 37 |
1 files changed, 11 insertions, 26 deletions
diff --git a/src/jumper/build_stages.py b/src/jumper/build_stages.py index 3c54e8e894..a6d637552d 100755 --- a/src/jumper/build_stages.py +++ b/src/jumper/build_stages.py @@ -93,6 +93,15 @@ subprocess.check_call(clang + cflags + hsw + win + ['-c', stages_8bit] + ['-o', 'win_8bit_hsw.o']) +# Merge x86-64 object files to deduplicate constants. +# (No other platform has more than one specialization.) +subprocess.check_call(['ld', '-r', '-o', 'merged.o', + 'hsw.o', 'avx.o', 'sse41.o', 'sse2.o', + '8bit_hsw.o', '8bit_sse41.o', '8bit_sse2.o']) +subprocess.check_call(['ld', '-r', '-o', 'win_merged.o', + 'win_hsw.o', 'win_avx.o', 'win_sse41.o', 'win_sse2.o', + 'win_8bit_hsw.o', 'win_8bit_sse41.o', 'win_8bit_sse2.o']) + # iOS disallows the use of register x18, # so we need to use it as a least-common denominator. aarch64 = [ '--target=arm64-apple-ios' ] @@ -235,19 +244,7 @@ parse_object_file( 'vfp4.o', '.long', target='elf32-littlearm') print '#elif defined(__x86_64__)' print 'BALIGN32' -parse_object_file('hsw.o', '.byte') -print 'BALIGN32' -parse_object_file('avx.o', '.byte') -print 'BALIGN32' -parse_object_file('sse41.o', '.byte') -print 'BALIGN32' -parse_object_file('sse2.o', '.byte') -print 'BALIGN32' -parse_object_file('8bit_hsw.o', '.byte') -print 'BALIGN32' -parse_object_file('8bit_sse41.o', '.byte') -print 'BALIGN32' -parse_object_file('8bit_sse2.o', '.byte') +parse_object_file('merged.o', '.byte') print '#elif defined(__i386__)' print 'BALIGN32' @@ -267,19 +264,7 @@ print '''; Copyright 2017 Google Inc. print 'IFDEF RAX' print "_text32 SEGMENT ALIGN(32) 'CODE'" print 'ALIGN 32' -parse_object_file('win_hsw.o', 'DB') -print 'ALIGN 32' -parse_object_file('win_avx.o', 'DB') -print 'ALIGN 32' -parse_object_file('win_sse41.o', 'DB') -print 'ALIGN 32' -parse_object_file('win_sse2.o', 'DB') -print 'ALIGN 32' -parse_object_file('win_8bit_hsw.o', 'DB') -print 'ALIGN 32' -parse_object_file('win_8bit_sse41.o', 'DB') -print 'ALIGN 32' -parse_object_file('win_8bit_sse2.o', 'DB') +parse_object_file('win_merged.o', 'DB') print 'ELSE' print '.MODEL FLAT,C' |