public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Accessing const parameter of GIMPLE_CALL
@ 2022-01-16 13:22 Shubham Narlawar
  2022-01-16 23:53 ` David Malcolm
  0 siblings, 1 reply; 9+ messages in thread
From: Shubham Narlawar @ 2022-01-16 13:22 UTC (permalink / raw)
  To: GCC Development

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-01-18 18:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-16 13:22 Accessing const parameter of GIMPLE_CALL Shubham Narlawar
2022-01-16 23:53 ` David Malcolm
2022-01-17  8:25   ` Richard Biener
2022-01-17 19:18     ` Shubham Narlawar
2022-01-17 20:49       ` Martin Sebor
2022-01-18 18:45         ` Shubham Narlawar
2022-01-18  8:50       ` Richard Biener
2022-01-18 18:50         ` Shubham Narlawar
2022-01-17 19:18   ` Shubham Narlawar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).