Add more comments to arch.go
Make sure every exported function or type has a godoc comment. Also makes minor changes like unexporting functions that are not used outside the package and fixing minor style warnings. Bug: 173449605 Test: m checkbuild Change-Id: I533a595d02035aae8b2b603590be639826d2d4c8
This commit is contained in:
@@ -15,6 +15,7 @@ bootstrap_go_package {
|
||||
"apex.go",
|
||||
"api_levels.go",
|
||||
"arch.go",
|
||||
"arch_list.go",
|
||||
"bazel_handler.go",
|
||||
"config.go",
|
||||
"csuite_config.go",
|
||||
|
859
android/arch.go
859
android/arch.go
File diff suppressed because it is too large
Load Diff
410
android/arch_list.go
Normal file
410
android/arch_list.go
Normal file
@@ -0,0 +1,410 @@
|
||||
// Copyright 2020 Google Inc. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package android
|
||||
|
||||
import "fmt"
|
||||
|
||||
var archVariants = map[ArchType][]string{
|
||||
Arm: {
|
||||
"armv7-a",
|
||||
"armv7-a-neon",
|
||||
"armv8-a",
|
||||
"armv8-2a",
|
||||
"cortex-a7",
|
||||
"cortex-a8",
|
||||
"cortex-a9",
|
||||
"cortex-a15",
|
||||
"cortex-a53",
|
||||
"cortex-a53-a57",
|
||||
"cortex-a55",
|
||||
"cortex-a72",
|
||||
"cortex-a73",
|
||||
"cortex-a75",
|
||||
"cortex-a76",
|
||||
"krait",
|
||||
"kryo",
|
||||
"kryo385",
|
||||
"exynos-m1",
|
||||
"exynos-m2",
|
||||
},
|
||||
Arm64: {
|
||||
"armv8_a",
|
||||
"armv8_2a",
|
||||
"armv8-2a-dotprod",
|
||||
"cortex-a53",
|
||||
"cortex-a55",
|
||||
"cortex-a72",
|
||||
"cortex-a73",
|
||||
"cortex-a75",
|
||||
"cortex-a76",
|
||||
"kryo",
|
||||
"kryo385",
|
||||
"exynos-m1",
|
||||
"exynos-m2",
|
||||
},
|
||||
X86: {
|
||||
"amberlake",
|
||||
"atom",
|
||||
"broadwell",
|
||||
"haswell",
|
||||
"icelake",
|
||||
"ivybridge",
|
||||
"kabylake",
|
||||
"sandybridge",
|
||||
"silvermont",
|
||||
"skylake",
|
||||
"stoneyridge",
|
||||
"tigerlake",
|
||||
"whiskeylake",
|
||||
"x86_64",
|
||||
},
|
||||
X86_64: {
|
||||
"amberlake",
|
||||
"broadwell",
|
||||
"haswell",
|
||||
"icelake",
|
||||
"ivybridge",
|
||||
"kabylake",
|
||||
"sandybridge",
|
||||
"silvermont",
|
||||
"skylake",
|
||||
"stoneyridge",
|
||||
"tigerlake",
|
||||
"whiskeylake",
|
||||
},
|
||||
}
|
||||
|
||||
var archFeatures = map[ArchType][]string{
|
||||
Arm: {
|
||||
"neon",
|
||||
},
|
||||
Arm64: {
|
||||
"dotprod",
|
||||
},
|
||||
X86: {
|
||||
"ssse3",
|
||||
"sse4",
|
||||
"sse4_1",
|
||||
"sse4_2",
|
||||
"aes_ni",
|
||||
"avx",
|
||||
"avx2",
|
||||
"avx512",
|
||||
"popcnt",
|
||||
"movbe",
|
||||
},
|
||||
X86_64: {
|
||||
"ssse3",
|
||||
"sse4",
|
||||
"sse4_1",
|
||||
"sse4_2",
|
||||
"aes_ni",
|
||||
"avx",
|
||||
"avx2",
|
||||
"avx512",
|
||||
"popcnt",
|
||||
},
|
||||
}
|
||||
|
||||
var archFeatureMap = map[ArchType]map[string][]string{
|
||||
Arm: {
|
||||
"armv7-a-neon": {
|
||||
"neon",
|
||||
},
|
||||
"armv8-a": {
|
||||
"neon",
|
||||
},
|
||||
"armv8-2a": {
|
||||
"neon",
|
||||
},
|
||||
},
|
||||
Arm64: {
|
||||
"armv8-2a-dotprod": {
|
||||
"dotprod",
|
||||
},
|
||||
},
|
||||
X86: {
|
||||
"amberlake": {
|
||||
"ssse3",
|
||||
"sse4",
|
||||
"sse4_1",
|
||||
"sse4_2",
|
||||
"avx",
|
||||
"avx2",
|
||||
"aes_ni",
|
||||
"popcnt",
|
||||
},
|
||||
"atom": {
|
||||
"ssse3",
|
||||
"movbe",
|
||||
},
|
||||
"broadwell": {
|
||||
"ssse3",
|
||||
"sse4",
|
||||
"sse4_1",
|
||||
"sse4_2",
|
||||
"avx",
|
||||
"avx2",
|
||||
"aes_ni",
|
||||
"popcnt",
|
||||
},
|
||||
"haswell": {
|
||||
"ssse3",
|
||||
"sse4",
|
||||
"sse4_1",
|
||||
"sse4_2",
|
||||
"aes_ni",
|
||||
"avx",
|
||||
"popcnt",
|
||||
"movbe",
|
||||
},
|
||||
"icelake": {
|
||||
"ssse3",
|
||||
"sse4",
|
||||
"sse4_1",
|
||||
"sse4_2",
|
||||
"avx",
|
||||
"avx2",
|
||||
"avx512",
|
||||
"aes_ni",
|
||||
"popcnt",
|
||||
},
|
||||
"ivybridge": {
|
||||
"ssse3",
|
||||
"sse4",
|
||||
"sse4_1",
|
||||
"sse4_2",
|
||||
"aes_ni",
|
||||
"avx",
|
||||
"popcnt",
|
||||
},
|
||||
"kabylake": {
|
||||
"ssse3",
|
||||
"sse4",
|
||||
"sse4_1",
|
||||
"sse4_2",
|
||||
"avx",
|
||||
"avx2",
|
||||
"aes_ni",
|
||||
"popcnt",
|
||||
},
|
||||
"sandybridge": {
|
||||
"ssse3",
|
||||
"sse4",
|
||||
"sse4_1",
|
||||
"sse4_2",
|
||||
"popcnt",
|
||||
},
|
||||
"silvermont": {
|
||||
"ssse3",
|
||||
"sse4",
|
||||
"sse4_1",
|
||||
"sse4_2",
|
||||
"aes_ni",
|
||||
"popcnt",
|
||||
"movbe",
|
||||
},
|
||||
"skylake": {
|
||||
"ssse3",
|
||||
"sse4",
|
||||
"sse4_1",
|
||||
"sse4_2",
|
||||
"avx",
|
||||
"avx2",
|
||||
"avx512",
|
||||
"aes_ni",
|
||||
"popcnt",
|
||||
},
|
||||
"stoneyridge": {
|
||||
"ssse3",
|
||||
"sse4",
|
||||
"sse4_1",
|
||||
"sse4_2",
|
||||
"aes_ni",
|
||||
"avx",
|
||||
"avx2",
|
||||
"popcnt",
|
||||
"movbe",
|
||||
},
|
||||
"tigerlake": {
|
||||
"ssse3",
|
||||
"sse4",
|
||||
"sse4_1",
|
||||
"sse4_2",
|
||||
"avx",
|
||||
"avx2",
|
||||
"avx512",
|
||||
"aes_ni",
|
||||
"popcnt",
|
||||
},
|
||||
"whiskeylake": {
|
||||
"ssse3",
|
||||
"sse4",
|
||||
"sse4_1",
|
||||
"sse4_2",
|
||||
"avx",
|
||||
"avx2",
|
||||
"avx512",
|
||||
"aes_ni",
|
||||
"popcnt",
|
||||
},
|
||||
"x86_64": {
|
||||
"ssse3",
|
||||
"sse4",
|
||||
"sse4_1",
|
||||
"sse4_2",
|
||||
"popcnt",
|
||||
},
|
||||
},
|
||||
X86_64: {
|
||||
"amberlake": {
|
||||
"ssse3",
|
||||
"sse4",
|
||||
"sse4_1",
|
||||
"sse4_2",
|
||||
"avx",
|
||||
"avx2",
|
||||
"aes_ni",
|
||||
"popcnt",
|
||||
},
|
||||
"broadwell": {
|
||||
"ssse3",
|
||||
"sse4",
|
||||
"sse4_1",
|
||||
"sse4_2",
|
||||
"avx",
|
||||
"avx2",
|
||||
"aes_ni",
|
||||
"popcnt",
|
||||
},
|
||||
"haswell": {
|
||||
"ssse3",
|
||||
"sse4",
|
||||
"sse4_1",
|
||||
"sse4_2",
|
||||
"aes_ni",
|
||||
"avx",
|
||||
"popcnt",
|
||||
},
|
||||
"icelake": {
|
||||
"ssse3",
|
||||
"sse4",
|
||||
"sse4_1",
|
||||
"sse4_2",
|
||||
"avx",
|
||||
"avx2",
|
||||
"avx512",
|
||||
"aes_ni",
|
||||
"popcnt",
|
||||
},
|
||||
"ivybridge": {
|
||||
"ssse3",
|
||||
"sse4",
|
||||
"sse4_1",
|
||||
"sse4_2",
|
||||
"aes_ni",
|
||||
"avx",
|
||||
"popcnt",
|
||||
},
|
||||
"kabylake": {
|
||||
"ssse3",
|
||||
"sse4",
|
||||
"sse4_1",
|
||||
"sse4_2",
|
||||
"avx",
|
||||
"avx2",
|
||||
"aes_ni",
|
||||
"popcnt",
|
||||
},
|
||||
"sandybridge": {
|
||||
"ssse3",
|
||||
"sse4",
|
||||
"sse4_1",
|
||||
"sse4_2",
|
||||
"popcnt",
|
||||
},
|
||||
"silvermont": {
|
||||
"ssse3",
|
||||
"sse4",
|
||||
"sse4_1",
|
||||
"sse4_2",
|
||||
"aes_ni",
|
||||
"popcnt",
|
||||
},
|
||||
"skylake": {
|
||||
"ssse3",
|
||||
"sse4",
|
||||
"sse4_1",
|
||||
"sse4_2",
|
||||
"avx",
|
||||
"avx2",
|
||||
"avx512",
|
||||
"aes_ni",
|
||||
"popcnt",
|
||||
},
|
||||
"stoneyridge": {
|
||||
"ssse3",
|
||||
"sse4",
|
||||
"sse4_1",
|
||||
"sse4_2",
|
||||
"aes_ni",
|
||||
"avx",
|
||||
"avx2",
|
||||
"popcnt",
|
||||
},
|
||||
"tigerlake": {
|
||||
"ssse3",
|
||||
"sse4",
|
||||
"sse4_1",
|
||||
"sse4_2",
|
||||
"avx",
|
||||
"avx2",
|
||||
"avx512",
|
||||
"aes_ni",
|
||||
"popcnt",
|
||||
},
|
||||
"whiskeylake": {
|
||||
"ssse3",
|
||||
"sse4",
|
||||
"sse4_1",
|
||||
"sse4_2",
|
||||
"avx",
|
||||
"avx2",
|
||||
"avx512",
|
||||
"aes_ni",
|
||||
"popcnt",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
var defaultArchFeatureMap = map[OsType]map[ArchType][]string{}
|
||||
|
||||
// RegisterDefaultArchVariantFeatures is called by files that define Toolchains to specify the
|
||||
// arch features that are available for the default arch variant. It must be called from an
|
||||
// init() function.
|
||||
func RegisterDefaultArchVariantFeatures(os OsType, arch ArchType, features ...string) {
|
||||
checkCalledFromInit()
|
||||
|
||||
for _, feature := range features {
|
||||
if !InList(feature, archFeatures[arch]) {
|
||||
panic(fmt.Errorf("Invalid feature %q for arch %q variant \"\"", feature, arch))
|
||||
}
|
||||
}
|
||||
|
||||
if defaultArchFeatureMap[os] == nil {
|
||||
defaultArchFeatureMap[os] = make(map[ArchType][]string)
|
||||
}
|
||||
defaultArchFeatureMap[os][arch] = features
|
||||
}
|
@@ -183,7 +183,7 @@ func InitDefaultsModule(module DefaultsModule) {
|
||||
|
||||
initAndroidModuleBase(module)
|
||||
initProductVariableModule(module)
|
||||
InitArchModule(module)
|
||||
initArchModule(module)
|
||||
InitDefaultableModule(module)
|
||||
|
||||
// Add properties that will not have defaults applied to them.
|
||||
|
@@ -717,7 +717,9 @@ type commonProperties struct {
|
||||
DebugMutators []string `blueprint:"mutated"`
|
||||
DebugVariations []string `blueprint:"mutated"`
|
||||
|
||||
// set by ImageMutator
|
||||
// ImageVariation is set by ImageMutator to specify which image this variation is for,
|
||||
// for example "" for core or "recovery" for recovery. It will often be set to one of the
|
||||
// constants in image.go, but can also be set to a custom value by individual module types.
|
||||
ImageVariation string `blueprint:"mutated"`
|
||||
}
|
||||
|
||||
@@ -825,6 +827,8 @@ func initAndroidModuleBase(m Module) {
|
||||
m.base().module = m
|
||||
}
|
||||
|
||||
// InitAndroidModule initializes the Module as an Android module that is not architecture-specific.
|
||||
// It adds the common properties, for example "name" and "enabled".
|
||||
func InitAndroidModule(m Module) {
|
||||
initAndroidModuleBase(m)
|
||||
base := m.base()
|
||||
@@ -844,6 +848,12 @@ func InitAndroidModule(m Module) {
|
||||
setPrimaryVisibilityProperty(m, "visibility", &base.commonProperties.Visibility)
|
||||
}
|
||||
|
||||
// InitAndroidArchModule initializes the Module as an Android module that is architecture-specific.
|
||||
// It adds the common properties, for example "name" and "enabled", as well as runtime generated
|
||||
// property structs for architecture-specific versions of generic properties tagged with
|
||||
// `android:"arch_variant"`.
|
||||
//
|
||||
// InitAndroidModule should not be called if InitAndroidArchModule was called.
|
||||
func InitAndroidArchModule(m Module, hod HostOrDeviceSupported, defaultMultilib Multilib) {
|
||||
InitAndroidModule(m)
|
||||
|
||||
@@ -857,16 +867,33 @@ func InitAndroidArchModule(m Module, hod HostOrDeviceSupported, defaultMultilib
|
||||
m.AddProperties(&base.hostAndDeviceProperties)
|
||||
}
|
||||
|
||||
InitArchModule(m)
|
||||
initArchModule(m)
|
||||
}
|
||||
|
||||
// InitAndroidMultiTargetsArchModule initializes the Module as an Android module that is
|
||||
// architecture-specific, but will only have a single variant per OS that handles all the
|
||||
// architectures simultaneously. The list of Targets that it must handle will be available from
|
||||
// ModuleContext.MultiTargets. It adds the common properties, for example "name" and "enabled", as
|
||||
// well as runtime generated property structs for architecture-specific versions of generic
|
||||
// properties tagged with `android:"arch_variant"`.
|
||||
//
|
||||
// InitAndroidModule or InitAndroidArchModule should not be called if
|
||||
// InitAndroidMultiTargetsArchModule was called.
|
||||
func InitAndroidMultiTargetsArchModule(m Module, hod HostOrDeviceSupported, defaultMultilib Multilib) {
|
||||
InitAndroidArchModule(m, hod, defaultMultilib)
|
||||
m.base().commonProperties.UseTargetVariants = false
|
||||
}
|
||||
|
||||
// As InitAndroidMultiTargetsArchModule except it creates an additional CommonOS variant that
|
||||
// has dependencies on all the OsType specific variants.
|
||||
// InitCommonOSAndroidMultiTargetsArchModule initializes the Module as an Android module that is
|
||||
// architecture-specific, but will only have a single variant per OS that handles all the
|
||||
// architectures simultaneously, and will also have an additional CommonOS variant that has
|
||||
// dependencies on all the OS-specific variants. The list of Targets that it must handle will be
|
||||
// available from ModuleContext.MultiTargets. It adds the common properties, for example "name" and
|
||||
// "enabled", as well as runtime generated property structs for architecture-specific versions of
|
||||
// generic properties tagged with `android:"arch_variant"`.
|
||||
//
|
||||
// InitAndroidModule, InitAndroidArchModule or InitAndroidMultiTargetsArchModule should not be
|
||||
// called if InitCommonOSAndroidMultiTargetsArchModule was called.
|
||||
func InitCommonOSAndroidMultiTargetsArchModule(m Module, hod HostOrDeviceSupported, defaultMultilib Multilib) {
|
||||
InitAndroidArchModule(m, hod, defaultMultilib)
|
||||
m.base().commonProperties.UseTargetVariants = false
|
||||
|
Reference in New Issue
Block a user