public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Generate annotations for a binary translator
@ 2011-05-12  9:44 陳韋任
  2011-05-13  0:21 ` Ian Lance Taylor
  0 siblings, 1 reply; 4+ messages in thread
From: 陳韋任 @ 2011-05-12  9:44 UTC (permalink / raw)
  To: gcc-help

Hi, all

  I am wondering if there is any possibility that gcc can
generate annotations like control flow, or register usage
into the executable. The idea comes from the paper below,

  Techniques to improve dynamic binary optimization
  http://www-users.cs.umn.edu/~adas/adas-thesis-embed.pdf

The paper lists annotations that may benefit a binary translator
on chapter 5. For example, basic block register usage (live-ins
ans live-outs) lets binary translators know which register
can be used for optimizing. And control flow information can be
used by the binary translator to identify a loop.

  I am not familar with gcc, so any sugguestion is apprecidated.
Thanks!

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667

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

* Re: Generate annotations for a binary translator
  2011-05-12  9:44 Generate annotations for a binary translator 陳韋任
@ 2011-05-13  0:21 ` Ian Lance Taylor
  2011-05-13  3:35   ` 陳韋任
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Lance Taylor @ 2011-05-13  0:21 UTC (permalink / raw)
  To: 陳韋任; +Cc: gcc-help

陳韋任 <chenwj@iis.sinica.edu.tw> writes:

>   I am wondering if there is any possibility that gcc can
> generate annotations like control flow, or register usage
> into the executable. The idea comes from the paper below,
>
>   Techniques to improve dynamic binary optimization
>   http://www-users.cs.umn.edu/~adas/adas-thesis-embed.pdf
>
> The paper lists annotations that may benefit a binary translator
> on chapter 5. For example, basic block register usage (live-ins
> ans live-outs) lets binary translators know which register
> can be used for optimizing. And control flow information can be
> used by the binary translator to identify a loop.

I'm not sure exactly what you are asking.  gcc does not generate these
kinds of annotations today.  It is possible for it to generate them in
the future, if there is some way to make use of them.

Ian

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

* Re: Generate annotations for a binary translator
  2011-05-13  0:21 ` Ian Lance Taylor
@ 2011-05-13  3:35   ` 陳韋任
  2011-05-13  5:00     ` Ian Lance Taylor
  0 siblings, 1 reply; 4+ messages in thread
From: 陳韋任 @ 2011-05-13  3:35 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help

Hi, Ian

> I'm not sure exactly what you are asking.  gcc does not generate these
> kinds of annotations today.  It is possible for it to generate them in
> the future, if there is some way to make use of them.

  I assume you know a liitle bit about what a binary translator does, or
you can think what it does is like QEMU.

  Take basic block (bb) register usage as an example. It good to a binary
translator to know that a basic block register usage information. Say, bb
A whose binary address starts from 0x100 to 0x120 does NOT use R1, then
the binary translator can use R1 for free.

  I know there is a data structure for basic block. But in order to let
a binary translator use the basic block register usage information, each
basic block must be associated with its corresponding binary (virtual)
address.

  If it is possible to generating such information, which part of gcc
should I look into first?

  Thanks! 

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667

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

* Re: Generate annotations for a binary translator
  2011-05-13  3:35   ` 陳韋任
@ 2011-05-13  5:00     ` Ian Lance Taylor
  0 siblings, 0 replies; 4+ messages in thread
From: Ian Lance Taylor @ 2011-05-13  5:00 UTC (permalink / raw)
  To: 陳韋任; +Cc: gcc-help

陳韋任 <chenwj@iis.sinica.edu.tw> writes:

>   Take basic block (bb) register usage as an example. It good to a binary
> translator to know that a basic block register usage information. Say, bb
> A whose binary address starts from 0x100 to 0x120 does NOT use R1, then
> the binary translator can use R1 for free.
>
>   I know there is a data structure for basic block. But in order to let
> a binary translator use the basic block register usage information, each
> basic block must be associated with its corresponding binary (virtual)
> address.
>
>   If it is possible to generating such information, which part of gcc
> should I look into first?

I don't know how you plan to emit this information.  However, the
general approach given the current compiler would be to walk the basic
blocks just before or after the variable tracking pass (var-tracking.c)
and emit the information you want.  My first guess would be that you
would want to have final.c emit basic block labels, and refer to those
labels in the information you generate.

Ian

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

end of thread, other threads:[~2011-05-13  5:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-12  9:44 Generate annotations for a binary translator 陳韋任
2011-05-13  0:21 ` Ian Lance Taylor
2011-05-13  3:35   ` 陳韋任
2011-05-13  5:00     ` Ian Lance Taylor

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