Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit ac39a03

Browse files
author
Guy Benyei
committed
Add support for SPIR64 target - the 64bit counterpart of SPIR.
The new OpenCL SPIR extension spec will define separate SPIR for 32 and 64 bit architectures. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168036 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 7ecfcc1 commit ac39a03

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

include/llvm/ADT/Triple.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ class Triple {
6565
nvptx64, // NVPTX: 64-bit
6666
le32, // le32: generic little-endian 32-bit CPU (PNaCl / Emscripten)
6767
amdil, // amdil: amd IL
68-
spir // SPIR: standard portable IR for OpenCL
68+
spir, // SPIR: standard portable IR for OpenCL 32-bit version
69+
spir64 // SPIR: standard portable IR for OpenCL 64-bit version
6970
};
7071
enum VendorType {
7172
UnknownVendor,

lib/Support/Triple.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const char *Triple::getArchTypeName(ArchType Kind) {
4242
case le32: return "le32";
4343
case amdil: return "amdil";
4444
case spir: return "spir";
45+
case spir64: return "spir64";
4546
}
4647

4748
llvm_unreachable("Invalid ArchType!");
@@ -82,6 +83,7 @@ const char *Triple::getArchTypePrefix(ArchType Kind) {
8283
case le32: return "le32";
8384
case amdil: return "amdil";
8485
case spir: return "spir";
86+
case spir64: return "spir";
8587
}
8688
}
8789

@@ -173,6 +175,7 @@ Triple::ArchType Triple::getArchTypeForLLVMName(StringRef Name) {
173175
.Case("le32", le32)
174176
.Case("amdil", amdil)
175177
.Case("spir", spir)
178+
.Case("spir64", spir64)
176179
.Default(UnknownArch);
177180
}
178181

@@ -198,6 +201,7 @@ const char *Triple::getArchNameForAssembler() {
198201
.Case("le32", "le32")
199202
.Case("amdil", "amdil")
200203
.Case("spir", "spir")
204+
.Case("spir64", "spir64")
201205
.Default(NULL);
202206
}
203207

@@ -232,6 +236,7 @@ static Triple::ArchType parseArch(StringRef ArchName) {
232236
.Case("le32", Triple::le32)
233237
.Case("amdil", Triple::amdil)
234238
.Case("spir", Triple::spir)
239+
.Case("spir64", Triple::spir64)
235240
.Default(Triple::UnknownArch);
236241
}
237242

@@ -645,7 +650,6 @@ void Triple::setOSAndEnvironmentName(StringRef Str) {
645650

646651
static unsigned getArchPointerBitWidth(llvm::Triple::ArchType Arch) {
647652
switch (Arch) {
648-
case llvm::Triple::spir:
649653
case llvm::Triple::UnknownArch:
650654
return 0;
651655

@@ -667,6 +671,7 @@ static unsigned getArchPointerBitWidth(llvm::Triple::ArchType Arch) {
667671
case llvm::Triple::thumb:
668672
case llvm::Triple::x86:
669673
case llvm::Triple::xcore:
674+
case llvm::Triple::spir:
670675
return 32;
671676

672677
case llvm::Triple::mips64:
@@ -675,6 +680,7 @@ static unsigned getArchPointerBitWidth(llvm::Triple::ArchType Arch) {
675680
case llvm::Triple::ppc64:
676681
case llvm::Triple::sparcv9:
677682
case llvm::Triple::x86_64:
683+
case llvm::Triple::spir64:
678684
return 64;
679685
}
680686
llvm_unreachable("Invalid architecture value");
@@ -725,6 +731,7 @@ Triple Triple::get32BitArchVariant() const {
725731
case Triple::ppc64: T.setArch(Triple::ppc); break;
726732
case Triple::sparcv9: T.setArch(Triple::sparc); break;
727733
case Triple::x86_64: T.setArch(Triple::x86); break;
734+
case Triple::spir64: T.setArch(Triple::spir); break;
728735
}
729736
return T;
730737
}
@@ -746,7 +753,7 @@ Triple Triple::get64BitArchVariant() const {
746753
T.setArch(UnknownArch);
747754
break;
748755

749-
case Triple::spir:
756+
case Triple::spir64:
750757
case Triple::mips64:
751758
case Triple::mips64el:
752759
case Triple::nvptx64:
@@ -762,6 +769,7 @@ Triple Triple::get64BitArchVariant() const {
762769
case Triple::ppc: T.setArch(Triple::ppc64); break;
763770
case Triple::sparc: T.setArch(Triple::sparcv9); break;
764771
case Triple::x86: T.setArch(Triple::x86_64); break;
772+
case Triple::spir: T.setArch(Triple::spir64); break;
765773
}
766774
return T;
767775
}

0 commit comments

Comments
 (0)