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

Discussion

Common subexpression elimination replaces a repeated computation provided that

  • A.none of its operands has been changed since the first evaluation
  • B.the expression turns up at least three times somewhere in the procedure
  • C.all the operands of the expression are compile time constants
  • D.there are registers to spare on whatever machine is being targeted

Answer: A

An assignment to any operand between the two occurrences invalidates the saved value. Establishing that no such assignment occurs requires available expression analysis. Within a single block the check is much simpler and needs no data flow at all.

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

Post your comment

Please log in or register to post a comment.