Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(460)

Side by Side Diff: third_party/yasm/BUILD.gn

Issue 2885213002: Optimize yasm even in debug builds (Closed)
Patch Set: Use variables to avoid replicating logic Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/config/win/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # The yasm build process creates a slew of small C subprograms that 5 # The yasm build process creates a slew of small C subprograms that
6 # dynamically generate files at various point in the build process. This makes 6 # dynamically generate files at various point in the build process. This makes
7 # the build integration moderately complex. 7 # the build integration moderately complex.
8 # 8 #
9 # There are three classes of dynamically generated files: 9 # There are three classes of dynamically generated files:
10 # 1) C source files that should be included in the build (eg., lc3bid.c) 10 # 1) C source files that should be included in the build (eg., lc3bid.c)
(...skipping 11 matching lines...) Expand all
22 # 3) yasm_utils -- Object files with memory management and hashing utilities 22 # 3) yasm_utils -- Object files with memory management and hashing utilities
23 # shared between yasm and the genperf subprogram. 23 # shared between yasm and the genperf subprogram.
24 # 4) genmacro, genmodule, etc. -- One executable target for each subprogram. 24 # 4) genmacro, genmodule, etc. -- One executable target for each subprogram.
25 # 5) generate_license, generate_module, etc. -- Actions that invoke programs 25 # 5) generate_license, generate_module, etc. -- Actions that invoke programs
26 # built in #4 to generate .c files. 26 # built in #4 to generate .c files.
27 # 6) compile_gperf, compile_re2c, etc. -- Actions that invoke programs that 27 # 6) compile_gperf, compile_re2c, etc. -- Actions that invoke programs that
28 # turn intermediate files into .c files. 28 # turn intermediate files into .c files.
29 29
30 import("//build/config/compiler/compiler.gni") 30 import("//build/config/compiler/compiler.gni")
31 31
32 configs_to_delete = []
33 configs_to_add = []
34 if (is_debug) {
35 configs_to_delete += [
36 # Build with full optimizations even on debug configurations, because some
37 # yasm build steps (highbd_sad4d_sse2.asm) can take ~33 seconds or more in
38 # debug component builds on Windows. Enabling compiler optimizations saves
39 # ~5 seconds.
40 "//build/config/compiler:default_optimization",
41
42 # Don't define _DEBUG. Modest savings, but good for consistency.
43 "//build/config:debug",
44 ]
45 configs_to_add += [
46 "//build/config:release",
47 "//build/config/compiler:optimize_max",
48 ]
49 if (is_win) {
50 # This switches to using the release CRT. On debug component builds of
51 # highbd_sad4d_sse2.asm on Windows this saves about 15 s.
52 configs_to_delete += [ "//build/config/win:default_crt" ]
53 configs_to_add += [ "//build/config/win:release_crt" ]
54 }
55 }
56
32 if (current_toolchain == host_toolchain) { 57 if (current_toolchain == host_toolchain) {
33 # Various files referenced by multiple targets. 58 # Various files referenced by multiple targets.
34 yasm_gen_include_dir = "$target_gen_dir/include" 59 yasm_gen_include_dir = "$target_gen_dir/include"
35 config_makefile = "source/config/$host_os/Makefile" 60 config_makefile = "source/config/$host_os/Makefile"
36 version_file = "version.mac" 61 version_file = "version.mac"
37 62
38 import("//build/compiled_action.gni") 63 import("//build/compiled_action.gni")
39 64
40 config("yasm_config") { 65 config("yasm_config") {
41 include_dirs = [ 66 include_dirs = [
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 "source/patched-yasm/tools/genperf/genperf.c", 112 "source/patched-yasm/tools/genperf/genperf.c",
88 "source/patched-yasm/tools/genperf/perfect.c", 113 "source/patched-yasm/tools/genperf/perfect.c",
89 ] 114 ]
90 115
91 configs -= [ "//build/config/compiler:chromium_code" ] 116 configs -= [ "//build/config/compiler:chromium_code" ]
92 configs += [ 117 configs += [
93 ":yasm_config", 118 ":yasm_config",
94 "//build/config/compiler:no_chromium_code", 119 "//build/config/compiler:no_chromium_code",
95 ] 120 ]
96 121
122 # Must be compatible with yasm_utils/yasm
123 configs -= configs_to_delete
124 configs += configs_to_add
125
97 deps = [ 126 deps = [
98 ":yasm_utils", 127 ":yasm_utils",
99 "//build/config/sanitizers:deps", 128 "//build/config/sanitizers:deps",
100 129
101 # Default manifest on Windows (a no-op elsewhere). 130 # Default manifest on Windows (a no-op elsewhere).
102 "//build/win:default_exe_manifest", 131 "//build/win:default_exe_manifest",
103 ] 132 ]
104 } 133 }
105 134
106 # Used by both yasm and genperf binaries. 135 # Used by both yasm and genperf binaries.
107 static_library("yasm_utils") { 136 static_library("yasm_utils") {
108 sources = [ 137 sources = [
109 "source/patched-yasm/libyasm/phash.c", 138 "source/patched-yasm/libyasm/phash.c",
110 "source/patched-yasm/libyasm/xmalloc.c", 139 "source/patched-yasm/libyasm/xmalloc.c",
111 "source/patched-yasm/libyasm/xstrdup.c", 140 "source/patched-yasm/libyasm/xstrdup.c",
112 ] 141 ]
113 142
114 configs -= [ "//build/config/compiler:chromium_code" ] 143 configs -= [ "//build/config/compiler:chromium_code" ]
115 configs += [ 144 configs += [
116 ":yasm_config", 145 ":yasm_config",
117 "//build/config/compiler:no_chromium_code", 146 "//build/config/compiler:no_chromium_code",
118 ] 147 ]
148
149 # Must be compatible with yasm
150 configs -= configs_to_delete
151 configs += configs_to_add
119 } 152 }
120 153
121 executable("genstring") { 154 executable("genstring") {
122 sources = [ 155 sources = [
123 "source/patched-yasm/genstring.c", 156 "source/patched-yasm/genstring.c",
124 ] 157 ]
125 configs -= [ "//build/config/compiler:chromium_code" ] 158 configs -= [ "//build/config/compiler:chromium_code" ]
126 configs += [ 159 configs += [
127 ":yasm_config", 160 ":yasm_config",
128 "//build/config/compiler:no_chromium_code", 161 "//build/config/compiler:no_chromium_code",
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 334
302 # Must be after no_chromium_code for warning flags to be ordered 335 # Must be after no_chromium_code for warning flags to be ordered
303 # correctly. 336 # correctly.
304 ":yasm_warnings", 337 ":yasm_warnings",
305 ] 338 ]
306 339
307 # Disable WPO for yasm: crbug.com/604808 340 # Disable WPO for yasm: crbug.com/604808
308 if (is_official_build && full_wpo_on_official) { 341 if (is_official_build && full_wpo_on_official) {
309 configs -= [ "//build/config/compiler:default_optimization" ] 342 configs -= [ "//build/config/compiler:default_optimization" ]
310 configs += [ "//build/config/compiler:optimize_no_wpo" ] 343 configs += [ "//build/config/compiler:optimize_no_wpo" ]
344 } else {
345 configs -= configs_to_delete
346 configs += configs_to_add
311 } 347 }
312 348
313 # Yasm generates a bunch of .c files which its source file #include. 349 # Yasm generates a bunch of .c files which its source file #include.
314 # Add the |target_gen_dir| into the include path so it can find them. 350 # Add the |target_gen_dir| into the include path so it can find them.
315 # Ideally, these generated .c files would be placed into a separate 351 # Ideally, these generated .c files would be placed into a separate
316 # directory, but the gen_x86_insn.py script does not make this easy. 352 # directory, but the gen_x86_insn.py script does not make this easy.
317 include_dirs = [ yasm_gen_include_dir ] 353 include_dirs = [ yasm_gen_include_dir ]
318 354
319 if (!is_win) { 355 if (!is_win) {
320 cflags = [ 356 cflags = [
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 574
539 # Output eventually #included by source/patched-yasm/frontends/yasm/x86id.c 575 # Output eventually #included by source/patched-yasm/frontends/yasm/x86id.c
540 outputs = [ 576 outputs = [
541 "$yasm_gen_include_dir/x86insns.c", 577 "$yasm_gen_include_dir/x86insns.c",
542 "$yasm_gen_include_dir/x86insn_gas.gperf", 578 "$yasm_gen_include_dir/x86insn_gas.gperf",
543 "$yasm_gen_include_dir/x86insn_nasm.gperf", 579 "$yasm_gen_include_dir/x86insn_nasm.gperf",
544 ] 580 ]
545 args = [ rebase_path(yasm_gen_include_dir, root_build_dir) ] 581 args = [ rebase_path(yasm_gen_include_dir, root_build_dir) ]
546 } 582 }
547 } 583 }
OLDNEW
« no previous file with comments | « build/config/win/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698