aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Triple.cpp
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2015-06-29 23:51:55 +0000
committerDan Gohman <dan433584@gmail.com>2015-06-29 23:51:55 +0000
commit10e730a2634ed185b179868485bac44b4f2ab956 (patch)
treeac2f1062086d5372ba68d80c153d4ac59d1177ad /llvm/lib/Support/Triple.cpp
parent96d071cd0ccc53bbf94bcd6ed4b52c9006b17e15 (diff)
downloadllvm-10e730a2634ed185b179868485bac44b4f2ab956.zip
llvm-10e730a2634ed185b179868485bac44b4f2ab956.tar.gz
llvm-10e730a2634ed185b179868485bac44b4f2ab956.tar.bz2
[WebAssembly] Initial WebAssembly backend
This WebAssembly backend is just a skeleton at this time and is not yet functional. llvm-svn: 241022
Diffstat (limited to 'llvm/lib/Support/Triple.cpp')
-rw-r--r--llvm/lib/Support/Triple.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp
index 072d4a0..1bd0d01 100644
--- a/llvm/lib/Support/Triple.cpp
+++ b/llvm/lib/Support/Triple.cpp
@@ -60,6 +60,8 @@ const char *Triple::getArchTypeName(ArchType Kind) {
case spir64: return "spir64";
case kalimba: return "kalimba";
case shave: return "shave";
+ case wasm32: return "wasm32";
+ case wasm64: return "wasm64";
}
llvm_unreachable("Invalid ArchType!");
@@ -122,6 +124,8 @@ const char *Triple::getArchTypePrefix(ArchType Kind) {
case spir64: return "spir";
case kalimba: return "kalimba";
case shave: return "shave";
+ case wasm32: return "wasm32";
+ case wasm64: return "wasm64";
}
}
@@ -173,6 +177,7 @@ const char *Triple::getOSTypeName(OSType Kind) {
case NVCL: return "nvcl";
case AMDHSA: return "amdhsa";
case PS4: return "ps4";
+ case WebAssembly: return "wasm";
}
llvm_unreachable("Invalid OSType");
@@ -255,6 +260,8 @@ Triple::ArchType Triple::getArchTypeForLLVMName(StringRef Name) {
.Case("spir64", spir64)
.Case("kalimba", kalimba)
.Case("shave", shave)
+ .Case("wasm32", wasm32)
+ .Case("wasm64", wasm64)
.Default(UnknownArch);
}
@@ -360,6 +367,8 @@ static Triple::ArchType parseArch(StringRef ArchName) {
.Case("spir64", Triple::spir64)
.StartsWith("kalimba", Triple::kalimba)
.Case("shave", Triple::shave)
+ .Case("wasm32", Triple::wasm32)
+ .Case("wasm64", Triple::wasm64)
.Default(Triple::UnknownArch);
}
@@ -406,6 +415,7 @@ static Triple::OSType parseOS(StringRef OSName) {
.StartsWith("nvcl", Triple::NVCL)
.StartsWith("amdhsa", Triple::AMDHSA)
.StartsWith("ps4", Triple::PS4)
+ .StartsWith("wasm", Triple::WebAssembly)
.Default(Triple::UnknownOS);
}
@@ -1009,6 +1019,7 @@ static unsigned getArchPointerBitWidth(llvm::Triple::ArchType Arch) {
case llvm::Triple::spir:
case llvm::Triple::kalimba:
case llvm::Triple::shave:
+ case llvm::Triple::wasm32:
return 32;
case llvm::Triple::aarch64:
@@ -1028,6 +1039,7 @@ static unsigned getArchPointerBitWidth(llvm::Triple::ArchType Arch) {
case llvm::Triple::amdil64:
case llvm::Triple::hsail64:
case llvm::Triple::spir64:
+ case llvm::Triple::wasm64:
return 64;
}
llvm_unreachable("Invalid architecture value");
@@ -1081,6 +1093,7 @@ Triple Triple::get32BitArchVariant() const {
case Triple::x86:
case Triple::xcore:
case Triple::shave:
+ case Triple::wasm32:
// Already 32-bit.
break;
@@ -1094,6 +1107,7 @@ Triple Triple::get32BitArchVariant() const {
case Triple::amdil64: T.setArch(Triple::amdil); break;
case Triple::hsail64: T.setArch(Triple::hsail); break;
case Triple::spir64: T.setArch(Triple::spir); break;
+ case Triple::wasm64: T.setArch(Triple::wasm32); break;
}
return T;
}
@@ -1134,6 +1148,7 @@ Triple Triple::get64BitArchVariant() const {
case Triple::sparcv9:
case Triple::systemz:
case Triple::x86_64:
+ case Triple::wasm64:
// Already 64-bit.
break;
@@ -1147,6 +1162,7 @@ Triple Triple::get64BitArchVariant() const {
case Triple::amdil: T.setArch(Triple::amdil64); break;
case Triple::hsail: T.setArch(Triple::hsail64); break;
case Triple::spir: T.setArch(Triple::spir64); break;
+ case Triple::wasm32: T.setArch(Triple::wasm64); break;
}
return T;
}