diff options
| author | Nate Begeman <natebegeman@mac.com> | 2009-03-19 05:21:56 +0000 |
|---|---|---|
| committer | Nate Begeman <natebegeman@mac.com> | 2009-03-19 05:21:56 +0000 |
| commit | 7cee81703de8333d457ec9e560b0537b71df5a48 (patch) | |
| tree | 510812a4ee134e4dbda6b3f38cdaeab84a82a86f /utils/TableGen/TGParser.cpp | |
| parent | b53db4fb321823a8a1f6abc372bdc7c36ef1447f (diff) | |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67286 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/TGParser.cpp')
| -rw-r--r-- | utils/TableGen/TGParser.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/utils/TableGen/TGParser.cpp b/utils/TableGen/TGParser.cpp index 1fa8272727..9d579c2ef7 100644 --- a/utils/TableGen/TGParser.cpp +++ b/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<std::pair<llvm::Init*, std::string> > 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: |
