forked from OSchip/llvm-project
[AVX] Make CodeInit Unique
Use a StringMap to ensure CodeInits are unique and created only once. llvm-svn: 136492
This commit is contained in:
parent
3ff33c9123
commit
3468b0f483
|
@ -575,7 +575,12 @@ const StringInit *StringInit::get(const std::string &V) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const CodeInit *CodeInit::get(const std::string &V) {
|
const CodeInit *CodeInit::get(const std::string &V) {
|
||||||
return new CodeInit(V);
|
typedef StringMap<CodeInit *> Pool;
|
||||||
|
static Pool ThePool;
|
||||||
|
|
||||||
|
CodeInit *&I = ThePool[V];
|
||||||
|
if (!I) I = new CodeInit(V);
|
||||||
|
return I;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ListInit *ListInit::get(ArrayRef<const Init *> Range, RecTy *EltTy) {
|
const ListInit *ListInit::get(ArrayRef<const Init *> Range, RecTy *EltTy) {
|
||||||
|
|
Loading…
Reference in New Issue