public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mark Mitchell <mark@codesourcery.com>
To: Derrick Coetzee <dc@moonflare.com>
Cc: gcc@gcc.gnu.org
Subject: Re: On strategies for function call instrumentation
Date: Tue, 24 Nov 2009 16:08:00 -0000	[thread overview]
Message-ID: <4B0C04EB.4040809@codesourcery.com> (raw)
In-Reply-To: <bff535ec0911231944i450bacckedb3c5a317e1fdb9@mail.gmail.com>

Derrick Coetzee wrote:

> 1. We have a C/C++ source-to-source translation framework. We could
> translate each function call "f(a,b,c)" to something like "({ _asm {
> ... }; typeof(f(a,b,c)) result = f(a,b,c); _asm { ... }; result; })"
> 2. We could modify the code generation of gcc in a private fork.

I think you will need to do (2).  The source-to-source approach probably
isn't robust enough for what you need to do.  You *might* be able to do
it if you pull all calls out of the arguments, but then you have to do
things like:

  f(g()) -> temp = g(), f(temp)

before you put in your asm, and if you're in C++ land, you're now
doomed, since creating named temporaries can change the semantics of
programs.

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713

  reply	other threads:[~2009-11-24 16:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-24  3:44 Derrick Coetzee
2009-11-24 16:08 ` Mark Mitchell [this message]
2009-11-24 16:38   ` Basile STARYNKEVITCH
2009-11-24 16:56     ` Yuri Kashnikoff
2009-11-25  0:29 Grigori Fursin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B0C04EB.4040809@codesourcery.com \
    --to=mark@codesourcery.com \
    --cc=dc@moonflare.com \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).