A.

Fasbender

W.

Kremer

A

New

Approximation

Algorithm

for

Tandem

Networks

with

Priority

Nodes

J.

B?orstler

A.

Z?undorf

Revisiting

extensions

to

to

improve

reusability

J.

B?orstler

T.

Janning

Bridging

the

gap

between

Requirements

Analysis

and

Design

A.

Z?undorf

A.

Sch?urr

Nondeterministic

Control

Structures

for

Graph

Rewriting

Systems

M.

Jarke

J.

Mylopoulos

J.

W.

Schmidt

Y.

Vassiliou

DAIDA

An

Environment

for

Evolving

Information

Systems

M.

Jeusfeld

M.

Jarke

From

Relational

to

Object-Oriented

Integrity

Simplification

G.

Hogen

A.

Kindler

R.

Loogen

Automatic

Parallelization

of

Lazy

Functional

Programs

O.

Spaniol

ODP

-LRB-

Open

Distributed

Processing

-RRB-

Yet

another

Viewpoint

H.

Kuchen

F.

L?ucking

H.

Stoltze

The

Topology

Description

Language

TDL

S.

Graf

B.

Steffen

Compositional

Minimization

of

Finite

State

Systems

R.

Cleaveland

J.

Parrow

B.

Steffen

The

Concurrency

Workbench

A

Semantics

Based

Tool

for

the

Verification

of

Concurrent

Systems

R.

Mathar/J

Mattfeldt

Optimal

Transmission

Ranges

for

Mobile

Communication

in

Linear

Multihop

Packet

Radio

Networks

M.

Jeusfeld

M.

Staudt

Query

Optimazation

in

Deduktive

Object

Bases

J.

Knoop/B

Steffen

The

Interprocedural

Coincidence

Theorem

J.

Knoop/B

Steffen

Unifying

Strength

Reduction

and

Semantic

Code

Motion

R.

Cleaveland/M

Dreim

uller/B

Steffen

Faster

Model

Checking

in

the

Model

Mu-Calculus

T.

Margaria

First-Order

Theories

for

the

Verification

of

Complex

FSMs

P.

Martini

The

DQDB

Protocol

Is

it

Playing

the

Game

M.

Sch?ummer

CNC

DNC

Communication

with

MAP

M.

Sch?ummer

Local

Area

Networks

for

Manufactoring

Environments

with

hard

Real-Time

Requirements

M.

Sch?ummer

Th

Welzel

P.

Martini

Integration

of

Field

Bus

and

MAP

Networks

Hierarchical

Communication

Systems

in

Production

Environments

G.

Vossen

K.-U

Witt

SUXESS

Towards

a

Sound

Unification

of

Extensions

of

the

Relational

Data

Model

J.

Derissen

P.

Hruschka

M.v.d.Beeck

Th

Janning

M.

Nagl

Integrating

Structured

Analysis

and

Information

Modelling

A.

Maassen

Programming

with

Higher

Order

Functions

M.

Rodriguez-Artalejo

H.

Vogler

Note

on

A

Narrowing

Machine

for

Syntax

Directed

BABEL

H.

Kuchen

R.

Loogen

J.

J.

Moreno-Navarro

M.

Rodriguez-Artalejo

Graph-based

Implementation

of

a

Functional

Logic

Language

O.

Spaniol

Nat?urliche

Intelligenz

oder

Der

Parallel-Igel

G.

Vossen

S.

Wang

Correct

and

Efficient

Deadlock

Detection

and

Resolution

in

Distributed

Database

Systems

G.

Vossen

R.

Schwarz

Dynamic

Scheduling

of

Transactions

in

Design

Databases

based

on

Version

Consistency

Jahresbericht

V.

Jansen

A.

Potthoff

W.

Thomas

U.

Wermuth

A

Short

Guide

to

the

AMORE

System

-LRB-

computing

Automata

MOnoids

and

Regular

Expressions

-RRB-

J.

Skurczynski

On

Three

Hierarchies

of

Weak

SkS

Formulas

R.

Loogen

Stack-based

Implementation

of

Narrowing

H.

Kuchen

A.

Wagener

Comparison

of

Dynamic

Load

Balancing

Strategies

K.

Jakobs

F.

Reichert

Directory

Services

for

Mobile

Communication

K.

Jakobs

What

's

Beyond

the

Interface-OSI

Networks

to

Support

CooperativeWork

K.

Jakobs

Directory

Names

and

Schema

An

Evaluation

U.

Quernheim

D.

Kreuer

Das

CCITT

Signalisierungssystem

Nr

auf

Satellitenstrecken

Simulation

der

Zeichengabestrecke

U.

Quernheim

St.

Jacobs

D.

Kreuer

Adaptive

ARQ-Fehlersicherungsverfahren

f?ur

die

Point-to-Multipoint-Satellitenkommunikation

J.J.Moreno-Navarro

H.

Kuchen

R.

Loogen

M.

Rodriguez-Artalejo

Lazy

Nar-rowing

in

a

Graph

Machine

K.

Jakobs

J.

Kaltwasser

F.

Reichert

O.

Spaniol

Der

Computer

f?ahrt

mit

R.

Mathar

A.

Mann

Analyzing

a

Distributed

Slot

Assignment

Protocol

by

Markov

Chains

A.

Maassen

Compilerentwicklung

in

Miranda

ein

Praktikum

in

funktionaler

Programmierung

M.

Nagl

A.

Sch?urr

A

Specification

Environment

for

Graph

Grammars

A.

Sch?urr

PROGRESS

a

VHL-Language

Based

on

Graph

Grammars

M.

M?oller

Ein

Ebenenmodell

wissensbasierter

Konsultationen

Unterst?utzung

f?ur

Wissensakquisition

und

Erkl?arungsf?ahigkeit

E.

Kowalewski

Entwurf

und

Interpretation

einer

Sprache

zur

Beschreibung

von

Konsultationsphasen

in

Expertensystemen

F.

Strauss

Erkl?arungsf?ahigkeit

eines

ebenenorientierten

Expertensystemmodells

Y.

Ortega-Mallen

D.

de

Frutos-Escrig

A

Complete

Proof

System

for

Timed

Observations

M.

Nagl

Modelling

of

Software

Architectures

Importance

Notions

Experiences

H.

Fassbender

H.

Vogler

A

Call-by-need

Implementation

of

Syntax

Directed

Functional

Programming

Th

Janning

M.

Lefering

A

Transformation

from

Requirements

Engineering

into

Design

The

Method

and

the

Tool

J.

Noack

Nat?urlichsprachliche

Interaktion

mit

Datenbanken

R.

Mathar

Concurrence

Probabilities

for

a

Locally

Slotted

Packet

Radio

Network

by

Combinatorial

Methods

F.

Herrmann

Heiko

Vogler

Primitive

Recursive

Programs

for

Defining

Tree

Functions

Z.

F?ul?op

F.

Herrmann

S.

Vagv?olgyi

H.

Vogler

Tree

Transducers

with

External

Functions

P.

Bachmann

W.

Oberschelp

B.

Thalheim

G.

Vossen

The

Design

of

RAD

Towards

an

Interactive

Toolbox

for

Database

Design

Jahresbericht

F.

Beuting

F.

Piron

K.

Rausch

Ein

neuronales

Modell

zur

Feststellung

von

f?ur

die

visuelle

Aufmerksamkeit

relevanten

Figureneigenschaften

B.

Steffen

A.

Ingolfsdottir

Characteristic

Formulae

for

Processes

with

Divergence

M.

Portz

A

new

class

of

cryptosystems

based

on

interconnection

networks

H.

Kuchen

G.

Geiler

Distributed

Applicative

Arrays

L.

Staiger

Kolmogorov

Complexity

and

Hausdorff

Dimension

L.

Staiger

Syntactic

congruences

for

languages

K.

Jakobs

K.

D.

Kleefeld

Using

Public

Communication

Services

for

Archaeological

Applications

E.

Kuikka

A

Proposal

for

a

Syntax-Directed

Text

Processing

System

K.

Gladitz

H.

Fassbender

H.

Vogler

Compiler-based

Implementation

of

Syntax-Directed

Functional

Programming

R.

Loogen

S.

Winkler

Dynamic

Detection

of

Determinism

in

Functional

Logic

Languages

K.

Indermark

M.

Rodr?iguez

Artalejo

-LRB-

Eds

-RRB-

Granada

Workshop

on

the

Integration

of

Functional

and

Logic

Programming

R.

Hager

W.

Kremer

The

Adaptive

Priority

Scheduler

A

More

Fair

Priority

Service

Discipline

Aachener

Informatik-Berichte

Please

write

to

Informatik-Bibliothek

RWTH

Aachen

Ahornstr

Aachen

Jahresbericht

D.

de

Frutos

Escrig

K.

Indermark

Equivalence

relations

of

non-deterministic

Ianov-schemes

M.

Nagl

A

Software

Development

Environment

Based

on

Graph

Technology

C.

Lewerentz

M.

Nagl

B.

Westfechtel

On

Integration

Mechanisms

within

a

Graph-based

Software

Development

Environment

R.

Rinn

Uber

Eingabeanomalien

bei

verschiedenen

Inferenzmodellen

W.

Damm

G.

D?ohmen

Specifying

Distributed

Computer

Architectures

in

AADL

G.

Engels

C.

Lewerentz

W.

Sch?afer

Graph

Grammar

Engineering

A

Software

Specification

Method

M.

Nagl

Set

Theoretic

Approaches

to

Graph

Grammars

C.

Lewerentz

A.

Sch?urr

Experiences

with

a

Database

System

for

Software

Documents

H.

Klaeren

K.

Indermark

A

New

Implementation

Technique

for

Recursive

Function

Definitions

R.

Loogen

Design

of

a

parallel

programmable

graph

reduction

machine

with

distributed

memory

J.

B?orstler

U.

M?oncke

R.

Wilhelm

Table

Compression

for

Tree

Automata

C.

Lewerentz

Extended

Programming

in

the

Large

in

a

Software

Development

Environment

G.

Engels

Th

Janning

W.

Sch?afer

A

Highly

Integrated

Tool

Set

for

Program

Development

Support

R.

Loogen

U.

Goltz

A

non-interleaving

semantic

model

for

nondeterministic

concurrent

processes

Th

Hafer

On

the

Boolean

Closure

of

B?uchi

Tree

Automaton

Definable

Sets

of

w-Trees

U.

Heuter

First-Order

Properties

of

Trees

Star-Free

Expressions

and

Aperiodicity

G.

Esser

J.

R?uckert

F.

Wagner

-LRB-

Hrsg

-RRB-

Gesellschaftliche

Aspekte

der

Informatik

P.

Martini

O.

Spaniol

Token-Passing

in

High-Speed

Backbone

Networks

for

Campus-Wide

Environments

Th

Welzel

Simulation

of

a

Multiple

Token

Ring

Backbone

P.

Martini

Performance

Comparison

for

HSLAN

Media

Access

Protocols

P.

Martini

Performance

Analysis

of

Multiple

Token

Rings

A.

Mann

J.

R?uckert

O.

Spaniol

Datenfunknetze

A.

Mann

J.

R?uckert

Packet

Radio

Networks

for

Data

Exchange

A.

Mann

J.

R?uckert

Concurrent

Slot

Assignment

Protocol

for

Packet

Radio

Networks

W.

Kremer

F.

Reichert

J.

R?uckert

A.

Mann

Entwurf

einer

Netzwerktopologie

f?ur

ein

Mobilfunknetz

zur

Unterst?utzung

des

offentlichen

Strassenverkehrs

K.

Jakobs

Towards

User-Friendly

Networking

K.

Jakobs

The

Directory

Evolution

of

a

Standard

K.

Jakobs

Directory

Services

in

Distributed

Systems

A

Survey

M.

Sch?ummer

a

Protocol

for

the

Plant

Floor

U.

Quernheim

Satellite

Communication

Protocols

A

Performance

Comparison

Considering

On-Board

Processing

P.

Martini

O.

Spaniol

Th

Welzel

File

Transfer

in

High

Speed

Token

Ring

Networks

Performance

Evaluation

by

Approximate

Analysis

and

Simulation

Jahresbericht

W.

Thomas

Automata

on

Infinite

Objects

M.

Sonnenschein

On

Petri

Nets

and

Data

Flow

Graphs

H.

Vogler

Functional

Description

of

the

Contextual

Analysis

in

BlockStructured

Programming

Languages

A

Case

Study

of

Tree

Transducers

Th

Welzel

Einsatz

des

Simulationswerkzeuges

zur

Leistungsbewertung

von

Kommunikationsprotokollen

Th

Janning

C.

Lewerentz

Integrated

Project

Team

Management

in

a

Software

Development

Environment

J.

Engelfriet

H.

Vogler

Modular

Tree

Transducers

W.

Thomas

Automata

and

Quantifier

Hierarchies

U.

Heuter

Generalized

Definite

Tree

Languages

Jahresbericht

G.

Esser

J.

R?uckert

F.

Wagner

-LRB-

Hrsg

-RRB-

Gesellschaftliche

Aspekte

der

Informatik

H.

Vogler

Bottom-Up

Computation

of

Primitive

Recursive

Tree

Functions

A.

Sch?urr

Introduction

to

PROGRESS

an

Attribute

Graph

Grammar

Based

Specification

Language

J.

B?orstler

Wiederverwendbarkeit

und

Softwareentwicklung

Probleme

L?osungsans?atze

und

Bibliographie

K.

Jakobs

OSI

An

Appropriate

Basis

for

Group

Communication

K.

Jakobs

ISO

s

Directory

Proposal

Evolution

Current

Status

and

Future

Problems

B.

Westfechtel

Extension

of

a

Graph

Storage

for

Software

Documents

with

Primitives

for

Undo

Redo

and

Revision

Control

P.

Martini

High

Speed

Local

Area

Networks

A

Tutorial

Jozef

Filser

Bolidische

Gedangen

-LRB-

Gabidel

-RRB-

Ieber

die

Kombjuderkunzt

P.

Davids

Th

Welzel

Performance

Analysis

of

DQDB

Based

on

Simulation

M.

Nagl

-LRB-

Ed

-RRB-

Abstracts

of

Talks

presented

at

the

WG

International

Workshop

on

Graphtheoretic

Concepts

in

Computer

Science

Rolduc

-LRB-

NL

-RRB-

near

Aachen

-LRB-

D

-RRB-

June

END

ELSE

IF

SR-Insert

-LRB-

-RRB-

THEN

LET

M

f

j

SR-Redundant

-LRB-

-RRB-

g

BEGIN

IF

M

THEN

LET

M

BEGIN

Attach

the

assignment

hnr

-LRB-

-RRB-

hnr

-LRB-

-RRB-

at

the

entry

of

node

n

END

ELSE

LET

VFN

Distr

-LRB-

-RRB-

BEGIN

Attach

the

assignment

hnr

-LRB-

-RRB-

hnr

-LRB-

-RRB-

hnr

-LRB-

-RRB-

at

the

entry

of

node

n

END

END

ELSE

LET

op

Lpost

-LRB-

n

-RRB-

-LRB-

-RRB-

VFN

l

-LRB-

-RRB-

VFN

r

-LRB-

-RRB-

BEGIN

Attach

the

assignment

hnr

-LRB-

-RRB-

hnr

-LRB-

-RRB-

op

hnr

-LRB-

-RRB-

at

the

entry

of

node

n

END

FI

FI

END

OD

OD

-LRB-

Introducing

spill

code

for

the

generated

auxiliary

variables

-RRB-

FORALL

-LRB-

-RRB-

f

-LRB-

-RRB-

VFE

j

nr

-LRB-

-RRB-

nr

-LRB-

-RRB-

g

DO

IF

nr

-LRB-

-RRB-

nr

-LRB-

-RRB-

THEN

Attach

a

component

of

spill

code

-LRB-

hnr

-LRB-

-RRB-

:-RRB-

-LRB-

hnr

-LRB-

-RRB-

:-RRB-

at

the

exit

of

node

N

-LRB-

-RRB-

FI

OD

-LRB-

Substituting

original

computations

by

a

reference

to

their

covering

auxiliary

variable

-RRB-

FORALL

n

N

DO

-LRB-

Let

n

-LRB-

xr

-RRB-

-LRB-

tr

-RRB-

-RRB-

FORALL

f

VFN

j

N

-LRB-

-RRB-

n

Tpre

-LRB-

n

-RRB-

-LRB-

-RRB-

trg

g

DO

Replace

all

original

computations

t

trg

Tpre

-LRB-

n

-RRB-

-LRB-

-RRB-

by

hnr

-LRB-

-RRB-

OD

OD

avail

-LSB-

-RSB-

Insert

-LRB-

-RRB-

workset

workset

-LSB-

f

g

FI

OD

END

OD

Algorithm

A.

-LRB-

The

Optimizing

Program

Transformation

-LRB-

Step

-LRB-

ii

-RRB-

-RRB-

-RRB-

INPUT

A

flow

graph

G

an

associated

value

flow

graph

VFG

and

the

predicates

Antloc

Insert

SR-Insert

SR-Usable

SR-Redundant

and

Distr

OUTPUT

The

transformed

flow

graph

GT

In

GT

abstract

values

-LRB-

stored

in

auxiliary

variables

-RRB-

are

computed

at

their

earliest

down-safe

computation

points

by

their

minimal

computation

forms

with

respect

to

the

value

flow

graph

under

consideration

Original

computations

are

replaced

by

auxiliary

variables

REMARK

The

algorithm

consists

of

three

phases

namely

ffl

Marking

the

definition-use

chains

in

VFG

ffl

Allocating

auxiliary

variable

numbers

ffl

