Commit f1794b62 authored by Taddeus Kroes's avatar Taddeus Kroes

Merge branch 'master' of github.com:taddeus/peephole

parents cbd8597b 7b0de9af
...@@ -106,14 +106,15 @@ implementation is a slightly less fancy, but easier to implement. ...@@ -106,14 +106,15 @@ implementation is a slightly less fancy, but easier to implement.
We search from the end of the block up for instructions that are eligible for We search from the end of the block up for instructions that are eligible for
CSE. If we find one, we check further up in the code for the same instruction, CSE. If we find one, we check further up in the code for the same instruction,
and add that to a temporary storage list. This is done until the beginning of and add that to a temporary storage list. This is done until the beginning of
the block or until one of the arguments of this expression is assigned. Now all the block or until one of the arguments of this expression is assigned.
occurrences of this expression can be replaced by a move of a new variable that
is generated above the first occurrence, which contains the value of the
expression.
This is a less efficient method, but because the basic blocks are in general We now add the instruction above the first use, and write the result in a new
not very large and the execution time of the optimizer is not a primary variable. Then all occurrences of this expression can be replaced by a move of
concern, this is not a big problem. from new variable into the original destination variable of the instruction.
This is a less efficient method then the dag, but because the basic blocks are
in general not very large and the execution time of the optimizer is not a
primary concern, this is not a big problem.
\section{Implementation} \section{Implementation}
...@@ -201,7 +202,7 @@ $Lx: ... ...@@ -201,7 +202,7 @@ $Lx: ...
j $Ly -> $Lx: ... j $Ly -> $Lx: ...
$Lx: ... $Lx: ...
\end{verbatim} \end{verbatim}
\textbf{Simple basic block optimizations} \textbf{Standard basic block optimizations}
\begin{verbatim} \begin{verbatim}
mov $regA,$regA -> --- // remove it mov $regA,$regA -> --- // remove it
......
...@@ -91,3 +91,10 @@ def fold_constants(block): ...@@ -91,3 +91,10 @@ def fold_constants(block):
#else: #else:
return False return False
def copy_propagtion(block):
"""
Rename values that were copied to there original, so the copy statement
might be useless, allowing it to be removed by dead code elimination.
"""
return false
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment