This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: building a basic global function call
Thanks, I have it working now. Turns out the compiler was optimizing
out my function call. Thanks for the info as I'm sure it will prove
very useful.
On Tuesday 17 February 2004 4:49 pm, Jim Wilson wrote:
> Adam Treat wrote:
> > This builds just fine, but the resultant exec does not contain
> > the function call? What am I missing?
>
> You need to build a tree to represent the function call, and you
> need to add it to the chain of trees that represent the current
> function. Perhaps you are missing the second step. It is also
> possible that the call is getting optimized away for some reason.
> Use -da, and look at the rtl dumps, to see if the call is present
> in the first one.
>
> There is a magic variable last_tree that represents that end of the
> current function, and you can add the call by appending it to
> last_tree. See the add_tree function, and also RECHAIN_STMTS.
>
> It may also be useful to dump out the tree nodes to see what you
> have. Gcc is historically not very good at this, but there is a
> -fdump-translation-unit option that might be useful here.