Transforming

the

flow

graph

-LCB-

Initializing

auxiliary

variables

at

their

computation

points

by

their

computation

forms

-LCB-

Introducing

spill

code

for

the

generated

auxiliary

variables

-LCB-

Substituting

original

computations

by

their

covering

auxiliary

variable

The

predicate

mark

-LRB-

-RRB-

indicates

whether

a

node

VFN

is

marked

or

not

nr

-LRB-

-RRB-

denotes

the

index

of

the

auxiliary

variable

associated

with

VFN

and

count

denotes

the

highest

index

of

an

auxiliary

variable

currently

valid

Note

that

attaching

an

assignment

at

the

entry

of

a

node

implies

that

the

following

correctness

conditions

are

satisfied

First

an

attached

assignment

follows

all

initializations

of

its

right

hand

side

auxiliary

variables

and

second

it

precedes

all

uses

of

its

left

hand

side

auxiliary

variable

in

the

insertion

node

under

consideration

-LRB-

Phase

Marking

the

definition-use

chains

in

VFG

-RRB-

FORALL

VFN

DO

mark

-LRB-

-RRB-

false

OD

workset

f

VFN

j

Antloc

-LRB-

-RRB-

SR-Usable

-LRB-

-RRB-

VFN

SR-Redundant

-LRB-

-RRB-

g

WHILE

workset

DO

LET

workset

BEGIN

workset

workset

nf?g

mark

-LRB-

-RRB-

true

IF

Insert

-LRB-

-RRB-

THEN

workset

workset

-LSB-

f

predVFG

-LRB-

-RRB-

j

mark

-LRB-

-RRB-

g

FI

END

OD

-LRB-

Phase

Allocating

auxiliary

variable

numbers

-RRB-

count

FORALL

VFN

DO

nr

-LRB-

-RRB-

OD

workset

f

VFN

j

Insert

-LRB-

-RRB-

g

WHILE

workset

DO

LET

workset

BEGIN

workset

workset

nf?g

mark

-LRB-

-RRB-

false

IF

Insert

-LRB-

-RRB-

j

predVFG

-LRB-

-RRB-

j

THEN

count

count

nr

-LRB-

-RRB-

count

ELSE

-LRB-

assume

predVFG

-LRB-

-RRB-

f

-RRB-

nr

-LRB-

-RRB-

nr

-LRB-

-RRB-

FI

workset

workset

-LSB-

f

succVFG

-LRB-

-RRB-

j

mark

-LRB-

-RRB-

g

END

OD

-LRB-

Phase

Transforming

the

flow

graph

-RRB-

-LRB-

Initializing

auxiliary

variables

at

their

computation

points

by

their

computation

forms

-RRB-

FORALL

n

N

DO

workset

f

VFN

j

Insert

-LRB-

-RRB-

N

-LRB-

-RRB-

n

g

WHILE

workset

DO

LET

f

workset

j

workset

succ

-LRB-

-RRB-

g

BEGIN

workset

workset

nf?g

IF

Lpre

-LRB-

n

-RRB-

-LRB-

-RRB-

-LRB-

V

-LSB-

C

-RRB-

THEN

LET

x

Lpre

-LRB-

n

-RRB-

-LRB-

-RRB-

-LRB-

V

-LSB-

C

-RRB-

BEGIN

Attach

the

assignment

hnr

-LRB-

-RRB-

x

at

the

entry

of

node

n

Remark

The

fixed

point

iteration

operates

on

the

complete

semi-lattice

ffalse

trueg

with

false

true

The

variable

counted-or

allows

an

efficient

update

of

the

predicate

d-safe

which

depends

on

a

disjunction

of

properties

The

variable

workset

controls

the

iterative

process

and

the

auxiliary

variable

d-safe

stores

the

result

of

the

most

recent

application

of

the

local

analysis

component

-LRB-

Initialization

-RRB-

FORALL

VFN

DO

d-safe

-LSB-

-RSB-

N

-LRB-

-RRB-

e

FORALL

n

-LRB-

N

-LRB-

-RRB-

-RRB-

DO

counted-or

-LRB-

n

-RRB-

j

f

j

succVFG

-LRB-

-RRB-

N

-LRB-

-RRB-

n

d-safe

-LSB-

-RSB-

g

j

OD

OD

workset

f

j

N

-LRB-

-RRB-

e

g

-LRB-

Iterative

fixed

point

computation

-RRB-

WHILE

workset

DO

LET

workset

BEGIN

workset

workset

nf

g

-LRB-

Update

the

environment

of

node

-RRB-

FORALL

predVFG

-LRB-

-RRB-

DO

counted-or

-LRB-

N

-LRB-

-RRB-

-RRB-

counted-or

-LRB-

N

-LRB-

-RRB-

-RRB-

d-safe

d-safe

-LSB-

-RSB-

-LRB-

Antloc

-LRB-

-RRB-

-LRB-

counted-or

-LRB-

N

-LRB-

-RRB-

-RRB-

-RRB-

-RRB-

IF

d-safe

-LSB-

-RSB-

d-safe

THEN

d-safe

-LSB-

-RSB-

d-safe

workset

workset

-LSB-

f

g

FI

OD

END

OD

Algorithm

A.

-LRB-

Earliestness

-LRB-

Step

-LRB-

i

-RRB-

-RRB-

-RRB-

Input

The

Boolean

Equation

System

Output

The

least

solution

Earliest

of

Equation

System

-LRB-

stored

in

earliest

-LSB-

-RSB-

-RRB-

Remark

The

fixed

point

iteration

operates

on

the

complete

semi-lattice

ffalse

trueg

with

false

true

The

variable

workset

controls

the

iterative

process

and

the

auxiliary

variable

earliest

stores

the

result

of

the

most

recent

application

of

the

local

analysis

component

-LRB-

Initialization

-RRB-

FORALL

VFN

DO

earliest

-LSB-

-RSB-

VFN

s

OD

workset

VFN

s

-LRB-

Iterative

fixed

point

computation

-RRB-

WHILE

workset

DO

LET

workset

BEGIN

workset

workset

nf

g

-LRB-

Update

the

environment

of

node

-RRB-

FORALL

succVFG

-LRB-

-RRB-

DO

earliest

earliest

-LSB-

-RSB-

:D

Safe

-LRB-

-RRB-

IF

earliest

-LSB-

-RSB-

earliest

THEN

earliest

-LSB-

-RSB-

earliest

workset

workset

-LSB-

f

g

FI

OD

END

OD

Algorithm

A.

-LRB-

Availability

-LRB-

Step

-LRB-

i

-RRB-

-RRB-

-RRB-

Input

The

Boolean

Equation

System

Output

The

greatest

solution

Avail

of

Equation

System

-LRB-

stored

in

avail

-LSB-

-RSB-

-RRB-

Remark

The

fixed

point

iteration

operates

on

the

complete

semi-lattice

ffalse

trueg

with

false

true

The

variable

workset

controls

the

iterative

process

-LRB-

Initialization

-RRB-

FORALL

VFN

DO

IF

VFN

s

THEN

avail

-LSB-

-RSB-

Insert

-LRB-

-RRB-

ELSE

avail

-LSB-

-RSB-

true

FI

OD

workset

f

j

avail

-LSB-

-RSB-

g

-LRB-

Iterative

fixed

point

computation

-RRB-

WHILE

workset

DO

LET

workset

BEGIN

workset

workset

nf

g

-LRB-

Update

the

environment

of

node

-RRB-

FORALL

succVFG

-LRB-

-RRB-

DO

IF

avail

-LSB-

-RSB-

Insert

-LRB-

-RRB-

THEN

roots

-LRB-

Q

-RRB-

determine

-LCB-

roots

-LRB-

Q

-RRB-

initialize

-LCB-

hashtables

-LRB-

P

-LRB-

xr

-RRB-

-LRB-

tr

-RRB-

-RRB-

FORALL

roots

-LRB-

Q

-RRB-

DO

construct

-LRB-

P

Q

true

VFN

-RRB-

OD

VFN

VFN

-LSB-

f

-LRB-

-RRB-

j

nodes

-LRB-

P

-RRB-

g

OD

-LRB-

Construction

of

the

edges

of

the

value

flow

graph

-RRB-

VFE

FORALL

-LRB-

m

n

-RRB-

E

DO

-LRB-

Let

P

-LRB-

NP

EP

LP

-RRB-

df

post

-LRB-

m

-RRB-

and

Q

-LRB-

NQ

EQ

LQ

-RRB-

df

pre

-LRB-

n

-RRB-

-RRB-

initialize

-LCB-

mark

-LRB-

Q

-RRB-

roots

-LRB-

Q

-RRB-

determine

-LCB-

roots

-LRB-

Q

-RRB-

initialize

-LCB-

hashtables

-LRB-

P

skip

-RRB-

FORALL

roots

-LRB-

Q

-RRB-

DO

construct

-LRB-

P

Q

false

VFE

-RRB-

OD

OD

END

where

PROCEDURE

initialize

-LCB-

mark

-LRB-

D

PDfin

-RRB-

BEGIN

FORALL

ND

DO

mark

-LRB-

-RRB-

false

OD

END

FUNCTION

determine

-LCB-

roots

-LRB-

D

PDfin

-RRB-

SET

OF

DAGnodes

VAR

roots

SET

OF

DAGnodes

BEGIN

roots

FORALL

ND

DO

IF

is

-LCB-

root

-LRB-

-RRB-

THEN

roots

roots

-LSB-

f

g

FI

OD

determine

-LCB-

roots

roots

END

PROCEDURE

construct

-LRB-

NQ

P

Q

PDfin

b

Boolean

VAR

VFNE

SET

OF

VFGnodes

or

SET

OF

VFGedges

-RRB-

VAR

father

DAGnodes

BEGIN

IF

mark

-LRB-

-RRB-

THEN

mark

-LRB-

-RRB-

true

IF

is

-LCB-

leaf

-LRB-

-RRB-

THEN

LET

z

LQ

-LRB-

-RRB-

BEGIN

get

-LCB-

vc

-LCB-

node

-LRB-

z

-RRB-

IF

NP

THEN

VFNE

VFNE

-LSB-

f

-LRB-

-RRB-

g

ptr

-LRB-

-RRB-

IF

b

THEN

nodes

-LRB-

P

-RRB-

nodes

-LRB-

P

-RRB-

nf

g

FI

ELSE

ptr

-LRB-

-RRB-

IF

b

THEN

VFNE

VFNE

-LSB-

f

-LRB-

-RRB-

g

FI

FI

END

ELSE

construct

-LRB-

l

-LRB-

-RRB-

P

Q

b

VFNE

-RRB-

construct

-LRB-

r

-LRB-

-RRB-

P

Q

b

VFNE

-RRB-

IF

ptr

-LRB-

l

-LRB-

-RRB-

-RRB-

ptr

-LRB-

r

-LRB-

-RRB-

-RRB-

THEN

father

get

-LCB-

op

-LCB-

node

-LRB-

LQ

-LRB-

-RRB-

Op

ptr

-LRB-

l

-LRB-

-RRB-

-RRB-

-RRB-

ptr

-LRB-

r

-LRB-

-RRB-

-RRB-

-RRB-

IF

father

NP

THEN

VFNE

VFNE

-LSB-

f

-LRB-

father

-RRB-

g

ptr

-LRB-

-RRB-

father

IF

b

THEN

nodes

-LRB-

P

-RRB-

nodes

-LRB-

P

-RRB-

nffatherg

FI

ELSE

ptr

-LRB-

-RRB-

IF

b

THEN

VFNE

VFNE

-LSB-

f

-LRB-

-RRB-

g

FI

FI

ELSE

ptr

-LRB-

-RRB-

IF

b

THEN

VFNE

VFNE

-LSB-

f

-LRB-

-RRB-

g

FI

FI

FI

FI

END

A.

The

Second

Stage

Algorithms

Algorithm

A.

-LRB-

Down-Safety

-LRB-

Step

-LRB-

i

-RRB-

-RRB-

-RRB-

Input

The

Boolean

Equation

System

Output

The

greatest

solution

D-Safe

of

Equation

System

-LRB-

stored

in

d-safe

-LSB-

-RSB-

-RRB-

Output

An

annotation

of

G

with

sets

of

terms

Tsuf

-LRB-

n

-RRB-

whose

elements

represent

values

that

must

be

computed

on

every

continuation

of

paths

from

s

to

n

that

end

in

e.

Remark

Term

annotations

are

denoted

by

TD

The

operators

nV

P

-LRB-

T

-RRB-

P

-LRB-

T

-RRB-

P

-LRB-

T

-RRB-

n

N

are

defined

as

follows

nV

-LRB-

-RRB-

df

ft

j

t

and

are

post

-LSB-

n

-RSB-

equivalent

g.

-LRB-

The

operators

nV

can

naturally

be

generalized

to

other

numbers

of

arguments

-RRB-

Finally

for

every

node

n

of

G

let

R

-LRB-

n

-RRB-

denote

a

representation

system

of

terms

of

the

equivalence

classes

of

the

post-DAG

of

n.

BEGIN

FORALL

n

N

DO

Tsuf

-LRB-

n

-RRB-

-LRB-

T

-LRB-

n

-RRB-

-RRB-

OD

closure

-LRB-

e

Tsuf

-RRB-

FORALL

n

N

DO

Tsuf

-LRB-

n

-RRB-

Tsuf

-LRB-

n

-RRB-

-LSB-

R

-LRB-

n

-RRB-

OD

END

where

PROCEDURE

closure

-LRB-

n

N

VAR

Tsuf

TD

-RRB-

VAR

Tsuf

TD

BEGIN

FORALL

m

N

DO

IF

n

m

THEN

Tsuf

-LRB-

m

-RRB-

Tsuf

-LRB-

m

-RRB-

ELSE

Tsuf

-LRB-

m

-RRB-

T

FI

OD

workset

predG

-LRB-

n

-RRB-

WHILE

workset

DO

LET

m

workset

BEGIN

workset

workset

nfmg

IF

Tsuf

-LRB-

m

-RRB-

oe

Tsuf

-LRB-

m

-RRB-

-LSB-

-LRB-

ffim

-LRB-

mV

-LRB-

m

-RRB-

-LRB-

Tsuf

-LRB-

-RRB-

-RRB-

-RRB-

-RRB-

THEN

Tsuf

-LRB-

m

-RRB-

Tsuf

-LRB-

m

-RRB-

-LSB-

-LRB-

ffim

-LRB-

mV

-LRB-

m

-RRB-

-LRB-

Tsuf

-LRB-

-RRB-

-RRB-

-RRB-

-RRB-

workset

workset

-LSB-

predG

-LRB-

m

-RRB-

FI

END

OD

Tsuf

Tsuf

END

Algorithm

A.

-LRB-

Construction

of

the

Value

Flow

Graph

-LRB-

Step

-LRB-

iii

-RRB-

-RRB-

-RRB-

Input

A

flow

graph

G

-LRB-

N

E

s

e

-RRB-

whose

nodes

are

annotated

with

structured

partition

DAGs

as

pre-DAGs

and

post-DAGs

Output

The

value

flow

graph

according

to

the

node

annotation

above

Remark

The

following

auxiliary

procedures

and

variables

are

used

ffl

initialize

-LCB-

hashtables

generates

two

hashtables

for

the

structured

partition

DAG

P

The

first

one

allows

to

find

every

inner

node

of

P

in

constant

time

and

the

second

one

to

find

that

node

of

P

which

is

labeled

with

a

special

constant

or

variable

in

constant

time

the

second

parameter

of

this

procedure

controls

whether

the

reference

depends

on

a

backward

substitution

-LRB-

this

is

necessary

for

the

construction

of

nodes

-RRB-

ffl

get

-LCB-

vc

-LCB-

node

given

a

variable

or

constant

as

argument

get

-LCB-

vc

-LCB-

node

yields

that

node

of

P

labeled

by

the

argument

if

such

a

node

exists

otherwise

get

-LCB-

vc

-LCB-

node

delivers

a

special

node

not

in

NP

ffl

get

-LCB-

op

-LCB-

node

given

two

nodes

of

NP

and

an

operator

symbol

get

-LCB-

op

-LCB-

node

yields

that

node

of

P

which

is

labeled

by

the

operator

and

whose

sons

are

the

two

argument

nodes

if

such

a

node

exists

otherwise

get

-LCB-

op

-LCB-

node

delivers

a

special

node

not

in

NP

ffl

is

-LCB-

leaf

given

a

node

of

a

structured

partition

DAG

is

-LCB-

leaf

determines

whether

this

node

is

a

leaf

or

not

ffl

is

-LCB-

root

given

a

node

of

a

structured

partition

DAG

is

-LCB-

root

determines

whether

this

node

is

a

root

or

not

ffl

mark

-LRB-

-RRB-

ptr

-LRB-

-RRB-

with

every

node

of

the

structured

partition

DAG

Q

the

auxiliary

variables

mark

-LRB-

-RRB-

and

ptr

-LRB-

-RRB-

are

associated

The

first

variable

indicates

whether

the

node

has

already

been

processed

the

second

variable

contains

a

pointer

-LRB-

indicated

by

-RRB-

to

that

node

of

P

which

represents

a

superset

of

terms

represented

by

if

such

a

node

exists

Otherwise

ptr

-LRB-

-RRB-

will

be

set

to

ffl

roots

-LRB-

Q

-RRB-

nodes

-LRB-

P

-RRB-

denote

two

auxiliary

variables

of

the

type

set

of

DA

Gnodes

BEGIN

-LRB-

Construction

of

the

nodes

of

the

value

flow

graph

-RRB-

VFN

FORALL

n

N

DO

-LRB-

Let

