AFDO for Rust
Bug: 195134194 Bug: 165018530 Test: build Change-Id: I30932a22dc0b22716cdc925a3fcc5f9a169fcec4
This commit is contained in:
10
rust/rust.go
10
rust/rust.go
@@ -148,6 +148,7 @@ type Module struct {
|
||||
|
||||
makeLinkType string
|
||||
|
||||
afdo *afdo
|
||||
compiler compiler
|
||||
coverage *coverage
|
||||
clippy *clippy
|
||||
@@ -403,6 +404,7 @@ type PathDeps struct {
|
||||
SharedLibDeps android.Paths
|
||||
StaticLibs android.Paths
|
||||
ProcMacros RustLibraries
|
||||
AfdoProfiles android.Paths
|
||||
|
||||
// depFlags and depLinkFlags are rustc and linker (clang) flags.
|
||||
depFlags []string
|
||||
@@ -551,6 +553,7 @@ func DefaultsFactory(props ...interface{}) android.Module {
|
||||
module.AddProperties(props...)
|
||||
module.AddProperties(
|
||||
&BaseProperties{},
|
||||
&cc.AfdoProperties{},
|
||||
&cc.VendorProperties{},
|
||||
&BenchmarkProperties{},
|
||||
&BindgenProperties{},
|
||||
@@ -688,6 +691,9 @@ func (mod *Module) Init() android.Module {
|
||||
mod.AddProperties(&mod.Properties)
|
||||
mod.AddProperties(&mod.VendorProperties)
|
||||
|
||||
if mod.afdo != nil {
|
||||
mod.AddProperties(mod.afdo.props()...)
|
||||
}
|
||||
if mod.compiler != nil {
|
||||
mod.AddProperties(mod.compiler.compilerProps()...)
|
||||
}
|
||||
@@ -719,6 +725,7 @@ func newBaseModule(hod android.HostOrDeviceSupported, multilib android.Multilib)
|
||||
}
|
||||
func newModule(hod android.HostOrDeviceSupported, multilib android.Multilib) *Module {
|
||||
module := newBaseModule(hod, multilib)
|
||||
module.afdo = &afdo{}
|
||||
module.coverage = &coverage{}
|
||||
module.clippy = &clippy{}
|
||||
module.sanitize = &sanitize{}
|
||||
@@ -856,6 +863,9 @@ func (mod *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
|
||||
}
|
||||
|
||||
// Calculate rustc flags
|
||||
if mod.afdo != nil {
|
||||
flags, deps = mod.afdo.flags(ctx, flags, deps)
|
||||
}
|
||||
if mod.compiler != nil {
|
||||
flags = mod.compiler.compilerFlags(ctx, flags)
|
||||
flags = mod.compiler.cfgFlags(ctx, flags)
|
||||
|
Reference in New Issue
Block a user