Tuesday, March 22, 2016

Describe the main problem in code generation


There are three main  problems occur in code generation. They are- 

  • Deciding what machine instructions to generate.
  • Deciding in what order the computations should be done.
  • Deciding which register to use.

What instructions should we generate?

Most machines permit certain computations to be done in a variety of ways.

For Example: The target machine has an "add-one-to-storage" instruction (AOS), then for the three-address statement A : = A+1. We might generate the signal instruction AOS A.
rather than the more obvious sequence-

LOAD A
ADD# 1
STORE A

In what order should we perform computation?-
Some computation orders require fewer registers to hold intermediate results than others. Picking the best order is a very difficult problem in general.

What register  should we use?
The register assignment problem occurs when the code generation.
If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SOLVE

0 comments:

Post a Comment