<p dir="ltr">Weirdly confusing, but OK. </p>
<br><div class="gmail_quote"><div dir="ltr">On Thu, Feb 4, 2016, 5:00 PM Matt Arsenault <<a href="mailto:Matthew.Arsenault@amd.com">Matthew.Arsenault@amd.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">arsenm created this revision.<br>
arsenm added reviewers: tstellarAMD, mareko, michel.daenzer, nhaehnle, echristo.<br>
arsenm added a subscriber: llvm-commits.<br>
<br>
As support expands to more runtimes, we'll need to<br>
distinguish between more than just HSA and unknown.<br>
This also lets us stop using unknown everywhere.<br>
<br>
<a href="http://reviews.llvm.org/D16909" rel="noreferrer" target="_blank">http://reviews.llvm.org/D16909</a><br>
<br>
Files:<br>
include/llvm/ADT/Triple.h<br>
lib/Support/Triple.cpp<br>
unittests/ADT/TripleTest.cpp<br>
<br>
Index: unittests/ADT/TripleTest.cpp<br>
===================================================================<br>
--- unittests/ADT/TripleTest.cpp<br>
+++ unittests/ADT/TripleTest.cpp<br>
@@ -212,6 +212,24 @@<br>
EXPECT_EQ(Triple::UnknownOS, T.getOS());<br>
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());<br>
<br>
+ T = Triple("amdgcn-mesa-clover");<br>
+ EXPECT_EQ(Triple::amdgcn, T.getArch());<br>
+ EXPECT_EQ(Triple::Mesa, T.getVendor());<br>
+ EXPECT_EQ(Triple::Clover, T.getOS());<br>
+ EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());<br>
+<br>
+ T = Triple("amdgcn-mesa-radeonsi");<br>
+ EXPECT_EQ(Triple::amdgcn, T.getArch());<br>
+ EXPECT_EQ(Triple::Mesa, T.getVendor());<br>
+ EXPECT_EQ(Triple::RadeonSI, T.getOS());<br>
+ EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());<br>
+<br>
+ T = Triple("amdgcn-amd-amdhsa");<br>
+ EXPECT_EQ(Triple::amdgcn, T.getArch());<br>
+ EXPECT_EQ(Triple::AMD, T.getVendor());<br>
+ EXPECT_EQ(Triple::AMDHSA, T.getOS());<br>
+ EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());<br>
+<br>
T = Triple("huh");<br>
EXPECT_EQ(Triple::UnknownArch, T.getArch());<br>
}<br>
Index: lib/Support/Triple.cpp<br>
===================================================================<br>
--- lib/Support/Triple.cpp<br>
+++ lib/Support/Triple.cpp<br>
@@ -148,6 +148,8 @@<br>
case NVIDIA: return "nvidia";<br>
case CSR: return "csr";<br>
case Myriad: return "myriad";<br>
+ case AMD: return "amd";<br>
+ case Mesa: return "mesa";<br>
}<br>
<br>
llvm_unreachable("Invalid VendorType!");<br>
@@ -184,6 +186,8 @@<br>
case ELFIAMCU: return "elfiamcu";<br>
case TvOS: return "tvos";<br>
case WatchOS: return "watchos";<br>
+ case Clover: return "clover";<br>
+ case RadeonSI: return "radeonsi";<br>
}<br>
<br>
llvm_unreachable("Invalid OSType");<br>
@@ -408,6 +412,8 @@<br>
.Case("nvidia", Triple::NVIDIA)<br>
.Case("csr", Triple::CSR)<br>
.Case("myriad", Triple::Myriad)<br>
+ .Case("amd", Triple::AMD)<br>
+ .Case("mesa", Triple::Mesa)<br>
.Default(Triple::UnknownVendor);<br>
}<br>
<br>
@@ -441,6 +447,8 @@<br>
.StartsWith("elfiamcu", Triple::ELFIAMCU)<br>
.StartsWith("tvos", Triple::TvOS)<br>
.StartsWith("watchos", Triple::WatchOS)<br>
+ .StartsWith("clover", Triple::Clover)<br>
+ .StartsWith("radeonsi", Triple::RadeonSI)<br>
.Default(Triple::UnknownOS);<br>
}<br>
<br>
Index: include/llvm/ADT/Triple.h<br>
===================================================================<br>
--- include/llvm/ADT/Triple.h<br>
+++ include/llvm/ADT/Triple.h<br>
@@ -130,7 +130,9 @@<br>
NVIDIA,<br>
CSR,<br>
Myriad,<br>
- LastVendorType = Myriad<br>
+ AMD,<br>
+ Mesa,<br>
+ LastVendorType = Mesa<br>
};<br>
enum OSType {<br>
UnknownOS,<br>
@@ -162,6 +164,8 @@<br>
ELFIAMCU,<br>
TvOS, // Apple tvOS<br>
WatchOS, // Apple watchOS<br>
+ Clover, // Mesa's OpenCL runtime.<br>
+ RadeonSI, // Mesa's OpenGL runtime.<br>
LastOSType = WatchOS<br>
};<br>
enum EnvironmentType {<br>
<br>
<br>
</blockquote></div>