forked from OSchip/llvm-project
Add support for let expressions around an mdef. This implements a new part
of Regression/TableGen/MultiClass.td. llvm-svn: 30887
This commit is contained in:
parent
ddf7347283
commit
9d9de698b5
|
|
@ -624,9 +624,9 @@ ObjectBody : ClassList {
|
||||||
// Delete the template arg values for the class
|
// Delete the template arg values for the class
|
||||||
delete (*$1)[i].second;
|
delete (*$1)[i].second;
|
||||||
}
|
}
|
||||||
delete $1; // Delete the class list...
|
delete $1; // Delete the class list.
|
||||||
|
|
||||||
// Process any variables on the set stack...
|
// Process any variables on the let stack.
|
||||||
for (unsigned i = 0, e = LetStack.size(); i != e; ++i)
|
for (unsigned i = 0, e = LetStack.size(); i != e; ++i)
|
||||||
for (unsigned j = 0, e = LetStack[i].size(); j != e; ++j)
|
for (unsigned j = 0, e = LetStack[i].size(); j != e; ++j)
|
||||||
setValue(LetStack[i][j].Name,
|
setValue(LetStack[i][j].Name,
|
||||||
|
|
@ -743,6 +743,14 @@ DefMInst : DEFM ID { CurDefmPrefix = $2; } ':' SubClassRef ';' {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the mdef is inside a 'let' expression, add to each def.
|
||||||
|
for (unsigned i = 0, e = LetStack.size(); i != e; ++i)
|
||||||
|
for (unsigned j = 0, e = LetStack[i].size(); j != e; ++j)
|
||||||
|
setValue(LetStack[i][j].Name,
|
||||||
|
LetStack[i][j].HasBits ? &LetStack[i][j].Bits : 0,
|
||||||
|
LetStack[i][j].Value);
|
||||||
|
|
||||||
|
|
||||||
// Ensure redefinition doesn't happen.
|
// Ensure redefinition doesn't happen.
|
||||||
if (Records.getDef(CurRec->getName())) {
|
if (Records.getDef(CurRec->getName())) {
|
||||||
err() << "def '" << CurRec->getName() << "' already defined, "
|
err() << "def '" << CurRec->getName() << "' already defined, "
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue