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: how to get instruction codes in gcc passes?


On Sun, 2010-06-13 at 18:29 +0400, Ilya K wrote:
> Hi all.
> (I have never used these maillists before. Sorry if something wrong here.)
> 
> I am newbie in gcc and I need some help.
> 
> I am performing some research work in theme of code optimization.
> Now I have to write my own optimization pass for gcc. And in this pass
> I need to get the instruction codes of the resulting assemble code.


Why do you want to optimize the generated assembly code? AFAIK, all
optimization passes in GCC work on some intermediate representation
which is not the assembly code, and many of them work on Gimple.

What is so special for your optimization to require working at the
assembly code level specifically?

There are several good reasons to prefer optimizing in the middle end
(e.g. power of the Gimple representation, target machine
independence, ...).

BTW, you might consider using MELT http://gcc.gnu.org/wiki/MELT to code
your optimization, especially if it can be expressed at the Gimple
level.


> Where is it described that "nop" is "0F 1F" value for x86 architecture
> and so on?

This is not described in GCC. GCC emit textual assembly code. The
assembler (that is binutils, not GCC) know that nop is 0f 1f.

Cheers.

PS. I might have some details wrong; I am not very familiar with GCC
back-ends & RTL passes.

-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***



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