diff options
Diffstat (limited to 'lib/CodeGen/SelectionDAG/TargetLowering.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/TargetLowering.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/lib/CodeGen/SelectionDAG/TargetLowering.cpp index dafda50a83..6e6fedeb2e 100644 --- a/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -678,9 +678,12 @@ TargetLowering::hasLegalSuperRegRegClasses(const TargetRegisterClass *RC) const{ } /// findRepresentativeClass - Return the largest legal super-reg register class -/// of the specified register class. -const TargetRegisterClass * -TargetLowering::findRepresentativeClass(const TargetRegisterClass *RC) const { +/// of the register class for the specified type and its associated "cost". +std::pair<const TargetRegisterClass*, uint8_t> +TargetLowering::findRepresentativeClass(EVT VT) const { + const TargetRegisterClass *RC = RegClassForVT[VT.getSimpleVT().SimpleTy]; + if (!RC) + return std::make_pair(RC, 0); const TargetRegisterClass *BestRC = RC; for (TargetRegisterInfo::regclass_iterator I = RC->superregclasses_begin(), E = RC->superregclasses_end(); I != E; ++I) { @@ -688,10 +691,10 @@ TargetLowering::findRepresentativeClass(const TargetRegisterClass *RC) const { if (RRC->isASubClass() || !isLegalRC(RRC)) continue; if (!hasLegalSuperRegRegClasses(RRC)) - return RRC; + return std::make_pair(RRC, 1); BestRC = RRC; } - return BestRC; + return std::make_pair(BestRC, 1); } /// computeRegisterProperties - Once all of the register classes are added, @@ -820,8 +823,11 @@ void TargetLowering::computeRegisterProperties() { // 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) { - const TargetRegisterClass *RC = RegClassForVT[i]; - RepRegClassForVT[i] = RC ? findRepresentativeClass(RC) : 0; + const TargetRegisterClass* RRC; + uint8_t Cost; + tie(RRC, Cost) = findRepresentativeClass((MVT::SimpleValueType)i); + RepRegClassForVT[i] = RRC; + RepRegClassCostForVT[i] = Cost; } } |