0% found this document useful (0 votes)
57 views4 pages

D. Final Phase of Compilation: A. First Phase of Compilation B. Second Phase of Compilation C. Third Phase of Compilation

Code generation is considered the second phase of compilation. Directed Acyclic Graphs (DAGs) depict basic block structure and value flow for optimization. In a DAG, leaf nodes represent constants. Algebraic expression simplification can replace a = a + 1 with a, and x * 2 with x << 1, which is an example of strength reduction. Optimization can be broadly categorized into 3 types. A variable whose value is altered within a loop by a loop-invariant value is called an induction variable. Constant folding involves substituting values for names whose values are constant.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views4 pages

D. Final Phase of Compilation: A. First Phase of Compilation B. Second Phase of Compilation C. Third Phase of Compilation

Code generation is considered the second phase of compilation. Directed Acyclic Graphs (DAGs) depict basic block structure and value flow for optimization. In a DAG, leaf nodes represent constants. Algebraic expression simplification can replace a = a + 1 with a, and x * 2 with x << 1, which is an example of strength reduction. Optimization can be broadly categorized into 3 types. A variable whose value is altered within a loop by a loop-invariant value is called an induction variable. Constant folding involves substituting values for names whose values are constant.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

1. Code generation can be considered as the?

A. first phase of compilation


B. second phase of compilation
C. third phase of compilation
D. final phase of compilation

2. ___________ is a tool that depicts the structure of basic blocks, helps to see the flow
of values flowing among the basic blocks, and offers optimization too.
A. DAG
B. CAG
C. SAG
D. PAG

3. In Directed Acyclic Graph, Leaf nodes represent?


A. identifiers
B. names
C. constants
D. All of the above

4. In Algebraic expression simplification, a = a + 1 can simply be replaced by?


A. a
B. INC a
C. DEC a
D. MUL a

5. x * 2 can be replaced by x << 1 is an example of?


A. Algebraic expression simplification
B. Accessing machine instructions
C. Strength reduction
D. Code Generator

6. The following code is an example of?

void add_ten(int x)

return x + 10;

printf(""value of x is %d"", x);

A. Redundant instruction elimination


B. Unreachable code
C. Flow of control optimization
D. None of the above

7. How many descriptors are used for track both the registers (for availability) and
addresses (location of values) while generating the code?
A. 2
B. 3
C. 4
D. 5

8. __________ are used to keep track of memory locations where the values of
identifiers are stored.
A. Register descriptor
B. Address descriptor
C. Both A and B
D. None of the above

9. Code generator uses ______ function to determine the status of available registers
and the location of name values.
A. setReg
B. cinReg
C. pfReg
D. getReg

10. Which of the following is not a form of Intermediate representation?


A. Abstract Syntax Tree
B. 3-address code
C. Directed cyclic Graph
D. Reverse Polish Notation
11. Optimization can be categorized broadly into ____ types.
A. 2
B. 3
C. 4
D. 5

12. A fragment of code that resides in the loop and computes the same value at each
iteration is called a?
A. Induction analysis
B. Strength reduction
C. loop-invariant code
D. None of the above
13. A variable is called an _________ variable if its value is altered within the loop by a
loop-invariant value.
A. Invariant
B. induction
C. strength
D. loop

14. Dead code plays no role in any program operation and therefore it can simply be
eliminated.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say

15. Substitution of values for names whose values are constant, is done in
A. local optimization
B. loop optimization
C. constant folding
D. None of the above

16. Peep-hole optimization is a form of


A. loop optimization
B. local optimization
C. data flow analysis
D. constant folding

17. In analyzing the compilation of PL/I program, the term Machine independent
optimization is assosiated with
A. creation of more optical matrix
B. recognition of basic elements and creation of uniform symbols
C. recognization of basic syntactic construction through reductionsc
D. use of macro-processor to produce more optimal assembly code

18. Before generating intermediate code, the compiler can modify the intermediate
code by address calculations and improving loops.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say

19. The compiler can make use of memory hierarchy and CPU registers.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say

20. A compiler for a high-level language that runs on one machine and produces
code for a different machine is called
A. optimizing compiler
B. one pass compiler
C. cross compiler
D. multipass compiler

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy