xref: /aosp_15_r20/external/angle/build/config/compiler/pgo/pgo.gni (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1*8975f5c5SAndroid Build Coastguard Worker# Copyright 2016 The Chromium Authors
2*8975f5c5SAndroid Build Coastguard Worker# Use of this source code is governed by a BSD-style license that can be
3*8975f5c5SAndroid Build Coastguard Worker# found in the LICENSE file.
4*8975f5c5SAndroid Build Coastguard Worker
5*8975f5c5SAndroid Build Coastguard Workerimport("//build/config/cast.gni")
6*8975f5c5SAndroid Build Coastguard Workerimport("//build/config/chrome_build.gni")
7*8975f5c5SAndroid Build Coastguard Workerimport("//build/config/chromeos/ui_mode.gni")
8*8975f5c5SAndroid Build Coastguard Workerimport("//build/config/cronet/config.gni")
9*8975f5c5SAndroid Build Coastguard Workerimport("//build/config/dcheck_always_on.gni")
10*8975f5c5SAndroid Build Coastguard Workerimport("//build/config/features.gni")
11*8975f5c5SAndroid Build Coastguard Worker
12*8975f5c5SAndroid Build Coastguard Workerif (is_ios) {
13*8975f5c5SAndroid Build Coastguard Worker  import("//build/config/apple/mobile_config.gni")
14*8975f5c5SAndroid Build Coastguard Worker}
15*8975f5c5SAndroid Build Coastguard Worker
16*8975f5c5SAndroid Build Coastguard Workerdeclare_args() {
17*8975f5c5SAndroid Build Coastguard Worker  # Specify the current PGO phase.
18*8975f5c5SAndroid Build Coastguard Worker  # Here's the different values that can be used:
19*8975f5c5SAndroid Build Coastguard Worker  #     0 : Means that PGO is turned off.
20*8975f5c5SAndroid Build Coastguard Worker  #     1 : Used during the PGI (instrumentation) phase.
21*8975f5c5SAndroid Build Coastguard Worker  #     2 : Used during the PGO (optimization) phase.
22*8975f5c5SAndroid Build Coastguard Worker  # PGO profiles are generated from `dcheck_always_on = false` builds. Mixing
23*8975f5c5SAndroid Build Coastguard Worker  # those profiles with `dcheck_always_on = true` builds can cause the compiler
24*8975f5c5SAndroid Build Coastguard Worker  # to think some code is hotter than it actually is, potentially causing very
25*8975f5c5SAndroid Build Coastguard Worker  # bad compile times.
26*8975f5c5SAndroid Build Coastguard Worker  chrome_pgo_phase = 0
27*8975f5c5SAndroid Build Coastguard Worker  if (!is_cronet_build && !dcheck_always_on && is_official_build &&
28*8975f5c5SAndroid Build Coastguard Worker      # TODO(crbug.com/1336055): Update this now-outdated condition with regard
29*8975f5c5SAndroid Build Coastguard Worker      # to chromecast and determine whether chromeos_is_browser_only is
30*8975f5c5SAndroid Build Coastguard Worker      # obsolete.
31*8975f5c5SAndroid Build Coastguard Worker      (is_high_end_android || is_win || is_mac || is_fuchsia ||
32*8975f5c5SAndroid Build Coastguard Worker       (is_linux && !is_castos) ||
33*8975f5c5SAndroid Build Coastguard Worker       (is_ios && use_blink && target_environment == "device") ||
34*8975f5c5SAndroid Build Coastguard Worker       (is_chromeos_lacros && is_chromeos_device))) {
35*8975f5c5SAndroid Build Coastguard Worker    chrome_pgo_phase = 2
36*8975f5c5SAndroid Build Coastguard Worker  }
37*8975f5c5SAndroid Build Coastguard Worker
38*8975f5c5SAndroid Build Coastguard Worker  # When using chrome_pgo_phase = 2, read profile data from this path.
39*8975f5c5SAndroid Build Coastguard Worker  pgo_data_path = ""
40*8975f5c5SAndroid Build Coastguard Worker
41*8975f5c5SAndroid Build Coastguard Worker  # Whether to enable temporal pgo or not (experimental).
42*8975f5c5SAndroid Build Coastguard Worker  temporal_pgo_profile = false
43*8975f5c5SAndroid Build Coastguard Worker}
44