Hello,

My aim is to iterate over gimple call stmt parameters and check
whether it is constant or constant expression and mark/store them for
some gimple transformation.

I have an intrinsic function call of the following -

__builtin_xyz(void*, 7, addr + 10);

I want to find its parameters which are either constant or constant
expression i.e. 7 and addr + 10 from above case.

[1] I tried below macro but there is very less usage in the entire source code -

tree fn_ptr = gimple_call_fn (dyn_cast<gcall *> (stmt));        //stmt
= gimple_call
function_args_iterator iter;
tree argtype;

if (TREE_CODE (fn_ptr) == ADDR_EXPR)
{
  FOREACH_FUNCTION_ARGS (fn_ptr, argtype, iter)
    {
        if (TREE_CONSTANT (argtype))
           // Found a constant expression parameter
    }
}

The problem is I am getting only one parameter tree but there are 2
constants in the above function call. Even if "addr + 10" is treated
differently, I want to mark it for the transformation.

a. Is the above correct method to iterate over function call parameters?
b. Is there a different way to achieve the above goal?

Thanks and Regards,
Shubham

Reply via email to