summaryrefslogtreecommitdiff
path: root/utils/TableGen
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
commitd0e9d04ab04d862392cbc84543ad9d77c58eb966 (patch)
tree509ec0f06fe0ec0acd26733f43f6f459be1c8f43 /utils/TableGen
parent2855b0f0730b1a31aa156ea667fee79f66be4b03 (diff)
downloadllvm-d0e9d04ab04d862392cbc84543ad9d77c58eb966.tar.gz
llvm-d0e9d04ab04d862392cbc84543ad9d77c58eb966.tar.bz2
llvm-d0e9d04ab04d862392cbc84543ad9d77c58eb966.tar.xz
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136491 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen')
-rw-r--r--utils/TableGen/Record.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/utils/TableGen/Record.cpp b/utils/TableGen/Record.cpp
index 54edfe5ea8..ee5db4713d 100644
--- a/utils/TableGen/Record.cpp
+++ b/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) {