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:
parent
f5fe06aed8
commit
cfcf1da683
@ -109,7 +109,8 @@ public:
|
|||||||
/// Cost of this mapping.
|
/// Cost of this mapping.
|
||||||
unsigned Cost;
|
unsigned Cost;
|
||||||
/// Mapping of all the operands.
|
/// 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.
|
/// Number of operands.
|
||||||
unsigned NumOperands;
|
unsigned NumOperands;
|
||||||
|
|
||||||
@ -131,7 +132,7 @@ public:
|
|||||||
: ID(ID), Cost(Cost), NumOperands(NumOperands) {
|
: ID(ID), Cost(Cost), NumOperands(NumOperands) {
|
||||||
assert(getID() != InvalidMappingID &&
|
assert(getID() != InvalidMappingID &&
|
||||||
"Use the default constructor for invalid mapping");
|
"Use the default constructor for invalid mapping");
|
||||||
OperandsMapping.reset(new ValueMapping[getNumOperands()]);
|
OperandsMapping.resize(getNumOperands());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Default constructor.
|
/// Default constructor.
|
||||||
|
Loading…
Reference in New Issue
Block a user