P

-LRB-

NP

EP

LP

-RRB-

df

pre

-LRB-

n

-RRB-

and

Q

-LRB-

NQ

EQ

LQ

-RRB-

df

post

-LRB-

n

-RRB-

and

let

n

-LRB-

xr

-RRB-

-LRB-

tr

-RRB-

-RRB-

nodes

-LRB-

P

-RRB-

NP

initialize

-LCB-

mark

-LRB-

Q

-RRB-

PROCEDURE

reconstruct

-LRB-

NQ

-RRB-

BEGIN

FORALL

pred

-LRB-

-RRB-

DO

LQ

-LRB-

-RRB-

LQ

-LRB-

-RRB-

nOp

EQ

EQnf

-LRB-

-RRB-

j

succ

-LRB-

-RRB-

g

IF

LQ

-LRB-

-RRB-

THEN

reconstruct

-LRB-

-RRB-

FI

OD

NQ

NQnf

g

END

Algorithm

A.

-LRB-

The

u

-LCB-

Algorithm

for

Structured

Partition

DAGs

-RRB-

Input

Two

finite

structured

partition

DAGs

P

-LRB-

NP

EP

LP

-RRB-

and

Q

-LRB-

NQ

EQ

LQ

-RRB-

Output

A

finite

structured

partition

DAG

R

-LRB-

NR

ER

LR

-RRB-

which

represents

the

meet

of

P

and

Q

i.e.

R

=P

u

Q.

Additionally

R

satisfies

T

-LRB-

R

-RRB-

T

-LRB-

P

-RRB-

T

-LRB-

Q

-RRB-

Remark

Nodes

of

R

are

denoted

by

pairs

-LRB-

-RRB-

where

NP

and

NQ

With

every

pair

-LRB-

-RRB-

NP

NQ

a

Boolean

variable

jstfd

-LRB-

-RRB-

is

associated

-LRB-

Note

that

jstfd

-LRB-

-RRB-

is

initialized

with

a

special

value

undefined

-RRB-

BEGIN

NR

ER

initialize

-LCB-

jstfd

-LRB-

P

Q

-RRB-

FORALL

-LRB-

-RRB-

NP

NQ

LP

-LRB-

-RRB-

LQ

-LRB-

-RRB-

DO

IF

LP

-LRB-

-RRB-

LQ

-LRB-

-RRB-

Op

THEN

IF

justified

-LRB-

l

-LRB-

-RRB-

l

-LRB-

-RRB-

-RRB-

justified

-LRB-

r

-LRB-

-RRB-

r

-LRB-

-RRB-

-RRB-

THEN

NR

NR

-LSB-

f

-LRB-

-RRB-

g

LR

-LRB-

-LRB-

-RRB-

-RRB-

LP

-LRB-

-RRB-

LQ

-LRB-

-RRB-

ELSE

IF

-LRB-

LP

-LRB-

-RRB-

LQ

-LRB-

-RRB-

-RRB-

n

Op

THEN

NR

NR

-LSB-

f

-LRB-

-RRB-

g

LR

-LRB-

-LRB-

-RRB-

-RRB-

-LRB-

LP

-LRB-

-RRB-

LQ

-LRB-

-RRB-

-RRB-

n

Op

FI

FI

ELSE

NR

NR

-LSB-

f

-LRB-

-RRB-

g

LR

-LRB-

-LRB-

-RRB-

-RRB-

LP

-LRB-

-RRB-

LQ

-LRB-

-RRB-

FI

OD

FORALL

-LRB-

-RRB-

NR

DO

IF

LR

-LRB-

-LRB-

-RRB-

-RRB-

Op

THEN

ER

ER

-LSB-

f

-LRB-

-LRB-

-RRB-

-LRB-

l

-LRB-

-RRB-

l

-LRB-

-RRB-

-RRB-

-RRB-

-LRB-

-LRB-

-RRB-

-LRB-

r

-LRB-

-RRB-

r

-LRB-

-RRB-

-RRB-

-RRB-

g

FI

OD

END

where

PROCEDURE

initialize

-LCB-

jstfd

-LRB-

P

Q

PDfin

-RRB-

BEGIN

FORALL

-LRB-

-RRB-

NP

NQ

DO

jstfd

-LRB-

-RRB-

false

OD

END

FUNCTION

justified

-LRB-

NP

NQ

-RRB-

Boolean

BEGIN

IF

jstfd

-LRB-

-RRB-

undefined

THEN

compute

-LCB-

justified

-LRB-

-RRB-

FI

justified

jstfd

-LRB-

-RRB-

END

PROCEDURE

compute

-LCB-

justified

-LRB-

NP

NQ

-RRB-

BEGIN

IF

LP

-LRB-

-RRB-

LQ

-LRB-

-RRB-

THEN

jstfd

-LRB-

-RRB-

false

ELSE

IF

LP

-LRB-

-RRB-

LQ

-LRB-

-RRB-

-LRB-

V

-LSB-

C

-RRB-

THEN

jstfd

-LRB-

-RRB-

true

ELSE

jstfd

-LRB-

-RRB-

justified

-LRB-

l

-LRB-

-RRB-

l

-LRB-

-RRB-

-RRB-

justified

-LRB-

r

-LRB-

-RRB-

r

-LRB-

-RRB-

-RRB-

FI

FI

END

Algorithm

A.

-LRB-

Computation

of

Relevant

Terms

-LRB-

Step

-LRB-

ii

-RRB-

-RRB-

-RRB-

Input

A

flow

graph

G

-LRB-

N

E

s

e

-RRB-

whose

nodes

are

annotated

with

the

preDAGs

and

post-DAGs

computed

by

Algorithm

BEGIN

Q

P

initialize

-LCB-

hashtables

-LRB-

Q

-RRB-

FORALL

T

Trg

DO

initialize

-LCB-

mark

-LRB-

T

-RRB-

root

-LRB-

T

-RRB-

determine

-LCB-

roots

-LRB-

T

-RRB-

extend

-LCB-

preDAG

-LRB-

root

-LRB-

T

-RRB-

-RRB-

OD

execute

-LCB-

assign

END

where

PROCEDURE

initialize

-LCB-

mark

-LRB-

D

PDfin

-RRB-

BEGIN

FORALL

ND

DO

mark

-LRB-

-RRB-

false

OD

END

FUNCTION

determine

-LCB-

roots

-LRB-

D

PDfin

-RRB-

SET

OF

DAGnodes

VAR

roots

SET

OF

DAGnodes

BEGIN

roots

FORALL

ND

DO

IF

is

-LCB-

root

-LRB-

-RRB-

THEN

roots

roots

-LSB-

f

g

FI

OD

determine

-LCB-

roots

roots

END

PROCEDURE

extend

-LCB-

preDAG

-LRB-

NT

-RRB-

VAR

left

right

father

DAGnodes

BEGIN

IF

mark

-LRB-

-RRB-

THEN

mark

-LRB-

-RRB-

true

IF

is

-LCB-

leaf

-LRB-

-RRB-

THEN

LET

z

LT

-LRB-

-RRB-

BEGIN

IF

get

-LCB-

vc

-LCB-

node

-LRB-

z

-RRB-

NQ

THEN

ptr

-LRB-

-RRB-

get

-LCB-

vc

-LCB-

node

-LRB-

z

-RRB-

ELSE

NQ

NQ

-LSB-

f

g

LQ

-LRB-

-RRB-

LT

-LRB-

-RRB-

ptr

-LRB-

-RRB-

update

-LCB-

hashtables

-LRB-

-RRB-

FI

END

ELSE

extend

-LCB-

preDAG

-LRB-

l

-LRB-

-RRB-

-RRB-

extend

-LCB-

preDAG

-LRB-

r

-LRB-

-RRB-

-RRB-

left

ptr

-LRB-

l

-LRB-

-RRB-

-RRB-

right

ptr

-LRB-

r

-LRB-

-RRB-

-RRB-

father

get

-LCB-

op

-LCB-

node

-LRB-

LT

-LRB-

-RRB-

Op

left

right

-RRB-

IF

father

NQ

THEN

ptr

-LRB-

-RRB-

father

ELSE

NQ

NQ

-LSB-

f

g

LQ

-LRB-

-RRB-

LT

-LRB-

-RRB-

EQ

EQ

-LSB-

f

-LRB-

left

-RRB-

-LRB-

right

-RRB-

g

ptr

-LRB-

-RRB-

update

-LCB-

hashtables

-LRB-

-RRB-

FI

FI

FI

END

PROCEDURE

execute

-LCB-

assign

VAR

DAGnodes

SET

OF

DAGnodes

BEGIN

FORALL

x

xrg

DO

get

-LCB-

vc

-LCB-

node

-LRB-

x

-RRB-

IF

NQ

THEN

LQ

-LRB-

-RRB-

LQ

-LRB-

-RRB-

nfxg

-LSB-

f

g

FI

-LRB-

Let

T

be

the

right

hand

side

term

corresponding

to

x

-RRB-

LQ

-LRB-

ptr

-LRB-

root

-LRB-

T

-RRB-

-RRB-

-RRB-

LQ

-LRB-

ptr

-LRB-

root

-LRB-

T

-RRB-

-RRB-

-RRB-

-LSB-

fxg

OD

FORALL

DO

IF

LQ

-LRB-

-RRB-

THEN

reconstruct

-LRB-

-RRB-

FI

OD

END

-LSB-

KU

-RSB-

J.

B.

Kam

and

J.

D.

Ullman

Monotone

Data

Flow

Analysis

Frameworks

Acta

Informatica

-LSB-

MR

-RSB-

E.

Morel

and

C.

Renvoise

Global

Optimization

by

Suppression

of

Partial

Redundancies

Communications

of

the

ACM

-LRB-

-RRB-

-LSB-

-RSB-

R.

Paige

Formal

Differentiation

A

Program

Synthesis

Technique

UMI

Research

Press

-LSB-

-RSB-

R.

Paige

Transformational

Programming

-LCB-

Applications

to

Algorithms

and

Systems

POPL

Austin

Texas

-LSB-

PK

-RSB-

R.

Paige

and

S.

Koenig

Finite

Differencing

of

Computable

Expressions

ACM

Transactions

on

Programming

Languages

and

Systems

Vol

No.

-LSB-

RWZ

-RSB-

B.

K.

Rosen

M.

N.

Wegman

and

F.

K.

Zadeck

Global

Value

Numbers

and

Redundant

Computations

POPL

San

Diego

California

-LSB-

-RSB-

B.

Steffen

Optimal

Run

Time

Optimization

Proved

by

a

New

Look

at

Abstract

Interpretations

TAPSOFT

Pisa

Italy

LNCS

-LSB-

-RSB-

B.

Steffen

Abstrakte

Interpretationen

beim

Optimieren

von

Programmlaufzeiten

Ein

Optimalit?atskonzept

und

seine

Anwendung

PhD

thesis

ChristianAlbrechts-Universit

at

Kiel

Germany

-LSB-

-RSB-

B.

Steffen

Data

Flow

Analysis

as

Model

Checking

In

Proceedings

TACS

LNCS

Sendai

Japan

-LSB-

-RSB-

B.

Steffen

and

J.

Knoop

Finite

Constants

Characterizations

of

a

New

Decidable

Set

of

Constants

MFCS

Por?abka

Kozubnik

Poland

LNCS

-LSB-

-RSB-

B.

Steffen

and

J.

Knoop

Finite

Constants

Characterizations

of

a

New

Decidable

Set

of

Constants

Extended

version

of

-LSB-

-RSB-

TCS

-LSB-

-RSB-

B.

Steffen

J.

Knoop

and

O.

R?uthing

The

Value

Flow

Graph

A

Program

Representation

for

Optimal

Program

Transformations

ESOP

Copenhagen

Denmark

LNCS

-LSB-

-RSB-

B.

Steffen

J.

Knoop

and

O.

R?uthing

Efficient

Code

Motion

and

an

Adaption

to

Strength

Reduction

TAPSOFT

Brighton

United

Kingdom

LNCS

A

Appendix

A.

The

First

Stage

Algorithms

Algorithm

A.

-LRB-

The

Local

Analysis

Component

-LSB-

-LSB-

-RSB-

-RSB-

-RRB-

Input

A

node

n

of

a

flow

graph

G

representing

the

parallel

assignment

-LRB-

xr

-RRB-

-LRB-

tr

-RRB-

where

the

right

hand

side

terms

tr

are

represented

as

structured

partition

DAGs

Ti

-LRB-

NTi

ETi

LTi

-RRB-

and

a

finite

structured

partition

DAG

P

-LRB-

NP

EP

LP

-RRB-

which

represents

the

valid

term

equivalences

before

the

execution

of

node

n.

Output

The

finite

structured

partition

DAG

Q

-LRB-

NQ

EQ

LQ

-RRB-

defined

by

-LSB-

-LSB-

n

-RSB-

-RSB-

-LRB-

P

-RRB-

Remark

The

following

auxiliary

procedures

and

variables

are

used

ffl

initialize

-LCB-

hashtables

generates

two

hashtables

for

Q

The

first

one

allows

to

find

every

inner

node

of

Q

in

constant

time

and

the

second

one

to

find

that

node

of

Q

which

is

labeled

with

a

special

constant

or

variable

in

constant

time

ffl

get

-LCB-

vc

-LCB-

node

given

a

variable

or

constant

as

argument

get

-LCB-

vc

-LCB-

node

yields

that

node

of

Q

which

is

labeled

by

the

argument

if

such

a

node

exists

otherwise

get

-LCB-

vc

-LCB-

node

delivers

a

special

node

not

in

NQ

ffl

get

-LCB-

op

-LCB-

node

given

two

nodes

of

NQ

and

an

operator

symbol

get

-LCB-

op

-LCB-

node

yields

that

node

of

Q

which

is

labeled

by

the

operator

and

whose

sons

are

the

two

argument

nodes

if

such

a

node

exists

otherwise

get

-LCB-

op

-LCB-

node

delivers

a

special

node

not

in

NQ

ffl

update

-LCB-

hashtables

having

extended

Q

by

a

new

node

update

-LCB-

hashtables

updates

the

hashtables

mentioned

above

ffl

is

-LCB-

leaf

given

a

node

of

a

structured

partition

DAG

is

-LCB-

leaf

determines

whether

this

node

is

a

leaf

or

not

ffl

is

-LCB-

root

given

a

node

of

a

structured

partition

DAG

is

-LCB-

root

determines

whether

this

node

is

a

root

or

not

ffl

mark

-LRB-

-RRB-

ptr

-LRB-

-RRB-

with

every

node

of

a

right

hand

side

term

the

auxiliary

variables

mark

-LRB-

-RRB-

and

ptr

-LRB-

-RRB-

are

associated

The

first

variable

indicates

whether

the

node

has

already

been

processed

the

second

variable

contains

a

pointer

-LRB-

indicated

by

-RRB-

to

that

node

of

Q

labeled

with

the

term

which

is

represented

by

node

ffl

root

-LRB-

T

-RRB-

roots

-LRB-

Q

-RRB-

denote

two

auxiliary

variables

of

the

type

DAGnode

and

set

of

DAGnodes

respectively

-LRB-

here

we

identify

a

set

with

one

element

with

its

element

-RRB-

ffl

pred

-LRB-

-RRB-

df

f

j

-LRB-

-RRB-

EQg

and

succ

-LRB-

-RRB-

df

f

j

-LRB-

-RRB-

EQg

denote

the

set

of

all

predecessors

and

successors

of

a

node

NQ

respectively

Figure

a

-RRB-

Locally

Updating

m

l

-LRB-

q

h

-RRB-

-LRB-

j

-RRB-

p

h

p

h

j

j

h

h

j

j

h

h

j

h

j

j

h

h

b

-RRB-

Globally

Updating

m

l

-LRB-

q

h

-RRB-

-LRB-

j

-RRB-

p

h

p

h

j

j

j

j

h

h

j

j

j

h

q

Conclusions

We

have

presented

an

algorithm

that

uniformly

combines

strength

reduction

and

semantic

code

motion

on

the

basis

of

optimally

moving

computations

within

programs

with

respect

to

the

Herbrand

equivalence

In

addition

to

the

algorithm

of

-LSB-

-RSB-

which

generalizes

and

improves

previous

techniques

for

common

subexpression

elimination

partial

redundancy

elimination

and

loop

invariant

code

motion

the

new

algorithm

also

improves

on

all

classical

techniques

for

strength

reduction

in

that

it

overcomes

their

restrictions

concerning

admissible

program

structures

-LRB-

previously

detected

loops

-RRB-

and

admissible

term

structures

-LRB-

built

of

induction

variables

and

region

constants

-RRB-

The

development

of

this

algorithm

profited

from

the

modular

structure

of

the

underlying

code

motion

algorithm

-LRB-

cf.

-LSB-

-RSB-

-RRB-

which

has

been

maintained

in

this

extension

This

supports

further

extensions

For

example

it

is

straightforward

to

extend

the

algorithm

's

strength

reduction

capacity

to

further

operators

e.g.

to

capture

the

reduction

of

exponentiations

to

Moreover

extensions

to

further

optimization

goals

like

constant

propagation

and

constant

folding

-LRB-

-LSB-

-RSB-

-RRB-

can

be

obtained

by

strengthening

the

analyis

capacity

of

the

first

stage

We

are

also

investigating

an

adaption

of

the

lazy

placing

strategy

realized

by

the

syntactically

based

code

motion

and

strength

reduction

algorithms

of

-LSB-

-RSB-

to

the

semantically

based

algorithm

here

in

order

to

minimize

the

lifetimes

of

auxiliary

variables

However

without

this

assumption

it

would

insert

the

