1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

[RegisterBankInfo] Avoid heap allocation in InstructionMapping.

Use SmallVector instead of dynamically allocated arrays for the mapping of the
operands in the InstructionMapping. That way we avoid heap allocation for most
of the cases. Ultimately, we should not have to rely on such tricky, the
instances of InstructionMapping would be TableGen'ed.

This improves the compilation time of the RegBankSelect pass.

llvm-svn: 281955
This commit is contained in:
Quentin Colombet 2016-09-20 00:48:44 +00:00
parent f5fe06aed8
commit cfcf1da683

View File

@ -109,7 +109,8 @@ public:
/// Cost of this mapping.
unsigned Cost;
/// Mapping of all the operands.
std::unique_ptr<ValueMapping[]> OperandsMapping;
/// Note: Use a SmallVector to avoid heap allocation in most cases.
SmallVector<ValueMapping, 8> OperandsMapping;
/// Number of operands.
unsigned NumOperands;
@ -131,7 +132,7 @@ public:
: ID(ID), Cost(Cost), NumOperands(NumOperands) {
assert(getID() != InvalidMappingID &&
"Use the default constructor for invalid mapping");
OperandsMapping.reset(new ValueMapping[getNumOperands()]);
OperandsMapping.resize(getNumOperands());
}
/// Default constructor.