# US 2004/0083459 A1 · Compiler apparatus and method for unrolling a superblock in a computer program

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2004/0083459 A1
- Document ID: US20040083459A1
- Status: Published application
- Kind: A1
- Application number: 10/282,811
- Filed: 2002-10-29
- Published: 2004-04-29
- Earliest claimed: 2002-10-29
- Assignees: International Business Machines Corporation
- Inventors: Robert Ralph Roediger; William Jon Schmidt; Peter Jerome Steinmetz
- Web page: https://patentgrep.com/patent/US20040083459A1

## CPC

- G06F 8/443: {Optimisation}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A superblock unroller creates a superblock in a first instruction stream, and unrolls the superblock using different methods depending on the suitability of the superblock to different types of unrolling. The superblock unroller uses complete unrolling if a number of iterations of the superblock is sufficiently small and if the number of iterations is known at compile-time. The superblock unroller uses static unrolling if the number of iterations of the superblock is too large for complete unrolling and if the number of iterations is known at compile-time. The superblock unroller uses dynamic unrolling if the number of iterations of the superblock is unknown at compile-time. Each of these unrolling methods may include the insertion of count rectification code into the first instruction stream to account for execution that exits the superblock. Code performance may be improved by providing the sophisticated unrolling of superblocks disclosed herein.

## Claims

### Claim 1

An apparatus comprising:
at least one processor;
a memory coupled to the at least one processor;
a first instruction stream residing in the memory; and
a profile-based superblock unroller residing in the memory and executed by the at least one processor, the superblock unroller forming and unrolling a superblock in the first instruction stream according to profile data, the superblock unroller including a count rectifier that makes at least one change to the first instruction stream to adjust a loop counter when execution exits the superblock.

### Claim 2 (depends on 1)

The apparatus of claim 1 wherein types of unrolling performed by the superblock unroller include complete unrolling, static unrolling, and dynamic unrolling.

### Claim 3 (depends on 1)

The apparatus of claim 1 wherein the superblock unroller uses complete unrolling if a number of iterations of the superblock is sufficiently small and if the number of iterations is known at compile-time.

### Claim 4 (depends on 1)

The apparatus of claim 1 wherein the superblock unroller uses static unrolling if a number of iterations of the superblock is too large for complete unrolling and if the number of iterations is known at compile-time.

### Claim 5 (depends on 1)

The apparatus of claim 1 wherein the superblock unroller uses dynamic unrolling if a number of iterations of the superblock is unknown at compile-time.

### Claim 6 (depends on 1)

The apparatus of claim 1 wherein the count rectifier inserts at least one block in the first instruction stream outside the superblock that adjusts at least one counter value to account for an exit from the superblock.

### Claim 7

An apparatus comprising:
at least one processor;
a memory coupled to the at least one processor;
a first instruction stream residing in the memory;
a profile-based superblock unroller residing in the memory and executed by the at least one processor, the superblock unroller forming and unrolling a superblock in the first instruction stream according to profile data, the superblock unroller including a count rectifier that makes at least one change to the first instruction stream to adjust a loop counter when execution exits the superblock, wherein the superblock unroller uses complete unrolling if a number of iterations of the superblock is sufficiently small and if the number of iterations is known at compile-time, wherein the superblock unroller uses static unrolling if the number of iterations of the superblock is too large for complete unrolling and if the number of iterations is known at compile-time, and wherein the superblock unroller uses dynamic unrolling if the number of iterations is unknown at compile-time.

### Claim 8 (depends on 7)

The apparatus of claim 7 wherein the count rectifier inserts at least one block in the first instruction stream outside the superblock that adjusts at least one counter value to account for an exit from the superblock.

### Claim 9

A method for optimizing a first instruction stream comprising the steps of:
creating a superblock in the first instruction stream according to profile data;
unrolling the superblock; and
providing count rectification code, if needed, external to the superblock to adjust at least one counter value to account for an exit from the superblock.

