[llvm-commits] CVS: llvm/lib/Target/TargetLowering.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Feb 22 15:01:03 PST 2006



Changes in directory llvm/lib/Target:

TargetLowering.cpp updated: 1.35 -> 1.36
---
Log message:

Don't return registers from register classes that aren't legal.


---
Diffs of the changes:  (+15 -2)

 TargetLowering.cpp |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)


Index: llvm/lib/Target/TargetLowering.cpp
diff -u llvm/lib/Target/TargetLowering.cpp:1.35 llvm/lib/Target/TargetLowering.cpp:1.36
--- llvm/lib/Target/TargetLowering.cpp:1.35	Tue Feb 21 18:56:38 2006
+++ llvm/lib/Target/TargetLowering.cpp	Wed Feb 22 17:00:51 2006
@@ -766,11 +766,24 @@
   for (MRegisterInfo::regclass_iterator RCI = RI->regclass_begin(),
        E = RI->regclass_end(); RCI != E; ++RCI) {
     const TargetRegisterClass *RC = *RCI;
+    
+    // If none of the the value types for this register class are valid, we 
+    // can't use it.  For example, 64-bit reg classes on 32-bit targets.
+    bool isLegal = false;
+    for (TargetRegisterClass::vt_iterator I = RC->vt_begin(), E = RC->vt_end();
+         I != E; ++I) {
+      if (isTypeLegal(*I)) {
+        isLegal = true;
+        break;
+      }
+    }
+    
+    if (!isLegal) continue;
+    
     for (TargetRegisterClass::iterator I = RC->begin(), E = RC->end(); 
          I != E; ++I) {
-      if (StringsEqualNoCase(RegName, RI->get(*I).Name)) {
+      if (StringsEqualNoCase(RegName, RI->get(*I).Name))
         return std::make_pair(*I, RC);
-      }
     }
   }
   






More information about the llvm-commits mailing list