[llvm-commits] patch 2: langref "derived types" cleanup

Nick Lewycky nicholas at mxc.ca
Sun Sep 27 11:29:34 PDT 2009


Duncan Sands wrote:
> Hi Nick,
> 
>> +   function type is a <a href="#t_firstclass">first class type</a>,
>> +   <a href="#t_void">void</a>, or <a href="#t_metadata">metadata</a>.
> 
> can a function really return metadata?

Nope. I'll fix that.

> If the
>> +   return type is a <a href="#t_struct">struct type</a> then the 
>> struct must
>> +   have at least one element.  The argument of a function must be 
>> first class
>> +   types.</p>
> 
> Why must a returned struct have an element?  I thought the plan was to
> get rid of the "void" return type and return {} instead.

This is no longer true, the code which checked for it turned out to be 
in a dead code region.

>> -   underlying processor.  The elements of a structure may be any type 
>> that has a
>> -   size.</p>
>> +   underlying processor.  The elements of a structure may be any
>> +   <a href="#t_firstclass">first class</a> type.</p>
> 
> So "first class" is the same as "has a size"?

How should I know, "has a size" was never defined in the LangRef :)

I checked the code and it's verifying Ty->isFirstClass, which is "every 
type except function, void and opaque".

>>     elements) and an underlying primitive data type.  Vectors must 
>> have a power
>> -   of two length (1, 2, 4, 8, 16 ...).  Vector types are considered
>> -   <a href="#t_firstclass">first class</a>.</p>
>> +   of two length (1, 2, 4, 8, 16 ...).</p>
> 
> Actually vectors don't have to have a power-of-two length anymore.

Well fancy that. I'll update that statement as well.

Thanks for the review!

Nick



More information about the llvm-commits mailing list