Page 2 of 2

Re: Assembler for an abstract machine

Posted: Thu Apr 22, 2010 11:24 am
by Thomas
Hobbes wrote:Gravaera, Solar,
I don't know much about code optimization, but isn't this true for every Intermediate Language? It doesn't need to have an assembly-like syntax, or am I missing something?
Yes you are right Hobbes.That's the case with most of the popular commercial implementations.MSIL supports constructs like allocating memory,declaring a class etc which is not that low level ,I am in the middle of reading a book on the internals of Java VM,I shall post more about that after sometime :). However both of them are stack based :) .They are close to some extent but not as close as you would expect :)
--Thomas

Re: Assembler for an abstract machine

Posted: Thu Apr 22, 2010 11:45 am
by Owen
Solar wrote:gravaera more or less named it.

The compiler already did the bulk work of parsing the high-level language (using one of multiple frontends), as well as the brunt of the optimizing work. Unreachable code has been eliminated, return value optimizations have been done, all the stuff that takes up clock cycles.

The loader / translater only has to map the virtual registers to physical / memory, and translate the virtual opcodes to native ones - simple lookup work, which can be done with reasonable efficiency even on low-on-horsepower embedded systems.
Most LLVM compilers don't have optimizers. They leave it all up to LLVM: After all, bticode makes both a good cross platform "assembly" language and an excellent intermediate language for optimization, and LLVM has very effective optimizers (For example: Clang regularly trades places with GCC performance wise, and uses LLVM's optimizers for all optimizations).

But bitcode is as close to a cross platform assembly as you get

Re: Assembler for an abstract machine

Posted: Thu Apr 22, 2010 12:03 pm
by Solar
What I said about Tao's VP technology (most of the optimization done AOT) was straight from what I remembered from the presentations they gave and the AmigaDE SDK documentation.

I can't judge on the validity of their claims, or the concept as a whole, and I won't.

Re: Assembler for an abstract machine

Posted: Thu Apr 22, 2010 12:11 pm
by qw
All right, what I make of all of this is that LLVM is a way to produce code that is optimized before it is translated to a certain platform. That makes sense, though I am curious how it performs in practice.

Re: Assembler for an abstract machine

Posted: Thu Apr 22, 2010 12:48 pm
by Owen
Hobbes wrote:All right, what I make of all of this is that LLVM is a way to produce code that is optimized before it is translated to a certain platform. That makes sense, though I am curious how it performs in practice.
Very well. And note that the target specific optimizations are implemented - in the target backend ;)

Also, most compilers do their optimizations on a nonspecific IR. For example, GCC does it on GIMPLE