aboutsummaryrefslogtreecommitdiffstats
path: root/unittests
diff options
context:
space:
mode:
authorRenato Golin <renato.golin@arm.com>2011-01-21 18:25:47 +0000
committerRenato Golin <renato.golin@arm.com>2011-01-21 18:25:47 +0000
commit859f8183639346378ed29d1e04a4b070ebc7e97f (patch)
treec52e2cb8579093cc8e76670765e8b3f07d5e52fa /unittests
parent596937914548c181f2504aad3b709189e87a561b (diff)
downloadexternal_llvm-859f8183639346378ed29d1e04a4b070ebc7e97f.zip
external_llvm-859f8183639346378ed29d1e04a4b070ebc7e97f.tar.gz
external_llvm-859f8183639346378ed29d1e04a4b070ebc7e97f.tar.bz2
Clang was not parsing target triples involving EABI and was generating wrong IR (wrong PCS) and passing the wrong information down llc via the target-triple printed in IR. I've fixed this by adding the parsing of EABI into LLVM's Triple class and using it to choose the correct PCS in Clang's Tools. A Clang patch is on its way to use this infrastructure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123990 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/ADT/TripleTest.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/unittests/ADT/TripleTest.cpp b/unittests/ADT/TripleTest.cpp
index bcc7196..8f778c1 100644
--- a/unittests/ADT/TripleTest.cpp
+++ b/unittests/ADT/TripleTest.cpp
@@ -85,9 +85,7 @@ TEST(TripleTest, ParsedIDs) {
EXPECT_EQ(Triple::x86_64, T.getArch());
EXPECT_EQ(Triple::PC, T.getVendor());
EXPECT_EQ(Triple::Linux, T.getOS());
- // When environments are defined, change this test to verify the "gnu"
- // environment.
- EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
+ EXPECT_EQ(Triple::GNU, T.getEnvironment());
T = Triple("powerpc-dunno-notsure");
EXPECT_EQ(Triple::ppc, T.getArch());
@@ -95,6 +93,12 @@ TEST(TripleTest, ParsedIDs) {
EXPECT_EQ(Triple::UnknownOS, T.getOS());
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
+ T = Triple("arm-none-eabi");
+ EXPECT_EQ(Triple::arm, T.getArch());
+ EXPECT_EQ(Triple::NoVendor, T.getVendor());
+ EXPECT_EQ(Triple::NoOS, T.getOS());
+ EXPECT_EQ(Triple::EABI, T.getEnvironment());
+
T = Triple("huh");
EXPECT_EQ(Triple::UnknownArch, T.getArch());
}
@@ -110,6 +114,7 @@ static std::string Join(StringRef A, StringRef B, StringRef C, StringRef D) {
}
TEST(TripleTest, Normalization) {
+
EXPECT_EQ("", Triple::normalize(""));
EXPECT_EQ("-", Triple::normalize("-"));
EXPECT_EQ("--", Triple::normalize("--"));
@@ -144,6 +149,8 @@ TEST(TripleTest, Normalization) {
EXPECT_EQ("-pc", Triple::normalize("pc"));
EXPECT_EQ("--linux", Triple::normalize("linux"));
+ EXPECT_EQ("x86_64--linux-gnu", Triple::normalize("x86_64-gnu-linux"));
+
// Check that normalizing a permutated set of valid components returns a
// triple with the unpermuted components.
StringRef C[4];
@@ -251,6 +258,7 @@ TEST(TripleTest, MutateName) {
EXPECT_EQ(Triple::PC, T.getVendor());
EXPECT_EQ(Triple::Darwin, T.getOS());
EXPECT_EQ("i386-pc-darwin", T.getTriple());
+
}
}