tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Adding asm examples



On Tue, Nov 15, 2011 at 03:32:45AM +0000, Valeriy E. Ushakov wrote:
 > >> I'm not convinced that reading compiler output is a good way to get
 > >> started on anything.
 > 
 > I'm not referring to random compiler output.  I'm referring to
 > compiler output of small programs that demonstrate some specific
 > scenarios, like a function call, a structure member access, etc.  E.g.
 > 
 >   extern void bar(int, int, int);
 >   void foo() { bar(1, 2, 3); }

Even so. I don;t know PPC asm, but I know that with mips there are a
number of nonobvious things that can be explained properly (and thus
become much clearer) with a worked example.

Admittedly I don't see any of that in the example that's been
committed.

Also, compilers often do crazy things and the output is often very
unclear. This is particularly noticeable with intel where the compiler
will do things like use LEA for mukltiplication, but it's true
elsewhere as well.

(And it's much, much worse with compilers that compile to higher-level
languages than assembler. Imagine trying to learn C from cfront
output.)

 > The mail that started the thread presupposes a book, which should
 > already provide enough background to read compiler output for such
 > test programs.  All books on assembler will cover calling conventions
 > &c anyway and psABI is not that hard to read either.

Um. I must have missed that part too. (That makes me what, 0 for 3 in
this?)

If you have a book, what's the point? I thought the idea was to
provide worked examples for developers who don't know the
architecture, don't have the books, but find themselves needing to
adjust MD bits regardless. *That* would be useful.

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index