written 7.6 years ago by | • modified 7.6 years ago |
Mumbai University > Computer > Sem 6 > System Programming and Compiler Construction
Marks: 10
Year:May 16
written 7.6 years ago by | • modified 7.6 years ago |
Mumbai University > Computer > Sem 6 > System Programming and Compiler Construction
Marks: 10
Year:May 16
written 7.6 years ago by |
It is used so that code can be executed in faster manner
Function Preserving
1.Common Subexpression elimination
2.Constant Floding
3.Copy Propogation
4.Dead Code Elimination
Loop Optimization
1.Code Motion
2.Strength Reduction
3.Frequency reduction
4.Loop Distribution
Branch optimization
Rearranges the program code to minimize branching logic and to combine physically separate blocks of code.
Code motion
If variables used in a computation within a loop are not altered within the loop, the calculation can be performed outside of the loop and the results used within the loop.
Common subexpression elimination
In common expressions, the same value is recalculated in a subsequent expression. The duplicate expression can be eliminated by using the previous value.
Constant propagation
Constants used in an expression are combined, and new ones are generated. Some implicit conversions between integers and floating-point types are done.
Dead code elimination
Eliminates code that cannot be reached or where the results are not subsequently used.
Dead store elimination
Eliminates stores when the value stored is never referenced again. For example, if two stores to the same location have no intervening load, the first store is unnecessary and is removed.
Global register allocation
Allocates variables and expressions to available hardware registers using a "graph coloring" algorithm.
Inlining
Replaces function calls with actual program code
Instruction scheduling
Reorders instructions to minimize execution time
Interprocedural analysis
Uncovers relationships across function calls, and eliminates loads, stores, and computations that cannot be eliminated with more straightforward optimizations.
Invariant IF code floating (Unswitching)
Removes invariant branching code from loops to make more opportunity for other optimizations.
Reassociation
Rearranges the sequence of calculations in an array subscript expression, producing more candidates for common expression elimination.
Store motion
Moves store instructions out of loops.
Strength Reduction
Replaces less efficient instructions with more efficient ones. For example, in array subscripting, an add instruction replaces a multiply instruction.
Value numbering Involves constant propagation, expression elimination, and folding of several instructions into a single instruction.