a2782@dis.ulpgc.es wrote:
But I think it should be a formal document with this step. I mean, when somebody implements a compiler, he/she must follow several steps: lex, parsing, generation of symbol table and object code generation.
Indeed. GPC does the former three and the backend (which is part of the `gpc' exectuable, but not of the sources we commonly refer to as GPC) does the latter.
Well, I search for a scheme with the correspondencies between the structures being parsed and the code generated.
E.g.:
program: program id other body; --> initialize memory
body: begin instructions end ';' --> generate instructions 'enter', 'leave'
...
I'm not interested in sources of GPC, because GPC is designed as a front-end, and I search for the back-end...
In practice, it's not quite as simple. E.g., the procedure enter/exit instructions may depend on the formal parameters, on the optimization options, of course, and inline routines don't have them at all.
Roughly, what you're looking for is in the machine descriptions files below gcc/config/. However, it's probably not in a form you imagine -- it's written in a kind of Lisp, and it builds upon an internal representation (RTX), which is already quite different from the Pascal source.
For more detailed questions, you might want to ask the GCC list where the backend is maintained.
Frank