Question: C Multiple Pass Question: Can anyone help me how I can implement multiple passes to get the final optimized answer? Am I supposed to use
C Multiple Pass Question:

Can anyone help me how I can implement multiple passes to get the final optimized answer? Am I supposed to use C Preprocessor? Basic idea how I can start coding multiple passes would be very helpful. Thank you so much in advance!
You might need more than one pass to exploit all the constant propagation opportunities Below is an example: LOADI Ra #1 LOADI Rb #1 ADD Re Ra Rb LOAD! Rd #2 LOADI Re #2 ADD R R Rd ADD R, Ri R After one pass, it is optimized to LOADI R, #2 LOADI Rf #4 ADD R, Rf R It can be further optimized to LOADI Rg #6 You may want to define one pass (one pass scans the entire program once) as one step, then repeat this step until no more instructions can be folded. You might need more than one pass to exploit all the constant propagation opportunities Below is an example: LOADI Ra #1 LOADI Rb #1 ADD Re Ra Rb LOAD! Rd #2 LOADI Re #2 ADD R R Rd ADD R, Ri R After one pass, it is optimized to LOADI R, #2 LOADI Rf #4 ADD R, Rf R It can be further optimized to LOADI Rg #6 You may want to define one pass (one pass scans the entire program once) as one step, then repeat this step until no more instructions can be folded
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
