aboutsummaryrefslogtreecommitdiffstats
path: root/cc/pgo.go
diff options
context:
space:
mode:
Diffstat (limited to 'cc/pgo.go')
-rw-r--r--cc/pgo.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/cc/pgo.go b/cc/pgo.go
index 1e703397..779ef39d 100644
--- a/cc/pgo.go
+++ b/cc/pgo.go
@@ -45,7 +45,7 @@ func getPgoProfileProjects(config android.DeviceConfig) []string {
})
}
-func recordMissingProfileFile(ctx ModuleContext, missing string) {
+func recordMissingProfileFile(ctx BaseModuleContext, missing string) {
getNamedMapForConfig(ctx.Config(), modulesMissingProfileFile).Store(missing, true)
}
@@ -63,6 +63,7 @@ type PgoProperties struct {
PgoPresent bool `blueprint:"mutated"`
ShouldProfileModule bool `blueprint:"mutated"`
+ PgoCompile bool `blueprint:"mutated"`
}
type pgo struct {
@@ -98,7 +99,7 @@ func (props *PgoProperties) addProfileGatherFlags(ctx ModuleContext, flags Flags
return flags
}
-func (props *PgoProperties) getPgoProfileFile(ctx ModuleContext) android.OptionalPath {
+func (props *PgoProperties) getPgoProfileFile(ctx BaseModuleContext) android.OptionalPath {
// Test if the profile_file is present in any of the PGO profile projects
for _, profileProject := range getPgoProfileProjects(ctx.DeviceConfig()) {
path := android.ExistentPathForSource(ctx, "", profileProject, *props.Pgo.Profile_file)
@@ -232,6 +233,12 @@ func (pgo *pgo) begin(ctx BaseModuleContext) {
}
}
}
+
+ if !ctx.Config().IsEnvTrue("ANDROID_PGO_NO_PROFILE_USE") {
+ if profileFile := pgo.Properties.getPgoProfileFile(ctx); profileFile.Valid() {
+ pgo.Properties.PgoCompile = true
+ }
+ }
}
func (pgo *pgo) deps(ctx BaseModuleContext, deps Deps) Deps {