assignment

h

j

on

the

edge

leaving

node

instead

of

the

insertions

at

node

and

And

in

this

case

there

would

be

no

positive

effect

on

the

run-time

efficiency

at

all

examples

can

be

found

in

-LSB-

ACK

-RSB-

Acknowledgements

The

presentation

in

this

paper

profited

from

discussions

with

Robert

Paige

References

-LSB-

All

-RSB-

F.

E.

Allen

Control

Flow

Analysis

ACM

Sigplan

Notices

July

-LSB-

ACK

-RSB-

F.

E.

Allen

J.

Cocke

and

K.

Kennedy

Reduction

of

Operator

Strength

In

St.

S.

Muchnick

and

N.

D.

Jones

-LRB-

Eds

-RRB-

Program

Flow

Analysis

Theory

and

Applications

Prentice

Hall

Inc.

Englewood

Cliffs

New

Jersey

-LSB-

Ch

-RSB-

G.

J.

Chaitin

Register

Allocation

and

Spilling

via

Graph

Coloring

SIGPLAN

Notices

-LRB-

-RRB-

-LSB-

CACCHM

-RSB-

G.

J.

Chaitin

M.

A.

Auslander

A.

K.

Chandra

J.

Cocke

M.

E.

Hopkins

and

P.

W.

Markstein

Register

Allocation

via

Coloring

Computer

Languages

Vol

-LSB-

CK

-RSB-

J.

Cocke

and

K.

Kennedy

An

Algorithm

for

Reduction

of

Operator

Strength

Communications

of

the

ACM

-LRB-

-RRB-

-LSB-

CP

-RSB-

J.

Cai

and

R.

Paige

Look

Ma

No

Hashing

And

No

Arrays

Neither

POPL

Orlando

Florida

-LSB-

FKU

-RSB-

A.

Fong

J.

B.

Kam

and

J.

D.

Ullman

Application

of

Lattice

Algebra

to

Loop

Optimization

POPL

Palo

Alto

California

-LSB-

-RSB-

S.

M.

Joshi

and

D.

M.

Dhamdhere

A

Composite

Hoisting-Strength

Reduction

Transformation

for

Global

Program

Optimization

-LCB-

Part

I

Internat

J.

Computer

Math

-LSB-

-RSB-

S.

M.

Joshi

and

D.

M.

Dhamdhere

A

Composite

Hoisting-Strength

Reduction

Transformation

for

Global

Program

Optimization

-LCB-

Part

II

Internat

J.

Computer

Math

-LSB-

-RSB-

G.

A.

Kildall

Global

Expression

Optimization

during

Compilation

Technical

Report

No.

University

of

Washington

Computer

Science

Group

Seattle

Washington

-LSB-

-RSB-

G.

A.

Kildall

A

Unified

Approach

to

Global

Program

Optimization

POPL

Boston

Massachusetts

-LSB-

-RSB-

J.

Knoop

O.

R?uthing

and

B.

Steffen

Lazy

Code

Motion

Submitted

to

SIG

PLAN

-LSB-

KS

-RSB-

J.

Knoop

and

B.

Steffen

Efficient

and

Optimal

Interprocedural

Bit-Vector

Data

Flow

Analyses

A

Uniform

Interprocedural

Framework

Submitted

to

ICCL

replace

the

initialization

term

of

by

the

auxiliary

variable

storing

the

value

of

at

the

insertion

point

This

procedure

avoids

the

introduction

of

totally

redundant

computations

caused

by

the

strength

reduction

transformation

however

it

does

not

avoid

the

introduction

of

partially

redundant

computations

a

problem

we

are

currently

investigating

Splitting

of

initializations

Initializing

different

auxiliary

variables

at

the

same

insertion

point

with

abstract

values

that

are

sharing

common

subvalues

may

cause

the

introduction

of

local

redundancies

This

however

can

easily

be

avoided

by

splitting

all

initializations

into

sequences

of

assignments

that

only

have

a

single

operator

in

their

right

hand

side

expression

Computations

costs

As

usual

for

code

motion

our

algorithm

is

devoted

to

the

costs

of

computations

Costs

of

register

loading

and

storing

however

are

subsequently

taken

care

of

by

variable

subsumption

and

dead

code

elimination

An

algorithm

based

on

the

graph

coloring

techniques

of

-LSB-

Ch

CACCHM

-RSB-

is

implemented

for

this

purpose

Related

Work

Strength

reduction

was

pioneered

by

Cocke

and

Kennedy

-LSB-

CK

-RSB-

and

later

on

generalized

and

improved

in

particular

by

Allen

Cocke

and

Kennedy

-LSB-

ACK

-RSB-

and

Joshi

and

Dhamdhere

-LSB-

-RSB-

All

these

approaches

which

characterize

the

state

of

the

art

are

ffl

Syntactic

they

optimize

term

by

term

without

exploiting

semantic

equivalences

between

syntactically

different

terms

ffl

Locally

updating

they

insert

update

assignments

whenever

an

operand

of

a

candidate

expression

for

strength

reduction

is

redefined

without

investigating

the

global

context

for

the

necessity

of

this

update

This

may

introduce

terms

whose

values

are

not

computed

in

the

original

program

Thus

the

resulting

program

transformation

can

not

be

guaranteed

to

be

safe

or

to

improve

run-time

efficiency

ffl

Structurally

restricted

-LSB-

CK

ACK

-RSB-

work

only

for

previously

detected

loops

and

terms

built

from

induction

variables

and

region

constants

which

excludes

the

optimization

of

more

general

program

structures

In

contrast

-LSB-

-RSB-

work

for

arbitrary

control

flow

structures

and

terms

composed

of

variables

and

program

constants

They

pay

for

their

ability

to

deal

with

general

program

structures

by

requiring

an

unnecessarily

strong

notion

of

admissible

term

structure

In

contrast

our

algorithm

is

ffl

Semantic

it

exploits

semantic

equivalence

between

syntactically

different

terms

ffl

Globally

updating

update

assignments

are

only

inserted

if

they

are

required

by

the

global

context

This

guarantees

that

the

resulting

program

transformation

is

safe

and

that

it

improves

the

run-time

efficiency

of

the

original

program

efficient

hash-free

solution

to

the

strength

reduction

transformation

of

-LSB-

CK

-RSB-

is

presented

in

-LSB-

CP

-RSB-

ffl

General

it

works

for

arbitrary

program

structures

without

requiring

additional

constraints

concerning

admissible

term

To

our

knowledge

of

these

points

has

been

realized

in

a

strength

reduction

algorithm

before

In

fact

also

the

-LRB-

significantly

different

-RRB-

approach

of

-LSB-

PK

-RSB-

the

finite

differencing

fails

these

points

Its

major

achievement

is

the

generalization

of

strength

reduction

to

non-numerical

applications

which

we

do

not

consider

here

Whereas

the

predicates

syntactic

semantic

structurally

restricted

and

general

are

self-explaining

locally

updating

and

globally

updating

need

some

more

explanation

We

will

therefore

illustrate

these

two

predicates

by

means

of

a

simplified

version

of

an

example

given

in

-LSB-

-RSB-

Figure

q

-LRB-

m

l

-RRB-

p

j

p

j

j

j

j

j

j

m

l

j

j

In

the

flow

graph

above

the

computation

of

j

in

node

and

is

a

candidate

expression

for

strength

reduction

Local

updating

requires

to

insert

for

every

redefinition

of

an

operand

of

a

candidate

expression

e

a

redefinition

of

the

auxiliary

variable

h

This

guarantees

h

always

to

hold

the

value

of

e

even

at

places

where

it

is

not

going

to

be

used

Therefore

a

locally

updating

transformation

can

not

arrive

at

a

better

result

than

the

flow

graph

shown

in

Figure

-LRB-

a

-RRB-

where

a

computation

is

introduced

whose

value

is

not

computed

in

the

original

program

namely

the

value

of

the

computation

of

h

at

node

Hence

the

transformation

is

not

safe

Moreover

it

even

impairs

the

run-time

efficiency

on

path

-LRB-

-RRB-

one

multiplication

is

saved

but

a

multiplication

and

an

addition

is

inserted

and

on

path

-LRB-

-RRB-

a

multiplication

is

saved

on

the

costs

of

two

inserted

additions

whose

added

computation

costs

may

exceed

those

of

the

saved

Our

algorithm

is

unique

in

producing

the

flow

graph

of

Figure

-LRB-

b

-RRB-

do

not

even

need

region

constants

because

strength

reduction

is

completely

reduced

to

the

availability

of

-LRB-

abstract

-RRB-

values

in

our

algorithm

transformation

is

realized

by

the

algorithms

of

-LSB-

PK

-RSB-

whereas

the

algorithms

of

-LSB-

ACK

CK

CP

-RSB-

leave

the

flow

graph

unchanged

because

j

is

due

to

the

assignment

j

m

l

in

node

not

an

induction

variable

-LRB-

cf.

-LSB-

CK

-RSB-

-RRB-

algorithm

of

-LSB-

-RSB-

deals

with

these

problems

using

a

machine

dependent

heuristics

assuming

that

the

computation

costs

of

two

additions

are

less

expensive

than

those

of

a

multiplication

it

would

insert

within

the

loop

the

assignments

h

j

on

the

edge

leaving

node

h

h

at

node

and

h

h

at

node

This

transformation

would

improve

the

left

part

of

the

loop

construct

Distributivity

The

predicate

Distr

-LRB-

Distributivity

-RRB-

establishes

a

relationship

between

candidates

for

strength

reduction

-LRB-

given

by

terms

of

having

as

top

most

operator

-RRB-

and

abstract

values

-LRB-

given

by

terms

of

and

-RRB-

whose

sum

is

equivalent

to

the

abstract

value

of

the

candidate

Distr

-LRB-

-RRB-

-LRB-

-RRB-

N

-LRB-

-RRB-

N

-LRB-

-RRB-

N

-LRB-

-RRB-

Insert

-LRB-

-RRB-

Avail

-LRB-

-RRB-

Avail

-LRB-

-RRB-

Lpre

-LRB-

N

-LRB-

-RRB-

-RRB-

-LRB-

-RRB-

f?g

Tpre

-LRB-

N

-LRB-

-RRB-

-RRB-

-LRB-

-RRB-

Tpre

-LRB-

N

-LRB-

-RRB-

-RRB-

-LRB-

-RRB-

-LRB-

-RRB-

-LRB-

Tpre

-LRB-

N

-LRB-

-RRB-

-RRB-

-LRB-

-RRB-

-RRB-

For

notational

convenience

we

define

the

predicates

SR-Insert

and

SR-Usable

that

are

directly

derived

from

Distr

SR-Insert

-LRB-

-RRB-

-LRB-

-RRB-

VFN

Distr

-LRB-

-RRB-

SR-Usable

-LRB-

-RRB-

-LRB-

-RRB-

VFN

Distr

-LRB-

-RRB-

The

intuitive

meaning

of

the

predicates

SR-Insert

-LRB-

Strength

Reduction

Insertion

-RRB-

and

SR-Usable

-LRB-

Usable

for

a

Strength

Reduction

Insertion

-RRB-

is

the

following

whenever

an

abstract

value

satisfies

the

predicate

SR-Insert

then

there

exist

two

further

abstract

values

and

satisfying

the

predicate

SR-Usable

whose

sum

is

equal

to

the

abstract

value

of

This

allows

us

to

perform

the

strength

reduction

transformation

i.e.

to

choose

a

term

for

initialization

which

has

as

top

most

operator

and

initialization

terms

of

and

as

operands

instead

of

the

standard

minimal

representative

of

which

has

as

top

most

operator

Note

that

due

to

the

availability

of

and

this

choice

is

provably

safe

and

it

improves

the

run-time

efficiency

This

is

a

consequence

of

the

fact

that

our

transformation

guarantees

that

abstract

values

satisfying

the

availability

predicate

and

being

required

by

a

strength

reduction

insertion

are

hold

in

auxiliary

variables

at

the

insertion

points

-LRB-

cf.

Algorithm

A.

-RRB-

Obviously

there

is

no

better

choice

of

initialization

terms

Proposition

-LRB-

Computation

Forms

-RRB-

The

computation

forms

-LRB-

initialization

terms

-RRB-

are

optimal

with

respect

to

the

convertibility

relation

and

the

local

equivalence

information

expressed

by

the

value

flow

graph

under

consideration

Every

flow

graph

that

is

transformed

by

our

two

stage

algorithm

has

essentially

the

same

computations

points

as

the

flow

graph

that

results

from

the

algorithm

of

-LSB-

-RSB-

applied

to

the

same

value

flow

graph

Slight

differences

which

do

not

affect

the

efficiency

of

the

resulting

program

are

only

due

to

the

fact

that

the

algorithm

of

-LSB-

-RSB-

inserts

computations

at

node

exits

rather

than

at

node

entries

as

it

is

done

here

Initialization

terms

however

differ

significantly

because

of

the

greater

flexibility

in

the

choice

of

the

initialization

terms

here

Placing

the

Computations

The

placement

Algorithm

A.

is

a

straightforward

adaption

of

the

placement

algorithm

of

-LSB-

-RSB-

It

proceeds

in

three

steps

Marking

the

definition-use

chains

in

the

value

flow

graph

All

nodes

of

the

value

flow

graph

that

occur

on

paths

leading

from

nodes

satisfying

Insert

to

nodes

satisfying

Antloc

or

SR-Usable

are

marked

Allocating

auxiliary

variables

Every

marked

node

of

the

value

flow

graph

is

associated

with

an

auxiliary

variable

This

is

a

new

auxiliary

variable

if

the

marked

node

either

satisfies

Insert

or

has

more

than

one

predecessor

in

the

value

flow

graph

Otherwise

the

auxiliary

variable

of

its

unique

predecessor

in

the

value

flow

graph

is

taken

Transforming

the

flow

graph

Auxiliary

variables

associated

with

a

node

of

the

value

flow

graph

satisfying

Insert

are

initialized

by

their

initialization

terms

-LRB-

cf.

Section

-RRB-

If

two

marked

nodes

which

are

associated

with

different

auxiliary

variables

say

hk

and

hl

are

connected

by

an

edge

in

the

value

flow

graph

a

trivial

assignment

hl

hk

is

added

at

the

end

of

the

first

node

Finally

original

computations

of

the

flow

graph

are

replaced

by

the

corresponding

auxiliary

variables

Pragmatics

In

this

section

we

discuss

some

pragmatic

aspects

of

the

strength

reduction

transformation

introduced

so

far

Second

order

effects

As

mentioned

already

the

algorithm

here

has

a

greater

flexibility

in

the

choice

of

the

initialization

terms

than

the

algorithm

of

-LSB-

-RSB-

This

is

because

of

its

potential

of

replacing

multiplications

by

additions

which

may

lead

to

second

order

effects

-LRB-

cf.

-LSB-

RWZ

-RSB-

-RRB-

replacing

multiplications

by

summations

according

to

the

distributive

law

may

introduce

-LRB-

partial

-RRB-

redundancies

in

the

program

This

is

a

consequence

of

the

fact

that

the

specific

properties

of

and

are

only

considered

by

the

second

stage

of

the

algorithm

but

not

during

the

semantic

analysis

of

the

first

stage

Introducing

the

predicate

SR-Redundant

-LRB-

Redundant

by

the

Strength

Reduction

Transformation

-RRB-

is

sufficient

to

avoid

the

introduction

of

totally

redundant

computations

-LRB-

see

Algorithm

A.

for

details

-RRB-

SR-Redundant

-LRB-

-RRB-

-LRB-

-RRB-

VFN

l

-LRB-

-RRB-

r

-LRB-

-RRB-

Distr

-LRB-

-RRB-

Avail

-LRB-

-RRB-

Lpre

-LRB-

N

-LRB-

-RRB-

-RRB-

-LRB-

-RRB-

f

g

Intuitively

a

pair

of

value

flow

graph

nodes

-LRB-

-RRB-

satisfies

the

predicate

SR-Redundant

if

is

a

candidate

for

strength

reduction

whose

abstract

value

has

an

additive

representation

by

a

term

of

that

is

available

at

the

insertion

point

Therefore

keeping

the

value

of

this

representation

alive

until

the

initialization

point

of

allows

us

to

Let

now

M

df

f

rp

j

p

P

g

and

M

df

f

i

j

p

P

and

i

rp

g

Then

investigating

Equation

System

and

-LRB-

-RRB-

we

immediately

obtain

for

all

nodes

of

M

:D

Safe

-LRB-

-RRB-

This

however

yields

together

with

-LRB-

-RRB-

and

the

consistency

condition

of

Equation

System

also

:D

Safe

-LRB-

-RRB-

for

all

M

and

therefore

a

contradiction

because

of

M

-LSB-

M

Earliestness

Earliestness

of

a

placement

is

defined

as

follows

Definition

-LRB-

Earliestness

-RRB-

The

placement

of

an

abstract

value

VFN

is

earliest

at

the

entry

of

node

N

-LRB-

-RRB-

if

there

is

a

path

p

-LRB-

nq

-RRB-

P

-LSB-

s

N

-LRB-

-RRB-

-RRB-

and

a

path

p

-LRB-

r

-RRB-

PVFG

-LSB-

-RRB-

corresponding

to

a

postfix

of

p

-LRB-

i.e.

N

-LRB-

i

-RRB-

ni

-LRB-

q?r

-RRB-

i

rg

-RRB-

such

that

VFN

s

and

for

all

i

rg

the

abstract

value

i

is

not

down-safe

at

N

-LRB-

i

-RRB-

The

set

of

earliest

computation

points

for

an

abstract

value

is

given

by

the

least

solution

of

Equation

