Browse Prior Art Database

Effective Register Management During Code Generation

IP.com Disclosure Number: IPCOM000078557D
Original Publication Date: 1973-Jan-01
Included in the Prior Art Database: 2005-Feb-26
Document File: 6 page(s) / 100K

Publishing Venue

IBM

Related People

Gilbert, KM: AUTHOR

Abstract

Traditionally, an optimizing compiler is concerned with the assignment of certain data items to registers, in order to minimize the number of accesses to storage. The data items are chosen according to their activity within a defined region of the program. The most severe constraint on this process is the actual number of registers available, since most programs have many more data items than registers.

This text was extracted from a PDF file.
At least one non-text object (such as an image or picture) has been suppressed.
This is the abbreviated version, containing approximately 31% of the total text.

Page 1 of 6

Effective Register Management During Code Generation

Traditionally, an optimizing compiler is concerned with the assignment of certain data items to registers, in order to minimize the number of accesses to storage. The data items are chosen according to their activity within a defined region of the program. The most severe constraint on this process is the actual number of registers available, since most programs have many more data items than registers.

Previous approaches to the optimized register assignment process have completely divorced it from the actual generation of code, so that either global assignment and/or local assignment or simple assignment -- for the "no- optimization" case -- are performed prior to code generation. In the case of the "no-opt" register assignment, it is necessary to make two passes over the program text in order to assign registers and generate code. However, if they were combined then one pass may be eliminated. This requires the "no-opt" register assignment to be embedded within the code generation process. By doing this, it also simplifies the local and global assignments so that they need not assign all the registers, but only those necessary to cover the most active data items; and the data items not assigned will be handled by the code generation register assignment.

In order to describe the functions of the new simple register assignment, which is performed during code generation, it is necessary to first describe the requisite form of the input program text. The representation chosen is an operator followed by zero or more operands, where the operator defines the operation to be performed on the operands (e.g. addition, subtraction, function call, label definition, load, store, etc.). Each operand can be either a table pointer (e.g. to the symbol table, constant table, label table, etc.) or a pointer to a preceding text entry, which means the operand is the result of that operation.

The process of assigning registers while generating code for this form of program text is not very difficult. All that is required is to maintain a register contents table, which contains a pointer to the program text item that caused the setting of the current value in each register. The text item pointer is necessary since an operand, which may be a previous text item pointer, must be matched up with the register that contains its value.

The register contents table will also contain a description of the current value in each register. This information will be used to generate acceptable code. That is, if the current value of an operand is already in a register then it can be obtained from that register, thereby eliminating the need for generating a load instruction or for referencing memory. Code Generation Framework.

This section is concerned with the code generation framework in which the register management functions are to be used. The first topic to be discussed is the requisite form of the input progr...