diff options
| author | Kristina Brooks <kristina@nym.hush.com> | 2018-11-29 03:23:01 +0000 |
|---|---|---|
| committer | Kristina Brooks <kristina@nym.hush.com> | 2018-11-29 03:23:01 +0000 |
| commit | 69127e1ebd3fa9ed69168a330e7cb6fef7fb331a (patch) | |
| tree | d8b37cdfdb112cd6d21c0d401a21c5dcb8ddf834 /llvm | |
| parent | bcae407a3ce959f089ab964f89b6e7654192a5b6 (diff) | |
| download | bcm5719-llvm-69127e1ebd3fa9ed69168a330e7cb6fef7fb331a.tar.gz bcm5719-llvm-69127e1ebd3fa9ed69168a330e7cb6fef7fb331a.zip | |
Add Hurd target to LLVMSupport (1/2)
Add the required target triples to LLVMSupport to support Hurd
in LLVM (formally `pc-hurd-gnu`).
Patch by sthibaul (Samuel Thibault)
Differential Revision: https://reviews.llvm.org/D54378
llvm-svn: 347832
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/llvm/ADT/Triple.h | 11 | ||||
| -rw-r--r-- | llvm/lib/Support/Triple.cpp | 2 | ||||
| -rw-r--r-- | llvm/unittests/ADT/TripleTest.cpp | 6 |
3 files changed, 17 insertions, 2 deletions
diff --git a/llvm/include/llvm/ADT/Triple.h b/llvm/include/llvm/ADT/Triple.h index fe78f78aaab..04b64e2fa60 100644 --- a/llvm/include/llvm/ADT/Triple.h +++ b/llvm/include/llvm/ADT/Triple.h @@ -186,7 +186,8 @@ public: Contiki, AMDPAL, // AMD PAL Runtime HermitCore, // HermitCore Unikernel/Multikernel - LastOSType = HermitCore + Hurd, // GNU/Hurd + LastOSType = Hurd }; enum EnvironmentType { UnknownEnvironment, @@ -582,9 +583,15 @@ public: return getOS() == Triple::KFreeBSD; } + /// Tests whether the OS is Hurd. + bool isOSHurd() const { + return getOS() == Triple::Hurd; + } + /// Tests whether the OS uses glibc. bool isOSGlibc() const { - return (getOS() == Triple::Linux || getOS() == Triple::KFreeBSD) && + return (getOS() == Triple::Linux || getOS() == Triple::KFreeBSD || + getOS() == Triple::Hurd) && !isAndroid(); } diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp index c53c878e9df..4471fd05181 100644 --- a/llvm/lib/Support/Triple.cpp +++ b/llvm/lib/Support/Triple.cpp @@ -210,6 +210,7 @@ StringRef Triple::getOSTypeName(OSType Kind) { case Contiki: return "contiki"; case AMDPAL: return "amdpal"; case HermitCore: return "hermit"; + case Hurd: return "hurd"; } llvm_unreachable("Invalid OSType"); @@ -508,6 +509,7 @@ static Triple::OSType parseOS(StringRef OSName) { .StartsWith("contiki", Triple::Contiki) .StartsWith("amdpal", Triple::AMDPAL) .StartsWith("hermit", Triple::HermitCore) + .StartsWith("hurd", Triple::Hurd) .Default(Triple::UnknownOS); } diff --git a/llvm/unittests/ADT/TripleTest.cpp b/llvm/unittests/ADT/TripleTest.cpp index 71a922a92b6..efe859f158f 100644 --- a/llvm/unittests/ADT/TripleTest.cpp +++ b/llvm/unittests/ADT/TripleTest.cpp @@ -93,6 +93,12 @@ TEST(TripleTest, ParsedIDs) { EXPECT_EQ(Triple::Contiki, T.getOS()); EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment()); + T = Triple("i386-pc-hurd-gnu"); + EXPECT_EQ(Triple::x86, T.getArch()); + EXPECT_EQ(Triple::PC, T.getVendor()); + EXPECT_EQ(Triple::Hurd, T.getOS()); + EXPECT_EQ(Triple::GNU, T.getEnvironment()); + T = Triple("x86_64-pc-linux-gnu"); EXPECT_EQ(Triple::x86_64, T.getArch()); EXPECT_EQ(Triple::PC, T.getVendor()); |

