What assembler code is generated by C instruction X?

Augustine Cano afc at shibaya.lonestar.org
Sat Dec 29 09:01:15 AEST 1990


Hello net.land:

I need to find out what assembler code is generated by compilers/optimizers.
The first thing that comes to mind is: compile x programs and look at the
assembler output.  This is highly inefficient for various reasons: much of
the code would be duplicated (who needs to wade through the assembler
generated by passing a parameter by reference 200 times?), a real program
converts to possibly thousands of lines of assembler and some C instructions/
constructs will most likely be missing.

The next thing that comes to mind is a bare bones program whose whole purpose
is to use each C instruction/construct once, with function and/or variable
names such that the particular item can be quickly located in the (many)
lines of assembler generated.  This would make it relatively easy to
connect assembly code with the C instruction that generated it, for any
compiler/cpu type, without extraneous garbage in the way.

Has anybody seen something like this?  I'd rather not duplicate effort if
someone has even parts of this.  Taking care of every case of indirection,
double indirection, types, sizes etc... is likely to be not a trivial
undertaking.

Such a program could be the "training" part for a universal de-compiler.
Once the assembler output of a specific compiler/cpu type has been generated
from this program, the de-compiler could then re-generate the original
C source (within limits).  Part 2 would obviously be more difficult to
implement and I suspect such a thing only exists now for specific cpu
types (and for significant $s too).  In any case I'm only interested in the
"training" part now.

Any code, suggestions, references, etc... are welcome.   BTW, compiler
textbooks are too general and incomplete for my needs.

Thanks.

-- 
Augustine Cano		INTERNET: afc at shibaya.lonestar.org
			UUCP:     ...!{ernest,egsner}!shibaya!afc



More information about the Comp.lang.c mailing list