mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
[AVX] Make FieldInit Unique
Make sure FieldInits are unique and created only once. llvm-svn: 136500
This commit is contained in:
parent
619a865a18
commit
e1cb4aa5bb
@ -1475,7 +1475,15 @@ std::string DefInit::getAsString() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const FieldInit *FieldInit::get(const Init *R, const std::string &FN) {
|
const FieldInit *FieldInit::get(const Init *R, const std::string &FN) {
|
||||||
return new FieldInit(R, FN);
|
typedef std::pair<const Init *, TableGenStringKey> Key;
|
||||||
|
typedef DenseMap<Key, FieldInit *> Pool;
|
||||||
|
static Pool ThePool;
|
||||||
|
|
||||||
|
Key TheKey(std::make_pair(R, FN));
|
||||||
|
|
||||||
|
FieldInit *&I = ThePool[TheKey];
|
||||||
|
if (!I) I = new FieldInit(R, FN);
|
||||||
|
return I;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Init *FieldInit::resolveBitReference(Record &R, const RecordVal *RV,
|
const Init *FieldInit::resolveBitReference(Record &R, const RecordVal *RV,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user