diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2010-06-29 14:02:34 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2010-06-29 14:02:34 +0000 |
commit | 38a7d7cbc308c6a3f77eac646155ebfa869467ef (patch) | |
tree | fce9a15fbc3660096672336bbe42dbdafa71004b /llvm/lib/Target/TargetRegisterInfo.cpp | |
parent | d34bb4e9b0467152bb39eb59cbcb668341b02b0d (diff) | |
download | bcm5719-llvm-38a7d7cbc308c6a3f77eac646155ebfa869467ef.tar.gz bcm5719-llvm-38a7d7cbc308c6a3f77eac646155ebfa869467ef.zip |
Add a VT argument to getMinimalPhysRegClass and replace the copy related uses
of getPhysicalRegisterRegClass with it.
If we want to make a copy (or estimate its cost), it is better to use the
smallest class as more efficient operations might be possible.
llvm-svn: 107140
Diffstat (limited to 'llvm/lib/Target/TargetRegisterInfo.cpp')
-rw-r--r-- | llvm/lib/Target/TargetRegisterInfo.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Target/TargetRegisterInfo.cpp b/llvm/lib/Target/TargetRegisterInfo.cpp index 32299f6c7e0..48374d93d88 100644 --- a/llvm/lib/Target/TargetRegisterInfo.cpp +++ b/llvm/lib/Target/TargetRegisterInfo.cpp @@ -63,7 +63,7 @@ TargetRegisterInfo::getPhysicalRegisterRegClass(unsigned reg, EVT VT) const { /// getMinimalPhysRegClass - Returns the Register Class of a physical /// register of the given type. const TargetRegisterClass * -TargetRegisterInfo::getMinimalPhysRegClass(unsigned reg) const { +TargetRegisterInfo::getMinimalPhysRegClass(unsigned reg, EVT VT) const { assert(isPhysicalRegister(reg) && "reg must be a physical register"); // Pick the most sub register class of the right type that contains @@ -71,7 +71,8 @@ TargetRegisterInfo::getMinimalPhysRegClass(unsigned reg) const { const TargetRegisterClass* BestRC = 0; for (regclass_iterator I = regclass_begin(), E = regclass_end(); I != E; ++I){ const TargetRegisterClass* RC = *I; - if (RC->contains(reg) && (!BestRC || BestRC->hasSubClass(RC))) + if ((VT == MVT::Other || RC->hasType(VT)) && RC->contains(reg) && + (!BestRC || BestRC->hasSubClass(RC))) BestRC = RC; } |