mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-20 16:17:38 +00:00
Intern all RecTy subclass instances to avoid duplicates.
Make all of the RecTy constructors private, and use get() factory methods instead. Return singleton instances when it makes sense. ListTy instance pointers are stored in the element RecTy instance. BitsRecTy instance pointers, one per length, are stored in a static vector. Also unique DefInit instances. A Record has a unique DefInit which has a unique RecordRecTy instance. This saves some 200k-300k RecTy allocations when parsing ARM.td. It reduces TableGen's heap usage by almost 50%. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135399 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1771,7 +1771,7 @@ TreePatternNode *TreePattern::ParseTreePattern(Init *TheInit, StringRef OpName){
|
||||
|
||||
if (BitsInit *BI = dynamic_cast<BitsInit*>(TheInit)) {
|
||||
// Turn this into an IntInit.
|
||||
Init *II = BI->convertInitializerTo(new IntRecTy());
|
||||
Init *II = BI->convertInitializerTo(IntRecTy::get());
|
||||
if (II == 0 || !dynamic_cast<IntInit*>(II))
|
||||
error("Bits value must be constants!");
|
||||
return ParseTreePattern(II, OpName);
|
||||
@@ -2180,7 +2180,7 @@ void CodeGenDAGPatterns::ParseDefaultOperands() {
|
||||
|
||||
// Find some SDNode.
|
||||
assert(!SDNodes.empty() && "No SDNodes parsed?");
|
||||
Init *SomeSDNode = new DefInit(SDNodes.begin()->first);
|
||||
Init *SomeSDNode = DefInit::get(SDNodes.begin()->first);
|
||||
|
||||
for (unsigned iter = 0; iter != 2; ++iter) {
|
||||
for (unsigned i = 0, e = DefaultOps[iter].size(); i != e; ++i) {
|
||||
|
||||
Reference in New Issue
Block a user