aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/TargetLowering.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2010-07-19 22:15:08 +0000
committerEvan Cheng <evan.cheng@apple.com>2010-07-19 22:15:08 +0000
commitd70f57b254114841892425a40944268d38ae0bcd (patch)
treea0ecece58a2f27bc4732c896c9b51fb171f59fb4 /lib/CodeGen/SelectionDAG/TargetLowering.cpp
parentbd3c63c70ed5e146e6d057cb842d4c2eec4f1cf8 (diff)
ARM has to provide its own TargetLowering::findRepresentativeClass because its scalar floating point registers alias its vector registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108761 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/TargetLowering.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/TargetLowering.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 5c09db2860..dafda50a83 100644
--- a/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -664,7 +664,8 @@ bool TargetLowering::isLegalRC(const TargetRegisterClass *RC) const {
/// hasLegalSuperRegRegClasses - Return true if the specified register class
/// has one or more super-reg register classes that are legal.
-bool TargetLowering::hasLegalSuperRegRegClasses(const TargetRegisterClass *RC) {
+bool
+TargetLowering::hasLegalSuperRegRegClasses(const TargetRegisterClass *RC) const{
if (*RC->superregclasses_begin() == 0)
return false;
for (TargetRegisterInfo::regclass_iterator I = RC->superregclasses_begin(),
@@ -679,9 +680,7 @@ bool TargetLowering::hasLegalSuperRegRegClasses(const TargetRegisterClass *RC) {
/// findRepresentativeClass - Return the largest legal super-reg register class
/// of the specified register class.
const TargetRegisterClass *
-TargetLowering::findRepresentativeClass(const TargetRegisterClass *RC) {
- if (!RC) return 0;
-
+TargetLowering::findRepresentativeClass(const TargetRegisterClass *RC) const {
const TargetRegisterClass *BestRC = RC;
for (TargetRegisterInfo::regclass_iterator I = RC->superregclasses_begin(),
E = RC->superregclasses_end(); I != E; ++I) {
@@ -820,8 +819,10 @@ void TargetLowering::computeRegisterProperties() {
// not a sub-register class / subreg register class) legal register class for
// a group of value types. For example, on i386, i8, i16, and i32
// representative would be GR32; while on x86_64 it's GR64.
- for (unsigned i = 0; i != MVT::LAST_VALUETYPE; ++i)
- RepRegClassForVT[i] = findRepresentativeClass(RegClassForVT[i]);
+ for (unsigned i = 0; i != MVT::LAST_VALUETYPE; ++i) {
+ const TargetRegisterClass *RC = RegClassForVT[i];
+ RepRegClassForVT[i] = RC ? findRepresentativeClass(RC) : 0;
+ }
}
const char *TargetLowering::getTargetNodeName(unsigned Opcode) const {