summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/TGParser.cpp
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2009-05-14 22:23:47 +0000
committerDavid Greene <greened@obbligato.org>2009-05-14 22:23:47 +0000
commite917fff30f9bb8c24a656492449d72d8262c7d7f (patch)
treeeefc5fbbe9cdaefdab325135f8232fdc4e6908b7 /llvm/utils/TableGen/TGParser.cpp
parent0a7c01ff2b2b42c22e25733bf6c961cdf6ad5166 (diff)
downloadbcm5719-llvm-e917fff30f9bb8c24a656492449d72d8262c7d7f.tar.gz
bcm5719-llvm-e917fff30f9bb8c24a656492449d72d8262c7d7f.zip
Implement a !foreach operator analogous to GNU make's $(foreach).
Use it on dags and lists like this: class decls { string name; } def Decls : decls; class B<list<string> names> : A<!foreach(Decls.name, names, !strconcat(Decls.name, ", Sr."))>; llvm-svn: 71803
Diffstat (limited to 'llvm/utils/TableGen/TGParser.cpp')
-rw-r--r--llvm/utils/TableGen/TGParser.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/llvm/utils/TableGen/TGParser.cpp b/llvm/utils/TableGen/TGParser.cpp
index 967f5d0d5dd..bc5d65eea59 100644
--- a/llvm/utils/TableGen/TGParser.cpp
+++ b/llvm/utils/TableGen/TGParser.cpp
@@ -792,7 +792,7 @@ Init *TGParser::ParseOperation(Record *CurRec) {
return (new BinOpInit(Code, LHS, RHS, Type))->Fold(CurRec, CurMultiClass);
}
-// case tgtok::XForEach:
+ case tgtok::XForEach:
case tgtok::XSubst: { // Value ::= !ternop '(' Value ',' Value ',' Value ')'
TernOpInit::TernaryOp Code;
RecTy *Type = 0;
@@ -802,9 +802,9 @@ Init *TGParser::ParseOperation(Record *CurRec) {
Lex.Lex(); // eat the operation
switch (LexCode) {
default: assert(0 && "Unhandled code!");
- //case tgtok::XForEach:
- //Code = TernOpInit::FOREACH;
- //break;
+ case tgtok::XForEach:
+ Code = TernOpInit::FOREACH;
+ break;
case tgtok::XSubst:
Code = TernOpInit::SUBST;
break;
@@ -844,15 +844,15 @@ Init *TGParser::ParseOperation(Record *CurRec) {
switch (LexCode) {
default: assert(0 && "Unhandled code!");
- //case tgtok::XForEach: {
- //TypedInit *MHSt = dynamic_cast<TypedInit *>(MHS);
- //if (MHSt == 0) {
- // TokError("could not get type for !foreach");
- // return 0;
- //}
- //Type = MHSt->getType();
- //break;
- //}
+ case tgtok::XForEach: {
+ TypedInit *MHSt = dynamic_cast<TypedInit *>(MHS);
+ if (MHSt == 0) {
+ TokError("could not get type for !foreach");
+ return 0;
+ }
+ Type = MHSt->getType();
+ break;
+ }
case tgtok::XSubst: {
TypedInit *RHSt = dynamic_cast<TypedInit *>(RHS);
if (RHSt == 0) {
@@ -1079,7 +1079,7 @@ Init *TGParser::ParseSimpleValue(Record *CurRec) {
case tgtok::XSHL:
case tgtok::XStrConcat:
case tgtok::XNameConcat: // Value ::= !binop '(' Value ',' Value ')'
- // case tgtok::XForEach:
+ case tgtok::XForEach:
case tgtok::XSubst: { // Value ::= !ternop '(' Value ',' Value ',' Value ')'
return ParseOperation(CurRec);
break;
OpenPOWER on IntegriCloud