I wonder it's better to pass this intrinsic to BE and lower it just before
CGEXP phase. So that we keep the opportunity to optimize it in wopt in the
future.
Another suggestion, for the ID of the intrin, "INTRN_OBJECT_SIZE" is better
than "INTRN_OBJ_SZ".
2010/12/8 shuxin yang <shuxin.ope...@gmail.com>
> Hi, there:
>
> Bug 586 is about back-end folding gcc extension __builtin_object_size()
> into a compile time constant.
>
> If I understand right, "__builtin_object_size(void*p, int type)" depends
> on compiler's capability
> of data flow analysis; if the compiler is able to reveal the object O that
> <p> points to, it will returns
> sizeof(typeof(O)); otherwise, it returns "type < 2? -1 : 0".
>
> gcc tries to fold this built-in function in many places; it calls
> fold_builtin_object_size()@builtin.c
> prior to generic -> gspin conversion. However, fold_builtin_object_size()
> is only able to handle simple cases;
> general cases are taken cared by a pass named "objsz" (see
> tree-object-size.c) which rely on
> SSA and it is called after the generic->gspin conversion.
>
> My fix, honestly kludge, is simply to replace the builtin function with
> "type < 2 ? -1 : 0".
> In the long run, the back-end should have full-blown support.
>
> Thanks
> Shuxin
>
>
>
> ------------------------------------------------------------------------------
> This SF Dev2Dev email is sponsored by:
>
> WikiLeaks The End of the Free Internet
> http://p.sf.net/sfu/therealnews-com
> _______________________________________________
> Open64-devel mailing list
> Open64-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/open64-devel
>
>
--
Regards,
Lai Jian-Xin
------------------------------------------------------------------------------
This SF Dev2Dev email is sponsored by:
WikiLeaks The End of the Free Internet
http://p.sf.net/sfu/therealnews-com
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel