summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/TGParser.cpp
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2010-01-05 19:11:42 +0000
committerDavid Greene <greened@obbligato.org>2010-01-05 19:11:42 +0000
commit297bfe6d711285bc9d80a3bacb3bb363c0e444c4 (patch)
treee4d284df05e6dd9390954f2d96e6f17e191592cb /llvm/utils/TableGen/TGParser.cpp
parenta318efd1f21a21358f45a201f7b6cb2b8b118ec0 (diff)
downloadbcm5719-llvm-297bfe6d711285bc9d80a3bacb3bb363c0e444c4.tar.gz
bcm5719-llvm-297bfe6d711285bc9d80a3bacb3bb363c0e444c4.zip
Add an !eq() operator to TableGen. It operates on strings only.
Use !cast<string>() to compare other types of objects. llvm-svn: 92754
Diffstat (limited to 'llvm/utils/TableGen/TGParser.cpp')
-rw-r--r--llvm/utils/TableGen/TGParser.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/utils/TableGen/TGParser.cpp b/llvm/utils/TableGen/TGParser.cpp
index b095a6c3014..8c158e0e4ee 100644
--- a/llvm/utils/TableGen/TGParser.cpp
+++ b/llvm/utils/TableGen/TGParser.cpp
@@ -792,6 +792,7 @@ Init *TGParser::ParseOperation(Record *CurRec) {
case tgtok::XSRA:
case tgtok::XSRL:
case tgtok::XSHL:
+ case tgtok::XEq:
case tgtok::XStrConcat:
case tgtok::XNameConcat: { // Value ::= !binop '(' Value ',' Value ')'
BinOpInit::BinaryOp Code;
@@ -820,6 +821,11 @@ Init *TGParser::ParseOperation(Record *CurRec) {
Code = BinOpInit::SHL;
Type = new IntRecTy();
break;
+ case tgtok::XEq:
+ Lex.Lex(); // eat the operation
+ Code = BinOpInit::EQ;
+ Type = new IntRecTy();
+ break;
case tgtok::XStrConcat:
Lex.Lex(); // eat the operation
Code = BinOpInit::STRCONCAT;
@@ -1257,6 +1263,7 @@ Init *TGParser::ParseSimpleValue(Record *CurRec, RecTy *ItemType) {
case tgtok::XSRA:
case tgtok::XSRL:
case tgtok::XSHL:
+ case tgtok::XEq:
case tgtok::XStrConcat:
case tgtok::XNameConcat: // Value ::= !binop '(' Value ',' Value ')'
case tgtok::XIf:
OpenPOWER on IntegriCloud