Since this is what I believe is a custom attribute, to make sure we are on
the same page, the vecreturn attribute is described as follows in our gcc
doc:

***
Returning a Vector Class in Registers

According to the PPU ABI specifications, a class with a single member of
vector type is returned in
memory when used as the return value of a function. This results in
inefficient code when implementing
vector classes. To return the value in a single vector register, add the
vecreturn attribute to the class
definition. This attribute is also applicable to struct types.

Example:

struct Vector
{
  __vector float xyzw;
} __attribute__((vecreturn));

Vector Add(Vector lhs, Vector rhs)
{
  Vector result;
  result.xyzw = vec_add(lhs.xyzw, rhs.xyzw);
  return result; // This will be returned in a register
}
***

I believe I should be doing a little more checking to make sure the
structure/class to which the vecreturn attribute is attached is of the
proper kind, i.e. only has one data member, and the member is a vector.

Is the enclosed patch the right way to do this checking, using the field
iterator?

If so, may I check it in?  Otherwise, please let me know the right way to do
it.

-John

-- 
John Thompson
[email protected]

Attachment: vecreturn2.patch
Description: Binary data

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to