Compiler Global Variable Address Offset Generation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

RISC architectures with fixed-length instructions face inefficiencies in loading 32-bit addresses into registers, requiring multiple instructions and hampering execution speed for programs with frequent memory accesses.

Innovation Solution

A compiler generates a global variable order list based on usage frequency and alignment to group variables likely to be on the same memory page, using a single instruction for the base address and offsets for other variables within the group, reducing the number of instructions needed to load addresses.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Ease of manufacture

If fixed-length instructions are used in RISC architecture, then instruction fetching and parsing is simplified, but the ability to load large values (32-bit addresses) in a single operation is limited

Engineering Contradiction:
Improveinstruction fetching and parsing simplicityVSAvoidability to load 32-bit addresses
Core Design Contradiction:
Ease of manufactureVSAdaptability or versatility

Solution Approach 1:

The patent divides the address loading process into segments: the fixed-length instruction carries the upper portion of the address, and a subsequent instruction carries the lower portion. This segmentation allows the system to maintain fixed-length instructions while still achieving full 32-bit address loading capability.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces a new dimension to address loading by using multiple instructions operating in sequence rather than attempting to fit the entire address in a single instruction. This transforms the problem from a spatial constraint (single instruction width) to a temporal solution (multiple instructions over time).

Inventive Principle:
Principle #17Another dimension (Dimensionality change)

2Reliability

If multiple instructions are used to load 32-bit addresses, then full address capability is achieved, but execution speed is hampered by redundant instructions

Engineering Contradiction:
Improve32-bit address loading capabilityVSAvoidprogram execution speed
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent performs preliminary analysis during compilation to identify groups of global variables that are likely to be located on the same memory page. By pre-organizing variables into groups based on their usage patterns and proximity, the compiler can generate more efficient code that reduces the number of address loading operations needed at runtime.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent changes the parameter of address representation by introducing offset values relative to a base address. Instead of loading full 32-bit addresses for each global variable, the system loads a base address once and then uses smaller offset values to access individual variables, reducing the instruction count and improving execution speed.

Inventive Principle:
Principle #35Parameter changes

3Productivity

If groups of global variables are aggregated based on memory page proximity, then fewer instructions are needed to load addresses, but compiler complexity increases

Engineering Contradiction:
Improveinstruction reductionVSAvoidcompiler complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The patent replaces complex runtime address resolution mechanisms with a simpler compilation-time analysis approach. By using static analysis to determine variable grouping and offset calculation, the system eliminates the need for complex runtime address computation, achieving instruction reduction without excessive compiler complexity.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

Data Source

PatentUS11599478B2Reduced instructions to generate global variable addresses
Publication Date: 2023.03.07 MICROSOFT TECHNOLOGY LICENSING LLC
  • US11599478B2 patent drawing
  • US11599478B2 patent drawing
  • US11599478B2 patent drawing

AI summary

In order to reduce the number of instructions that the compiler generates to load the address of a global variable into a register, the compiler uses a technique that analyzes the global variables used in each function in order to estimate which global variables will be located within the same memory page and have a common base address. A base global variable is selected for each function whose address is fully resolved. The address of each subsequent global variable is constructed using an offset relative to the address of the base global variable that is based on the subsequent global variable's position in a global variable order list.