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

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


On Feb 21, 2008, at 6:50 PM, Devang Patel wrote:
> Author: dpatel
> Print ret instruction that returns aggregates.

>
> -  } else if (isa<ReturnInst>(I) && !Operand) {
> -    Out << " void";
> +  } else if (isa<ReturnInst>(I)) {
> +    if (!Operand)
> +      Out << " void";
> +    else {
> +      if (I.getOperand(0)->getType()->isFirstClassType())
> +        writeOperand(I.getOperand(0), true);
> +      else {

Does this work?  I thought that 'ret i32 1, float 1.0' was represented  
as a return with two operands, not as one with struct type.

-Chris

>
> +        Constant *ROp = cast<Constant>(I.getOperand(0));
> +        const StructType *STy = cast<StructType>(ROp->getType());
> +        unsigned NumElems = STy->getNumElements();
> +        for (unsigned i = 0; i < NumElems; ++i) {
> +          if (i)
> +            Out << ",";
> +          writeOperand(ROp->getOperand(i), true);
> +        }
> +      }
> +    }
>   } else if (const CallInst *CI = dyn_cast<CallInst>(&I)) {
>     // Print the calling convention being used.
>     switch (CI->getCallingConv()) {
>
>
> _______________________________________________
> 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