Compiler Design, Free Study

Next-Use Information – Compiler Design | Freestudy9

Next-Use Information

Again freestudy9 comes with new post related to Next-Use Information. Additionally, we had described it as a point to point information.

Next-Use Information

  • The next-use information is a collection of all the names that are useful for a next-use subsequent statement in a block. Th75e use of a name is defined as follows,
  • Consider a statement,
    x := i
    j := x op y
  • That means the statement j uses a value of x.
  • So, The next-use information can be collected by making the backward scan of the use programming code in that specific block.
Storage for Temporary Names
  • For the distinct names, each time a temporary need And each time space gets allocated for each temporary. To have optimization in the process of code generation we pack two temporaries into the same location if they are not live simultaneously.
  • So, Consider three address code as,

t1 := a * a                                        t1 := a * a
t2    := a * b                                     t2 := a * b
t3    := 4 * t2                                    t2 := 4 * t2
t4    := t1+t3                                     t1 := t1+t2
t5    := b * b                                      t2 := b * b
t6    := t4+t5                                     t1 := t1+t2

Register and address descriptors.

  • So The code generation algorithm uses descriptors to keep track of register contents and addresses for names.
  • Similarly, Address descriptor stores the location where the current value of the name can found at runtime. Also, The information about locations can store in the symbol table and used to access the variables.
  • Additionally, Register descriptor used to keep track of what currently in each register. The register descriptor shows that initially, all the registers are empty. As t generation forgisterthe the block progresses the registers will hold the values of computation.

Role of a code generator.

  • The final phase of the compilation process is code generation.
  • Moreover, It takes an intermediate representation of the source program as input and produces an equivalent target program as output.

  • So, Target code should have following property,
    1. Correctness
    2. High quality
    3. Efficient use of resources of target code
    4. Quick code generation

Related Search

Compiler Design, Source language issue, Register AllocationFree Study.

Tagged ,

Leave a Reply

Your email address will not be published. Required fields are marked *