Re: What is a restructuring compiler?

Silvius Rus <silviusr@yahoo.com>
30 Oct 2004 22:45:46 -0400

          From comp.compilers

Related articles
What is a restructuring compiler? hzmonte@hotmail.com (2004-10-21)
Re: What is a restructuring compiler? nmm1@cus.cam.ac.uk (2004-10-23)
Re: What is a restructuring compiler? hzmonte@hotmail.com (2004-10-25)
Re: What is a restructuring compiler? nmm1@cus.cam.ac.uk (2004-10-30)
Re: What is a restructuring compiler? silviusr@yahoo.com (Silvius Rus) (2004-10-30)
Re: What is a restructuring compiler? pohjalai@cc.helsinki.fi (A Pietu Pohjalainen) (2004-10-30)
Re: What is a restructuring compiler? news1@oregonw.com (M Wolfe) (2004-11-29)
| List of all articles for this month |

From: Silvius Rus <silviusr@yahoo.com>
Newsgroups: comp.compilers
Date: 30 Oct 2004 22:45:46 -0400
Organization: Posted via Supernews, http://www.supernews.com
References: 04-10-143 04-10-164 04-10-178
Keywords: optimize
Posted-Date: 30 Oct 2004 22:45:46 EDT

hzmonte wrote:
> [...] why would there exist a restructuring compiler by itself?
> [Actually, there are. They rewrite programs to make them more amenable
> to other kinds of optimization. -John]




Hello hzmonte,


I would agree with John on this. For instance, you can imagine a
transformation that restructures a program so that the result has a
particular type of control. This lets you and others design or/and
use simpler and stronger analysis techniques based on this assumption.


If the Control Dependence Graph of your restructured program is always
acyclic (self-loops allowed), you are already in much better shape
than having to deal with a general graph. And I mean both you as a
compiler writer and you as a programmer -- since you can now rewrite
the code hierarchically even if it was originally written as a
mile-long sausage.


I use restructuring as a separate precompilation phase to unify
several syntactically different -- though semantically equivalent --
Abstract Syntax Tree constructs. There are many different ways a
programmer can mean the same thing, while the compiler writer wants to
write a single transformation for any one given purpose. If you do
not restructure/unify, you may end up rewriting the transformation for
each case.


After all, I think the first C++ compilers worked by lowering it to C.
You can also view this as restructuring the code to a subset of C++
that is understood by C compilers. So you get a restructuring C++
compiler. The restructured code can be compiled by various C
compilers, while the original cannot.


Regards,
Silvius


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.