const Arch *GetHostArch(void) { static const Arch *gHostArch = nullptr; if (!gHostArch) { gHostArch = Arch::Get(GetOSName(REMILL_OS), GetArchName(REMILL_ARCH)); } return gHostArch; }
const Arch *GetTargetArch(void) { static const Arch *gTargetArch = nullptr; if (!gTargetArch) { gTargetArch = Arch::Get(GetOSName(FLAGS_os), GetArchName(FLAGS_arch)); } return gTargetArch; }
char const *GetArchName(CPUType type, CPUSubType subtype, Endian endian) { switch (type) { case kCPUTypeARM: if (endian == kEndianLittle) { switch (subtype) { case kCPUSubTypeARM_V7: case kCPUSubTypeARM_V7F: case kCPUSubTypeARM_V7S: case kCPUSubTypeARM_V7K: case kCPUSubTypeARM_V7M: case kCPUSubTypeARM_V7EM: return "armv7"; default: return "arm"; } } else { return "armeb"; } case kCPUTypePOWERPC: if (endian == kEndianLittle) return "powerpcle"; else return "powerpc"; case kCPUTypePOWERPC64: if (endian == kEndianLittle) return "powerpc64le"; else return "powerpc64"; case kCPUTypeMIPS: if (endian == kEndianLittle) return "mipsel"; else return "mipseb"; case kCPUTypeMIPS64: if (endian == kEndianLittle) return "mips64el"; else return "mips64eb"; default: break; } return GetArchName(type, subtype); }