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

Discussion

Register allocation is performed

  • A.during machine independent optimisation of the intermediate code
  • B.in the code generation phase of the back end
  • C.in the lexical analyser as identifiers are first recognised
  • D.in the parser while the syntax tree is being constructed

Answer: B

Correct answer: in the code generation phase of the back end

Registers are a property of the target machine - how many there are, which are reserved, which instructions can use which. Nothing about them exists in the machine-independent intermediate code.

Allocation therefore belongs to the back end, alongside instruction selection and scheduling. Doing it earlier would tie the intermediate form to one architecture and destroy the point of a common representation. The front end deals in an unlimited supply of temporaries; the back end maps them onto real registers and spills the remainder.

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

Post your comment

Please log in or register to post a comment.