From 6786d5e18387465d6106eaef0b7923526ef0bc10 Mon Sep 17 00:00:00 2001 From: David Greene Date: Tue, 5 Jan 2010 19:11:42 +0000 Subject: Add an !eq() operator to TableGen. It operates on strings only. Use !cast() to compare other types of objects. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92754 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/TableGen/TGParser.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'utils/TableGen/TGParser.cpp') 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: -- cgit v1.2.3-70-g09d2