0% found this document useful (0 votes)
65 views1 page

Assignment 5.4 Ans

This document discusses applying peephole optimization techniques to optimize code. It provides two code examples - the first optimizes a conditional branch by removing an unnecessary check and goto, and the second replaces arithmetic operations with equivalent but faster operations like increment/decrement.

Uploaded by

Sreekrishna M
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views1 page

Assignment 5.4 Ans

This document discusses applying peephole optimization techniques to optimize code. It provides two code examples - the first optimizes a conditional branch by removing an unnecessary check and goto, and the second replaces arithmetic operations with equivalent but faster operations like increment/decrement.

Uploaded by

Sreekrishna M
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Assignment 5.

4 : Peephole Optimization

Apply Peephole Optimization techniques for the following and produce the optimized code.

1.

degug=0

if degug==1 goto L1

goto L2

L1: print debug information

L2:

2.

X*1 =?

X+1=?

x-1=?

2*x=?

Answers

1.

Goto L2

L2:

2. X*1 = X

X+1 = ++x

x-1 = --x

2*x = x+x

You might also like