Computer Sciences > GATE 2025 SET-1 > Code Optimization
Which ONE of the following techniques used in compiler code optimization uses live variable analysis?
A
Run-time function call management
B
Register assignment to variables
C
Strength reduction
D
Constant folding

Explanation

Correct : b

A) Run-time function call management — This involves managing function calls at runtime and does not use live variable analysis.

B) Register assignment to variables — This uses live variable analysis to determine which variables are live at different program points, helping the compiler decide which variables should be allocated to registers and for how long. This is the primary application of live variable analysis.

C) Strength reduction — This optimization replaces expensive operations with cheaper ones (like replacing multiplication by 2 with left shift) and does not require live variable analysis.

D) Constant folding — This optimization evaluates constant expressions at compile time and does not use live variable analysis.

✅ Final Answer: Option (B) — Register assignment to variables.

Reason: Live variable analysis determines which variables are "live" at each program point, which is essential for efficient register allocation and assignment to minimize memory access and optimize performance.

Similar Questions

What is the worst-case time complexity of insertion in an AVL tree?
Question #23 Medium
Which operations on a binary search tree have O(h) complexity?
Question #31 Easy
Compare search complexities of sorted array vs balanced BST.
Question #47 Hard

Related Topics

Data Structures Binary Search Tree Time Complexity Algorithm Analysis Tree Algorithms Computer Science