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 > Compilers > Re: Generating ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 4 Topic 2348 of 2508
Post > Topic >>

Re: Generating Static Single Assignment ?

by "=?ISO-8859-1?Q?Roland_Lei=DFa?=" <roland.leissa@[EMAIL PROTECTED] > Mar 2, 2008 at 04:01 AM

Hi,

> Hi, I am currently building my first compiler through the help of a
> few books. So far I have my grammar and most of the front-end ready,
> up to the AST.

I am currently building my own compiler as a fun project, too. Perhaps
you want to take a look:
http://swiftc.berlios.de/

My front-end and middle-end is more or less ready. I am working at the
register allocation at the moment.

> Next step is to convert to intermediate code. What I am not sure
> about is whether to generate Three Address Code, or SSA. Most books
> introduce triples and quadruples, and then talk about SSA later on,
> stating that it can be used for many optimization/transformation
> techniques and is preferred over 3ac/etc.

First of all you must know that SSA form does not mean, that your
instructions do not have a form like this:
a = b + c
In SSA form it is just im****tant that 'a' is only defined once.

Here some reading related to SSA form:
http://grothoff.org/christian/teaching/2007/3353/papers/ssa.pdf
http://www.hipersoft.rice.edu/grads/publications/dom14.pdf

I would advise you building SSA form.

> Can I generate SSA immediately from the AST?

I am doing it like this:
First I am building intermediate code where not all vars have SSA
property. Building this is pretty straightforward. For every var
stored in the middle-end I store a var nr. Negative values mean, that
these vars are defined at least once. Positive values mean, that these
vars are defined exactly once. The latter can be the case for instance
when tem****ary vars have to be created as my instructions are three
address code. Vars with the same var nr correspond to the same var.
Then the algorithms in the above papers transform my intermediate code
to real SSA form. This is the "most directly" way I found for doing
his. However depending on your language you can even directly generate
SSA form. This is the case for a Lisp/Scheme like language. But AFAIK
this is not the case for most languages.

Greetz,
R. Lei_a
 




 4 Posts in Topic:
Generating Static Single Assignment ?
kphillips <kevin.phill  2008-02-29 00:34:37 
Re: Generating Static Single Assignment ?
Richard Pennington <ri  2008-03-01 13:14:00 
Re: Generating Static Single Assignment ?
"=?ISO-8859-1?Q?Rola  2008-03-02 04:01:05 
Re: Generating Static Single Assignment ?
parthaspanda22@[EMAIL PRO  2008-03-03 09:14:25 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Sun Sep 7 6:57:18 CDT 2008.