summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/Record.cpp
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2011-07-29 19:07:14 +0000
committerDavid Greene <greened@obbligato.org>2011-07-29 19:07:14 +0000
commit3ff33c9123e943af2230c4e37becf826d937d725 (patch)
tree075838ce745caf35b652fde58d522721da3c2938 /llvm/utils/TableGen/Record.cpp
parenta44263c0cc9e279b4f250cb39886312bff166dff (diff)
downloadbcm5719-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.cpp8
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) {
OpenPOWER on IntegriCloud