diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 13 | ||||
-rw-r--r-- | llvm/lib/Target/ARM/ARMISelLowering.cpp | 16 | ||||
-rw-r--r-- | llvm/lib/Target/ARM/ARMISelLowering.h | 4 |
3 files changed, 27 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp index 5c09db28607..dafda50a834 100644 --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/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 { diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp index 9b6db1d2336..9102664c6e9 100644 --- a/llvm/lib/Target/ARM/ARMISelLowering.cpp +++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp @@ -550,6 +550,22 @@ ARMTargetLowering::ARMTargetLowering(TargetMachine &TM) benefitFromCodePlacementOpt = true; } +const TargetRegisterClass * +ARMTargetLowering::findRepresentativeClass(const TargetRegisterClass *RC) const{ + switch (RC->getID()) { + default: + return RC; + case ARM::tGPRRegClassID: + case ARM::GPRRegClassID: + return ARM::GPRRegisterClass; + case ARM::SPRRegClassID: + case ARM::DPRRegClassID: + return ARM::DPRRegisterClass; + case ARM::QPRRegClassID: + return ARM::QPRRegisterClass; + } +} + const char *ARMTargetLowering::getTargetNodeName(unsigned Opcode) const { switch (Opcode) { default: return 0; diff --git a/llvm/lib/Target/ARM/ARMISelLowering.h b/llvm/lib/Target/ARM/ARMISelLowering.h index 7f37e20724e..ef47003058c 100644 --- a/llvm/lib/Target/ARM/ARMISelLowering.h +++ b/llvm/lib/Target/ARM/ARMISelLowering.h @@ -271,6 +271,10 @@ namespace llvm { /// materialize the FP immediate as a load from a constant pool. virtual bool isFPImmLegal(const APFloat &Imm, EVT VT) const; + protected: + const TargetRegisterClass * + findRepresentativeClass(const TargetRegisterClass *RC) const; + private: /// Subtarget - Keep a pointer to the ARMSubtarget around so that we can /// make the right decision when generating code for different targets. |