Xref: utzoo unix-pc.general:6991 comp.sys.att:11314 alt.sources.wanted:755 comp.sources.wanted:14638 comp.lang.c:34937 Path: utzoo!utgpu!cs.utexas.edu!sun-barr!newstop!male!texsun!vector!egsner!mic!ernest!shibaya!afc From: afc@shibaya.lonestar.org (Augustine Cano) Newsgroups: unix-pc.general,comp.sys.att,alt.sources.wanted,comp.sources.wanted,comp.lang.c Subject: What assembler code is generated by C instruction X? Message-ID: <1990Dec28.220115.15930@shibaya.lonestar.org> Date: 28 Dec 90 22:01:15 GMT Sender: afc@shibaya.lonestar.org (Augustine Cano) Organization: Multidisciplinary Designs Unlimited Lines: 38 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@shibaya.lonestar.org UUCP: ...!{ernest,egsner}!shibaya!afc