[llvm-commits] [llvm] r47473 - /llvm/trunk/lib/VMCore/AsmWriter.cpp

Chris Lattner clattner at apple.com
Thu Feb 21 21:52:13 PST 2008


On Feb 21, 2008, at 7:10 PM, Devang Patel wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=47473&view=rev
> Log:
> Print getresult instruction properly.
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
> +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Thu Feb 21 21:10:23 2008
> @@ -1291,6 +1291,19 @@
>       writeOperand(I.getOperand(op  ), false); Out << ',';
>       writeOperand(I.getOperand(op+1), false); Out << " ]";
>     }
> +  } else if (isa<GetResultInst>(I)) {
> +    const StructType *STy = cast<StructType>(I.getOperand(0)- 
> >getType());
> +    unsigned NumElems = STy->getNumElements();
> +    Out << " {";
> +    for (unsigned i = 0; i < NumElems; ++i) {
> +      if (i)
> +        Out << ",";
> +      Out << " ";
> +      printType(STy->getElementType(i));
> +    }
> +    Out << " }";

Why print the type manually here?  Why not have writeOperand print the  
type?

>
> +    writeOperand(I.getOperand(0), false);
> +    Out << ", " << cast<GetResultInst>(I).getIndex();

instead of isa (in the if) and cast here, please use dyn_cast.

-Chris




More information about the llvm-commits mailing list