summaryrefslogtreecommitdiff
path: root/runtime/arch/instruction_set_features.cc
diff options
context:
space:
mode:
author Santiago Aboy Solanes <solanes@google.com> 2022-02-03 13:45:56 +0000
committer Santiago Aboy Solanes <solanes@google.com> 2022-02-04 14:13:59 +0000
commit3b76ab46081304d6847b0d27e26aa4e0da24e673 (patch)
treef21cbada02814850dc0dda7c956a25b4f4b76522 /runtime/arch/instruction_set_features.cc
parent92138f0dae9348a9ce90bd91ef34341efefc74d5 (diff)
Add known instruction set variants to logging strings
If a user had a wrong variant, they would get a message like `Unexpected CPU variant for X86 using defaults: x86` but they wouldn't know which ones we accept, unless they take a look at the code. This change comes after a developer's suggestion when encountering said warning string. Test: Presubmit tests Change-Id: I3a7b9408cf55114229843f6ff6013999350d7185
Diffstat (limited to 'runtime/arch/instruction_set_features.cc')
-rw-r--r--runtime/arch/instruction_set_features.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/runtime/arch/instruction_set_features.cc b/runtime/arch/instruction_set_features.cc
index ec1e340245..5ae920bef1 100644
--- a/runtime/arch/instruction_set_features.cc
+++ b/runtime/arch/instruction_set_features.cc
@@ -267,6 +267,16 @@ bool InstructionSetFeatures::FindVariantInArray(const char* const variants[], si
return std::find(begin, end, variant) != end;
}
+void InstructionSetFeatures::CommaSeparateVariants(std::ostream& os,
+ const char* const variants[],
+ size_t num_variants) {
+ std::string separator = "";
+ for (size_t i = 0u; i < num_variants; ++i) {
+ os << separator << variants[i];
+ separator = ", ";
+ }
+}
+
std::unique_ptr<const InstructionSetFeatures> InstructionSetFeatures::AddRuntimeDetectedFeatures(
const InstructionSetFeatures *features ATTRIBUTE_UNUSED) const {
UNIMPLEMENTED(FATAL) << kRuntimeISA;