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

Related Posts:

  • What is Intermediate Language with two properties? Intermediate Language with two properties : - After syntax & semantic analysis the compiler generates an explicit intermediate representation of the source program. This, intermediate representation as a program for an … Read More
  • What is Prefix notation/Polish notation With Example? Prefix notation/Polish notation : It is the form of an expression obtained from preorder traversal of the tree representing this expression. So, in the prefix notation, operators must be placed before the operands.  … Read More
  • What is Postfix notation/Reverse Polish notation With Example? Postfix notation/Reverse Polish notation : It is the form of an expression obtained from postorder traversal of the tree representing this expression. So, in the postfix notation, operators must be placed after the ope… Read More
  • What is Activation Code? Activation Code : Stack allocation collect fixed -storage by using activation record. The activation record contain the following steps -  Storage for simple name & pointers to array & other data structures l… Read More
  • What is infix notation with example? Infix notation : It is the form of an expression obtained from in order traversal of the tree representing this expression. So in the infix notation, Operators must be placed in the operands. Example :  A+B, C*D, /GH… Read More

0 comments:

Post a Comment