System

which

specifies

a

forward

analysis

of

VFG

As

Equation

System

it

is

a

straightforward

adaption

of

the

corresponding

equation

systems

of

-LSB-

-RSB-

which

are

tailored

for

flow

graphs

to

value

flow

graphs

here

in

order

to

capture

semantic

equivalence

of

terms

Equation

System

-LRB-

Earliestness

-RRB-

EARLIEST

-LRB-

-RRB-

true

if

VFN

s

P

predVFG

-LRB-

-RRB-

:D

Safe

-LRB-

-RRB-

EARLIEST

-LRB-

-RRB-

otherwise

Denoting

the

least

solution

of

Equation

System

by

Earliest

we

have

Lemma

-LRB-

Earliestness

-RRB-

The

placement

of

an

abstract

value

VFN

is

earliest

at

the

entry

of

node

N

-LRB-

-RRB-

if

and

only

if

Earliest

-LRB-

-RRB-

holds

The

proof

of

Lemma

is

similar

to

the

one

of

Lemma

and

is

therefore

omitted

The

computation

points

are

now

determined

by

Insert

-LRB-

-RRB-

df

D-Safe

-LRB-

-RRB-

Earliest

-LRB-

-RRB-

Applying

Lemma

and

Lemma

we

obtain

the

following

theorem

which

guarantees

that

the

program

resulting

from

these

computation

points

can

not

be

improved

any

further

by

means

of

semantics

preserving

code

motion

with

respect

to

the

value

flow

graph

under

consideration

-LRB-

cf.

-LSB-

-RSB-

-RRB-

Theorem

-LRB-

Computation

Points

-RRB-

The

computation

points

satisfying

Insert

-LRB-

-RRB-

are

the

earliest

down-safe

computation

points

for

the

abstract

value

The

proof

of

the

following

lemma

is

similar

to

that

of

Lemma

Lemma

Algorithm

A.

and

Algorithm

A.

terminate

with

VFN

D-Safe

-LRB-

-RRB-

d-safe

-LSB-

-RSB-

Earliest

-LRB-

-RRB-

earliest

-LSB-

-RSB-

Choosing

Computation

Forms

In

this

step

we

determine

for

every

value

flow

graph

node

satisfying

the

predicate

Insert

an

initialization

term

-LRB-

computation

form

-RRB-

i.e.

a

term

with

minimal

executions

costs

that

represents

the

abstract

value

of

the

equivalence

class

In

the

case

of

the

Herbrand

interpretation

an

initialization

term

is

just

a

minimal

representative

of

-LRB-

cf.

-LSB-

-RSB-

-RRB-

However

in

order

to

capture

the

effects

of

strength

reduction

a

more

careful

choice

is

necessary

As

mentioned

already

the

essence

of

classical

strength

reduction

is

the

combination

of

availability

and

distributivity

This

is

reflected

by

introducing

the

two

predicates

Avail

and

Distr

that

are

concerned

with

the

availability

of

abstract

values

and

the

distributivity

of

terms

respectively

Availability

Intuitively

an

abstract

value

is

available

at

the

entry

of

node

N

-LRB-

-RRB-

if

it

is

computed

on

every

path

from

the

start

node

of

the

program

reaching

node

N

-LRB-

-RRB-

Usually

availability

is

determined

with

respect

to

the

original

computations

of

a

program

Here

however

it

is

computed

with

respect

to

the

computation

points

determined

in

the

previous

step

-LRB-

cf.

Section

-RRB-

Thus

it

means

availability

after

the

code

motion

transformation

here

which

in

terms

of

the

original

computations

of

the

program

can

be

considered

as

potential

availability

Definition

-LRB-

Availability

-RRB-

An

abstract

value

VFN

is

available

at

the

entry

of

node

N

-LRB-

-RRB-

if

every

path

p

-LRB-

nq

-RRB-

P

-LSB-

s

N

-LRB-

-RRB-

-RSB-

has

a

postfix

with

a

corresponding

path

p

-LRB-

r

-RRB-

PVFG

-LSB-

-RSB-

-LRB-

i.e.

N

-LRB-

i

-RRB-

ni

-LRB-

q?r

-RRB-

i

rg

-RRB-

such

that

Insert

-LRB-

-RRB-

holds

The

availability

predicate

Avail

is

defined

as

the

greatest

solution

of

Equation

System

whose

computation

requires

a

forward

analysis

of

VFG

Equation

System

-LRB-

Availability

-RRB-

AVAIL

-LRB-

-RRB-

Insert

-LRB-

-RRB-

if

VFN

s

Insert

-LRB-

-RRB-

Q

-LRB-

-RRB-

AVAIL

-LRB-

-RRB-

otherwise

We

have

Lemma

-LRB-

Availability

-RRB-

An

abstract

value

is

available

at

the

entry

of

node

N

-LRB-

-RRB-

if

and

only

if

Avail

-LRB-

-RRB-

holds

Whereas

Lemma

can

be

proved

in

the

same

way

as

Lemma

the

proof

of

the

following

lemma

is

similar

to

that

of

Lemma

Lemma

Algorithm

A.

terminates

with

VFN

Avail

-LRB-

-RRB-

avail

-LSB-

-RSB-

Determination

of

Computation

Points

and

Forms

The

determination

of

computation

points

and

forms

is

split

into

two

steps

First

determining

the

computation

points

with

respect

to

the

equivalence

information

expressed

by

the

value

flow

graph

under

consideration

and

second

choosing

the

computation

forms

for

the

computation

points

computed

in

the

first

step

The

first

step

is

essentially

the

same

as

in

-LSB-

-RSB-

Only

the

bi-directional

character

of

the

equation

system

there

is

decomposed

here

into

a

backward

and

a

forward

analysis

along

the

lines

of

-LSB-

KS

-RSB-

This

decomposition

does

not

affect

the

result

of

the

analysis

at

all

The

second

step

however

has

to

be

modified

significantly

here

in

comparison

to

-LSB-

-RSB-

in

order

to

capture

strength

reduction

In

fact

this

step

has

been

trivial

in

-LSB-

-RSB-

where

computation

forms

are

simply

minimal

representatives

of

the

Herbrand

equivalence

classes

associated

with

the

computation

points

However

in

the

context

of

strength

reduction

this

choice

is

much

more

elaborate

because

semantic

equations

need

to

be

exploited

in

order

to

take

care

of

replacing

expensive

by

cheap

operations

-LRB-

cf.

Proposition

-RRB-

Determining

Computation

Points

The

point

of

this

step

is

to

determine

for

every

abstract

value

of

the

value

flow

graph

under

consideration

its

earliest

down-safe

computation

points

Intuitively

down-safe

means

that

is

used

on

every

terminating

path

starting

at

the

considered

point

This

is

a

necessary

requirement

for

computation

points

in

order

to

guaranteethat

the

program

semantics

is

preserved

Earliest

means

that

a

placement

at

an

earlier

position

would

not

be

down-safe

and

therefore

would

change

the

program

semantics

by

introducing

the

computation

of

a

new

abstract

value

on

a

path

Earliestness

guarantees

optimality

of

the

placement

Down-Safety

For

every

abstract

value

we

define

a

local

predicate

indicating

whether

is

used

in

N

-LRB-

-RRB-

or

not

Antloc

-LRB-

-RRB-

-LRB-

-RRB-

Tpre

-LRB-

N

-LRB-

-RRB-

-RRB-

-LRB-

-RRB-

T

-LRB-

N

-LRB-

-RRB-

-RRB-

As

mentioned

already

down-safety

of

an

abstract

value

at

a

node

n

means

that

it

is

used

on

every

terminating

program

path

starting

at

n.

Definition

-LRB-

Down-Safety

-RRB-

The

placement

of

an

abstract

value

VFN

is

down-safe

at

the

entry

of

node

N

-LRB-

-RRB-

if

every

path

p

-LRB-

nq

-RRB-

P

-LSB-

N

-LRB-

-RRB-

e

-RSB-

has

a

prefix

with

a

corresponding

path

-LRB-

r

-RRB-

PVFG

-LSB-

-RSB-

-LRB-

i.e.

N

-LRB-

i

-RRB-

ni

i

rg

-RRB-

such

that

Antloc

-LRB-

-RRB-

holds

The

set

of

down-safe

computation

points

for

the

abstract

value

is

given

by

the

greatest

solution

of

Equation

System

which

specifies

a

backward

analysis

of

VFG

name

of

this

predicate

stands

for

local

anticipability

-LRB-

cf.

-LSB-

MR

-RSB-

-RRB-

here

means

to

insert

a

computation

of

a

term

t

represented

by

at

the

entry

of

N

-LRB-

-RRB-

Equation

System

-LRB-

Down-Safety

-RRB-

D-SAFE

-LRB-

-RRB-

false

if

N

-LRB-

-RRB-

e

Antloc

-LRB-

-RRB-

Q

succG

-LRB-

N

-LRB-

-RRB-

-RRB-

P

succVFG

-LRB-

-RRB-

N

-LRB-

-RRB-

m

D-SAFE

-LRB-

-RRB-

otherwise

Denoting

the

greatest

solution

of

Equation

System

by

D-Safe

we

have

Lemma

-LRB-

Down-Safety

-RRB-

The

placement

of

an

abstract

value

is

down-safe

at

the

entry

of

node

N

-LRB-

-RRB-

if

and

only

if

D-Safe

-LRB-

-RRB-

holds

Proof

We

first

prove

the

implication

from

the

left

to

the

right

Thus

let

be

an

abstract

value

which

can

down-safely

be

placed

at

the

entry

of

N

-LRB-

-RRB-

Then

according

to

Definition

every

path

p

-LRB-

nq

-RRB-

P

-LSB-

N

-LRB-

-RRB-

e

-RSB-

possess

a

w.l.o.g.

shortest

prefix

with

a

corresponding

path

p

-LRB-

rp

-RRB-

PVFG

-LSB-

-RSB-

satisfying

Antloc

-LRB-

-RRB-

and

N

-LRB-

i

-RRB-

ni

for

i

rpg

Based

on

this

definition

of

rp

with

respect

to

a

path

p

P

-LSB-

N

-LRB-

-RRB-

e

-RSB-

we

define

the

set

of

value

flow

graph

nodes

M

df

MA

-LSB-

MT

VFN

where

MA

df

f

rp

j

p

P

-LSB-

N

-LRB-

-RRB-

e

-RSB-

g

and

MT

df

f

i

j

p

P

-LSB-

N

-LRB-

-RRB-

e

-RSB-

and

i

rp

g

Obviously

we

have

M

MT

succVFG

-LRB-

-RRB-

MT

-LSB-

MA

MA

Antloc

-LRB-

-RRB-

D-Safe

is

defined

as

the

greatest

solution

of

Equation

System

Thus

according

to

-LRB-

-RRB-

it

is

sufficient

to

check

that

D-SAFE

-LRB-

-RRB-

true

M

is

consistent

with

this

equation

system

in

order

to

verify

the

first

implication

For

nodes

MA

this

consistency

is

an

immediate

consequence

of

-LRB-

-RRB-

and

for

nodes

MT

it

easily

follows

from

-LRB-

-RRB-

and

the

consistency

of

D-SAFE

-LRB-

-RRB-

true

for

the

nodes

of

MA

For

the

proof

of

the

remaining

implication

let

satisfy

the

predicate

D-Safe

-LRB-

-RRB-

and

assume

that

there

is

a

path

p

-LRB-

nq

-RRB-

P

-LSB-

n

e

-RSB-

violating

the

lemma

Moreover

let

P

be

the

set

of

maximal

corresponding

paths

to

prefices

of

p

Then

every

path

p

-LRB-

rp

-RRB-

P

satisfies

N

-LRB-

i

-RRB-

ni

i

rp?g

and

N

-LRB-

rp

-RRB-

e

or

nrp

N

-LRB-

succVFG

-LRB-

rp

-RRB-

-RRB-

and

therefore

due

to

the

choice

of

p

and

P

-LRB-

-RRB-

p

P

i

rp?g

Antloc

-LRB-

i

-RRB-

Thus

nodes

of

the

value

flow

graph

are

pairs

-LRB-

-RRB-

where

is

a

node

of

the

preDAG

and

a

node

of

the

post-DAG

for

node

n

of

G

such

that

and

represent

the

same

values

i.e.

satisfy

the

inclusion

Tpre

-LRB-

n

-RRB-

-LRB-

-RRB-

ft

j

Tpost

-LRB-

n

-RRB-

-LRB-

-RRB-

t

ffin

-LRB-

-RRB-

g

In

fact

we

have

the

following

lemma

which

can

easily

be

proved

by

means

of

the

Substitution

Lemma

and

the

Optimality

Theorem

Lemma

-LRB-

VFN-Lemma

-RRB-

VFN

p

P

-LSB-

s

N

-LRB-

-RRB-

-RRB-

Tpre

-LRB-

N

-LRB-

-RRB-

-RRB-

-LRB-

-RRB-

Tpost

-LRB-

N

-LRB-

-RRB-

-RRB-

-LRB-

-RRB-

H

-LRB-

-RRB-

-LRB-

p

-LRB-

-RRB-

-RRB-

H

-LRB-

-RRB-

-LRB-

p

-LRB-

n

-RRB-

-LRB-

-RRB-

-RRB-

This

lemma

motivates

our

decision

to

refer

to

value

flow

graph

nodes

as

abstract

values

because

on

every

path

reaching

node

N

-LRB-

-RRB-

all

terms

represented

by

the

first

and

second

projection

of

have

the

same

value

with

respect

to

the

Herbrand

interpretation

Edges

of

the

value

flow

graph

are

pairs

-LRB-

-RRB-

such

that

N

-LRB-

-RRB-

is

a

successor

of

N

-LRB-

-RRB-

and

values

are

maintained

along

the

connecting

edge

-LRB-

N

-LRB-

-RRB-

N

-LRB-

-RRB-

-RRB-

i.e.

Tpost

-LRB-

N

-LRB-

-RRB-

-RRB-

-LRB-

-RRB-

Tpre

-LRB-

N

-LRB-

-RRB-

-RRB-

-LRB-

-RRB-

Here

we

have

Lemma

-LRB-

VFE-Lemma

-RRB-

-LRB-

-RRB-

VFE

p

P

-LSB-

s

N

-LRB-

-RRB-

-RSB-

Tpost

-LRB-

N

-LRB-

-RRB-

-RRB-

-LRB-

-RRB-

Tpre

-LRB-

N

-LRB-

-RRB-

-RRB-

-LRB-

-RRB-

H

-LRB-

-RRB-

-LRB-

p

-LRB-

-RRB-

-RRB-

H

-LRB-

-RRB-

-LRB-

p

-LRB-

-RRB-

-RRB-

Thus

nodes

of

the

value

flow

graph

model

the

value

flow

over

a

single

assignment

statement

and

edges

the

value

flow

along

the

-LRB-

local

-RRB-

branching

structure

of

G.

See

Figure

for

As

an

inductive

extension

of

the

VFE-Lemma

we

obtain

the

VFG-Lemma

which

expresses

the

central

property

of

a

value

flow

graph

namely

that

it

models

the

value

flow

over

the

global

branching

structure

of

G

In

order

to

define

this

property

precisely

let

PVFG

-LSB-

-RSB-

and

PVFG

-LSB-

-RRB-

denote

the

set

of

all

finite

paths

from

to

and

from

to

a

predecessor

of

in

VFG

respectively

Moreover

let

pVFG

-LRB-

q

-RRB-

PVFG

-LSB-

-RSB-

and

pG

-LRB-

nr

-RRB-

P

-LSB-

n

-RSB-

Then

the

paths

pVFG

and

pG

are

said

to

correspond

to

each

other

if

and

only

if

q

r

and

N

-LRB-

i

-RRB-

ni

i

Denoting

the

corresponding

path

of

pVFG

PVFG

-LSB-

-RSB-

in

P

-LSB-

N

-LRB-

-RRB-

N

-LRB-

-RRB-

-RSB-

by

C

-LSB-

pVFG

-RSB-

and

its

unique

prefix

in

P

-LSB-

N

-LRB-

-RRB-

N

-LRB-

-RRB-

-RRB-

by

C

-LSB-

pVFG

-RRB-

we

obtain

Lemma

-LRB-

VFG-Lemma

-RRB-

pVFG

PVFG

-LSB-

-RSB-

P

-LSB-

s

N

-LRB-

-RRB-

-RRB-

Tpre

-LRB-

N

-LRB-

-RRB-

-RRB-

-LRB-

-RRB-

Tpre

-LRB-

N

-LRB-

-RRB-

-RRB-

-LRB-

-RRB-

H

-LRB-

-RRB-

-LRB-

-LRB-

-RRB-

-RRB-

H

-LRB-

-RRB-

-LRB-

C

-LSB-

pVFG

-RRB-

-LRB-

-RRB-

-RRB-

more

detailed

explanation

can

be

found

in

the

first

part

of

-LSB-

-RSB-

that

every

path

in

PVFG

has

a

corresponding

path

in

G

whereas

the

converse

is

in

general

false

Intuitively

this

yields

that

whenever

a

path

of

the

value

flow

graph

pVFG

corresponds

to

a

part

of

a

program

execution

-LRB-

path

in

the

flow

graph

-RRB-

then

the

abstract

values

of

pVFG

that

belong

to

the

different

steps

of

the

program

execution

represent

the

same

value

We

conclude

this

section

by

introducing

two

abbreviations

VFN

s

df

f

j

N

-LRB-

predVFG

-LRB-

-RRB-

-RRB-

predG

-LRB-

N

-LRB-

-RRB-

-RRB-

N

-LRB-

-RRB-

s

