Machine-translated by Google. Questions are authored in English.
Top

Discussion

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

Answer: B

Live variable analysis is used for Register assignment to variables.

A variable is live at a point if its current value may be used later. Two variables that are never live at the same time can share a register, so register allocation builds an interference graph from liveness information and colours it with the available registers. Liveness also tells the allocator when a register can be freed or a value need not be stored back.

Strength reduction replaces expensive operations such as multiplication by cheaper ones such as addition, usually in loops with induction variables. Constant folding evaluates constant expressions at compile time. Run-time function call management concerns activation records. None of these depends on liveness.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.