From 7cf0ce4b8d122575c3348b5fa4947014c3d8432d Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 3 Aug 2003 18:17:22 +0000 Subject: Changes to allow lists of any type git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7519 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/TableGen/FileParser.y | 36 ++++-------------------------------- 1 file changed, 4 insertions(+), 32 deletions(-) (limited to 'utils/TableGen/FileParser.y') diff --git a/utils/TableGen/FileParser.y b/utils/TableGen/FileParser.y index 7144c91..4025d4e 100644 --- a/utils/TableGen/FileParser.y +++ b/utils/TableGen/FileParser.y @@ -162,7 +162,6 @@ static void addSubClass(Record *SC, const std::vector &TemplateArgs) { RecTy *Ty; Init *Initializer; std::vector *FieldList; - std::vector *RecPtr; std::vector*BitList; Record *Rec; SubClassRefTy *SubClassRef; @@ -174,8 +173,7 @@ static void addSubClass(Record *SC, const std::vector &TemplateArgs) { %token ID STRVAL CODEFRAGMENT %type Type -%type DefList DefListNE -%type ClassInst DefInst Object ObjectBody ClassID DefID +%type ClassInst DefInst Object ObjectBody ClassID %type SubClassRef %type ClassList ClassListNE @@ -197,15 +195,6 @@ ClassID : ID { delete $1; }; -DefID : ID { - $$ = Records.getDef(*$1); - if ($$ == 0) { - err() << "Couldn't find def '" << *$1 << "'!\n"; - abort(); - } - delete $1; - }; - // TableGen types... Type : STRING { // string type @@ -216,7 +205,7 @@ Type : STRING { // string type $$ = new BitsRecTy($3); } | INT { // int type $$ = new IntRecTy(); - } | LIST '<' ClassID '>' { // list type + } | LIST '<' Type '>' { // list type $$ = new ListRecTy($3); } | CODE { // code type $$ = new CodeRecTy(); @@ -252,11 +241,7 @@ Value : INTVAL { $$ = Init; delete $2; } | ID { - if (CurRec == 0) { - err() << "Def/Class name '" << *$1 << "' not allowed here!\n"; - abort(); - } - if (const RecordVal *RV = CurRec->getValue(*$1)) { + if (const RecordVal *RV = (CurRec ? CurRec->getValue(*$1) : 0)) { $$ = new VarInit(*$1, RV->getType()); } else if (Record *D = Records.getDef(*$1)) { $$ = new DefInit(D); @@ -273,7 +258,7 @@ Value : INTVAL { abort(); } delete $3; - } | '[' DefList ']' { + } | '[' ValueList ']' { $$ = new ListInit(*$2); delete $2; } | Value '.' ID { @@ -285,19 +270,6 @@ Value : INTVAL { delete $3; }; -DefList : /*empty */ { - $$ = new std::vector(); - } | DefListNE { - $$ = $1; - }; -DefListNE : DefID { - $$ = new std::vector(); - $$->push_back($1); - } | DefListNE ',' DefID { - ($$=$1)->push_back($3); - }; - - RBitList : INTVAL { $$ = new std::vector(); $$->push_back($1); -- cgit v1.1