From 07eba05a610bb1711c2d9e798ad72df0ddf90249 Mon Sep 17 00:00:00 2001 From: David Greene Date: Mon, 8 Jun 2009 17:00:34 +0000 Subject: Add a !regmatch operator to do pattern matching in TableGen. llvm-svn: 73074 --- llvm/utils/TableGen/TGParser.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'llvm/utils/TableGen/TGParser.cpp') diff --git a/llvm/utils/TableGen/TGParser.cpp b/llvm/utils/TableGen/TGParser.cpp index fc6f29fd9f1..b4d448b1e8c 100644 --- a/llvm/utils/TableGen/TGParser.cpp +++ b/llvm/utils/TableGen/TGParser.cpp @@ -791,6 +791,7 @@ Init *TGParser::ParseOperation(Record *CurRec) { case tgtok::XSRL: case tgtok::XSHL: case tgtok::XStrConcat: + case tgtok::XRegMatch: case tgtok::XNameConcat: { // Value ::= !binop '(' Value ',' Value ')' BinOpInit::BinaryOp Code; RecTy *Type = 0; @@ -823,6 +824,11 @@ Init *TGParser::ParseOperation(Record *CurRec) { Code = BinOpInit::STRCONCAT; Type = new StringRecTy(); break; + case tgtok::XRegMatch: + Lex.Lex(); // eat the operation + Code = BinOpInit::REGMATCH; + Type = new IntRecTy(); + break; case tgtok::XNameConcat: Lex.Lex(); // eat the operation Code = BinOpInit::NAMECONCAT; @@ -1174,6 +1180,7 @@ Init *TGParser::ParseSimpleValue(Record *CurRec) { case tgtok::XSRL: case tgtok::XSHL: case tgtok::XStrConcat: + case tgtok::XRegMatch: case tgtok::XNameConcat: // Value ::= !binop '(' Value ',' Value ')' case tgtok::XIf: case tgtok::XForEach: -- cgit v1.2.3