fold_builtin changes tree

Paulo J. Matos paulo@matos-sorge.com
Wed Mar 21 16:30:00 GMT 2012


On 20/03/12 10:30, Jakub Jelinek wrote:
 >
> Like any other builtin expander?  There are many dozens of examples in
> builtins.c.  It is called with the tree argument, so you verify it, complain
> if the argument is not the one you are expecting, and just expand it as the
> symbol instead of expanding the call.  Basically you could do what you
> currently do in the folder, and feed what you'd return from that to
> expand_normal or expand_expr.
>
> 	Jakub
>

Thanks Jakub. I guess that might work but I have to reimplement my 
function since part of my folder would look for the initial function 
definition.

So, for example if I had:
int lt(int x) { return x < 0;}
int sizeof_lt(void) { return __function_size(lt); }

Since lt, argument to __function_size, is not void (*) (void), the that 
got the folder was:
void (*lt.TEMP)(void) = lt;
return __function_size(lt.TEMP);

So in the folder I was looking through the sequence of statements to 
find the real function lt from the argument to __function_size: lt.TEMP. 
This in the expander doesn't work anymore since we now have basic blocks 
and are handling gimple instead of trees.

If you have any further suggestions, let me know.

Thanks.

-- 
PMatos



More information about the Gcc mailing list