g

and

VFN

e

df

f

j

N

-LRB-

succVFG

-LRB-

-RRB-

-RRB-

succG

-LRB-

N

-LRB-

-RRB-

-RRB-

N

-LRB-

-RRB-

e

g

Here

predVFG

and

succVFG

denote

functions

that

map

a

node

of

VFG

to

its

set

of

predecessors

and

successors

respectively

Placement

of

Computations

Before

going

into

details

let

us

mention

a

technicality

which

is

typical

for

code

motion

-LRB-

cf.

-LSB-

KS

RWZ

-RSB-

-RRB-

Edges

leading

from

a

node

with

more

than

one

successor

to

a

node

with

more

than

one

predecessor

are

critical

since

they

may

block

the

code

motion

process

Figure

a

-RRB-

b

-RRB-

B

BN

B

BN

B

BN

fl

a

b

B

B

B

B

B

BN

a

b

B

BN

B

BN

B

BN

fl

h

a

b

fl

h

a

b

h

B

B

B

B

BN

h

In

Figure

-LRB-

a

-RRB-

the

computation

of

a

b

at

node

is

partially

redundant

with

respect

to

the

computation

of

a

b

at

node

However

this

partial

redundancy

can

not

safely

be

eliminated

by

moving

the

computation

of

a

b

to

its

preceding

nodes

because

this

may

introduce

a

new

computation

on

a

path

leaving

node

on

the

right

branch

On

the

other

hand

it

can

safely

be

eliminated

after

inserting

a

synthetic

node

in

the

critical

edge

-LRB-

-RRB-

as

it

is

illustrated

in

Figure

-LRB-

b

-RRB-

In

order

to

exclude

any

blocking

we

will

therefore

assume

that

every

original

edge

leading

to

a

node

with

more

than

one

predecessor

has

been

split

by

inserting

a

synthetic

node

This

simple

transformation

certainly

implies

that

all

critical

edges

are

eliminated

Moreover

it

simplifies

the

subsequent

analysis

since

it

allows

us

to

meet

our

optimality

result

by

inserting

all

computations

uniformly

at

the

entry

of

critical

edges

would

require

a

placement

procedure

which

is

capable

of

placing

computations

both

at

node

entries

and

exits

On

the

other

hand

if

all

edges

are

split

leaving

a

node

with

more

than

one

successor

the

same

optimality

result

can

be

obtained

by

placing

all

computations

uniformly

at

the

exit

of

nodes

as

it

was

done

in

-LSB-

-RSB-

Thus

after

a

simple

syntactic

transformation

all

placing

strategies

have

the

same

transformational

power

and

here

we

follow

the

placing

strategy

of

-LSB-

-RSB-

with

-LRB-

prek

-LSB-

-RSB-

postk

-LSB-

-RSB-

-RRB-

-LRB-

prek

-LSB-

-RSB-

u

post

k

-LSB-

m

-RSB-

-LSB-

-LSB-

n

-RSB-

-RSB-

-LRB-

prek

-LSB-

-RSB-

u

post

k

-LSB-

m

-RSB-

-RRB-

-RRB-

-LRB-

prek

-LSB-

-RSB-

postk

-LSB-

-RSB-

-RRB-

are

added

to

the

workset

Collecting

the

results

of

the

invariants

-LRB-

-RRB-

and

-LRB-

-RRB-

and

the

fact

that

the

workset

is

empty

after

the

-LRB-

guaranteed

-RRB-

termination

we

obtain

that

pre

-LSB-

n

-RSB-

contains

a

solution

of

Equation

System

after

the

termination

of

Algorithm

Finally

invariant

-LRB-

-RRB-

yields

the

required

maximality

of

this

solution

which

completes

the

proof

of

the

lemma

Theorem

and

Lemma

yield

the

central

result

of

this

section

Theorem

-LRB-

Optimality

Theorem

-RRB-

Algorithm

terminates

with

an

annotation

of

the

flow

graph

with

finite

structured

partition

DAGs

which

semantically

characterizes

all

equivalences

of

program

terms

with

respect

to

the

Herbrand

interpretation

Computation

of

Relevant

Terms

The

placement

process

of

our

algorithm

-LRB-

Section

-RRB-

considers

the

pre-DAGs

and

postDAGs

of

a

flow

graph

annotation

as

purely

syntactical

objects

i.e.

terms

are

considered

equivalent

iff

they

are

syntactically

equivalent

-LRB-

Definition

-LRB-

-RRB-

-RRB-

Thus

we

need

to

extend

the

flow

graph

annotation

constructed

in

Section

which

characterizes

Herbrand

equivalence

semantically

-LRB-

Definition

-LRB-

-RRB-

-RRB-

to

a

sufficiently

large

syntactic

representation

As

in

-LSB-

-RSB-

this

is

achieved

by

computing

for

every

node

n

of

G

a

finite

set

of

relevant

terms

Tsuf

-LRB-

n

-RRB-

that

contains

a

representative

of

all

equivalence

classes

that

are

necessary

at

node

n.

However

in

order

to

capture

-LRB-

classical

-RRB-

strength

reduction

we

additionally

need

to

exploit

algebraic

laws

Remember

classical

strength

reduction

essentially

replaces

computations

of

the

form

u

-LRB-

v

w

-RRB-

by

-LRB-

u

v

-RRB-

-LRB-

u

w

-RRB-

This

is

safe

and

profitable

whenever

the

values

of

u?v

and

u?w

are

available

Therefore

we

consider

a

term

-LRB-

u

v

-RRB-

-LRB-

u

w

-RRB-

and

its

subterms

as

relevant

here

whenever

the

term

u

-LRB-

v

w

-RRB-

is

relevant

in

the

sense

of

-LSB-

-RSB-

Moreover

commutativity

and

associativity

are

necessary

in

order

to

evaluate

subterms

with

constant

operands

whose

values

can

be

computed

already

at

compile

time

This

requires

to

enlarge

the

number

of

relevant

expressions

accordingly

Technically

this

is

realized

by

enhancing

the

strategies

of

-LSB-

-RSB-

for

computing

relevant

terms

by

means

of

the

closure

operator

P

-LRB-

T

-RRB-

P

-LRB-

T

-RRB-

which

is

defined

by

T

-LRB-

T

-RRB-

df

f

j

t

T

t

c

g

where

c

T?T

denotes

a

convertibility

relation

between

terms

c

if

and

only

if

and

can

be

deduced

from

each

other

by

means

of

the

commutative

associative

and

distributive

law

for

and

together

with

the

evaluation

of

subterms

with

constant

operands

In

this

paper

we

consider

the

basic

strategy

of

-LSB-

-RSB-

for

computing

relevant

terms

which

determines

for

every

program

point

the

set

of

all

terms

whose

value

must

be

computed

on

every

continuation

of

a

program

execution

passing

this

point

Enhancing

this

strategy

by

means

of

the

closure

operator

is

already

sufficient

to

uniformly

capture

the

known

strength

reduction

The

complete

closure

algorithm

is

given

in

the

Appendix

-LRB-

see

Algorithm

A.

-RRB-

The

Value

Flow

Graph

The

value

flow

graph

represents

global

equivalence

information

explicitly

Essentially

its

nodes

represent

term

equivalence

classes

and

its

edges

the

data

flow

For

technical

reasons

the

nodes

of

a

value

flow

graph

are

defined

as

pairs

of

equivalence

classes

However

identifying

these

pairs

with

their

first

components

leads

back

to

the

original

intuition

In

the

following

let

us

assume

that

every

node

n

of

G

is

annotated

by

a

pre-DAG

pre

-LRB-

n

-RRB-

and

a

post-DAG

post

-LRB-

n

-RRB-

according

to

the

results

of

Section

For

the

sake

of

readability

we

abbreviate

S

n

-LRB-

Npre

-LRB-

n

-RRB-

Npost

-LRB-

n

-RRB-

-RRB-

by

and

denote

the

flow

graph

node

corresponding

to

a

pair

-LRB-

-RRB-

by

N

-LRB-

-RRB-

This

allows

us

to

define

the

backward

substitution

relation

ffi

by

-LRB-

-RRB-

ffi

-LRB-

-RRB-

df

Tpre

-LRB-

N

-LRB-

-RRB-

-RRB-

-LRB-

-RRB-

ffiN

-LRB-

-RRB-

-LRB-

Tpost

-LRB-

N

-LRB-

-RRB-

-RRB-

-LRB-

-RRB-

-RRB-

where

-LRB-

-RRB-

ffi

is

abbreviated

by

ffi

Intuitively

ffi

means

that

the

set

of

terms

represented

by

backward

substituted

with

respect

to

the

assignment

of

node

N

-LRB-

-RRB-

is

included

in

the

set

of

terms

represented

by

Let

now

denote

a

new

symbol

Then

the

formal

definition

of

the

value

flow

graph

for

the

DAG

annotation

under

consideration

is

as

follows

-LRB-

cf.

-LSB-

-RSB-

-RRB-

Definition

-LRB-

Value

Flow

Graph

-RRB-

A

value

flow

graph

VFG

is

a

pair

-LRB-

VFN

VFE

-RRB-

consisting

of

ffl

a

set

of

nodes

VFN

S

-LRB-

-LRB-

Npre

-LRB-

n

-RRB-

-LSB-

ffig

-RRB-

-LRB-

Npost

-LRB-

n

-RRB-

-LSB-

ffig

-RRB-

-RRB-

where

-LRB-

-RRB-

VFN

-LRB-

-RRB-

df

ffi

if

ffi

if

ffi

if

ffl

a

set

of

edges

VFE

VFN

VFN

where

-LRB-

-RRB-

VFE

-LRB-

-RRB-

df

N

-LRB-

-RRB-

succG

-LRB-

N

-LRB-

-RRB-

-RRB-

Tpost

-LRB-

N

-LRB-

-RRB-

-RRB-

-LRB-

-RRB-

Tpre

-LRB-

N

-LRB-

-RRB-

-RRB-

-LRB-

-RRB-

where

and

denote

the

projection

of

a

node

to

its

first

and

second

component

respectively

and

N

-LRB-

-RRB-

the

node

of

the

flow

graph

that

is

related

to

course

the

same

is

true

for

the

other

more

complex

strategies

FORALL

m

N

DO

IF

m

s

THEN

-LRB-

pre

-LSB-

m

-RSB-

post

-LSB-

m

-RSB-

-RRB-

-LRB-

-LSB-

-LSB-

m

-RSB-

-RSB-

-LRB-

-RRB-

-RRB-

ELSE

-LRB-

pre

-LSB-

m

-RSB-

post

-LSB-

m

-RSB-

-RRB-

-LRB-

-RRB-

FI

OD

workset

fsg

-LRB-

Iterative

fixed

point

computation

-RRB-

WHILE

workset

DO

LET

m

workset

BEGIN

workset

worksetnfmg

-LRB-

Update

the

environment

of

node

m

-RRB-

FORALL

n

succG

-LRB-

m

-RRB-

DO

meet

pre

-LSB-

n

-RSB-

u

post

-LSB-

m

-RSB-

IF

pre

-LSB-

n

-RSB-

meet

THEN

pre

-LSB-

n

-RSB-

meet

post

-LSB-

n

-RSB-

-LSB-

-LSB-

n

-RSB-

-RSB-

-LRB-

pre

-LSB-

n

-RSB-

-RRB-

workset

workset

-LSB-

fng

FI

OD

END

OD

In

order

to

simplify

the

formulation

of

the

central

properties

of

Algorithm

we

abbreviate

the

values

of

workset

pre

-LSB-

n

-RSB-

and

post

-LSB-

n

-RSB-

after

the

k-th

execution

of

the

while-loop

by

workset

k

prek

-LSB-

n

-RSB-

and

post

k

-LSB-

n

-RSB-

respectively

We

have

Lemma

Algorithm

terminates

with

N

pre

-LRB-

n

-RRB-

pre

-LSB-

n

-RSB-

Proof

The

termination

of

Algorithm

is

an

immediate

consequence

of

Lemma

and

the

fact

that

PD

satisfies

the

descending

chain

condition

For

the

proof

of

the

remaining

part

of

the

lemma

let

fix-pre

and

fix-post

denote

an

arbitrary

solution

of

Equation

System

This

implies

in

particular

-LRB-

-RRB-

-LRB-

fix-pre

-LSB-

s

-RSB-

fix-post

-LSB-

s

-RSB-

-RRB-

-LRB-

-LSB-

-LSB-

n

-RSB-

-RSB-

-LRB-

-RRB-

-RRB-

The

central

step

in

proving

Lemma

is

to

check

the

following

three

invariants

of

Algorithm

k

N

-LRB-

fix-pre

-LSB-

n

-RSB-

fix-post

-LSB-

n

-RSB-

-RRB-

v

-LRB-

prek

-LSB-

n

-RSB-

postk

-LSB-

n

-RSB-

-RRB-

k

N

prek

-LSB-

n

-RSB-

u

uf

postk

-LSB-

m

-RSB-

j

m

predG

-LRB-

n

-RRB-

workset

k

g

-LRB-

if

n

s

uf

postk

-LSB-

m

-RSB-

j

m

predG

-LRB-

n

-RRB-

g

otherwise

k

N

post

k

-LSB-

n

-RSB-

-LSB-

-LSB-

n

-RSB-

-RSB-

-LRB-

prek

-LSB-

n

-RSB-

-RRB-

These

three

invariants

are

proved

simultaneously

by

induction

on

the

number

k

of

iterations

of

the

while-loop

For

k

the

investigation

of

the

initialization

part

of

Algorithm

delivers

-LRB-

a

-RRB-

-LSB-

n

-RSB-

-LRB-

if

n

s

otherwise

-LRB-

b

-RRB-

-LSB-

n

-RSB-

-LRB-

-LSB-

-LSB-

n

-RSB-

-RSB-

-LRB-

-RRB-

if

n

s

otherwise

-LRB-

c

-RRB-

workset

f

s

g

Thus

-LRB-

-RRB-

is

an

immediate

consequence

of

-LRB-

a

-RRB-

-LRB-

b

-RRB-

and

-LRB-

-RRB-

Moreover

-LRB-

-RRB-

holds

trivially

for

all

nodes

n

succG

-LRB-

s

-RRB-

and

for

n

succG

-LRB-

s

-RRB-

it

is

a

consequence

of

the

following

sequence

of

-LSB-

n

-RSB-

u

uf

-LSB-

m

-RSB-

j

m

predG

-LRB-

n

-RRB-

workset

g

-LRB-

-LRB-

a

-RRB-

-LRB-

c

-RRB-

and

n

s

-RRB-

u

-LSB-

s

-RSB-

-LRB-

-LRB-

b

-RRB-

-RRB-

uf

-LSB-

m

-RSB-

j

m

predG

-LRB-

n

-RRB-

nfsg

g

u

post

-LSB-

s

-RSB-

uf

-LSB-

m

-RSB-

j

m

predG

-LRB-

n

-RRB-

g

Finally

-LRB-

-RRB-

follows

from

-LRB-

b

-RRB-

and

the

For

the

induction

step

let

k

and

m

be

the

element

currently

chosen

from

the

workset

Obviously

we

have

-LRB-

-RRB-

prek

-LSB-

n

-RSB-

prek

-LSB-

n

-RSB-

u

postk

-LSB-

m

-RSB-

if

n

succG

-LRB-

m

-RRB-

prek

-LSB-

n

-RSB-

prek

-LSB-

n

-RSB-

u

post

k

-LSB-

m

-RSB-

prek

-LSB-

n

-RSB-

otherwise

-LRB-

-RRB-

post

k

-LSB-

n

-RSB-

-LSB-

-LSB-

n

-RSB-

-RSB-

-LRB-

prek

-LSB-

n

-RSB-

-RRB-

if

n

succG

-LRB-

m

-RRB-

prek

-LSB-

n

-RSB-

prek

-LSB-

n

-RSB-

u

postk

-LSB-

m

-RSB-

post

k

-LSB-

n

-RSB-

otherwise

Together

with

Lemma

and

the

induction

hypothesis

this

implies

the

induction

step

for

the

invariants

-LRB-

-RRB-

and

-LRB-

-RRB-

For

the

induction

step

of

-LRB-

-RRB-

we

can

assume

n

succG

-LRB-

m

-RRB-

-LSB-

succG

-LRB-

succG

-LRB-

m

-RRB-

-RRB-

because

otherwise

-LRB-

-RRB-

follows

trivially

by

induction

In

the

case

of

n

succG

-LRB-

m

-RRB-

the

induction

step

is

a

consequence

of

the

induction

hypothesis

-LRB-

-RRB-

on

-LRB-

-RRB-

Thus

we

are

left

with

the

case

n

succG

-LRB-

succG

-LRB-

m

-RRB-

-RRB-

nsuccG

-LRB-

m

-RRB-

If

no

predecessor

of

n

is

added

to

the

workset

during

the

kth

iteration

of

the

while-loop

i.e.

if

all

nodes

predG

-LRB-

n

-RRB-

satisfy

-LRB-

prek

-LSB-

-RSB-

postk

-LSB-

-RSB-

-RRB-

-LRB-

prek

-LSB-

-RSB-

postk

-LSB-

-RSB-

-RRB-

the

induction

step

holds

trivially

by

induction

Otherwise

the

induction

step

follows

from

the

induction

hypothesis

-LRB-

-RRB-

-LRB-

-RRB-

and

the

fact

that

all

nodes

predG

-LRB-

n

-RRB-

that

n

succG

-LRB-

s

-RRB-

implies

n

s.

Algorithm

-LRB-

INPUT

-RRB-

Structured

partition

DAGs

are

tailored

for

computing

Herbrand

