diff options
| author | Evan Cheng <evan.cheng@apple.com> | 2008-03-11 07:19:34 +0000 |
|---|---|---|
| committer | Evan Cheng <evan.cheng@apple.com> | 2008-03-11 07:19:34 +0000 |
| commit | 676dd7c80b6f91178452535ac45ca58feb23cc42 (patch) | |
| tree | 33282790f7a542b3ef2f3af7a23646d8f8514a1c /lib/Target/TargetRegisterInfo.cpp | |
| parent | 204496d58e7e740f0da6d41c6214a91d67950d26 (diff) | |
When the register allocator runs out of registers, spill a physical register around the def's and use's of the interval being allocated to make it possible for the interval to target a register and spill it right away and restore a register for uses. This likely generates terrible code but is before than aborting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48218 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/TargetRegisterInfo.cpp')
| -rw-r--r-- | lib/Target/TargetRegisterInfo.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Target/TargetRegisterInfo.cpp b/lib/Target/TargetRegisterInfo.cpp index 11f1b3d070..0f8373b10f 100644 --- a/lib/Target/TargetRegisterInfo.cpp +++ b/lib/Target/TargetRegisterInfo.cpp @@ -34,20 +34,21 @@ TargetRegisterInfo::TargetRegisterInfo(const TargetRegisterDesc *D, unsigned NR, TargetRegisterInfo::~TargetRegisterInfo() {} /// getPhysicalRegisterRegClass - Returns the Register Class of a physical -/// register. +/// register of the given type. If type is MVT::Other, then just return any +/// register class the register belongs to. const TargetRegisterClass * -TargetRegisterInfo::getPhysicalRegisterRegClass(MVT::ValueType VT, - unsigned reg) const { +TargetRegisterInfo::getPhysicalRegisterRegClass(unsigned reg, + MVT::ValueType VT) const { assert(isPhysicalRegister(reg) && "reg must be a physical register"); // Pick the register class of the right type that contains this physreg. for (regclass_iterator I = regclass_begin(), E = regclass_end(); I != E; ++I) - if ((*I)->hasType(VT) && (*I)->contains(reg)) + if ((VT == MVT::Other || (*I)->hasType(VT)) + && (*I)->contains(reg)) return *I; assert(false && "Couldn't find the register class"); return 0; } - /// getAllocatableSetForRC - Toggle the bits that represent allocatable /// registers for the specific register class. static void getAllocatableSetForRC(MachineFunction &MF, |
