[llvm-commits] [llvm] r136490 - /llvm/trunk/utils/TableGen/Record.cpp
David Greene
greened at obbligato.org
Fri Jul 29 12:07:13 PDT 2011
Author: greened
Date: Fri Jul 29 14:07:12 2011
New Revision: 136490
URL: http://llvm.org/viewvc/llvm-project?rev=136490&view=rev
Log:
[AVX] Make IntInit Unique
Use a DenseMap to make sure only one IntInit of any value exists.
Modified:
llvm/trunk/utils/TableGen/Record.cpp
Modified: llvm/trunk/utils/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.cpp?rev=136490&r1=136489&r2=136490&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/Record.cpp (original)
+++ llvm/trunk/utils/TableGen/Record.cpp Fri Jul 29 14:07:12 2011
@@ -539,7 +539,12 @@
}
const IntInit *IntInit::get(int64_t V) {
- return new IntInit(V);
+ typedef DenseMap<int64_t, IntInit *> Pool;
+ static Pool ThePool;
+
+ IntInit *&I = ThePool[V];
+ if (!I) I = new IntInit(V);
+ return I;
}
std::string IntInit::getAsString() const {
More information about the llvm-commits
mailing list