Skip to content
Snippets Groups Projects
Commit 31e9202c authored by Richard Torenvliet's avatar Richard Torenvliet
Browse files

worked on report constant folding part

parent 9525cbe1
No related branches found
No related tags found
No related merge requests found
...@@ -126,9 +126,10 @@ calculated at compile time. If a value x is assigned to a certain value, lets ...@@ -126,9 +126,10 @@ calculated at compile time. If a value x is assigned to a certain value, lets
say 10, than all next occurences of \texttt{x} are replaced by 10 until a say 10, than all next occurences of \texttt{x} are replaced by 10 until a
redefinition of x. Arithmetics in Assembly are always performed between two redefinition of x. Arithmetics in Assembly are always performed between two
variables or a variable and a constant. If this is not the case the calculation variables or a variable and a constant. If this is not the case the calculation
is not possible. See the example for a more clear explanation of constant is not possible. See \ref{opt} for an example. In other words until the current
folding(will come). In other words until the current definition of \texttt{x} definition of \texttt{x} becomes dead. Therefore reaching definitions analysis is
becomes dead. Therefore reaching definitions analysis is needed. needed. Reaching definitions is a form of liveness analysis, we use the liveness
analysis within a block and not between blocks.
\subsubsection*{Copy propagation} \subsubsection*{Copy propagation}
...@@ -305,7 +306,13 @@ addu $regC, $regB, 4 move $regC, $regD ...@@ -305,7 +306,13 @@ addu $regC, $regB, 4 move $regC, $regD
# Constant folding # Constant folding
li $regA, constA ""
sw $regA, 16($fp) ""
li $regA, constB -> ""
sw $regA, 20($fp) ""
lw $regA, 16($fp) ""
lw $regB, 20($fp) ""
addu $regA, $regA, $regA $li regA, (constA + constB) at compile time
# Copy propagation # Copy propagation
move $regA, $regB move $regA, $regB move $regA, $regB move $regA, $regB
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment