Re: Some clarification on "Pre-Parsers" and other bits



santosh wrote:
f0dder wrote:
zcoder wrote:
To ME C is a parser, it parses the C language into assembly text
which is then feed to a assembler.

GNU GCC does this, and a few others as well. Afaik most decent
compilers don't, they tend to perform their operations on the
pcode/AST, and then convert this directly to machine code instead of
going through AST->ascii assembly mnemonics->machine code. An asm
listing is just a different backend from the machine code backend.

At least I've seen no indication that MS Visual C++ (version 6.0 and
onwards) do a silly intermediate ascii-asm step.

I confess I don't know much with regard to language translators, their
theory and implementation. But why do you feel that it is "silly" to
go through an intermediate assembler step? Is it merely a matter of
loss of speed or does it affect the amount of optimisation the
compiler can perform?

A loss of speed as well as unncessary step. To do decent optimizations, the
compiler will work on an abstract representation of the source program
anyway for a decent amount of it's (processor-independent) optimizations.
Then there's the processor specific optimizations and register allocation
etc. And finally the machine code is generated - either directly, or with
asm intermediate.

I guess the justification for asm intermediate is that "we can then use a
single assembler to output multiple diffent object formats" and requiring
somewhat less code in the compiler. And "processors and harddrives are so
fast these days that the indirection doesn't matter, and we can even pipe
the assembly output to GAS without going through a disk file". *shrug*.


.



Relevant Pages

  • Re: Migrating ARM9E codebase to ARM11
    ... > optimizations done using hand-coding, only the control code is left to ... You should then consider upgrading to a newer compiler. ... wish to target might be faster than the assembler optimised for the 9E. ... I do not believe that the ARM ARM for architecture version 6 has been ...
    (comp.sys.arm)
  • Re: Interesting article by Randall Hyde
    ... > assembler is that the assembler should generate _exactly_ what I ... any assembler that did optimizations would have to offer you ... But advanced programmers should be able to take advantage of compiler ... As a RL programmer I expect no such thing. ...
    (comp.lang.asm.x86)
  • Re: What micros do you actually hate to work with?
    ... the compiler was pretty good to start with. ... level optimizations and fine tuning every bit of the compiler. ... emitting fewer instructions in the end. ... as assembler written by an expert. ...
    (comp.arch.embedded)
  • Re: Some clarification on "Pre-Parsers" and other bits
    ... which is then feed to a assembler. ... To do decent optimizations, the ... compiler will work on an abstract representation of the source program ... anyway for a decent amount of it's optimizations. ...
    (alt.lang.asm)
  • Re: What micros do you actually hate to work with?
    ... with less than tiny asm ... hassle to work with 32 bit longs in assembler for an 8 bit uP, ... Microchip's C compiler tools and their assembly under MPLAB. ... is that other programmers for C are easier to find. ...
    (comp.arch.embedded)