A non relocatable program is one which
The phases of compiler
4. Intermediate code generation, are all machine dependent phases and are not relocatable.
The together make pass-1 of the compiler. This program hence can not be made to execute in any area of storage other than the one designated for it at the time of its coding or translation.
A self relocating program is one which
The self relocating program is one which can itself perform the relocation of its address sensitive portion. Code-optimization and target code generation comes under the pass-2 of the compiler and is machine independent.
Generation of intermediate code based on a abstract machine model is useful in compilers because
By the help of intermediate code generation, the portability of the front end of the compiler enhances.
Consider the adjacent binary tree:
$ denotes exponentiation. If the tree is traversed in preorder, which, if any, of the expressions below is formed?
The preorder expansion can be represented as
$ + x*yz* + xyz
Which of the following cannot be used as an intermediate code form?
Quadruples is not the intermediate code form.
A basic block can be analyzed by
Properties of a basic block are as follows:
The basic blocks become the nodes of a flow graph, whose edges indicate which blocks can follows which other blocks.
The graph that shows the basic blocks and their successor relationship is called
The graph that shows the basic blocks and their successor relationship is called control graph.
Consider the following C code segment:
Which one of the following is false?
(a) i%2 is inner loop invariant, it can be moved before inner loop.
(b) 4*j is common sub-expression-appeared in two statements.
(c) 4*j can be reduced to j<<2 by strength reduction.
(d) There is no dead code in given code segment. So there is no scope of dead code elimination in this code.
Hence only option (d) is FALSE.
Some code optimizations are carried out on the intermediate code because
Some code optimizations are carried out on the intermediate code because program analysis is more accurate on intermediate code than on machine code.
Which languages necessarily need heap allocation in the runtime environment?
Runtime environment means we deal with dynamic memory allocation and Heap is a dynamic data structure.
So it is clear that those languages that allow dynamic data structure necessarily need heap allocation in the runtime environment.