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. I put my pass just before the "NEXT_PASS (pass_final);" in init_optimization_passes function. So I think that asm instructions are almost ready when my pass starts its work. This pass is already inserted into the gcc code and can be started. The gcc is compiled. And I can see my debug stuff in especially generated file when the gcc works. Actually I have no useful code yet, but I just want to get some information for starting the developing. For the beginning I want to do something like this: for (insn = get_insns() ; insn ; insn = NEXT_INSN(insn)) { int code = ...; //I need help in this line!!! myDebugOutputShowCode(++i, code); } I.e. I just want to see the whole list of code of instructions. Like assembler listing. Can you help me and give some advices how to do it? I had a look at some *.md files in gcc sources, but did not found any source of codes of assembler instructions. How does the gcc generates the binary file? Where can it get the binary representation of asm instruction? Where is it described that "nop" is "0F 1F" value for x86 architecture and so on? Thanks for any help.