On Thu, May 2, 2013 at 2:28 PM, John McCall <[email protected]> wrote:
> On May 1, 2013, at 7:56 AM, Stephen Lin <[email protected]> wrote:
>> This patch converts the implementation of 'this'-returning
>> constructors and destructors (in ARM and MS C++ ABIs) to use the new
>> 'returned' attribute.
>>
>> It does so by adding a new flag to FunctionType::ExtInfo and other
>> associated classes which indicates that a function returns its first
>> argument; only a single bit is used currently since the only use cases
>> for this attribute are for the first parameter, but the API is
>> designed to theoretically allow the the attribute on any parameter if
>> needed later by increasing the number of reserved flag bits for the
>> field.
>
> This optimization is definitely not worth the complexity cost of raising it 
> into
> the formal type system.  Just find a way to add the new function attribute to
> the LLVM function declaration when creating a constructor or destructor.
>
> If we added a user-level attribute, that's how we'd handle it as well.
>
> LLVM has existing built-in knowledge of specific functions like memcpy;
> it can be responsible for adding this annotation as appropriate to them
> (when allowed).
>
> John.

Hi John,

Thanks for the reply and feedback. To clarify, so you mean to avoid
putting it in FunctionType::ExtInfo? I was hesistant to add it there
for the complexity cost you mentioned but couldn't figure out a better
place to put it: the information seems to have to get to
CodeGenModule::ConstructAttributeList somehow, or is there another
convenient place to add attributes to a parameter of a function
declaration?

A possible alternative to adding it to the FuncitonType::ExtInfo would
be to add a parameter to arrangeLLVMFunctionInfo(); the main reason I
avoided this is because it would require an extra parameter for a
specialized use case for a generic function called in many places. If
you think that's OK, though, of have any other suggestions, just let
me know.

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

Reply via email to