diff options
Diffstat (limited to 'contrib/llvm/lib/Support/Triple.cpp')
-rw-r--r-- | contrib/llvm/lib/Support/Triple.cpp | 54 |
1 files changed, 46 insertions, 8 deletions
diff --git a/contrib/llvm/lib/Support/Triple.cpp b/contrib/llvm/lib/Support/Triple.cpp index 2bac2a3..6783b40 100644 --- a/contrib/llvm/lib/Support/Triple.cpp +++ b/contrib/llvm/lib/Support/Triple.cpp @@ -17,7 +17,7 @@ #include <cstring> using namespace llvm; -const char *Triple::getArchTypeName(ArchType Kind) { +StringRef Triple::getArchTypeName(ArchType Kind) { switch (Kind) { case UnknownArch: return "unknown"; @@ -39,11 +39,14 @@ const char *Triple::getArchTypeName(ArchType Kind) { case ppc: return "powerpc"; case r600: return "r600"; case amdgcn: return "amdgcn"; + case riscv32: return "riscv32"; + case riscv64: return "riscv64"; case sparc: return "sparc"; case sparcv9: return "sparcv9"; case sparcel: return "sparcel"; case systemz: return "s390x"; case tce: return "tce"; + case tcele: return "tcele"; case thumb: return "thumb"; case thumbeb: return "thumbeb"; case x86: return "i386"; @@ -71,10 +74,10 @@ const char *Triple::getArchTypeName(ArchType Kind) { llvm_unreachable("Invalid ArchType!"); } -const char *Triple::getArchTypePrefix(ArchType Kind) { +StringRef Triple::getArchTypePrefix(ArchType Kind) { switch (Kind) { default: - return nullptr; + return StringRef(); case aarch64: case aarch64_be: return "aarch64"; @@ -134,10 +137,13 @@ const char *Triple::getArchTypePrefix(ArchType Kind) { case shave: return "shave"; case wasm32: case wasm64: return "wasm"; + + case riscv32: + case riscv64: return "riscv"; } } -const char *Triple::getVendorTypeName(VendorType Kind) { +StringRef Triple::getVendorTypeName(VendorType Kind) { switch (Kind) { case UnknownVendor: return "unknown"; @@ -160,7 +166,7 @@ const char *Triple::getVendorTypeName(VendorType Kind) { llvm_unreachable("Invalid VendorType!"); } -const char *Triple::getOSTypeName(OSType Kind) { +StringRef Triple::getOSTypeName(OSType Kind) { switch (Kind) { case UnknownOS: return "unknown"; @@ -168,6 +174,7 @@ const char *Triple::getOSTypeName(OSType Kind) { case Darwin: return "darwin"; case DragonFly: return "dragonfly"; case FreeBSD: return "freebsd"; + case Fuchsia: return "fuchsia"; case IOS: return "ios"; case KFreeBSD: return "kfreebsd"; case Linux: return "linux"; @@ -192,12 +199,13 @@ const char *Triple::getOSTypeName(OSType Kind) { case TvOS: return "tvos"; case WatchOS: return "watchos"; case Mesa3D: return "mesa3d"; + case Contiki: return "contiki"; } llvm_unreachable("Invalid OSType"); } -const char *Triple::getEnvironmentTypeName(EnvironmentType Kind) { +StringRef Triple::getEnvironmentTypeName(EnvironmentType Kind) { switch (Kind) { case UnknownEnvironment: return "unknown"; case GNU: return "gnu"; @@ -217,6 +225,7 @@ const char *Triple::getEnvironmentTypeName(EnvironmentType Kind) { case Cygnus: return "cygnus"; case AMDOpenCL: return "amdopencl"; case CoreCLR: return "coreclr"; + case OpenCL: return "opencl"; } llvm_unreachable("Invalid EnvironmentType!"); @@ -258,12 +267,15 @@ Triple::ArchType Triple::getArchTypeForLLVMName(StringRef Name) { .Case("ppc64le", ppc64le) .Case("r600", r600) .Case("amdgcn", amdgcn) + .Case("riscv32", riscv32) + .Case("riscv64", riscv64) .Case("hexagon", hexagon) .Case("sparc", sparc) .Case("sparcel", sparcel) .Case("sparcv9", sparcv9) .Case("systemz", systemz) .Case("tce", tce) + .Case("tcele", tcele) .Case("thumb", thumb) .Case("thumbeb", thumbeb) .Case("x86", x86) @@ -373,12 +385,15 @@ static Triple::ArchType parseArch(StringRef ArchName) { .Case("mips64el", Triple::mips64el) .Case("r600", Triple::r600) .Case("amdgcn", Triple::amdgcn) + .Case("riscv32", Triple::riscv32) + .Case("riscv64", Triple::riscv64) .Case("hexagon", Triple::hexagon) .Cases("s390x", "systemz", Triple::systemz) .Case("sparc", Triple::sparc) .Case("sparcel", Triple::sparcel) .Cases("sparcv9", "sparc64", Triple::sparcv9) .Case("tce", Triple::tce) + .Case("tcele", Triple::tcele) .Case("xcore", Triple::xcore) .Case("nvptx", Triple::nvptx) .Case("nvptx64", Triple::nvptx64) @@ -437,6 +452,7 @@ static Triple::OSType parseOS(StringRef OSName) { .StartsWith("darwin", Triple::Darwin) .StartsWith("dragonfly", Triple::DragonFly) .StartsWith("freebsd", Triple::FreeBSD) + .StartsWith("fuchsia", Triple::Fuchsia) .StartsWith("ios", Triple::IOS) .StartsWith("kfreebsd", Triple::KFreeBSD) .StartsWith("linux", Triple::Linux) @@ -462,6 +478,7 @@ static Triple::OSType parseOS(StringRef OSName) { .StartsWith("tvos", Triple::TvOS) .StartsWith("watchos", Triple::WatchOS) .StartsWith("mesa3d", Triple::Mesa3D) + .StartsWith("contiki", Triple::Contiki) .Default(Triple::UnknownOS); } @@ -484,6 +501,7 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) { .StartsWith("cygnus", Triple::Cygnus) .StartsWith("amdopencl", Triple::AMDOpenCL) .StartsWith("coreclr", Triple::CoreCLR) + .StartsWith("opencl", Triple::OpenCL) .Default(Triple::UnknownEnvironment); } @@ -546,6 +564,8 @@ static Triple::SubArchType parseSubArch(StringRef SubArchName) { return Triple::ARMSubArch_v8_1a; case ARM::AK_ARMV8_2A: return Triple::ARMSubArch_v8_2a; + case ARM::AK_ARMV8R: + return Triple::ARMSubArch_v8r; case ARM::AK_ARMV8MBaseline: return Triple::ARMSubArch_v8m_baseline; case ARM::AK_ARMV8MMainline: @@ -555,7 +575,7 @@ static Triple::SubArchType parseSubArch(StringRef SubArchName) { } } -static const char *getObjectFormatTypeName(Triple::ObjectFormatType Kind) { +static StringRef getObjectFormatTypeName(Triple::ObjectFormatType Kind) { switch (Kind) { case Triple::UnknownObjectFormat: return ""; case Triple::COFF: return "coff"; @@ -605,6 +625,8 @@ static Triple::ObjectFormatType getDefaultFormat(const Triple &T) { case Triple::r600: case Triple::renderscript32: case Triple::renderscript64: + case Triple::riscv32: + case Triple::riscv64: case Triple::shave: case Triple::sparc: case Triple::sparcel: @@ -613,6 +635,7 @@ static Triple::ObjectFormatType getDefaultFormat(const Triple &T) { case Triple::spir64: case Triple::systemz: case Triple::tce: + case Triple::tcele: case Triple::thumbeb: case Triple::wasm32: case Triple::wasm64: @@ -1132,9 +1155,11 @@ static unsigned getArchPointerBitWidth(llvm::Triple::ArchType Arch) { case llvm::Triple::nvptx: case llvm::Triple::ppc: case llvm::Triple::r600: + case llvm::Triple::riscv32: case llvm::Triple::sparc: case llvm::Triple::sparcel: case llvm::Triple::tce: + case llvm::Triple::tcele: case llvm::Triple::thumb: case llvm::Triple::thumbeb: case llvm::Triple::x86: @@ -1160,6 +1185,7 @@ static unsigned getArchPointerBitWidth(llvm::Triple::ArchType Arch) { case llvm::Triple::nvptx64: case llvm::Triple::ppc64: case llvm::Triple::ppc64le: + case llvm::Triple::riscv64: case llvm::Triple::sparcv9: case llvm::Triple::systemz: case llvm::Triple::x86_64: @@ -1212,9 +1238,11 @@ Triple Triple::get32BitArchVariant() const { case Triple::nvptx: case Triple::ppc: case Triple::r600: + case Triple::riscv32: case Triple::sparc: case Triple::sparcel: case Triple::tce: + case Triple::tcele: case Triple::thumb: case Triple::thumbeb: case Triple::x86: @@ -1234,6 +1262,7 @@ Triple Triple::get32BitArchVariant() const { case Triple::nvptx64: T.setArch(Triple::nvptx); break; case Triple::ppc64: T.setArch(Triple::ppc); break; case Triple::sparcv9: T.setArch(Triple::sparc); break; + case Triple::riscv64: T.setArch(Triple::riscv32); break; case Triple::x86_64: T.setArch(Triple::x86); break; case Triple::amdil64: T.setArch(Triple::amdil); break; case Triple::hsail64: T.setArch(Triple::hsail); break; @@ -1255,6 +1284,7 @@ Triple Triple::get64BitArchVariant() const { case Triple::msp430: case Triple::r600: case Triple::tce: + case Triple::tcele: case Triple::xcore: case Triple::sparcel: case Triple::shave: @@ -1275,6 +1305,7 @@ Triple Triple::get64BitArchVariant() const { case Triple::nvptx64: case Triple::ppc64: case Triple::ppc64le: + case Triple::riscv64: case Triple::sparcv9: case Triple::systemz: case Triple::x86_64: @@ -1291,6 +1322,7 @@ Triple Triple::get64BitArchVariant() const { case Triple::nvptx: T.setArch(Triple::nvptx64); break; case Triple::ppc: T.setArch(Triple::ppc64); break; case Triple::sparc: T.setArch(Triple::sparcv9); break; + case Triple::riscv32: T.setArch(Triple::riscv64); break; case Triple::x86: T.setArch(Triple::x86_64); break; case Triple::amdil: T.setArch(Triple::amdil64); break; case Triple::hsail: T.setArch(Triple::hsail64); break; @@ -1324,6 +1356,8 @@ Triple Triple::getBigEndianArchVariant() const { case Triple::nvptx64: case Triple::nvptx: case Triple::r600: + case Triple::riscv32: + case Triple::riscv64: case Triple::shave: case Triple::spir64: case Triple::spir: @@ -1342,6 +1376,7 @@ Triple Triple::getBigEndianArchVariant() const { T.setArch(UnknownArch); break; + case Triple::tcele: T.setArch(Triple::tce); break; case Triple::aarch64: T.setArch(Triple::aarch64_be); break; case Triple::bpfel: T.setArch(Triple::bpfeb); break; case Triple::mips64el:T.setArch(Triple::mips64); break; @@ -1365,7 +1400,6 @@ Triple Triple::getLittleEndianArchVariant() const { case Triple::ppc: case Triple::sparcv9: case Triple::systemz: - case Triple::tce: // ARM is intentionally unsupported here, changing the architecture would // drop any arch suffixes. @@ -1374,6 +1408,7 @@ Triple Triple::getLittleEndianArchVariant() const { T.setArch(UnknownArch); break; + case Triple::tce: T.setArch(Triple::tcele); break; case Triple::aarch64_be: T.setArch(Triple::aarch64); break; case Triple::bpfeb: T.setArch(Triple::bpfel); break; case Triple::mips64: T.setArch(Triple::mips64el); break; @@ -1408,6 +1443,8 @@ bool Triple::isLittleEndian() const { case Triple::nvptx: case Triple::ppc64le: case Triple::r600: + case Triple::riscv32: + case Triple::riscv64: case Triple::shave: case Triple::sparcel: case Triple::spir64: @@ -1418,6 +1455,7 @@ bool Triple::isLittleEndian() const { case Triple::x86: case Triple::x86_64: case Triple::xcore: + case Triple::tcele: case Triple::renderscript32: case Triple::renderscript64: return true; |