public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Best way to create rtl code
@ 2004-03-26  2:01 Jared Buttles
  2004-03-30  9:48 ` Jim Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: Jared Buttles @ 2004-03-26  2:01 UTC (permalink / raw)
  To: gcc

I'm looking to create and add some rtl code to the insns list, but I 
want to do it with as little intrusion as possible into the gcc source. 
Hopefully someone can tell me what the preferred way to do this might 
be, I really only see two ways:

1. Direct creation of the rtl statements added to the insns stream for 
each function
2. Creation of a small tree that represents the code I want to insert, 
use the provided functions to convert the statements therein to rtl and 
then insert them in the insns stream

Next, where is the best place to do this? I'd like to do it after 
inlining has been performed, if possible.

Are there any documents available that actually describe the how and 
why the code executes when creating rtl or is knowledge obtained mainly 
by reading the code and mailing list archives?

Jared Buttles


- Jared Buttles

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

* Re: Best way to create rtl code
  2004-03-26  2:01 Best way to create rtl code Jared Buttles
@ 2004-03-30  9:48 ` Jim Wilson
  2004-03-31 14:36   ` Jared Buttles
  0 siblings, 1 reply; 3+ messages in thread
From: Jim Wilson @ 2004-03-30  9:48 UTC (permalink / raw)
  To: Jared Buttles; +Cc: gcc

Jared Buttles wrote:
> I'm looking to create and add some rtl code to the insns list, but I 
> want to do it with as little intrusion as possible into the gcc source. 
> Hopefully someone can tell me what the preferred way to do this might 
> be, I really only see two ways:

It depends a great deal on what you are trying to do.  There are a great 
many ways to do this, and they are all preferred for some applications. 
  E.g. adding code to instrument functions is done in a different place 
than adding code to instrument branches.

> 1. Direct creation of the rtl statements added to the insns stream for 
> each function
> 2. Creation of a small tree that represents the code I want to insert, 
> use the provided functions to convert the statements therein to rtl and 
> then insert them in the insns stream

Generating trees will be awkward, and may conflict with the tree-ssa 
code that is expected to be merged in soon, which adds a new IL in 
between the tree and RTL ILs.

> Next, where is the best place to do this? I'd like to do it after 
> inlining has been performed, if possible.

This depends a great deal on what you are trying to do.

We currently have two inlining passes, one that operates on trees, and 
one that operates on RTL.  The one that operates on RTL may go away in 
the future.  Not all language front-ends support the tree inliner yet. 
If after the tree inliner is OK, then you could add rtl anytime during 
or after rtl generation.  If it has to be after hte RTL inliner, then 
you would have to look at the list of optimization passes, and add the 
new code sometime after the RTL inliner optimization pass.

> Are there any documents available that actually describe the how and why 
> the code executes when creating rtl or is knowledge obtained mainly by 
> reading the code and mailing list archives?

Try looking at the gcc/doc/passes.texi file which gives an overview of 
how things work.  This may be a bit out of date though.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com

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

* Re: Best way to create rtl code
  2004-03-30  9:48 ` Jim Wilson
@ 2004-03-31 14:36   ` Jared Buttles
  0 siblings, 0 replies; 3+ messages in thread
From: Jared Buttles @ 2004-03-31 14:36 UTC (permalink / raw)
  To: Jim Wilson; +Cc: gcc


On Mar 29, 2004, at 9:17 PM, Jim Wilson wrote:

>> Next, where is the best place to do this? I'd like to do it after 
>> inlining has been performed, if possible.
>
> This depends a great deal on what you are trying to do.
>
> We currently have two inlining passes, one that operates on trees, and 
> one that operates on RTL.  The one that operates on RTL may go away in 
> the future.  Not all language front-ends support the tree inliner yet. 
> If after the tree inliner is OK, then you could add rtl anytime during 
> or after rtl generation.  If it has to be after hte RTL inliner, then 
> you would have to look at the list of optimization passes, and add the 
> new code sometime after the RTL inliner optimization pass.

Thank you for your replies, I was able to get it working quite well.

Jared Buttles
-------------------------------------------
Research Associate, Cylant Inc.
www.cylant.com

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

end of thread, other threads:[~2004-03-31 12:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-26  2:01 Best way to create rtl code Jared Buttles
2004-03-30  9:48 ` Jim Wilson
2004-03-31 14:36   ` Jared Buttles

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