diff options
| author | Evan Cheng <evan.cheng@apple.com> | 2007-04-17 23:33:39 +0000 |
|---|---|---|
| committer | Evan Cheng <evan.cheng@apple.com> | 2007-04-17 23:33:39 +0000 |
| commit | 5118226c6cb1430aaa370e859b0ad2f501228b74 (patch) | |
| tree | c1a62a8626211bd13e742aedf07e64d0cd6bbb24 /llvm/lib | |
| parent | 4aff52bf3d6710759a6053a75eaad39acdf9afae (diff) | |
| download | bcm5719-llvm-5118226c6cb1430aaa370e859b0ad2f501228b74.tar.gz bcm5719-llvm-5118226c6cb1430aaa370e859b0ad2f501228b74.zip | |
Oops. Didn't mean to check in a quick hack.
llvm-svn: 36227
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/MRegisterInfo.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/llvm/lib/Target/MRegisterInfo.cpp b/llvm/lib/Target/MRegisterInfo.cpp index ae9f20372fc..3af611da485 100644 --- a/llvm/lib/Target/MRegisterInfo.cpp +++ b/llvm/lib/Target/MRegisterInfo.cpp @@ -34,18 +34,26 @@ MRegisterInfo::MRegisterInfo(const TargetRegisterDesc *D, unsigned NR, MRegisterInfo::~MRegisterInfo() {} +/// getAllocatableSetForRC - Toggle the bits that represent allocatable +/// registers for the specific register class. +static void getAllocatableSetForRC(MachineFunction &MF, + const TargetRegisterClass *RC, BitVector &R){ + for (TargetRegisterClass::iterator I = RC->allocation_order_begin(MF), + E = RC->allocation_order_end(MF); I != E; ++I) + R.set(*I); +} + 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 *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); + if (RC) { + getAllocatableSetForRC(MF, RC, Allocatable); + return Allocatable; } + + for (MRegisterInfo::regclass_iterator I = regclass_begin(), + E = regclass_end(); I != E; ++I) + getAllocatableSetForRC(MF, *I, Allocatable); return Allocatable; } |

