This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [lto][patch] Clear DECL_CONTEXT of PARM_DECL
> This isn't right. If you set the context to NULL, the optimizers
> will think that PARM_DECLs are call-clobbered, but they aren't.
> The right thing here is to set them to the FUNCTION_DECL to which
> they belong. If the function has been inlined the inliner will
> set it to the caller function. For nested functions, the
> unnester should set it to the function we are nesting into.
>
> This would avoid special casing PARM_DECLs all over the place.
> But setting DECL_CONTEXT to NULL here is certainly not right.
> We should not be special-casing PARM_DECLs here.
This is the first patch. I still have more DECL_CONTEXT to clean. As
you have just described, one can always know where a PARM_DECL came
from. We don't need DECL_CONTEXT for them once we have lowered nested
functions.
> Your explanation for this patch also doesn't seem to agree with
> what you are doing here. You say that PARM_DECLs should be
> local, and yet you are converting them into globals.
I am not. PARM_DECL are never globals. Just by knowing that they are
PARM_DECL is enough to know that they are local.
> Is there a test case you could post? I'm not following what you are after.
Not yet, sorry. I need this to be able to clean the DECL_CONTEXT of
VAR_DECLs that are the ones that are really causing a problem. For
them all we need is a bit saying if they are global or local.
> Thanks. Diego.
>
Cheers,
--
Rafael Avila de Espindola
Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047