public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Query regarding generating NOTE instruction at GIMPLE level
@ 2022-02-06 19:40 Shubham Narlawar
  2022-02-07  9:17 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Shubham Narlawar @ 2022-02-06 19:40 UTC (permalink / raw)
  To: GCC Development

Hello,

Is it possible to generate a NOTE instruction at GIMPLE level?

My use case scenario is as below -
I want to create a note for __builtin_xyz(_x) such that there is a
placeholder just before function call and in RTL pass, I want to
modify/assign register number at this placeholder location.

_x = (unsigned int) _y;
__builtin_xyz(_x);    //_x is constant expression

For above builtin function call, I want to insert a note just before the
function call. I tried generating GIMPLE_NOP instruction as below -

_x = (unsigned int) _y;
GIMPLE_NOP
__builtin_xyz(_x);

But as per my understanding, a NOTE instruction behaves similar to
GIMPLE_NOP that is to create a placeholder for some computation.


1. Is there any attribute that can be added to GIMPLE instruction? If yes,
then there must be a mechanism that translates those attributes to NOTE
instructions in the RTL pass?


2. Is there any different approach on achieving above goal?

Thanks and Regards,
Shubham

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

* Re: Query regarding generating NOTE instruction at GIMPLE level
  2022-02-06 19:40 Query regarding generating NOTE instruction at GIMPLE level Shubham Narlawar
@ 2022-02-07  9:17 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2022-02-07  9:17 UTC (permalink / raw)
  To: Shubham Narlawar; +Cc: GCC Development

On Sun, Feb 6, 2022 at 8:42 PM Shubham Narlawar via Gcc <gcc@gcc.gnu.org> wrote:
>
> Hello,
>
> Is it possible to generate a NOTE instruction at GIMPLE level?
>
> My use case scenario is as below -
> I want to create a note for __builtin_xyz(_x) such that there is a
> placeholder just before function call and in RTL pass, I want to
> modify/assign register number at this placeholder location.
>
> _x = (unsigned int) _y;
> __builtin_xyz(_x);    //_x is constant expression
>
> For above builtin function call, I want to insert a note just before the
> function call. I tried generating GIMPLE_NOP instruction as below -
>
> _x = (unsigned int) _y;
> GIMPLE_NOP
> __builtin_xyz(_x);
>
> But as per my understanding, a NOTE instruction behaves similar to
> GIMPLE_NOP that is to create a placeholder for some computation.
>
>
> 1. Is there any attribute that can be added to GIMPLE instruction? If yes,
> then there must be a mechanism that translates those attributes to NOTE
> instructions in the RTL pass?

There is no machinery to add attributes or notes to GIMPLE statements.
The existing information pieces that would qualify as those are instead
embedded directly into the corresponding data structures.

> 2. Is there any different approach on achieving above goal?

From your description it isn't clear whether the information you want to
put into the NOTE is recoverable at RTL expansion time.  Trying to
second-guess it's an equivalency of the constant (at RTL expansion time)
_x to something else which is still available in a register?

>
> Thanks and Regards,
> Shubham

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

end of thread, other threads:[~2022-02-07  9:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-06 19:40 Query regarding generating NOTE instruction at GIMPLE level Shubham Narlawar
2022-02-07  9:17 ` Richard Biener

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).