Don't put TGParser scratch results in the output.

Only fully expanded Records should go into RecordKeeper.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157431 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakob Stoklund Olesen 2012-05-24 22:17:36 +00:00
parent 8e5286e18f
commit 72cba6cdf6
3 changed files with 9 additions and 6 deletions

View File

@ -1558,12 +1558,14 @@ public:
return I == Defs.end() ? 0 : I->second;
}
void addClass(Record *R) {
assert(getClass(R->getNameInitAsString()) == 0 && "Class already exists!");
Classes.insert(std::make_pair(R->getNameInitAsString(), R));
bool Ins = Classes.insert(std::make_pair(R->getName(), R)).second;
(void)Ins;
assert(Ins && "Class already exists");
}
void addDef(Record *R) {
assert(getDef(R->getNameInitAsString()) == 0 && "Def already exists!");
Defs.insert(std::make_pair(R->getNameInitAsString(), R));
bool Ins = Defs.insert(std::make_pair(R->getName(), R)).second;
(void)Ins;
assert(Ins && "Record already exists");
}
/// removeClass - Remove, but do not delete, the specified record.

View File

@ -1903,7 +1903,7 @@ bool TGParser::ParseDef(MultiClass *CurMultiClass) {
// Parse ObjectName and make a record for it.
Record *CurRec = new Record(ParseObjectName(CurMultiClass), DefLoc, Records);
if (!CurMultiClass) {
if (!CurMultiClass && Loops.empty()) {
// Top-level def definition.
// Ensure redefinition doesn't happen.
@ -1913,7 +1913,7 @@ bool TGParser::ParseDef(MultiClass *CurMultiClass) {
return true;
}
Records.addDef(CurRec);
} else {
} else if (CurMultiClass) {
// Otherwise, a def inside a multiclass, add it to the multiclass.
for (unsigned i = 0, e = CurMultiClass->DefPrototypes.size(); i != e; ++i)
if (CurMultiClass->DefPrototypes[i]->getNameInit()

View File

@ -9,6 +9,7 @@ class Register<string name, int idx> {
foreach i = [0, 1, 2, 3, 4, 5, 6, 7] in
def R#i : Register<"R"#i, i>;
// CHECK-NOT: !strconcat
// CHECK: def R0
// CHECK: string Name = "R0";