equivalences

In

fact

an

annotation

of

the

flow

graph

with

pre

and

post

DAGs

that

characterize

all

Herbrand

equivalences

at

a

given

program

point

semantically

results

from

a

fixed

point

globalization

of

the

following

local

abstract

semantics

-LRB-

cf.

Optimality

Theorem

-RRB-

Definition

-LRB-

Local

Abstract

Semantics

-RRB-

The

polymorphic

functional

-LSB-

-LSB-

-RSB-

-RSB-

P

-LRB-

T

-RRB-

N

-RRB-

-LRB-

PD

PD

-RRB-

specifies

a

local

abstract

semantics

that

is

defined

by

ffl

P

-LRB-

T

-RRB-

PD

-LSB-

-LSB-

T

-RSB-

-RSB-

-LRB-

D

-RRB-

df

PD

j

D

v

T

-LRB-

-RRB-

T

-LRB-

D

-RRB-

-LSB-

T

g

ffl

N

PD

-LSB-

-LSB-

n

-RSB-

-RSB-

-LRB-

D

-RRB-

df

f

-LRB-

t

-RRB-

j

-LRB-

ffin

-LRB-

t

-RRB-

ffin

-LRB-

-RRB-

-RRB-

-LSB-

-LSB-

T

-LRB-

n

-RRB-

-RSB-

-RSB-

-LRB-

D

-RRB-

g

Intuitively

-LSB-

-LSB-

T

-RSB-

-RSB-

-LRB-

D

-RRB-

extends

the

carrier

set

of

D

onto

T

and

-LSB-

-LSB-

n

-RSB-

-RSB-

-LRB-

D

-RRB-

computes

the

effect

of

the

assignment

represented

by

n

after

extending

the

carrier

set

of

D

to

the

set

of

terms

occurring

in

n

This

is

illustrated

in

the

example

of

Figure

In

particular

this

example

shows

that

structured

partition

DAGs

allow

an

efficient

realization

of

-LSB-

-LSB-

-RSB-

-RSB-

In

fact

the

effects

of

assignments

can

be

computed

essentially

by

updating

the

position

of

the

left

hand

side

variables

Figure

pre-DAG

assignment

post-DAG

z

@R

a

x

b

y

-LRB-

a

b

-RRB-

-LRB-

b

c

a

b

-RRB-

z

b

@R

x

y

@R

c

a

The

following

lemma

is

easy

to

prove

Lemma

-LRB-

Distributivity

-RRB-

The

semantic

functions

-LSB-

-LSB-

T

-RSB-

-RSB-

T?T

and

-LSB-

-LSB-

n

-RSB-

-RSB-

n

N

are

We

are

now

going

to

present

the

fixed

point

globalization

of

-LSB-

-LSB-

-RSB-

-RSB-

for

G.

Consider

Equation

System

Equation

System

pre

-LRB-

n

-RRB-

-LRB-

if

n

s

ufpost

-LRB-

m

-RRB-

j

m

predG

-LRB-

n

-RRB-

g

otherwise

post

-LRB-

n

-RRB-

-LSB-

-LSB-

n

-RSB-

-RSB-

-LRB-

pre

-LRB-

n

-RRB-

-RRB-

function

f

C

D

for

some

complete

semi

-LCB-

lattices

C

and

D

is

called

distributive

iff

C

f

-LRB-

-RRB-

u

ff

-LRB-

c

-RRB-

j

c

Let

pre

denote

the

greatest

solution

of

Equation

System

with

respect

to

the

node

and

-LSB-

-LSB-

p

-RSB-

-RSB-

p

-LRB-

nq

-RRB-

P

-LSB-

m

n

-RSB-

the

straightforward

extension

of

-LSB-

-LSB-

-RSB-

-RSB-

to

finite

paths

i.e.

-LSB-

-LSB-

p

-RSB-

-RSB-

df

-LRB-

idPD

if

p

-LSB-

-LSB-

-LRB-

nq

-RRB-

-RSB-

-RSB-

ffi

-LSB-

-LSB-

-RSB-

-RSB-

otherwise

where

idPD

denotes

the

identity

on

PD

Then

the

application

of

Lemma

and

the

Coincidence

Theorem

of

-LSB-

KU

-RSB-

directly

Lemma

N

pre

-LRB-

n

-RRB-

uf

-LSB-

-LSB-

p

-RSB-

-RSB-

-LRB-

-RRB-

j

p

P

-LSB-

s

n

-RRB-

g

Lemma

allows

us

to

prove

Theorem

by

straightforward

induction

Theorem

t

T

N

t

and

are

Herbrand-equivalent

at

n

iff

t

and

are

semantically

pre

-LRB-

n

-RRB-

equivalent

The

practical

impact

of

Theorem

is

consequence

of

PD

satisfying

the

descending

chain

condition

which

yields

the

computability

of

the

Herbrand

equivalence

-LRB-

cf.

Section

-RRB-

The

Algorithm

In

this

section

we

present

an

algorithm

which

computes

an

annotation

of

G

with

structured

partition

DAGs

that

semantically

characterizes

all

Herbrand

equivalences

Algorithm

-LRB-

The

Semantic

Analysis

of

Step

-LRB-

i

-RRB-

-RRB-

Input

A

flow

graph

G

-LRB-

N

E

s

e

-RRB-

with

unique

start

node

s

and

unique

stop

node

e

which

are

assumed

to

possess

no

predecessors

and

no

successors

respectively

Additionally

the

local

abstract

semantics

-LSB-

-LSB-

n

-RSB-

-RSB-

n

N

according

to

Definition

where

all

semantic

functions

-LSB-

-LSB-

n

-RSB-

-RSB-

are

assumed

to

map

to

-LRB-

assumption

-RRB-

Output

An

annotation

of

G

with

pre-DAGs

-LRB-

stored

in

pre

-RRB-

and

post-DAGs

-LRB-

stored

in

post

-RRB-

of

PDfin

characterizing

valid

and

complete

equivalence

information

at

the

entry

and

at

the

exit

of

every

node

n

N

respectively

Remark

denotes

the

empty

data

flow

information

and

its

complement

the

universal

data

flow

information

which

is

assumed

to

contain

every

data

flow

information

The

local

analysis

component

-LSB-

-LSB-

-RSB-

-RSB-

-LRB-

see

Algorithm

A.

-RRB-

and

the

meet

operation

u

-LRB-

see

Algorithm

A.

-RRB-

are

assumed

to

work

on

structured

partition

DAGs

The

variable

workset

controls

the

iterative

process

and

the

auxiliary

variable

meet

stores

the

result

of

the

most

recent

meet

operation

-LRB-

Initialization

of

the

annotation

arrays

pre

and

post

and

the

variable

workset

-RRB-

that

pre

is

the

maximal

fixed

point

solution

in

the

sense

of

-LSB-

KU

-RSB-

that

uf

-LSB-

-LSB-

p

-RSB-

-RSB-

-LRB-

-RRB-

j

p

P

-LSB-

s

n

-RRB-

g

is

the

meet

over

all

paths

solution

in

the

sense

of

-LSB-

KU

-RSB-

which

completes

the

proof

of

the

Substitution

Lemma

A

finite

path

of

G

is

a

sequence

-LRB-

nq

-RRB-

of

nodes

such

that

-LRB-

nj

nj

-RRB-

E

for

j

f

q

g.

P

-LSB-

m

n

-RSB-

denotes

the

set

of

all

finite

paths

from

m

to

n

and

P

-LSB-

m

n

-RRB-

the

set

of

all

finite

paths

from

m

to

a

predecessor

of

n.

Additionally

denotes

the

unique

path

of

length

and

the

concatenation

of

two

paths

Now

the

backward

substitution

functions

ffin

T!T

and

the

state

transformations

n

can

be

extended

to

cover

finite

paths

as

well

For

every

path

p

-LRB-

m

nq

n

-RRB-

P

-LSB-

m

n

-RSB-

we

define

p

T!T

by

p

df

-LRB-

idT

if

p

-LRB-

nq

-RRB-

ffi

ffinq

otherwise

and

p

by

p

df

-LRB-

id

if

p

-LRB-

nq

-RRB-

ffi

otherwise

where

idT

and

id

denote

the

identity

on

T

and

respectively

The

set

of

all

possible

states

at

a

node

n

N

n

is

given

by

n

df

f

oe

j

P

-LSB-

s

n

-RRB-

p

-LRB-

-RRB-

oe

g

Now

we

can

define

Definition

-LRB-

Herbrand

Equivalence

-RRB-

Let

T

and

n

N

Then

and

are

Herbrand

equivalent

at

node

n

iff

oe

n

H

-LRB-

-RRB-

-LRB-

oe

-RRB-

H

-LRB-

-RRB-

-LRB-

oe

-RRB-

The

development

in

the

remainder

of

this

paper

is

made

with

respect

to

a

fixed

flow

graph

G

which

we

consider

as

to

be

given

from

now

on

Construction

of

a

Value

Flow

Graph

Local

Semantic

Equivalence

The

semantic

analysis

of

step

-LRB-

i

-RRB-

coincides

with

that

of

-LSB-

-RSB-

Therefore

we

only

give

a

brief

outline

of

the

central

notions

and

results

that

are

relevant

here

Equivalences

are

expressed

by

means

of

structured

partition

DAGs

-LRB-

cf.

-LSB-

FKU

-RSB-

-RRB-

which

are

directed

acyclic

multigraphs

whose

nodes

are

labeled

with

at

most

one

operator

or

constant

and

a

set

of

variables

Given

a

structured

partition

DAG

two

terms

are

equivalent

iff

they

are

represented

by

the

same

node

of

the

DAG

-LCB-

To

define

the

notion

of

a

structured

partition

DAG

precisely

let

Pfin

df

f

T

j

T

-LRB-

V

-LSB-

C

-LSB-

Op

-RRB-

j

T

j

g.

Definition

-LRB-

Structured

Partition

DAG

-RRB-

A

structured

partition

DAG

is

a

triple

D

-LRB-

ND

ED

LD

-RRB-

where

ffl

-LRB-

ND

ED

-RRB-

is

a

directed

acyclic

graph

with

node

set

ND

and

edge

set

ED

ND?ND

ffl

LD

ND

Pfin

is

a

labelling

function

which

satisfies

ND

j

LD

-LRB-

-RRB-

nV

j

and

ND

-RRB-

LD

-LRB-

-RRB-

LD

-LRB-

-RRB-

Op

ffl

Leaves

of

D

are

the

nodes

ND

with

LD

-LRB-

-RRB-

Op

ffl

An

inner

node

of

D

possesses

exactly

two

successors

which

we

denote

by

l

-LRB-

-RRB-

and

r

-LRB-

-RRB-

ffl

ND

LD

-LRB-

-RRB-

LD

-LRB-

-RRB-

Op

l

-LRB-

-RRB-

l

-LRB-

-RRB-

r

-LRB-

-RRB-

r

-LRB-

-RRB-

-RRB-

Additionally

D

is

called

a

finite

structured

partition

DAG

if

ND

is

finite

The

set

of

all

structured

partition

DAGs

-LRB-

finite

structured

partition

DAGs

-RRB-

is

denoted

by

PD

-LRB-

PDfin

-RRB-

A

node

ND

of

a

structured

partition

DAG

is

meant

to

represent

an

equivalence

class

of

program

terms

TD

-LRB-

-RRB-

-LRB-

-LRB-

V

-LSB-

C

-RRB-

LD

-LRB-

-RRB-

-RRB-

-LSB-

f

-LRB-

op

t

-RRB-

j

-LRB-

Op

LD

-LRB-

-RRB-

-RRB-

-LRB-

t

-RRB-

-LRB-

l

-LRB-

-RRB-

-RRB-

TD

-LRB-

r

-LRB-

-RRB-

-RRB-

g

Thus

a

full

DAG

represents

a

partition

-LRB-

or

equivalence

relation

-RRB-

on

its

carrier

set

T

-LRB-

D

-RRB-

T

-LRB-

D

-RRB-

df

S

fTD

-LRB-

-RRB-

j

NDg?T

This

can

be

illustrated

as

follows

Figure

partition

oe

DAG

-LSB-

a

x

j

b

y

j

a

b

a

y

x

b

x

y

z

-RSB-

z

@R

a

x

b

y

Viewing

DAGs

as

equivalence

relations

makes

PD

a

complete

lattice

with

bottom

element

top

element

fTg

and

inclusion

defined

set

theoretically

as

This

guarantees

the

existence

and

well

definedness

of

H

-LRB-

D

-RRB-

in

Definition

Let

D

PD

Then

H

-LRB-

D

-RRB-

is

the

smallest

structured

partition

DAG

satisfying

that

D?H

-LRB-

D

-RRB-

and

T

-LRB-

H

-LRB-

D

-RRB-

-RRB-

T.

T

are

syntactically

D-equivalent

iff

D

possesses

a

node

satisfying

that

TD

-LRB-

-RRB-

T

are

semantically

D-equivalent

iff

they

are

syntactically

H

-LRB-

D

-RRB-

equivalent

equivalence

relation

fTg

has

no

corresponding

structured

partition

DAG

It

is

rather

an

artificial

greatest

element

which

is

necessary

here

for

completion

In

contrast

to

-LSB-

-RSB-

where

the

algorithm

for

determining

the

computation

points

is

bi-directionally

specified

in

the

style

of

Morel

and

Renvoise

-LSB-

MR

-RSB-

it

is

decomposed

here

into

a

sequence

of

a

backward

and

a

forward

analysis

as

in

-LSB-

KS

-RSB-

-LRB-

cf.

Section

-RRB-

These

uni-directional

analyses

determine

the

predicates

D-Safe

and

Earliest

respectively

Intuitively

the

combined

analysis

yields

the

earliest

down-safe

computation

points

of

a

value

i.e.

the

earliest

points

satisfying

that

an

inserted

value

is

used

on

every

terminating

program

path

starting

at

an

insertion

point

In

addition

to

the

corresponding

step

of

-LSB-

-RSB-

the

determination

of

computation

forms

must

also

exploit

the

distributive

law

and

explicite

knowledge

about

the

availability

of

values

in

order

to

capture

strength

reduction

This

is

achieved

by

computing

the

predicates

Distr

and

Avail

-LRB-

cf.

Section

-RRB-

which

highlights

the

essence

of

classical

strength

reduction

distributivity

and

availability

After

this

preparation

the

placement

procedure

of

step

-LRB-

ii

-RRB-

results

in

the

following

flow

graph

-LRB-

cf.

Section

-RRB-

Figure

-LRB-

-RRB-

-LRB-

a

b

c

b

-RRB-

-LRB-

-RRB-

-LRB-

-RRB-

-LRB-

a

-RRB-

-LRB-

a

c

-RRB-

p

q

Subsequentvariable

subsumption

-LSB-

Ch

CACCHM

-RSB-

yields

the

desired

result

-LRB-

Figure

-LRB-

b

-RRB-

-RRB-

Preliminaries

We

consider

terms

t

T

which

are

inductively

built

from

variables

v

V

constants

c

C

and

operators

op

Op

To

keep

our

notation

simple

we

assume

that

all

operators

are

binary

The

semantics

of

terms

of

T

is

induced

by

the

Herbrand

interpretation

H

-LRB-

D

-RRB-

where

D

df

T

denotes

the

non

empty

data

domain

and

the

function

which

maps

every

constant

c

C

to

the

datum

-LRB-

c

-RRB-

c

D

and

every

operator

op

Op

to

the

total

function

-LRB-

op

-RRB-

D

D!D

which

is

defined

by

-LRB-

op

-RRB-

-LRB-

-RRB-

df

-LRB-

op

-RRB-

for

all

D.

f

oe

j

oe

V!D

g

denotes

the

set

of

all

Herbrand

states

and

the

distinct

start

state

which

is

the

identity

on

V

-LRB-

this

choice

of

reflects

the

fact

that

we

do

not

assume

anything

about

the

context

of

the

program

being

optimized

-RRB-

The

semantics

of

terms

t

T

is

given

by

the

Herbrand

semantics

H

T

-LRB-

D

-RRB-

which

is

inductively

defined

by

also

for

the

computation

a

c

at

node

an

auxiliary

variable

will

be

initialized

at

node

a

fact

which

we

neglect

here

in

order

to

keep

the

example

simple

t

T

oe

H

-LRB-

t

-RRB-

-LRB-

oe

-RRB-

df

oe

-LRB-

v

-RRB-

if

t

v

V

-LRB-

c

-RRB-

if

t

c

C

-LRB-

op

-RRB-

-LRB-

H

-LRB-

-RRB-

-LRB-

oe

-RRB-

H

-LRB-

-RRB-

-LRB-

oe

-RRB-

-RRB-

if

t

-LRB-

op

-RRB-

As

usual

we

represent

imperative

programs

as

directed

flow

graphs

G

-LRB-

N

E

s

e

-RRB-

with

node

set

N

and

edge

set

E

Nodes

n

N

represent

parallel

assignments

of

the

form

-LRB-

xr

-RRB-

-LRB-

tr

-RRB-

where

r

and

xi

xj

implies

i

j

and

edges

-LRB-

n

m

-RRB-

E

the

nondeterministic

branching

structure

of

G.

predG

-LRB-

n

-RRB-

df

f

m

j

-LRB-

m

n

-RRB-

E

g

denotes

the

set

of

all

predecessors

and

succG

-LRB-

n

-RRB-

df

f

m

j

-LRB-

n

m

-RRB-

E

g

the

set

of

all

successors

of

a

node

n

and

s

and

e

the

unique

start

node

and

end

node

of

G

which

are

assumed

to

possess

no

predecessors

and

successors

