This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Extend return by invisible reference mechanism
On Thu, Apr 8, 2010 at 1:01 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> Well, fndecl is needed for the DECL_RESULT check and ...
>
> That I'm removing.
>
>> How did you test the patch? ?I believe that removing
>>
>> - ?if (TREE_CODE (exp) == CALL_EXPR && fndecl && DECL_RESULT (fndecl)
>> - ? ? ?&& DECL_BY_REFERENCE (DECL_RESULT (fndecl)))
>>
>> might regress the C++ frontend as that also sets DECL_BY_REFERENCE
>> on RESULT_DECLs.
>
> No, it doesn't, all languages are clean. ?C++ doesn't need this check.
>
>> If not then the fndecl variable is completely unused after your patch?
>
> No, it's used to do some internal manipulation in the function:
>
> ?const_tree fndecl;
>
> ?if (fntype)
> ? ?switch (TREE_CODE (fntype))
> ? ? ?{
> ? ? ?case CALL_EXPR:
> ? ? ? ?fndecl = get_callee_fndecl (fntype);
> ? ? ? ?fntype = (fndecl
> ? ? ? ? ? ? ? ? ?? TREE_TYPE (fndecl)
> ? ? ? ? ? ? ? ? ?: TREE_TYPE (TREE_TYPE (CALL_EXPR_FN (fntype))));
> ? ? ? ?break;
> ? ? ?case FUNCTION_DECL:
> ? ? ? ?fndecl = fntype;
> ? ? ? ?fntype = TREE_TYPE (fndecl);
> ? ? ? ?break;
> ? ? ?case FUNCTION_TYPE:
> ? ? ?case METHOD_TYPE:
> ? ? ? ?break;
> ? ? ?case IDENTIFIER_NODE:
> ? ? ? ?fntype = NULL_TREE;
> ? ? ? ?break;
> ? ? ?default:
> ? ? ? ?/* We don't expect other rtl types here. ?*/
> ? ? ? ?gcc_unreachable ();
> ? ? ?}
Sure, but fndecl isn't used afterwards so the CALL_EXPR handling
could use some local temporary and the FUNCTION_DECL case
could avoid setting it.
Richard.
> --
> Eric Botcazou
>