The main goal of register allocation and assignment is to reduce or minimize the memory accesses because the instruction involving only the register operands are shorter and faster than those involving memory operands.
Register Allocation :
The register allocation is the process of deciding what names in a program should reside in registers. The allocation involves assigning symbolic registers to operations that require destination resources within the machine.
Register Assignment :
The register assignment is the process of determining in which register each name should reside. The assignment defines the process whereby the symbolic registers are mapped onto actual machine resources. The register allocation and assignment process occurs in four phases,
1 Code Selection :
uses an unbounded number of symbolic registers during the early parts of compilation to represent the program variables and compiler generated temporaries. A unique name usually represents each symbolic register, generally an increasing numerical sequence.
2 Allocation :
chooses which of the unbounded number of symbolic registers will reside in actual machine registers.
3 Assignment :
maps the chosen symbolic registers to actual hardware registers.
4 Spilling :
occurs when there is an insufficient number of hardware registers to cover symbolic register requirements. One approach to register allocation and assignment is to assign specific types of quantities is an object program to certain registers. For example, a decision can be made to assign:
- Subroutine links to one group of registers.
- Base addresses to another group of registers
- Arithmetic computations to another group of registers.
- The run-time stack pointer to a fixed register, and so on.
This approach simplifies the design of a compiler however, it uses the registers inefficiently.
Global Registers Allocation :
We are forced to store the values at the end of each block. Therefore, in ()icier to save some of these stores and corresponding loads, we must assign registers to frequently used•variables and keep these registers consistent across block boundaries. This process is known as global register allocation.
The global register allocation strategy is based on the assumption that some fixed number of registers (say three) will be assigned to hold the most active names in each inner loop. The selected names may differ in different loops. The main drawback of this approach is that no given number of registers will be universally the right number to make available for global register allocation.
- YouTube Thumbnail Downloader Script | Download YouTube Videos Thumbnail
- Add Countdown Timer Before Displaying the Download Button Link
- URL Shortener Script Free Download for WordPress And Blogger
- The Ultimate Guide to Becoming a Successful Blogger
- Most Profitable Blogging Niche – High-Demand Blog Topics