Note 11, DM546, fall 2019
Exercises March 22
-
Cover the most important exercises left over from previous sessions.
Then briefly talk about the discussion points below:
-
Consider possible targets for optimization other than time and space
and describe plausible goals.
-
Try to find patterns which could be used in a high-level
peep-hole optimization of for instance C-programs.
Are there any possible dangers in writing a high-level
optimizer for C-programs where simple but inefficient code
is replaced by more complicated but also more efficient code?
-
Take a look at code generated by gcc (compile with gcc -S)
for a few well-known and relatively short source files,
such as factorial, for instance.
Try to investigate the effect of the three options
-O1
, -O2
, and -O3
with regards to code optimization.
-
Find more peephole patterns in the categories from the lecture
or from new catagories that you come up with.