diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-08-16 15:29:24 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-08-16 15:29:24 +0000 |
commit | a9d64122c51bb206468210825c6c2ae65cb63077 (patch) | |
tree | ab15bffa89ddd76a9a12b7a80f41e3e141905b1b | |
parent | 1cc890d14befbd20a2636db282a31d3c099dc9af (diff) | |
download | bcm5719-llvm-a9d64122c51bb206468210825c6c2ae65cb63077.tar.gz bcm5719-llvm-a9d64122c51bb206468210825c6c2ae65cb63077.zip |
[TableGen] Return ValueTypeByHwMode by const reference from CodeGenRegisterClass::getValueTypeNum
Avoids costly std::map copies inside ValueTypeByHwMode constructor
llvm-svn: 339884
-rw-r--r-- | llvm/utils/TableGen/CodeGenRegisters.h | 2 | ||||
-rw-r--r-- | llvm/utils/TableGen/DAGISelMatcherGen.cpp | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/llvm/utils/TableGen/CodeGenRegisters.h b/llvm/utils/TableGen/CodeGenRegisters.h index 32aa33c80b3..0f7a025ded1 100644 --- a/llvm/utils/TableGen/CodeGenRegisters.h +++ b/llvm/utils/TableGen/CodeGenRegisters.h @@ -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!"); diff --git a/llvm/utils/TableGen/DAGISelMatcherGen.cpp b/llvm/utils/TableGen/DAGISelMatcherGen.cpp index ce23651b968..f8c8a16efcd 100644 --- a/llvm/utils/TableGen/DAGISelMatcherGen.cpp +++ b/llvm/utils/TableGen/DAGISelMatcherGen.cpp @@ -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 |