[llvm-commits] CVS: llvm/utils/TableGen/FileParser.y
Chris Lattner
lattner at cs.uiuc.edu
Mon Aug 4 15:45:01 PDT 2003
Changes in directory llvm/utils/TableGen:
FileParser.y updated: 1.19 -> 1.20
---
Log message:
Parse DAG patterns
---
Diffs of the changes:
Index: llvm/utils/TableGen/FileParser.y
diff -u llvm/utils/TableGen/FileParser.y:1.19 llvm/utils/TableGen/FileParser.y:1.20
--- llvm/utils/TableGen/FileParser.y:1.19 Sun Aug 3 23:56:53 2003
+++ llvm/utils/TableGen/FileParser.y Mon Aug 4 15:44:43 2003
@@ -161,6 +161,7 @@
int IntVal;
RecTy *Ty;
Init *Initializer;
+ std::vector<Init*> *DagValueList;
std::vector<Init*> *FieldList;
std::vector<unsigned>*BitList;
Record *Rec;
@@ -179,6 +180,7 @@
%type <SubClassList> ClassList ClassListNE
%type <IntVal> OptPrefix
%type <Initializer> Value OptValue
+%type <DagValueList> DagArgList DagArgListNE
%type <FieldList> ValueList ValueListNE
%type <BitList> BitList OptBitList RBitList
%type <StrVal> Declaration OptID
@@ -270,7 +272,29 @@
}
$$ = 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<Init*>();
+ $$->push_back($1);
+ }
+ | DagArgListNE ',' Value {
+ $1->push_back($3);
};
+
+DagArgList : /*empty*/ {
+ $$ = new std::vector<Init*>();
+ }
+ | DagArgListNE { $$ = $1; };
+
RBitList : INTVAL {
$$ = new std::vector<unsigned>();
More information about the llvm-commits
mailing list