This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: function structure
- From: 王 逸 <cnnjuwy at hotmail dot com>
- To: wilson at specifixinc dot com
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 06 Jul 2004 03:54:40 +0000
- Subject: Re: function structure
- Bcc:
I did my patch in function tree_rest_of_compilation (in tree-optimize.c).
ater the statement
/* Generate the RTL for this function. */
(*lang_hooks.rtl_expand.stmt) (DECL_SAVED_TREE (fndecl));
then I traversed the current RTL unit and inserted the RTL of my function
call.
Maybe I should try to add my patch before expand_call, but I have NOT read
the relevant source,
it may be a bit difficult to me.
But I'll try, if you have any advice, please tell me.
thanks!
WangYi
From: Jim Wilson <wilson@specifixinc.com>
To: ?? ??<cnnjuwy@hotmail.com>
CC: gcc@gcc.gnu.org
Subject: Re: function structure
Date: 05 Jul 2004 16:26:21 -0700
On Wed, 2004-07-07 at 17:59, ????wrote:
> Have you heard about StackGuard?
> I'm trying to do some work similar to that,
"Similar to StackGuard" doesn't really answer my question. Where are
you inserting RTL, and why are you inserting it there?
> In RTL, I emitted a function call (using emit_lib_call()) before each
CALL_INSN in the current RTL unit.
> But I found that my function call is emitted between the parameter
evaluate instructions and the real call instruction, this ruined the
parameters to be passed to the original routine.
Yes. It isn't safe to emit instrumentation code immediate before or
after a CALL insn, if the instrumentation code itself requires a call.
I think that what you are trying to do is impractical. You need to add
the instrumentation code when RTL is generated, e.g. in expand_call,
instead of waiting until after RTL generation and doing it during one of
the RTL optimization passes. Or alternatively, add the instrumentation
code during one of the tree/gimple passes.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com
_________________________________________________________________
享用世界上最大的电子邮件系统― MSN Hotmail。 http://www.hotmail.com