mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-21 03:29:40 +00:00
[AVX] Make CodeInit Unique
Use a StringMap to ensure CodeInits are unique and created only once. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136492 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d0e9d04ab0
commit
637b4ffa01
@ -575,7 +575,12 @@ const StringInit *StringInit::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) {
|
||||
|
Loading…
Reference in New Issue
Block a user