[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CPS and RTL

From: Noah Lavine
Subject: Re: CPS and RTL
Date: Thu, 24 Jan 2013 08:50:17 -0500

Hello Andy and Mark,

Thanks for the review! There has actually been more progress since I pushed that branch. I hit a point in the CPS->RTL stuff where I had trouble because I didn't know how to do things (like mutable variables) in RTL. So I've actually ported the compiler to GLIL in a branch on my computer. I also have a working Tree-IL->CPS compiler for some of Tree-IL (it's not done yet).

I thought that might be a better way forward because CPS and RTL are, to a certain extent, separate ideas. I'll push my wip-cps branch, which contains a Tree-IL->CPS compiler and a CPS->GLIL compiler. What I'm working on now is actually how to represent mutable variables in CPS. I think having explicit environment structures would be nice (and fit with Kennedy's paper), but I haven't figured out the details yet.

I realize it might be confusing to start with CPS->RTL, then switch to CPS->GLIL, then switch back later when the RTL branch is ready. If you'd rather do it that way, we can skip the CPS->GLIL phase.

Some thoughts:

* Yes, passes might be good. I had thought of writing some generic control-flow operators like 'compute-fixpoint' and then writing other things in terms of those.

* Using tree-il first sounds good to me.

* I also think that CPS should have some construct which says 'do these things in any order'. I haven't put one in yet, mostly because the compiler wouldn't take advantage of it anyway.


On Thu, Jan 24, 2013 at 5:38 AM, Nala Ginrut <address@hidden> wrote:

Are you guys going to use CSP to implement SSA for AOT?

在 2013-1-24 PM6:36,"Andy Wingo" <address@hidden>写道:


On Thu 24 Jan 2013 10:28, Mark H Weaver <address@hidden> writes:

> The problem is that CPS fixes the order in which everything is
> evaluated, such as the order in which procedure arguments are
> evaluated, the order in which 'let' or 'letrec' initializers are
> evaluated, etc.  The fact that these orders are unspecified in the
> direct-style gives the compiler freedom to choose an order that
> generates the best code, and apparently this freedom can often result
> in significant gains.  Such ordering decisions must be made before the
> conversion to CPS.

Agreed with the sentiment; however, two points:

  * we can have a CPS with let / letrec / * operators that bind a number
    of values in unspecified order, and have a pass later that fixes
    their order.

  * code motion passes like CSE depend on effects analysis, and can
    often commute some operations

Anyway, violent agreement!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]