This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Best way to create rtl code


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]