diff options
| author | David Greene <greened@obbligato.org> | 2011-07-29 19:07:22 +0000 |
|---|---|---|
| committer | David Greene <greened@obbligato.org> | 2011-07-29 19:07:22 +0000 |
| commit | 9aa82842c7ad48d05b9305d3478f3b318a7e7f81 (patch) | |
| tree | d69e20f87c63aca0a3bb8aa952891ed169aac81e /llvm/utils/TableGen/Record.cpp | |
| parent | cde30d04b7c21e80fda34fed4c47b87e0869bf45 (diff) | |
| download | bcm5719-llvm-9aa82842c7ad48d05b9305d3478f3b318a7e7f81.tar.gz bcm5719-llvm-9aa82842c7ad48d05b9305d3478f3b318a7e7f81.zip | |
[AVX] Make VarBitInit Unique
Make sure VarBitInits are unique and created only once.
llvm-svn: 136498
Diffstat (limited to 'llvm/utils/TableGen/Record.cpp')
| -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 68f9f2a2471..3a022fc151e 100644 --- a/llvm/utils/TableGen/Record.cpp +++ b/llvm/utils/TableGen/Record.cpp @@ -1389,7 +1389,16 @@ const Init *VarInit::resolveReferences(Record &R, const RecordVal *RV) const { } const VarBitInit *VarBitInit::get(const TypedInit *T, unsigned B) { - return new VarBitInit(T, B); + typedef std::pair<const TypedInit *, unsigned> Key; + typedef DenseMap<Key, VarBitInit *> Pool; + + static Pool ThePool; + + Key TheKey(std::make_pair(T, B)); + + VarBitInit *&I = ThePool[TheKey]; + if (!I) I = new VarBitInit(T, B); + return I; } std::string VarBitInit::getAsString() const { |

