Skip to content

Commit

Permalink
[gvn_on_cps] typos
Browse files Browse the repository at this point in the history
  • Loading branch information
raphael-proust committed Aug 24, 2012
1 parent 55f385a commit 68a59a4
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions experiments/gvn/gvn_on_cps.pdc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ of the Single Static Assignment (SSA) form to improve on Value Numbering.
Continuation Passing Style (CPS) is a special form of $\lambda$-calculus where Continuation Passing Style (CPS) is a special form of $\lambda$-calculus where
functions get a continuation argument to be used instead of returning. A functions get a continuation argument to be used instead of returning. A
translation between SSA and CPS (in both directions) is presented in \`\`A translation between SSA and CPS (in both directions) is presented in \`\`A
Correspondance Between CPS and SSA form''. Correspondence Between CPS and SSA form''.


We here present an adaptation of the GVN algorithm to CPS. We here present an adaptation of the GVN algorithm to CPS.


Expand Down Expand Up @@ -90,7 +90,7 @@ and value =
| .. | ..
\end{verbatim} \end{verbatim}


The notion of primitive operators (addition, multiplication) is purposedly The notion of primitive operators (addition, multiplication) is purportedly
left unspecified. left unspecified.


##About SSA to CPS translation ##About SSA to CPS translation
Expand Down Expand Up @@ -149,7 +149,7 @@ $\mathsf{letrec} \: \dots \: \Lambda_i \: \dots \: \mathsf{in} \: m$, where
$m$ is the translation of $b$, and $\Lambda_i$ is the translation of $b_i$. $m$ is the translation of $b$, and $\Lambda_i$ is the translation of $b_i$.
(Note that $m$ might be nested in another term, e.g. an `Mapp`.) (Note that $m$ might be nested in another term, e.g. an `Mapp`.)


Note that this correspondance between the term structure and the dominator Note that this correspondence between the term structure and the dominator
tree is not necessary for terms to be valid (with respect to scoping and tree is not necessary for terms to be valid (with respect to scoping and
well-formed-ness). We happen to preserve the dominator information during the well-formed-ness). We happen to preserve the dominator information during the
translation. translation.
Expand Down Expand Up @@ -183,7 +183,7 @@ and $max$ is implemented by another $\lambda_p$)
\end{verbatim} \end{verbatim}


The first block binds $x$, and $y$, the second binds $xx$. The binding of $z$ The first block binds $x$, and $y$, the second binds $xx$. The binding of $z$
is not part of any block's bindings per-se. is not part of any block's bindings per se.




##Notions ##Notions
Expand Down Expand Up @@ -262,7 +262,7 @@ We naturally extend $Calls$ to apply on sets. This is useful for composing
$Calls$ and $Subterms$ to get all the calls of a term. $Calls$ and $Subterms$ to get all the calls of a term.




\item[Conditional] tests wheter a term is a conditional \item[Conditional] tests whether a term is a conditional


\begin{equation} \begin{equation}
\begin{array}{l} \begin{array}{l}
Expand Down Expand Up @@ -337,7 +337,7 @@ Just as with the original GVN algorithm, the code needs to be (automatically)
modified. The two modifications that we apply are: modified. The two modifications that we apply are:


- landing lambdas insertion with virtual call annotations, and - landing lambdas insertion with virtual call annotations, and
- trivial-call uninlining. - trivial-call un-inlining.


### Landing Lambdas ### Landing Lambdas


Expand Down Expand Up @@ -568,7 +568,7 @@ VirtualCalls =
\end{equation} \end{equation}




###Trivial-call Uninlining ###Trivial-call Un-inlining


In this transformation we add a level of indirection to some calls by In this transformation we add a level of indirection to some calls by
un-inlining a trivial redirection. This allows the moving of code to the un-inlining a trivial redirection. This allows the moving of code to the
Expand Down Expand Up @@ -666,13 +666,13 @@ original algorithm). Defaulting to zero is essentially the same as not taking
##Trivial Binding Removing ##Trivial Binding Removing


Removing some trivial bindings in CPS code is easier than removing the Removing some trivial bindings in CPS code is easier than removing the
corresponding trivial assignements in SSA form. Because of the scoping rule, corresponding trivial assignments in SSA form. Because of the scoping rule,
changes are local to a term. On the other hand, the term structure is not as changes are local to a term. On the other hand, the term structure is not as
nice to work upon as a block of—temporarily unordered—assignments because it nice to work upon as a block of—temporarily unordered—assignments because it
is more rigid. is more rigid.


Thus we change the $let-in$ construct of our CPS terms. This is only intended Thus we change the $let-in$ construct of our CPS terms. This is only intended
to be used localy and does not need to be exported outside of this to be used locally and does not need to be exported outside of this
optimisation. (That is, it can be converted back to classic CPS after the optimisation. (That is, it can be converted back to classic CPS after the
optimisation is done.) optimisation is done.)


Expand Down Expand Up @@ -836,24 +836,24 @@ The last point is worth a few explanations. Consider the following SSA graph:


\begin{verbatim} \begin{verbatim}
+---------------+ +---------------+
| <assigments1> | | <assignments1> |
| <jump1> | | <jump1> |
+---------------+ +---------------+
| | | |
V V V V
+---------------+ +---------------+ +----------------+ +----------------+
| <assigments2> | | <assigments3> | | <assignments2> | | <assignments3> |
| <jump2> | | <jump3> | | <jump2> | | <jump3> |
+---------------+ +---------------+ +----------------+ +----------------+
| | | |
V V V V
+---------------+ +----------------+
| <assigments4> | | <assignments4> |
| <jump4> | | <jump4> |
+---------------+ +----------------+
\end{verbatim} \end{verbatim}


The original algorithm moves assignements from block `4` to blocks `2` and `3` The original algorithm moves assignments from block `4` to blocks `2` and `3`
(introducing the necessary $\phi$ nodes). And from blocks `2` and `3` to `1`. (introducing the necessary $\phi$ nodes). And from blocks `2` and `3` to `1`.


In CPS world, this example becomes: In CPS world, this example becomes:
Expand All @@ -876,15 +876,15 @@ letrec (
<calls1> <calls1>
\end{verbatim} \end{verbatim}


Where `<bindings>` are translations of `<assigments>` and `<calls>` Where `<bindings>` are translations of `<assignments>` and `<calls>`
translations of `<jump>`. translations of `<jump>`.


Moving some computations of `b4` into `b2` and `b3` requires the introduction Moving some computations of `b4` into `b2` and `b3` requires the introduction
of arguments to `b4` (just like $\phi$ nodes where necessary in the SSA form). of arguments to `b4` (just like $\phi$ nodes where necessary in the SSA form).
From a scope perspective, it is simpler to moves elements of `<bindings4>` From a scope perspective, it is simpler to moves elements of `<bindings4>`
into `<bindings1>`. This is what our prototype does. into `<bindings1>`. This is what our prototype does.


For this reason, our prototype does not make use of uninlined trivial calls For this reason, our prototype does not make use of un-inlined trivial calls
(CPS's equivalent of split edges). (CPS's equivalent of split edges).


It is more straight-forward than the original algorithm but fails to capture It is more straight-forward than the original algorithm but fails to capture
Expand Down

0 comments on commit 68a59a4

Please sign in to comment.