On 6/9/06, Sebastian Pop <[EMAIL PROTECTED]> wrote:
Steven Bosscher wrote:
> 2. Probably GIMPLE, but you can't express all of GIMPLE in ANSI C
> (with GCC extensions you can probably express most of it though).
Theoretically you can express all of GIMPLE in ANSI C,
practically it would require some engineering,
pragmatically it is worthless for GCC.
One imagines that one would construct a virtual machine architecture framework
and then write a back-end that would generate "machine code" for that virtual
machine, which would be a subset of ANSI C. Hey-presto, you then have a
butt-ugly anything-to-ANSI-C translator, that (whoops) loses any
back-end-specific
optimizations.
By framework I mean something like a C prelude that would declare all the
registers and define all the ops.
How could writing to C possibly be more complex, rather than less complex, than
writing to an actual machine code set?
Pragmatically, the exercise could be re-used to generate byte-code for other
virtual machines, such as javaVM or Parrot, or as a generic starting
point for writing
back-ends for new architectures.
--
David L Nicol, who has had plenty of coffee this afternoon