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

Discussion

Generating code for an array reference requires

  • A.one instruction that names the array and the subscript together
  • B.the subscript to be a constant known before the program runs
  • C.the whole array to be loaded into registers first
  • D.multiplying the index by the element width and adding the base

Answer: D

Machines with a scaled index addressing mode can perform the computation as part of the access. Where such a mode is absent the generator must emit explicit arithmetic. Strength reduction can often replace the multiplication with an addition.

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

Post your comment

Please log in or register to post a comment.