summaryrefslogtreecommitdiff
path: root/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
commit6786d5e18387465d6106eaef0b7923526ef0bc10 (patch)
tree3665a60a078ae910aeff79fc75a4c8eb9f918781 /utils/TableGen/TGParser.cpp
parent5f7775c85e60aa659ac76c4b18f7a1f6494f23e2 (diff)
downloadllvm-6786d5e18387465d6106eaef0b7923526ef0bc10.tar.gz
llvm-6786d5e18387465d6106eaef0b7923526ef0bc10.tar.bz2
llvm-6786d5e18387465d6106eaef0b7923526ef0bc10.tar.xz
Add an !eq() operator to TableGen. It operates on strings only.
Use !cast<string>() to compare other types of objects. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92754 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/TGParser.cpp')
-rw-r--r--utils/TableGen/TGParser.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/utils/TableGen/TGParser.cpp b/utils/TableGen/TGParser.cpp
index b095a6c301..8c158e0e4e 100644
--- a/utils/TableGen/TGParser.cpp
+++ b/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: