diff --git a/support/tools/TableGen/FileParser.y b/support/tools/TableGen/FileParser.y index 95dfb42ca92..0ab3e5bde0c 100644 --- a/support/tools/TableGen/FileParser.y +++ b/support/tools/TableGen/FileParser.y @@ -161,6 +161,7 @@ static void addSubClass(Record *SC, const std::vector &TemplateArgs) { int IntVal; RecTy *Ty; Init *Initializer; + std::vector *DagValueList; std::vector *FieldList; std::vector*BitList; Record *Rec; @@ -179,6 +180,7 @@ static void addSubClass(Record *SC, const std::vector &TemplateArgs) { %type ClassList ClassListNE %type OptPrefix %type Value OptValue +%type DagArgList DagArgListNE %type ValueList ValueListNE %type BitList OptBitList RBitList %type Declaration OptID @@ -270,8 +272,30 @@ Value : INTVAL { } $$ = new FieldInit($1, *$3); delete $3; + } | '(' ID DagArgList ')' { + Record *D = Records.getDef(*$2); + if (D == 0) { + err() << "Invalid def '" << *$2 << "'!\n"; + abort(); + } + $$ = new DagInit(D, *$3); + delete $2; delete $3; }; +DagArgListNE : Value { + $$ = new std::vector(); + $$->push_back($1); + } + | DagArgListNE ',' Value { + $1->push_back($3); + }; + +DagArgList : /*empty*/ { + $$ = new std::vector(); + } + | DagArgListNE { $$ = $1; }; + + RBitList : INTVAL { $$ = new std::vector(); $$->push_back($1); diff --git a/utils/TableGen/FileParser.y b/utils/TableGen/FileParser.y index 95dfb42ca92..0ab3e5bde0c 100644 --- a/utils/TableGen/FileParser.y +++ b/utils/TableGen/FileParser.y @@ -161,6 +161,7 @@ static void addSubClass(Record *SC, const std::vector &TemplateArgs) { int IntVal; RecTy *Ty; Init *Initializer; + std::vector *DagValueList; std::vector *FieldList; std::vector*BitList; Record *Rec; @@ -179,6 +180,7 @@ static void addSubClass(Record *SC, const std::vector &TemplateArgs) { %type ClassList ClassListNE %type OptPrefix %type Value OptValue +%type DagArgList DagArgListNE %type ValueList ValueListNE %type BitList OptBitList RBitList %type Declaration OptID @@ -270,8 +272,30 @@ Value : INTVAL { } $$ = new FieldInit($1, *$3); delete $3; + } | '(' ID DagArgList ')' { + Record *D = Records.getDef(*$2); + if (D == 0) { + err() << "Invalid def '" << *$2 << "'!\n"; + abort(); + } + $$ = new DagInit(D, *$3); + delete $2; delete $3; }; +DagArgListNE : Value { + $$ = new std::vector(); + $$->push_back($1); + } + | DagArgListNE ',' Value { + $1->push_back($3); + }; + +DagArgList : /*empty*/ { + $$ = new std::vector(); + } + | DagArgListNE { $$ = $1; }; + + RBitList : INTVAL { $$ = new std::vector(); $$->push_back($1);