respectively

Furthermore

we

assume

that

s

and

e

represent

the

empty

statement

skip

and

that

every

node

n

N

lies

on

a

path

from

s

to

e.

Finally

T

-LRB-

n

-RRB-

denotes

the

set

of

all

terms

occurring

in

the

assignment

represented

by

n

and

P

-LRB-

T

-RRB-

df

f

T

j

T?T

g

i.e.

P

denotes

the

power

set

operator

For

every

node

n

-LRB-

xr

-RRB-

-LRB-

tr

-RRB-

of

a

flow

graph

G

we

define

two

functions

ffin

T!T

by

t

T

ffin

-LRB-

t

-RRB-

df

t

-LSB-

tr

xr

-RSB-

where

t

-LSB-

tr

xr

-RSB-

stands

for

the

simultaneous

replacement

of

all

occurrences

of

xi

by

ti

in

t

i

rg

and

n

defined

by

oe

y

V

n

-LRB-

oe

-RRB-

-LRB-

y

-RRB-

df

-LRB-

H

-LRB-

ti

-RRB-

-LRB-

oe

-RRB-

if

y

xi

i

rg

oe

-LRB-

y

-RRB-

otherwise

ffin

realizes

the

backward

substitution

and

n

the

state

transformation

caused

by

the

assignment

of

node

n

The

Substitution

Lemma

establishes

a

well-known

relationship

between

ffin

and

n

which

is

central

Lemma

-LRB-

Substitution

Lemma

-RRB-

N

oe

t

T

H

-LRB-

ffin

-LRB-

t

-RRB-

-RRB-

-LRB-

oe

-RRB-

H

-LRB-

t

-RRB-

-LRB-

-LRB-

oe

-RRB-

-RRB-

Proof

Let

n

-LRB-

xr

-RRB-

-LRB-

tr

-RRB-

N

oe

and

t

T

The

lemma

is

trivial

for

t

being

a

constant

or

a

variable

v

xrg

and

the

case

t

xi

xrg

is

dealt

with

by

means

of

H

-LRB-

ffin

-LRB-

t

-RRB-

-RRB-

-LRB-

oe

-RRB-

H

-LRB-

ffin

-LRB-

xi

-RRB-

-RRB-

-LRB-

oe

-RRB-

H

-LRB-

ti

-RRB-

-LRB-

oe

-RRB-

H

-LRB-

xi

-RRB-

-LRB-

n

-LRB-

oe

-RRB-

-RRB-

H

-LRB-

t

-RRB-

-LRB-

n

-LRB-

oe

-RRB-

-RRB-

This

yields

the

base

for

the

following

induction

on

the

structure

of

the

term

t.

For

the

induction

step

we

can

assume

that

t

is

of

the

form

t

-LRB-

op

-RRB-

Applying

the

induction

hypothesis

H

-LRB-

ffin

-LRB-

ti

-RRB-

-RRB-

-LRB-

oe

-RRB-

H

-LRB-

ti

-RRB-

-LRB-

-LRB-

oen

-RRB-

-RRB-

for

both

subterms

and

we

obtain

H

-LRB-

ffin

-LRB-

t

-RRB-

-RRB-

-LRB-

oe

-RRB-

H

-LRB-

ffin

-LRB-

-LRB-

op

-RRB-

-RRB-

-LRB-

oe

-RRB-

-LRB-

op

-RRB-

-LRB-

H

-LRB-

ffin

-LRB-

-RRB-

-RRB-

-LRB-

oe

-RRB-

H

-LRB-

ffin

-LRB-

-RRB-

-RRB-

-LRB-

oe

-RRB-

-RRB-

-LRB-

IH

-RRB-

-LRB-

op

-RRB-

-LRB-

H

-LRB-

-RRB-

-LRB-

n

-LRB-

oe

-RRB-

-RRB-

H

-LRB-

-RRB-

-LRB-

n

-LRB-

oe

-RRB-

-RRB-

-RRB-

H

-LRB-

t

-RRB-

-LRB-

n

-LRB-

oe

-RRB-

-RRB-

flow

graphs

are

obtainable

for

example

by

the

algorithm

of

-LSB-

All

-RSB-

Figure

a

-RRB-

a

a

c

p

a

b

q

c

b

b

-RRB-

-LRB-

-RRB-

-LRB-

a

b

c

b

-RRB-

a

a

c

p

q

The

semantic

analysis

of

step

-LRB-

i

-RRB-

annotates

the

flow

graph

with

that

characterize

all

equivalences

between

terms

with

respect

to

the

Herbrand

interpretation

i.e.

all

equivalences

that

are

valid

independently

of

specific

properties

of

the

term

operators

-LRB-

Figure

-RRB-

In

particular

this

analysis

detects

the

equivalence

of

p

and

a

b

and

of

q

and

c

b

after

the

execution

of

node

-LRB-

cf.

Section

-RRB-

Figure

-LSB-

b

j

c

j

q

c

b

-RSB-

a

a

c

-LSB-

a

j

b

j

c

j

p

a

b

j

q

c

b

-RSB-

p

a

b

-LSB-

a

j

b

j

p

a

b

-RSB-

-LSB-

a

j

b

j

c

j

p

a

b

j

q

c

b

-RSB-

-LSB-

a

j

b

j

c

j

p

a

b

j

q

c

b

-RSB-

-LSB-

a

j

b

j

p

a

b

-RSB-

q

c

b

-LSB-

a

j

b

j

c

j

p

a

b

j

q

c

b

-RSB-

Afterwards

step

-LRB-

ii

-RRB-

computes

for

every

program

point

a

set

of

relevant

terms

which

contains

a

representation

system

of

those

equivalence

classes

that

express

all

necessary

equivalences

syntactically

-LRB-

cf.

Section

-RRB-

and

extends

the

node

annotation

computed

in

step

-LRB-

i

-RRB-

accordingly

This

-LRB-

straightforward

-RRB-

extension

is

necessary

because

the

placement

process

of

the

second

stage

only

refers

to

term

equivalences

that

are

explicit

in

the

value

flow

graph

under

consideration

i.e.

two

terms

are

equivalent

at

a

program

point

if

and

only

if

they

are

commonly

represented

by

a

node

of

the

value

flow

graph

at

this

point

In

addition

to

the

corresponding

step

of

the

algorithm

of

-LSB-

-RSB-

strength

reduction

requires

to

consider

terms

as

relevant

that

arise

from

an

application

of

arithmetic

laws

the

essence

of

classical

strength

reduction

is

to

exploit

the

distributive

law

for

sums

and

products

i.e.

-LRB-

u

v

-RRB-

w

u

w

v

w.

Therefore

are

represented

by

means

of

structured

partition

DAGs

-LRB-

see

Section

-RRB-

whenever

a

term

of

the

form

-LRB-

u

v

-RRB-

w

is

relevant

the

terms

u

w

and

v

w

are

also

Figure

shows

the

result

of

this

extension

Figure

-LSB-

p

j

a

j

b

j

c

j

a

b

j

c

b

j

q

-RSB-

-LSB-

p

j

a

j

b

j

c

j

a

b

j

c

b

j

q

-RSB-

-LSB-

a

j

b

j

c

j

a

b

j

p

j

q

c

b

-RSB-

a

a

c

-LSB-

a

j

b

j

c

j

a

c

j

-LRB-

a

c

-RRB-

b

j

p

a

b

j

q

c

b

-RSB-

-LSB-

p

j

a

j

b

j

c

j

a

b

j

c

b

j

q

-RSB-

p

a

b

-LSB-

a

j

b

j

c

j

p

a

b

j

c

b

j

q

-RSB-

-LSB-

a

j

b

j

c

j

a

c

j

-LRB-

a

c

-RRB-

b

j

p

a

b

j

q

c

b

-RSB-

-LSB-

a

j

b

j

c

j

a

c

j

-LRB-

a

c

-RRB-

b

j

p

a

b

j

q

c

b

-RSB-

-LSB-

a

j

b

j

c

j

p

a

b

j

c

b

j

q

-RSB-

q

c

b

-LSB-

a

j

b

j

c

j

p

a

b

j

q

c

b

-RSB-

Step

-LRB-

iii

-RRB-

produces

the

corresponding

value

flow

graph

-LRB-

cf.

Section

-RRB-

whose

relevant

part

is

displayed

in

Figure

Figure

-LSB-

p

j

a

j

b

j

c

j

a

b

j

c

b

j

q

-RSB-

-LSB-

p

j

a

j

b

j

c

j

a

b

j

c

b

j

q

-RSB-

-LSB-

a

j

b

j

c

j

a

b

j

p

j

q

c

b

-RSB-

a

a

c

-LSB-

a

j

b

j

c

j

a

c

j

-LRB-

a

c

-RRB-

b

j

p

a

b

j

q

c

b

-RSB-

-LSB-

p

j

a

j

b

j

c

j

a

b

j

c

b

j

q

-RSB-

p

a

b

-LSB-

a

j

b

j

c

j

p

a

b

j

c

b

j

q

-RSB-

-LSB-

a

j

b

j

c

j

a

c

j

-LRB-

a

c

-RRB-

b

j

p

a

b

j

q

c

b

-RSB-

-LSB-

a

j

b

j

c

j

a

c

j

-LRB-

a

c

-RRB-

b

j

p

a

b

j

q

c

b

-RSB-

-LSB-

a

j

b

j

c

j

p

a

b

j

c

b

j

q

-RSB-

q

c

b

-LSB-

a

j

b

j

c

j

p

a

b

j

q

c

b

-RSB-

Applying

a

modification

of

the

placement

procedures

of

-LSB-

KS

-RSB-

to

the

value

flow

graph

above

yields

the

required

computation

points

and

computation

forms

-LRB-

step

-LRB-

i

-RRB-

Section

-RRB-

the

example

-LRB-

a

c

-RRB-

b

makes

a

b

and

c

b

relevant

In

the

special

situation

here

these

terms

arise

already

after

step

-LRB-

i

-RRB-

Motivation

Strength

reduction

is

a

powerful

technique

for

the

optimization

of

loops

which

improves

run-time

efficiency

by

reducing

expensive

operations

e.g.

to

less

expensive

ones

e.g.

Its

essence

can

be

sketched

as

follows

Let

x

y

be

a

multiplication

occurring

in

a

loop

L

Then

try

to

eliminate

all

calculations

of

x

y

in

L

by

performing

the

following

three

steps

ffl

Initialize

a

new

auxiliary

variable

h

with

x

y

before

entering

L.

ffl

Insert

assignments

of

the

form

h

d

e

in

L

that

update

h

according

to

the

redefinitions

of

x

and

y.

ffl

Replace

all

occurrences

of

x

y

in

L

by

h.

Note

if

no

updating

assignments

are

inserted

this

three

step

procedure

performs

loop

invariant

code

motion

In

fact

a

clean

realization

of

it

should

transform

the

flow

graph

of

Figure

-LRB-

a

-RRB-

into

the

one

displayed

in

Figure

-LRB-

b

-RRB-

Figure

a

-RRB-

a

a

p

a

b

q

-LRB-

k

l

-RRB-

b

a

k

l

a

a

b

-RRB-

-LRB-

-RRB-

-LRB-

a

b

k

l

-RRB-

b

a

a

p

b

q

a

b

a

a

In

this

paper

we

present

such

a

clean

realization

It

evolves

as

a

uniform

extension

of

the

two

stage

algorithm

of

-LSB-

-RSB-

which

optimally

moves

computations

within

programs

with

respect

to

Herbrand

equivalence

-LRB-

cf.

Section

-RRB-

In

fact

this

extension

does

not

affect

the

structure

of

the

underlying

algorithm

at

all

It

only

requires

two

conceptual

changes

in

the

steps

-LRB-

ii

-RRB-

and

-LRB-

i

-RRB-

and

a

straightforward

modification

of

step

-LRB-

ii

-RRB-

Construction

of

a

value

flow

graph

-LRB-

i

-RRB-

Determining

for

every

program

point

a

characterization

of

all

term

equivalences

with

respect

to

the

Herbrand

interpretation

-LRB-

Section

-RRB-

-LRB-

ii

-RRB-

Computing

for

every

program

point

a

finite

set

of

relevant

terms

that

allows

us

to

syntactically

represent

enough

term

equivalences

in

order

to

perform

our

optimization

-LRB-

Section

-RRB-

to

the

best

of

our

knowledge

all

the

published

algorithms

for

strength

reduction

would

fail

this

test

-LRB-

iii

-RRB-

Connecting

the

representations

of

equivalence

classes

obtained

in

step

-LRB-

ii

-RRB-

according

to

the

actual

data

flow

in

order

to

arrive

at

a

value

flow

graph

-LRB-

Section

-RRB-

Placement

of

the

computations

-LRB-

i

-RRB-

Determining

the

computation

points

and

computation

forms

with

respect

to

the

value

flow

graph

obtained

in

step

-LRB-

iii

-RRB-

by

a

sequence

of

a

backward

and

two

forward

analyses

-LRB-

Section

-RRB-

-LRB-

ii

-RRB-

Placing

the

computations

-LRB-

Section

-RRB-

This

algorithm

uniformly

combines

strength

reduction

and

semantic

code

motion

where

the

underlying

code

motion

algorithm

optimally

moves

computations

within

programs

with

respect

to

Herbrand

equivalence

The

point

of

this

approach

is

that

it

reduces

strength

reduction

completely

to

the

availability

of

values

at

the

computation

points

This

allows

us

to

overcome

all

restrictions

concerning

admissible

program

structures

-LRB-

e.g.

previously

detected

loops

-RRB-

and

admissible

term

structures

-LRB-

e.g.

terms

built

of

induction

variables

and

region

constants

-RRB-

that

are

required

by

previous

strength

reduction

techniques

-LRB-

cf.

Section

-RRB-

Moreover

it

is

the

key

for

proving

that

program

transformations

obtained

by

our

algorithm

are

guaranteed

to

be

safe

and

to

improve

run-time

efficiency

Both

properties

can

be

violated

by

previous

techniques

-LRB-

cf.

Section

-RRB-

The

power

of

our

algorithm

that

generalizes

and

improves

the

classical

algorithms

for

strength

reduction

common

subexpression

elimination

partial

redundancy

elimination

and

loop

invariant

code

motion

is

illustrated

in

the

example

of

Figure

-LRB-

a

-RRB-

where

it

is

unique

in

performing

the

optimization

displayed

in

Figure

-LRB-

b

-RRB-

Structure

of

the

Paper

After

illustrating

our

algorithm

by

means

of

a

simple

example

in

Section

we

state

the

preliminary

definitions

in

Section

Subsequently

we

follow

the

structure

of

our

algorithm

in

Section

and

and

their

subsections

discuss

the

related

work

concerning

strength

reduction

in

Section

and

state

our

conclusions

in

Section

The

Appendix

contains

the

detailed

algorithms

A

Simple

Example

In

this

section

we

discuss

the

effects

of

the

five

steps

of

our

two

stage

algorithm

by

means

of

the

example

of

Figure

-LRB-

a

-RRB-

which

will

be

transformed

into

the

flow

graph

displayed

in

Figure

-LRB-

b

-RRB-

In

the

diagrams

below

arrows

represent

the

nondeterministic

branching

structure

and

nodes

-LRB-

parallel

-RRB-

assignments

Unifying

Strength

Reduction

and

Semantic

Code

Jens

Institut

f?ur

Informatik

und

Praktische

Mathematik

Christian-Albrechts-Universit

at

zu

Kiel

Preusserstr

D

-LCB-

Kiel

Bernhard

Steffen

Lehrstuhl

f?ur

Informatik

II

Rheinisch-Westf

alische

Technische

Hochschule

Aachen

Ahornstr

D

-LCB-

Aachen

Aachener

Informatikberichte

Nr

-LCB-

Abstract

We

present

an

algorithm

that

unifies

strength

reduction

and

semantic

code

motion

This

algorithm

evolves

as

a

modular

extension

of

the

semantic

code

motion

algorithm

of

-LSB-

-RSB-

which

optimally

moves

computations

within

programs

with

respect

to

Herbrand

equivalence

Our

algorithm

generalizes

and

improves

all

classical

techniques

for

strength

reduction

in

that

it

overcomes

their

structural

restrictions

concerning

admissible

program

structures

-LRB-

e.g.

previously

determined

loops

-RRB-

and

admissible

term

structures

-LRB-

e.g.

terms

built

of

induction

variables

and

region

constants

-RRB-

Additionally

the

program

transformation

obtained

by

our

algorithm

is

guaranteed

to

be

safe

and

to

improve

run-time

efficiency

Previous

techniques

fail

both

of

these

properties

paper

is

an

extended

and

revised

version

of

the

second

part

of

-LSB-

-RSB-

author

is

supported

by

the

DFG

grant

La

-LCB-

Contents

Motivation

Structure

of

the

Paper

A

Simple

Example

Preliminaries

Construction

of

a

Value

Flow

Graph

Local

Semantic

Equivalence

The

Algorithm

Computation

of

Relevant

Terms

The

Value

Flow

Graph

Placement

of

Computations

Determination

of

Computation

Points

and

Forms

Determining

Computation

Points

Choosing

Computation

Forms

Placing

the

Computations

Pragmatics

Related

Work

Conclusions

Acknowledgements

References

A

Appendix

A.

The

First

Stage

Algorithms

A.

The

Second

Stage

Algorithms

code motion
common subexpression elimination
computation points and forms
data flow analysis
loop invariant
partial redundancy elimination
program optimization
second order effects
strength reduction
structured partition dag
value flow graph

flow graphs (acyclic
herbrand interpretation and equivalence
imperative programming languages
irreducibel
nondeterministic)