forked from OSchip/llvm-project
[TableGen] Return ValueTypeByHwMode by const reference from CodeGenRegisterClass::getValueTypeNum
Avoids costly std::map copies inside ValueTypeByHwMode constructor llvm-svn: 339884
This commit is contained in:
parent
1cc890d14b
commit
a9d64122c5
|
@ -348,7 +348,7 @@ namespace llvm {
|
|||
ArrayRef<ValueTypeByHwMode> getValueTypes() const { return VTs; }
|
||||
unsigned getNumValueTypes() const { return VTs.size(); }
|
||||
|
||||
ValueTypeByHwMode getValueTypeNum(unsigned VTNum) const {
|
||||
const ValueTypeByHwMode &getValueTypeNum(unsigned VTNum) const {
|
||||
if (VTNum < VTs.size())
|
||||
return VTs[VTNum];
|
||||
llvm_unreachable("VTNum greater than number of ValueTypes in RegClass!");
|
||||
|
|
|
@ -33,15 +33,15 @@ static MVT::SimpleValueType getRegisterValueType(Record *R,
|
|||
|
||||
if (!FoundRC) {
|
||||
FoundRC = true;
|
||||
ValueTypeByHwMode VVT = RC.getValueTypeNum(0);
|
||||
const ValueTypeByHwMode &VVT = RC.getValueTypeNum(0);
|
||||
if (VVT.isSimple())
|
||||
VT = VVT.getSimple().SimpleTy;
|
||||
continue;
|
||||
}
|
||||
|
||||
// If this occurs in multiple register classes, they all have to agree.
|
||||
#ifndef NDEBUG
|
||||
ValueTypeByHwMode T = RC.getValueTypeNum(0);
|
||||
// If this occurs in multiple register classes, they all have to agree.
|
||||
const ValueTypeByHwMode &T = RC.getValueTypeNum(0);
|
||||
assert((!T.isSimple() || T.getSimple().SimpleTy == VT) &&
|
||||
"ValueType mismatch between register classes for this register");
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue