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

Discussion

An instruction cost model is used by a code generator to

  • A.compare candidate instruction sequences and choose among them
  • B.estimate how long the compilation itself will take to finish
  • C.decide how many passes the compiler should make over the input
  • D.determine whether the source program contains any errors

Answer: A

Correct answer: compare candidate instruction sequences and choose among them

Several sequences usually implement the same operation, and the cost model - typically counting instruction words and memory references - is what lets the generator prefer one. Its accuracy sets a limit on the quality of the code, since a model that misprices an instruction will choose wrongly every time.

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

Post your comment

Please log in or register to post a comment.