Change getAllocatableSet() so it returns allocatable registers for a specific registe...
authorEvan Cheng <evan.cheng@apple.com>
Tue, 17 Apr 2007 20:23:34 +0000 (20:23 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Tue, 17 Apr 2007 20:23:34 +0000 (20:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36215 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/MRegisterInfo.h
lib/Target/MRegisterInfo.cpp

index 23472f548dcdce7d30be05d5b1576362a0930348..509485ab97ddb573c5ad8c89e2b2e1e0cc74530f 100644 (file)
@@ -241,8 +241,10 @@ public:
   }
 
   /// getAllocatableSet - Returns a bitset indexed by register number
-  /// indicating if a register is allocatable or not.
-  BitVector getAllocatableSet(MachineFunction &MF) const;
+  /// indicating if a register is allocatable or not. If a register class is
+  /// specified, returns the subset for the class.
+  BitVector getAllocatableSet(MachineFunction &MF,
+                              const TargetRegisterClass *RC = NULL) const;
 
   const TargetRegisterDesc &operator[](unsigned RegNo) const {
     assert(RegNo < NumRegs &&
index 08039208fe80edbc1f0aef3bb87c1a0231af22be..ae9f20372fc80e42c3e3cf0086862d114942d40e 100644 (file)
@@ -34,13 +34,16 @@ MRegisterInfo::MRegisterInfo(const TargetRegisterDesc *D, unsigned NR,
 
 MRegisterInfo::~MRegisterInfo() {}
 
-BitVector MRegisterInfo::getAllocatableSet(MachineFunction &MF) const {
+BitVector MRegisterInfo::getAllocatableSet(MachineFunction &MF,
+                                           const TargetRegisterClass *RC) const {
   BitVector Allocatable(NumRegs);
   for (MRegisterInfo::regclass_iterator I = regclass_begin(),
          E = regclass_end(); I != E; ++I) {
-    const TargetRegisterClass *RC = *I;
-    for (TargetRegisterClass::iterator I = RC->allocation_order_begin(MF),
-           E = RC->allocation_order_end(MF); I != E; ++I)
+    const TargetRegisterClass *TRC = *I;
+    if (RC && TRC != RC)
+      continue;
+    for (TargetRegisterClass::iterator I = TRC->allocation_order_begin(MF),
+           E = TRC->allocation_order_end(MF); I != E; ++I)
       Allocatable.set(*I);
   }
   return Allocatable;