Nullstone Logo

COMPANY
Home
Contacts
Customers
Testimonials

PRODUCTS
Overview
NULLSTONE for C
NULLSTONE for Java
Technical Overview

SUPPORT
Release Notes
Download
PGP Information
Service Report
Write Us

INFORMATION
Performance Results
Glossary of Terms

RELATED LINKS
Compiler Connection
Compiler Jobs

Previous Up Next
Forward Store

Stores to global variables in loops can be moved out of the loop to reduce memory bandwidth requirements.

Example:

In the code fragment below, the load and store to the global variable sum can be moved out of the loop by computing the summation in a register and then storing the result to sum outside the loop.

    int sum;
    
    void f (void)
    {
      int i;
    
      sum = 0;
      for (i = 0; i < 100; i++)
        sum += a[i];
    }
    

Below is the code fragment after forward store optimization (we assume that t is a compiler generated temporary that is kept in a register).

    int sum;
    
    void f (void)
    {
      int i;
      register int t;
    
      t = 0;
      for (i = 0; i < 100; i++)
        t += a[i];
      sum = t;
    }
    

© 1990-2012 Nullstone Corporation. All Rights Reserved.