INTRODUCTION TO COMPILER DESIGN
OVERVIEW OF COMPILERS
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
Common sub-expression elimination
|
|
Dead-code elimination
|
|
Renaming of temporary variables
|
|
All the above
|
Detailed explanation-1: -The primary Structure-Preserving Transformation on basic blocks is as follows: Common sub-expression elimination. Dead code elimination. Renaming of temporary variables.
Detailed explanation-2: -In structure-preserving transformations no new defined symbols are added by the trans-formation but instead additional conditional arguments are added to defined symbols but increases their arity in order to wrap the conditions.
Detailed explanation-3: -2.1 Function-Preserving Transformations o Constant folding, are common examples of such function-preserving transformations. The other transformations come up primarily when global optimizations are performed. Frequently, a program will include several calculations of the same value, such as an offset in an array.
Detailed explanation-4: -Local transformations are only performed on single basic blocks. The transformations that are carried out must be safe and preserve the meaning of the code. We can say, that a local transformation is safe if the transformed basic block is guaranteed to be equivalent to its original form.