retagged by
14,858 views
41 votes
41 votes

Some code optimizations are carried out on the intermediate code because

  1. They enhance the portability of the compiler to the target processor

  2. Program analysis is more accurate on intermediate code than on machine code

  3. The information from dataflow analysis cannot otherwise be used for optimization

  4. The information from the front end cannot otherwise be used for optimization

retagged by

6 Answers

1 votes
1 votes

As this is Not Multiple select question so Answer A is more accurate than B.

As there are front end and back end.

front end has 4 parts ( Lexical Analysis, Syntax Analysis , semantic Analysis and Intermediate Code generation)

This front end is same for different Operating systems because it is not converting target code for any particular machine.

Where as for back end there are only 2 parts ( Code Optimization and Target Code generator)

This Back end part is different for different OS.

That’s why Option A is correct.

Some code optimizations are carried out on the intermediate code because

they enhance the portability of the compiler to the target processor

  

0 votes
0 votes

The answer is Program analysis is more accurate on intermediate code than on machine code.

Abstraction Level: Intermediate code (IR) is a simplified representation of the program, stripped of machine-specific details and closer to the source code's structure. This makes it easier to analyze and optimize than machine code, which is highly intertwined with the target hardware.

Control Flow Clarity: IR often employs structured control flow constructs (like if-then-else, loops), making it easier to track data dependencies and identify optimization opportunities. Machine code, with its jumps and branches, can obscure these relationships.

Dataflow Analysis Effectiveness: Dataflow analysis, a crucial technique for optimization, can pinpoint how values are used and propagated throughout the program. It's more precise on IR due to its cleaner structure and absence of low-level details that can complicate analysis.

 

Some says the answer is A) https://www.geeksforgeeks.org/gate-gate-cs-2008-question-11/

But the answer should be B

 

Answer:

Related questions

37 votes
37 votes
3 answers
1
Kathleen asked Sep 12, 2014
15,669 views
An LALR(1) parser for a grammar G can have shift-reduce (S-R) conflicts if and only ifThe SLR(1) parser for G has S-R conflictsThe LR(1) parser for G has S-R conflictsThe...