Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Languages Misc > Re: issue: RPN,...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 9 of 9 Topic 1113 of 1245
Post > Topic >>

Re: issue: RPN, TAC+SSA, and x86-style ASM

by "cr88192" <cr88192@[EMAIL PROTECTED] > Feb 26, 2008 at 10:46 AM

<robertwessel2@[EMAIL PROTECTED]
> wrote in message 
news:558037f6-299d-462b-9930-86e29c6f73f4@[EMAIL PROTECTED]
>

>
> The front-end/back-end split is usually such that there are no
> lexical, syntactic or semantic issues left for the back end to deal
> with.  Almost universally it's considered a good idea to begin code
> generation with no ambiguities left in the source (obviously excluding
> anything that's defined to be ambiguous until runtime).  If you've got
> a significant amount of that sort of stuff left in your back end, you
> may want to consider getting that moved up first.
>

there are no lexical or syntactic issues.
but, however, it does handle most of the semantics.

the reason is that I had started out with an abstract stack machine 
(basically, vaguely PostScript style, where we have a stack and operations

that work on pretty much anything they are given), and during development,

ever more things were done as the codegen became more developed.

now, the thing is very complicated...


the idea is then to split this level up, so that the lower level deals 
almost purely with architectural issues (register allocation and
operations, 
....), and the RPNIL compiler becomes more the "middle end" rather than
the 
"lower end".

so, the upper compiler:
does preprocessing and parsing;
does a some amount of AST level operations (folding constant expressions, 
eliminating dead branches, ...);
converts ASTs into a more or less stack-based representation.

the 'RPNIL' compiler:
deals with said abstract stack-based computational model;
decomposes complex types and operations into basic architectural types
(raw 
pointers, memory, and register operations);
also handles things like type conversions, function calls, the type tower,

operator overloading, and inlining;
....

the 'VRM' layer:
does things like register allocation, figures out good ways to perform 
register/memory and memory/memory operations;
emits assembler.

assembler and so on: ...



partly all this is because, originally, my compiler mutated out of an 
interpreter for a dynamically typed scripting language of mine.

as such, everything RPNIL or lower, was originally handled in what was 
originally the interpreter or JIT compiler (the major change was that of 
going over to using a textual representation rather than raw bytecode, 
originally due to issues that would have been involved trying to hack the 
two layers together at the bytecode level due to representational 
differences, it was much easier just to dump the output into a textual 
buffer and re-parse in terms of the RPNIL compiler's bytecode...).

the upper compiler was originally a severely hacked-over version of the 
script language's upper compiler (and, thus, operates at a similar level
of 
abstraction, which may not be perfectly well suited to a language like C, 
but oh well...).

later on, this upper compiler was rewritten to use DOM trees instead of 
S-Expressions (and be, in general, a little less hackish), but otherwise 
does not do much differently than before.


or such...
 




 9 Posts in Topic:
issue: RPN, TAC+SSA, and x86-style ASM
"cr88192" <c  2008-02-23 20:08:55 
Re: issue: RPN, TAC+SSA, and x86-style ASM
"Rod Pemberton"  2008-02-23 06:53:30 
Re: issue: RPN, TAC+SSA, and x86-style ASM
"cr88192" <c  2008-02-23 22:55:32 
Re: issue: RPN, TAC+SSA, and x86-style ASM
Reinder Verlinde <rein  2008-02-23 17:35:17 
Re: issue: RPN, TAC+SSA, and x86-style ASM
"cr88192" <c  2008-02-24 07:15:19 
Re: issue: RPN, TAC+SSA, and x86-style ASM
Phil Carmody <thefatph  2008-02-24 14:09:15 
Re: issue: RPN, TAC+SSA, and x86-style ASM
"cr88192" <c  2008-02-25 20:27:57 
Re: issue: RPN, TAC+SSA, and x86-style ASM
"robertwessel2@[EMAI  2008-02-25 15:04:32 
Re: issue: RPN, TAC+SSA, and x86-style ASM
"cr88192" <c  2008-02-26 10:46:45 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Oct 10 13:58:05 CDT 2008.