Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

GATE | GATE CS 2008 | Question 85

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

Some code optimizations are carried out on the intermediate code because
(A) they enhance the portability of the compiler to other target processors
(B) program analysis is more accurate on intermediate code than on machine code
(C) the information from dataflow analysis cannot otherwise be used for optimization
(D) the information from the front end cannot otherwise be used for optimization


Answer: (A)

Explanation: Option (B) is also true. But the main purpose of doing some code-optimization on intermediate code generation is to enhance the portability of the compiler to target processors. So Option A) is more suitable here.

Intermediate code is machine/architecture independent code. So a compiler can optimize it without worrying about the architecture on which the code is going to execute (it may be the same or the other ). So that kind of compiler can be used by multiple different architectures.

In contrast to that, suppose code optimization is done on target code, which is machine/architecture dependent, then the compiler has be specific about the optimizations on that kind of code. In this case the compiler can’t be used by multiple different architectures, because the target code produced on different architectures would be different. Hence portability reduces here.



Quiz of this Question

My Personal Notes arrow_drop_up
Last Updated : 17 Sep, 2021
Like Article
Save Article
Similar Reads