From dbe3f77f5bfa4e580ddddc85b5afa3bb5a29a921 Mon Sep 17 00:00:00 2001 From: Nate Begeman Date: Thu, 19 Mar 2009 05:21:56 +0000 Subject: Add support to tablegen for naming the nodes themselves, not just the operands, in selectiondag patterns. This is required for the upcoming shuffle_vector rewrite, and as it turns out, cleans up a hack in the Alpha instruction info. llvm-svn: 67286 --- llvm/utils/TableGen/TGParser.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'llvm/utils/TableGen/TGParser.cpp') diff --git a/llvm/utils/TableGen/TGParser.cpp b/llvm/utils/TableGen/TGParser.cpp index 1fa8272727b..9d579c2ef7e 100644 --- a/llvm/utils/TableGen/TGParser.cpp +++ b/llvm/utils/TableGen/TGParser.cpp @@ -636,6 +636,18 @@ Init *TGParser::ParseSimpleValue(Record *CurRec) { Init *Operator = ParseIDValue(CurRec); if (Operator == 0) return 0; + // If the operator name is present, parse it. + std::string OperatorName; + if (Lex.getCode() == tgtok::colon) { + if (Lex.Lex() != tgtok::VarName) { // eat the ':' + TokError("expected variable name in dag operator"); + return 0; + } + OperatorName = Lex.getCurStrVal(); + Lex.Lex(); // eat the VarName. + } + + std::vector > DagArgs; if (Lex.getCode() != tgtok::r_paren) { DagArgs = ParseDagArgList(CurRec); @@ -648,7 +660,7 @@ Init *TGParser::ParseSimpleValue(Record *CurRec) { } Lex.Lex(); // eat the ')' - return new DagInit(Operator, DagArgs); + return new DagInit(Operator, OperatorName, DagArgs); } case tgtok::XConcat: case tgtok::XSRA: -- cgit v1.2.3