[cfe-commits] [QUESTION] vecreturn attribute question 2

Eli Friedman eli.friedman at gmail.com
Tue Aug 10 20:42:34 PDT 2010


On Tue, Aug 10, 2010 at 1:18 PM, John Thompson
<john.thompson.jtsoftware at gmail.com> wrote:
> With respect to the vecreturn attribute, do you have any suggestions on how
> to implement the code generation part?
>
> The only approach I can think of changes both the function definition and
> function calling code, and actually any other code using the record, to
> treat it as if it were in a vector register if it sees the attribute
> attached to the structure definition.  However, this seems like a major
> change.

It's definitely non-trivial, but fortunately for you, we already have
code which handles this sort of thing in lib/CodeGen/TargetInfo.cpp.
For example, when generating code for x86-64, clang actually does
precisely the transformation in question for structs containing only a
single vector.  Making the vecreturn attribute work should just be a
matter of adding an appropriate check to the relevant version of
classifyReturnType.

-El




More information about the cfe-commits mailing list