Created
December 6, 2015 21:24
-
-
Save kripken/0b7ba068faf21d5449a3 to your computer and use it in GitHub Desktop.
asmjs-unknown-emscripten triple for upstream llvm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h | |
index e50cec1..4ae8ec9 100644 | |
--- a/include/llvm/ADT/Triple.h | |
+++ b/include/llvm/ADT/Triple.h | |
@@ -78,6 +78,7 @@ public: | |
nvptx64, // NVPTX: 64-bit | |
le32, // le32: generic little-endian 32-bit CPU (PNaCl) | |
le64, // le64: generic little-endian 64-bit CPU (PNaCl) | |
+ asmjs, // asm.js JavaScript subset | |
amdil, // AMDIL | |
amdil64, // AMDIL with 64-bit pointers | |
hsail, // AMD HSAIL | |
@@ -148,6 +149,7 @@ public: | |
Haiku, | |
Minix, | |
RTEMS, | |
+ Emscripten, // Emscripten JavaScript runtime | |
NaCl, // Native Client | |
CNK, // BG/P Compute-Node Kernel | |
Bitrig, | |
@@ -507,6 +509,13 @@ public: | |
return getOS() == Triple::NaCl; | |
} | |
+ /// Tests whether the OS is Emscripten. | |
+ bool isOSEmscripten() const { | |
+ return getOS() == Triple::Emscripten; | |
+ } | |
+ | |
/// Tests whether the OS is Linux. | |
bool isOSLinux() const { | |
return getOS() == Triple::Linux; | |
diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp | |
index f1f2d26..7eb3345 100644 | |
--- a/lib/Support/Triple.cpp | |
+++ b/lib/Support/Triple.cpp | |
@@ -53,6 +53,7 @@ const char *Triple::getArchTypeName(ArchType Kind) { | |
case nvptx64: return "nvptx64"; | |
case le32: return "le32"; | |
case le64: return "le64"; | |
+ case asmjs: return "asmjs"; | |
case amdil: return "amdil"; | |
case amdil64: return "amdil64"; | |
case hsail: return "hsail"; | |
@@ -117,6 +118,8 @@ const char *Triple::getArchTypePrefix(ArchType Kind) { | |
case le32: return "le32"; | |
case le64: return "le64"; | |
+ case asmjs: return "asmjs"; | |
+ | |
case amdil: | |
case amdil64: return "amdil"; | |
@@ -173,6 +176,7 @@ const char *Triple::getOSTypeName(OSType Kind) { | |
case Haiku: return "haiku"; | |
case Minix: return "minix"; | |
case RTEMS: return "rtems"; | |
+ case Emscripten: return "emscripten"; | |
case NaCl: return "nacl"; | |
case CNK: return "cnk"; | |
case Bitrig: return "bitrig"; | |
@@ -261,6 +265,7 @@ Triple::ArchType Triple::getArchTypeForLLVMName(StringRef Name) { | |
.Case("nvptx64", nvptx64) | |
.Case("le32", le32) | |
.Case("le64", le64) | |
+ .Case("asmjs", asmjs) | |
.Case("amdil", amdil) | |
.Case("amdil64", amdil64) | |
.Case("hsail", hsail) | |
@@ -369,6 +374,7 @@ static Triple::ArchType parseArch(StringRef ArchName) { | |
.Case("nvptx64", Triple::nvptx64) | |
.Case("le32", Triple::le32) | |
.Case("le64", Triple::le64) | |
+ .Case("asmjs", Triple::asmjs) | |
.Case("amdil", Triple::amdil) | |
.Case("amdil64", Triple::amdil64) | |
.Case("hsail", Triple::hsail) | |
@@ -430,6 +436,7 @@ static Triple::OSType parseOS(StringRef OSName) { | |
.StartsWith("haiku", Triple::Haiku) | |
.StartsWith("minix", Triple::Minix) | |
.StartsWith("rtems", Triple::RTEMS) | |
+ .StartsWith("emscripten", Triple::Emscripten) | |
.StartsWith("nacl", Triple::NaCl) | |
.StartsWith("cnk", Triple::CNK) | |
.StartsWith("bitrig", Triple::Bitrig) | |
@@ -1070,6 +1077,7 @@ static unsigned getArchPointerBitWidth(llvm::Triple::ArchType Arch) { | |
case llvm::Triple::armeb: | |
case llvm::Triple::hexagon: | |
case llvm::Triple::le32: | |
+ case llvm::Triple::asmjs: | |
case llvm::Triple::mips: | |
case llvm::Triple::mipsel: | |
case llvm::Triple::nvptx: | |
@@ -1149,6 +1157,7 @@ Triple Triple::get32BitArchVariant() const { | |
case Triple::hexagon: | |
case Triple::kalimba: | |
case Triple::le32: | |
+ case Triple::asmjs: | |
case Triple::mips: | |
case Triple::mipsel: | |
case Triple::nvptx: | |
@@ -1196,6 +1205,7 @@ Triple Triple::get64BitArchVariant() const { | |
case Triple::thumb: | |
case Triple::thumbeb: | |
case Triple::xcore: | |
+ case Triple::asmjs: | |
case Triple::sparcel: | |
case Triple::shave: | |
T.setArch(UnknownArch); | |
@@ -1244,6 +1254,7 @@ Triple Triple::getBigEndianArchVariant() const { | |
case Triple::amdgcn: | |
case Triple::amdil64: | |
case Triple::amdil: | |
+ case Triple::asmjs: | |
case Triple::avr: | |
case Triple::hexagon: | |
case Triple::hsail64: | |
@@ -1317,6 +1328,7 @@ Triple Triple::getLittleEndianArchVariant() const { | |
case Triple::amdil64: | |
case Triple::amdil: | |
case Triple::arm: | |
+ case Triple::asmjs: | |
case Triple::avr: | |
case Triple::bpfel: | |
case Triple::hexagon: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment