diff options
author | David Greene <greened@obbligato.org> | 2011-07-29 19:07:23 +0000 |
---|---|---|
committer | David Greene <greened@obbligato.org> | 2011-07-29 19:07:23 +0000 |
commit | 7f501e8b4d7c0637f30132ce6d5e52d10f6f4700 (patch) | |
tree | d2ec423aef154f1144a7c946da9619b3bb885857 | |
parent | 9aa82842c7ad48d05b9305d3478f3b318a7e7f81 (diff) | |
download | bcm5719-llvm-7f501e8b4d7c0637f30132ce6d5e52d10f6f4700.tar.gz bcm5719-llvm-7f501e8b4d7c0637f30132ce6d5e52d10f6f4700.zip |
[AVX] Make VarListElementInit Unique
Make sure VarListElementInits are unique and created only once.
llvm-svn: 136499
-rw-r--r-- | llvm/utils/TableGen/Record.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/utils/TableGen/Record.cpp b/llvm/utils/TableGen/Record.cpp index 3a022fc151e..89de3edfd19 100644 --- a/llvm/utils/TableGen/Record.cpp +++ b/llvm/utils/TableGen/Record.cpp @@ -1414,7 +1414,16 @@ const Init *VarBitInit::resolveReferences(Record &R, const VarListElementInit *VarListElementInit::get(const TypedInit *T, unsigned E) { - return new VarListElementInit(T, E); + typedef std::pair<const TypedInit *, unsigned> Key; + typedef DenseMap<Key, VarListElementInit *> Pool; + + static Pool ThePool; + + Key TheKey(std::make_pair(T, E)); + + VarListElementInit *&I = ThePool[TheKey]; + if (!I) I = new VarListElementInit(T, E); + return I; } std::string VarListElementInit::getAsString() const { |