[llvm-commits] [llvm] r47349 - in /llvm/trunk/lib/AsmParser: LLLexer.cpp llvmAsmParser.y

Chris Lattner clattner at apple.com
Tue Feb 19 20:20:50 PST 2008


On Feb 19, 2008, at 2:26 PM, Devang Patel wrote:

> Author: dpatel
> Date: Tue Feb 19 16:26:37 2008
> New Revision: 47349
>
> URL: http://llvm.org/viewvc/llvm-project?rev=47349&view=rev
> Log:
> Parse
> %b = getresult {i32, i32} %a, i32 1

Ok.  I don't think we need "i32 1" if we're converting to a raw  
unsigned instead of a Value* for the index.  Just using "%b =  
getresult {i32, i32} %a, 1" seems good.

> Modified:
>    llvm/trunk/lib/AsmParser/LLLexer.cpp
>    llvm/trunk/lib/AsmParser/llvmAsmParser.y

Don't forget to regen the .ll parser stuff.

> @@ -3130,6 +3131,14 @@
>     $$ = new StoreInst($3, tmpVal, $1, $7);
>     delete $5;
>   }
> +| GETRESULT Types LocalName ',' ConstVal  {

This should use ValueRef instead of LocalName.  "%4" is valid for an  
unnamed value.  Use EUINT64VAL instead of ConstVal to get the index.

>
> +  ValID TmpVID = ValID::createLocalName(*$3);
> +  Value *TmpVal = getVal($2->get(), TmpVID);
> +  if (!GetResultInst::isValidOperands(TmpVal, $5))
> +      GEN_ERROR("Invalid getresult operands");
> +    $$ = new GetResultInst(TmpVal, $5);
> +    CHECK_FOR_ERROR

You need to delete $2 (the type holder) at the end of this to avoid  
leaking the type holder.

-Chris



More information about the llvm-commits mailing list