Introduce afdo

A new configuration rule for sampling PGO. This differs from the
original pgo.go rule in the following ways:
 * Automatic propagation to static dependencies
 * Simpler configuration (just put `afdo: true` to optimsation targets)

http://go/android-afdo

Test: build
Bug: 79161490
Change-Id: Ie194824cd523bca19e10ced41d2078fc598f13b3
This commit is contained in:
Yi Kong
2021-12-09 18:06:29 +08:00
parent 55f84a74c5
commit eb8efc902d
5 changed files with 217 additions and 2 deletions

View File

@@ -64,6 +64,9 @@ func RegisterCCBuildComponents(ctx android.RegistrationContext) {
ctx.BottomUp("coverage", coverageMutator).Parallel()
ctx.TopDown("afdo_deps", afdoDepsMutator)
ctx.BottomUp("afdo", afdoMutator).Parallel()
ctx.TopDown("lto_deps", ltoDepsMutator)
ctx.BottomUp("lto", ltoMutator).Parallel()
@@ -810,6 +813,7 @@ type Module struct {
sabi *sabi
vndkdep *vndkdep
lto *lto
afdo *afdo
pgo *pgo
library libraryInterface
@@ -1143,6 +1147,9 @@ func (c *Module) Init() android.Module {
if c.lto != nil {
c.AddProperties(c.lto.props()...)
}
if c.afdo != nil {
c.AddProperties(c.afdo.props()...)
}
if c.pgo != nil {
c.AddProperties(c.pgo.props()...)
}
@@ -1620,6 +1627,7 @@ func newModule(hod android.HostOrDeviceSupported, multilib android.Multilib) *Mo
module.sabi = &sabi{}
module.vndkdep = &vndkdep{}
module.lto = &lto{}
module.afdo = &afdo{}
module.pgo = &pgo{}
return module
}
@@ -1815,6 +1823,9 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
if c.lto != nil {
flags = c.lto.flags(ctx, flags)
}
if c.afdo != nil {
flags = c.afdo.flags(ctx, flags)
}
if c.pgo != nil {
flags = c.pgo.flags(ctx, flags)
}
@@ -1942,6 +1953,9 @@ func (c *Module) begin(ctx BaseModuleContext) {
if c.lto != nil {
c.lto.begin(ctx)
}
if c.afdo != nil {
c.afdo.begin(ctx)
}
if c.pgo != nil {
c.pgo.begin(ctx)
}
@@ -3534,6 +3548,7 @@ func DefaultsFactory(props ...interface{}) android.Module {
&SAbiProperties{},
&VndkProperties{},
&LTOProperties{},
&AfdoProperties{},
&PgoProperties{},
&android.ProtoProperties{},
// RustBindgenProperties is included here so that cc_defaults can be used for rust_bindgen modules.