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 | d31f972bd33de85071c716f69bf5c6d735f730f2 (patch) | |
tree | 043445afb1aebab394f490a791eb8f072a6f7377 /lib/Target/TargetRegisterInfo.cpp | |
parent | 17c6e6d9cf4c9e56a6a28e4d0ae3699d376a8962 (diff) | |
download | llvm-d31f972bd33de85071c716f69bf5c6d735f730f2.tar.gz llvm-d31f972bd33de85071c716f69bf5c6d735f730f2.tar.bz2 llvm-d31f972bd33de85071c716f69bf5c6d735f730f2.tar.xz |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107140 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/TargetRegisterInfo.cpp')
-rw-r--r-- | lib/Target/TargetRegisterInfo.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Target/TargetRegisterInfo.cpp b/lib/Target/TargetRegisterInfo.cpp index 32299f6c7e..48374d93d8 100644 --- a/lib/Target/TargetRegisterInfo.cpp +++ b/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; } |