[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l llvmAsmParser.y
Reid Spencer
rspencer at reidspencer.com
Sun Dec 31 13:47:26 PST 2006
Oops. Sorry, missed that. Its fixed and regenerated now.
Reid.
On Sun, 2006-12-31 at 13:43 -0800, Jeff Cohen wrote:
> Only half-fixed. The extra semi-colon is still there.
>
> Reid Spencer wrote:
> > Jeff,
> >
> > This is now fixed. I wish the newer versions of bison would at least
> > warn about this!
> >
> > Reid.
> >
> > On Sun, 2006-12-31 at 12:42 -0800, Jeff Cohen wrote:
> >
> >> A semi-colon appears to be in the wrong place, as marked below. Some
> >> versions of bison complain, while others silently accept it (including
> >> the newest ones)--though how they interpret the grammar is not clear.
> >>
> >> Reid Spencer wrote:
> >>
> >>> Changes in directory llvm/lib/AsmParser:
> >>>
> >>> Lexer.l updated: 1.89 -> 1.90
> >>> llvmAsmParser.y updated: 1.292 -> 1.293
> >>> ---
> >>> Log message:
> >>>
> >>> For PR950: http://llvm.org/PR950 :
> >>> Major reorganization. This patch introduces the signedness changes for
> >>> the new integer types (i8, i16, i32, i64) which replace the old signed
> >>> versions (ubyte, sbyte, ushort, short, etc). This patch also implements
> >>> the function type parameter attributes feature. Together these conspired
> >>> to introduce new reduce/reduce errors into the grammar. Consequently, it
> >>> was necessary to introduce a new keyword into the grammar in order to
> >>> disambiguate. Without this, yacc would make incorrect shift/reduce and
> >>> reduce/reduce decisions and fail to parse the intended assembly.
> >>>
> >>> Changes in assembly:
> >>>
> >>> 1. The "implementation" keyword is superfluous but still supported. You
> >>> can use it as a sentry which will ensure there are no remaining up
> >>> reference types. However, this is optional as those checks are also
> >>> performed elsewhere.
> >>>
> >>> 2. Parameter attributes are now implemented using an at sign to
> >>> indicate the attribute. The attributes are placed after the type
> >>> in a function declaration or after the argument value in a function
> >>> call. For example:
> >>> i8 @sext %myfunc(i16 @zext)
> >>> call i8 @sext %myfunc(i16 @zext %someVal)
> >>> The facility is available for supporting additional attributes and
> >>> they can be combined using the @(attr1,attr2,attr3) syntax. Right
> >>> now the only two supported are @sext and @zext
> >>>
> >>> 3. Functions must now be defined with the "define" keyword which is
> >>> analagous to the "declare" keyword for function declarations. The
> >>> introduction of this keyword disambiguates situations where a
> >>> named result type is confused with a new type or gvar definition.
> >>> For example:
> >>> %MyType = type i16
> >>> %MyType %func(%MyType) { ... }
> >>> With the introduction of optional parameter attributes between
> >>> the function name and the function result type, yacc will pick
> >>> the wrong rule to reduce unless it is disambiguated with "define"
> >>> before the function definition, as in:
> >>> define %MyType @zext %func(%MyType %someArg) { ... }
> >>>
> >>>
> >>>
> >>> ---
> >>> Diffs of the changes: (+413 -253)
> >>>
> >>> Lexer.l | 12 -
> >>> llvmAsmParser.y | 654 +++++++++++++++++++++++++++++++++++---------------------
> >>> 2 files changed, 413 insertions(+), 253 deletions(-)
> >>>
> >>>
> >>> Index: llvm/lib/AsmParser/llvmAsmParser.y
> >>> diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.292 llvm/lib/AsmParser/llvmAsmParser.y:1.293
> >>> --- llvm/lib/AsmParser/llvmAsmParser.y:1.292 Fri Dec 29 14:29:48 2006
> >>> +++ llvm/lib/AsmParser/llvmAsmParser.y Sat Dec 30 23:40:12 2006
> >>>
> >>> @@ -2307,18 +2412,31 @@
> >>> };
> >>>
> >>>
> >>> -ValueRefList : ResolvedVal { // Used for call statements, and memory insts...
> >>> - $$ = new std::vector<Value*>();
> >>> - $$->push_back($1);
> >>> +ValueRefList : Types ValueRef OptParamAttrs {
> >>> + if (!UpRefs.empty())
> >>> + GEN_ERROR("Invalid upreference in type: " + (*$1)->getDescription());
> >>> + // Used for call and invoke instructions
> >>> + $$ = new ValueRefList();
> >>> + ValueRefListEntry E; E.Attrs = $3; E.Val = getVal($1->get(), $2);
> >>> + $$->push_back(E);
> >>> }
> >>> - | ValueRefList ',' ResolvedVal {
> >>> + | ValueRefList ',' Types ValueRef OptParamAttrs {
> >>> + if (!UpRefs.empty())
> >>> + GEN_ERROR("Invalid upreference in type: " + (*$3)->getDescription());
> >>> $$ = $1;
> >>> - $1->push_back($3);
> >>> + ValueRefListEntry E; E.Attrs = $5; E.Val = getVal($3->get(), $4);
> >>> + $$->push_back(E);
> >>> CHECK_FOR_ERROR
> >>> - };
> >>> + }
> >>> + | /*empty*/ { $$ = new ValueRefList(); };
> >>>
> >>> -// ValueRefListE - Just like ValueRefList, except that it may also be empty!
> >>> -ValueRefListE : ValueRefList | /*empty*/ { $$ = 0; };
> >>> +IndexList // Used for gep instructions and constant expressions
> >>> + : /*empty*/ { $$ = new std::vector<Value*>(); }; <====== bad semi-colon
> >>> + | IndexList ',' ResolvedVal {
> >>> + $$ = $1;
> >>> + $$->push_back($3);
> >>> + CHECK_FOR_ERROR
> >>> + } <====== missing semi-colon
> >>>
> >>>
> >>>
> >>>
> >> _______________________________________________
> >> llvm-commits mailing list
> >> llvm-commits at cs.uiuc.edu
> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >>
> >
> >
> >
> >
> >
>
More information about the llvm-commits
mailing list