Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
peephole
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
peephole
Commits
941ce4df
Commit
941ce4df
authored
Dec 28, 2011
by
Jayke Meijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Filled list of optimizations.
parent
134aea82
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
35 deletions
+48
-35
report/report.tex
report/report.tex
+48
-35
No files found.
report/report.tex
View file @
941ce4df
...
...
@@ -45,10 +45,11 @@ will be discussed seperatly
We only perform one global optimization, which is optimizing branch-jump
statements. The unoptimized Assembly code contains sequences of code of the
following structure:
\begin{
lstlisting
}
\begin{
verbatim
}
beq ...,
$
Lx
j
$
Ly
$
Lx: ...
\end
{
lstlisting
}
$
Lx: ...
\end
{
verbatim
}
This is inefficient, since there is a jump to a label that follows this code.
It would be more efficient to replace the branch statement with a
\texttt
{
bne
}
(
the opposite case
)
to the label used in the jump statement. This way the jump
...
...
@@ -79,14 +80,14 @@ will describe the types of optimizations here in stead of each optimization.
These are optimizations that simply look for a certain statement or pattern of
statements, and optimize these. For example,
\begin
{
lstlisting
}
\begin
{
verbatim
}
mov
$
regA,
$
regB
instr
$
regA,
$
regA,...
\end
{
lstlisting
}
\end
{
verbatim
}
can be optimized into
\begin
{
lstlisting
}
\begin
{
verbatim
}
instr
$
regA,
$
regB,...
\end
{
lstlisting
}
\end
{
verbatim
}
since the register
\texttt
{
\$
regA
}
gets overwritten by the second instruction
anyway, and the instruction can easily use
\texttt
{
\$
regB
}
in stead of
\texttt
{
\$
regA
}
. There are a few more of these cases, which are the same as
...
...
@@ -163,36 +164,48 @@ this IR and writing the IR back to Assembly.
\textbf
{
Global optimizations
}
\begin
{
tabular
}{
| c c c |
}
\hline
\begin
{
lstlisting
}
beq ...,
$
Lx
j
$
Ly
$
Lx: ...
\end{lstlisting}
&
$
\Rightarrow
$
&
\begin{lstlisting}
bne ...,
$
Ly
$
Lx: ...
\end{lstlisting}
\\
\hline
\begin{lstlisting}
bne ...,
$
Lx
j
$
Ly
$
Lx: ...
\end
{
lstlisting
}
&
$
\Rightarrow
$
&
\begin
{
lstlisting
}
beq ...,
$
Ly
$
Lx: ...
\end
{
lstlisting
}
\\
\hline
\end
{
tabular
}
\\
\\
\begin
{
verbatim
}
beq ...,
$
Lx bne ...,
$
Ly
j
$
Ly ->
$
Lx: ...
$
Lx: ...
bne ...,
$
Lx beq ...,
$
Ly
j
$
Ly
-
>
$
Lx: ...
$
Lx: ...
\end
{
verbatim
}
\textbf
{
Simple basic block optimizations
}
\begin
{
tabular
}{
|c c c|
}
\hline
\begin
{
lstlisting
}
beq ...,
$
Lx
j
$
Ly
$
Lx: ...
\end{lstlisting}
&
$
\Rightarrow
$
&
\begin{lstlisting}
bne ...,
$
Ly
$
Lx: ...
\end{lstlisting}
\\
\hline
\end{tabular}
\\
\\
\begin
{
verbatim
}
mov
$
regA,
$
regA
-
>
---
//
remove it
mov
$
regA,
$
regB
-
> instr
$
regA,
$
regB,...
instr
$
regA,
$
regA,...
instr
$
regA,... instr
$
4
,...
mov
[
$
4-
$
7
]
,
$
regA -> jal XXX
jal XXX
sw
$
regA,XXX
-
> sw
$
regA, XXX
ld
$
regA,XXX
shift
$
regA,
$
regA,
0
-
>
---
//
remove it
add
$
regA,
$
regA,X
-
> lw ...,X
(
$
regA)
lw ...,0(
$
regA
)
\end
{
verbatim
}
\textbf
{
Advanced basic block optimizations
}
\begin
{
verbatim
}
addu
$
regA,
$
regB,
4
addu
$
regD,
$
regB,
4
... move
$
regA,
$
regD
Code not writing
$
regB -> ...
... ...
addu
$
regC,
$
regB, 4 move
$
regC,
$
regD
\end{verbatim}
\end{document}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment