[llvm-commits] [llvm] r66466 - in /llvm/branches/Apple/Dib: lib/Target/ARM/ARMSubtarget.cpp lib/Target/ARM/ARMTargetMachine.cpp test/CodeGen/ARM/uxtb.ll

Bill Wendling isanbard at gmail.com
Mon Mar 9 14:13:13 PDT 2009


Author: void
Date: Mon Mar  9 16:13:13 2009
New Revision: 66466

URL: http://llvm.org/viewvc/llvm-project?rev=66466&view=rev
Log:
Reapply these patches:

--- Merging (from foreign repository) r66365 into '.':
U    test/CodeGen/ARM/uxtb.ll
U    lib/Target/ARM/ARMSubtarget.cpp

Recognize triplets starting with armv5-, armv6- etc. And set the ARM arch
version accordingly.

--- Merging (from foreign repository) r66435 into '.':
G    lib/Target/ARM/ARMSubtarget.cpp
U    lib/Target/ARM/ARMTargetMachine.cpp

ARM target now also recognize triplets like thumbv6-apple-darwin and set thumb
mode and arch subversion. Eventually thumb triplets will go way and replaced
with function notes.

Modified:
    llvm/branches/Apple/Dib/lib/Target/ARM/ARMSubtarget.cpp
    llvm/branches/Apple/Dib/lib/Target/ARM/ARMTargetMachine.cpp
    llvm/branches/Apple/Dib/test/CodeGen/ARM/uxtb.ll

Modified: llvm/branches/Apple/Dib/lib/Target/ARM/ARMSubtarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/ARM/ARMSubtarget.cpp?rev=66466&r1=66465&r2=66466&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/ARM/ARMSubtarget.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/ARM/ARMSubtarget.cpp Mon Mar  9 16:13:13 2009
@@ -35,8 +35,31 @@
   // Set the boolean corresponding to the current target triple, or the default
   // if one cannot be determined, to true.
   const std::string& TT = M.getTargetTriple();
-  if (TT.length() > 5) {
+  unsigned Len = TT.length();
+  unsigned Idx = 0;
+  if (Len >= 5 && TT.substr(0, 4) == "armv")
+    Idx = 4;
+  else if (Len >= 6 && TT.substr(0, 6) == "thumb") {
+    IsThumb = true;
+    if (Len >= 7 && TT[5] == 'v')
+      Idx = 6;
+  }
+  if (Idx) {
+    unsigned SubVer = TT[Idx];
+    if (SubVer > '4' && SubVer <= '9') {
+      if (SubVer >= '6')
+        ARMArchVersion = V6;
+      else if (SubVer == '5') {
+        ARMArchVersion = V5T;
+        if (Len >= Idx+3 && TT[Idx+1] == 't' && TT[Idx+2] == 'e')
+          ARMArchVersion = V5TE;
+      }
+    }
+  }
+
+  if (Len >= 10) {
     if (TT.find("-darwin") != std::string::npos)
+      // arm-darwin
       TargetType = isDarwin;
   } else if (TT.empty()) {
 #if defined(__APPLE__)

Modified: llvm/branches/Apple/Dib/lib/Target/ARM/ARMTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/ARM/ARMTargetMachine.cpp?rev=66466&r1=66465&r2=66466&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/ARM/ARMTargetMachine.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/ARM/ARMTargetMachine.cpp Mon Mar  9 16:13:13 2009
@@ -53,7 +53,9 @@
 
 unsigned ThumbTargetMachine::getModuleMatchQuality(const Module &M) {
   std::string TT = M.getTargetTriple();
-  if (TT.size() >= 6 && std::string(TT.begin(), TT.begin()+6) == "thumb-")
+  // Match thumb-foo-bar, as well as things like thumbv5blah-*
+  if (TT.size() >= 6 &&
+      (TT.substr(0, 6) == "thumb-" || TT.substr(0, 6) == "thumbv"))
     return 20;
 
   // If the target triple is something non-thumb, we don't match.
@@ -105,7 +107,8 @@
 
 unsigned ARMTargetMachine::getModuleMatchQuality(const Module &M) {
   std::string TT = M.getTargetTriple();
-  if (TT.size() >= 4 && // Match arm-foo-bar, as well as things like armv5blah-*
+  // Match arm-foo-bar, as well as things like armv5blah-*
+  if (TT.size() >= 4 &&
       (TT.substr(0, 4) == "arm-" || TT.substr(0, 4) == "armv"))
     return 20;
   // If the target triple is something non-arm, we don't match.

Modified: llvm/branches/Apple/Dib/test/CodeGen/ARM/uxtb.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/ARM/uxtb.ll?rev=66466&r1=66465&r2=66466&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/test/CodeGen/ARM/uxtb.ll (original)
+++ llvm/branches/Apple/Dib/test/CodeGen/ARM/uxtb.ll Mon Mar  9 16:13:13 2009
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | llc -march=arm -mattr=+v6 | \
+; RUN: llvm-as < %s | llc -mtriple=armv6-apple-darwin | \
 ; RUN:   grep uxt | count 10
 
 define i32 @test1(i32 %x) {





More information about the llvm-commits mailing list