CSC365 Compiler Design and Construction

Compiler Design and ConstructionModel question

What is peephole optimization? Explain the following peephole optimization techniques with examples: Redundant load/store elimination Constant folding Strength reduction Use of machine idioms Apply…

5

What is peephole optimization? Explain the following peephole optimization techniques with examples:

  • Redundant load/store elimination
  • Constant folding
  • Strength reduction
  • Use of machine idioms

Apply these optimizations to the following assembly code:

MOV R0, a

MOV b, R0

MOV R0, b

ADD R0, R0, #0

MUL R0, R0, #2

MOV R1, #10

ADD R1, R1, #5

MOV R2, #0

ADD R2, R2, R1

A worked answer is on its wayMeanwhile, read the Compiler Design and Construction notes for this topic.

Discussion

Loading…

More Compiler Design and Construction questions

All Compiler Design and Construction old questions