Single assignment

From Free Pascal wiki
Revision as of 10:45, 20 May 2006 by Daniel-fpc (talk | contribs) (Start of article about singe assignment)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Single assignment is an optimization technique that breaks the connection between variable names in a high level programming language and their location in the assembler code.

The basic principle of single assigment is that each location is written only once. After that the location can only be read from.

Demonstration:

a:=x+y;
b:=a-1;
a:=y+b;
b:=x*4;
a:=a+b;

...becomes...

loc1:=x+y;
loc2:=loc1-1;
loc3:=y+loc2;
loc4:=x*4;
loc5:=loc3+loc4;