diff options
Diffstat (limited to 'runtime/instruction_set.cc')
| -rw-r--r-- | runtime/instruction_set.cc | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/runtime/instruction_set.cc b/runtime/instruction_set.cc index c96462915b..73d427985f 100644 --- a/runtime/instruction_set.cc +++ b/runtime/instruction_set.cc @@ -16,8 +16,78 @@ #include "instruction_set.h" +#include "globals.h" +#include "base/logging.h" // Logging is required for FATAL in the helper functions. + namespace art { +size_t GetInstructionSetPointerSize(InstructionSet isa) { + switch (isa) { + case kArm: + // Fall-through. + case kThumb2: + return kArmPointerSize; + case kArm64: + return kArm64PointerSize; + case kX86: + return kX86PointerSize; + case kX86_64: + return kX86_64PointerSize; + case kMips: + return kMipsPointerSize; + case kNone: + LOG(FATAL) << "ISA kNone does not have pointer size."; + return 0; + default: + LOG(FATAL) << "Unknown ISA " << isa; + return 0; + } +} + +size_t GetInstructionSetAlignment(InstructionSet isa) { + switch (isa) { + case kArm: + // Fall-through. + case kThumb2: + return kArmAlignment; + case kArm64: + return kArm64Alignment; + case kX86: + // Fall-through. + case kX86_64: + return kX86Alignment; + case kMips: + return kMipsAlignment; + case kNone: + LOG(FATAL) << "ISA kNone does not have alignment."; + return 0; + default: + LOG(FATAL) << "Unknown ISA " << isa; + return 0; + } +} + +bool Is64BitInstructionSet(InstructionSet isa) { + switch (isa) { + case kArm: + case kThumb2: + case kX86: + case kMips: + return false; + + case kArm64: + case kX86_64: + return true; + + case kNone: + LOG(FATAL) << "ISA kNone does not have bit width."; + return 0; + default: + LOG(FATAL) << "Unknown ISA " << isa; + return 0; + } +} + std::string InstructionSetFeatures::GetFeatureString() const { std::string result; if ((mask_ & kHwDiv) != 0) { |