diff options
| author | David Greene <greened@obbligato.org> | 2011-07-29 19:07:14 +0000 |
|---|---|---|
| committer | David Greene <greened@obbligato.org> | 2011-07-29 19:07:14 +0000 |
| commit | 3ff33c9123e943af2230c4e37becf826d937d725 (patch) | |
| tree | 075838ce745caf35b652fde58d522721da3c2938 /llvm/utils/TableGen/Record.cpp | |
| parent | a44263c0cc9e279b4f250cb39886312bff166dff (diff) | |
| download | bcm5719-llvm-3ff33c9123e943af2230c4e37becf826d937d725.tar.gz bcm5719-llvm-3ff33c9123e943af2230c4e37becf826d937d725.zip | |
[AVX] Make StringInit Unique
Use a StringMap to ensure the StringInits are unique. This is
especially important for AVX where we will have many smallish
strings representing instruction prefixes, suffixes and the like.
llvm-svn: 136491
Diffstat (limited to 'llvm/utils/TableGen/Record.cpp')
| -rw-r--r-- | llvm/utils/TableGen/Record.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/utils/TableGen/Record.cpp b/llvm/utils/TableGen/Record.cpp index 54edfe5ea8f..ee5db4713dc 100644 --- a/llvm/utils/TableGen/Record.cpp +++ b/llvm/utils/TableGen/Record.cpp @@ -21,6 +21,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringMap.h" using namespace llvm; @@ -565,7 +566,12 @@ IntInit::convertInitializerBitRange(const std::vector<unsigned> &Bits) const { } const StringInit *StringInit::get(const std::string &V) { - return new StringInit(V); + typedef StringMap<StringInit *> Pool; + static Pool ThePool; + + StringInit *&I = ThePool[V]; + if (!I) I = new StringInit(V); + return I; } const CodeInit *CodeInit::get(const std::string &V) { |