### Claim 10 (depends on 9)

The method of claim 9 wherein the step of unrolling the superblock comprises the step of performing complete unrolling of the superblock if a number of iterations of the superblock is sufficiently small and if the number of iterations is known at compile-time.

### Claim 11 (depends on 9)

The method of claim 9 wherein the step of unrolling the superblock comprises the step of performing static unrolling of the superblock if a number of iterations of the superblock is too large for complete unrolling and if the number of iterations is known at compile-time.

### Claim 12 (depends on 9)

The method of claim 9 wherein the step of unrolling the superblock comprises the step of performing dynamic unrolling of the superblock if a number of iterations of the superblock is unknown at compile-time.

### Claim 13

A method for optimizing a first instruction stream comprising the steps of:
creating a superblock in the first instruction stream according to profile data;
if a number of iterations of the superblock is sufficiently small and if the number of iterations is known at compile-time, performing complete unrolling of the superblock;
if the number of iterations is too large for complete unrolling and if the number of iterations is known at compile-time, performing static unrolling of the superblock;
if the number of iterations of the superblock is unknown at compile-time, performing dynamic unrolling of the superblock; and
providing count rectification code, if needed, external to the superblock to adjust at least one counter value to account for an exit from the superblock.

### Claim 14

A program product comprising:
(A) a profile-based superblock unroller that forms and unrolls a superblock in a first instruction stream according to profile data, the superblock unroller including a count rectifier that makes at least one change to the first instruction stream to adjust a loop counter when execution exits the superblock; and
(B) computer-readable signal bearing media bearing the profile-based superblock unroller.

### Claim 15 (depends on 14)

The program product of claim 14 wherein the computer-readable signal bearing media comprises recordable media.

### Claim 16 (depends on 14)

The program product of claim 14 wherein the computer-readable signal bearing media comprises transmission media.

### Claim 17 (depends on 14)

The program product of claim 14 wherein types of unrolling performed by the superblock unroller include complete unrolling, static unrolling, and dynamic unrolling.

### Claim 18 (depends on 14)

The program product of claim 14 wherein the superblock unroller uses complete unrolling if a number of iterations of the superblock is sufficiently small and if the number of iterations is known at compile-time.

### Claim 19 (depends on 14)

The program product of claim 14 wherein the superblock unroller uses static unrolling if a number of iterations of the superblock is too large for complete unrolling and if the number of iterations is known at compile-time.

### Claim 20 (depends on 14)

The program product of claim 14 wherein the superblock unroller uses dynamic unrolling if a number of iterations of the superblock is unknown at compile-time.

### Claim 21 (depends on 14)

The program product of claim 14 wherein the count rectifier inserts at least one block in the first instruction stream outside the superblock that adjusts at least one counter value to account for an exit from the superblock.

### Claim 22

A program product comprising:
(A) a profile-based superblock unroller that forms and unrolls a superblock in a first instruction stream according to profile data, the superblock unroller including a count rectifier that makes at least one change to the first instruction stream to adjust a loop counter when execution exits the superblock, wherein the superblock unroller uses complete unrolling if a number of iterations of the superblock is sufficiently small and if the number of iterations is known at compile-time, wherein the superblock unroller uses static unrolling if the number of iterations of the superblock is too large for complete unrolling and if the number of iterations is known at compile-time, and wherein the superblock unroller uses dynamic unrolling if the number of iterations is unknown at compile-time; and
(B) computer-readable signal bearing media bearing the profile-based superblock unroller.

### Claim 23 (depends on 22)

The program product of claim 22 wherein the computer-readable signal bearing media comprises recordable media.

### Claim 24 (depends on 22)

The program product of claim 22 wherein the computer-readable signal bearing media comprises transmission media.

### Claim 25 (depends on 22)

The program product of claim 22 wherein the count rectifier inserts at least one block in the first instruction stream outside the superblock that adjusts at least one counter value to account for an exit from the superblock.
