summaryrefslogtreecommitdiffstats
path: root/runtime/instruction_set.cc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/instruction_set.cc')
-rw-r--r--runtime/instruction_set.cc42
1 files changed, 42 insertions, 0 deletions
diff --git a/runtime/instruction_set.cc b/runtime/instruction_set.cc
index 73d427985f..cbcd2e063b 100644
--- a/runtime/instruction_set.cc
+++ b/runtime/instruction_set.cc
@@ -21,6 +21,48 @@
namespace art {
+const char* GetInstructionSetString(const InstructionSet isa) {
+ switch (isa) {
+ case kArm:
+ case kThumb2:
+ return "arm";
+ case kArm64:
+ return "arm64";
+ case kX86:
+ return "x86";
+ case kX86_64:
+ return "x86_64";
+ case kMips:
+ return "mips";
+ case kNone:
+ return "none";
+ default:
+ LOG(FATAL) << "Unknown ISA " << isa;
+ return nullptr;
+ }
+}
+
+InstructionSet GetInstructionSetFromString(const char* isa_str) {
+ CHECK(isa_str != nullptr);
+
+ if (!strcmp("arm", isa_str)) {
+ return kArm;
+ } else if (!strcmp("arm64", isa_str)) {
+ return kArm64;
+ } else if (!strcmp("x86", isa_str)) {
+ return kX86;
+ } else if (!strcmp("x86_64", isa_str)) {
+ return kX86_64;
+ } else if (!strcmp("mips", isa_str)) {
+ return kMips;
+ } else if (!strcmp("none", isa_str)) {
+ return kNone;
+ }
+
+ LOG(FATAL) << "Unknown ISA " << isa_str;
+ return kNone;
+}
+
size_t GetInstructionSetPointerSize(InstructionSet isa) {
switch (isa) {
case kArm: