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

Devang Patel dpatel at apple.com
Fri Feb 22 17:07:54 PST 2008


On Feb 21, 2008, at 9:52 PM, Chris Lattner wrote:

>> =
>> =====================================================================
>> --- 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?

I was unnecessarily trying to avoid printing
	getresult %struct.A %d, 1

Fixed.


>> +    writeOperand(I.getOperand(0), false);
>> +    Out << ", " << cast<GetResultInst>(I).getIndex();
>
> instead of isa (in the if) and cast here, please use dyn_cast.


Fixed.

-
Devang






More information about the llvm-commits mailing list