../ssa

SSA

I’m not an expert, do not hesitate to correct me

The Static Single Assignement is kinda like a CFG with pseudocode.

The goal is that for each variable there is on and only assignation which allow direct analysis of the code purpose without more computing.

So it allow you to have a full representation of the control flow inside of a subroutine with basic bloc representic a less abstract logic (with all the arithmetic infide the block).

Let’s take the following code :

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char ** argv)
{
    int a = atoi(argv[1]);
    int b = atoi(argv[2]);
    if (a > b)
    {
     	printf("%d\n",a); 
        return 0;
    }
    if (b > a)
    {
     	printf("%d\n",b); 
        return 0;
    }
    printf("%d\n",a+b); 
    return 0;
}

We would have a graph looking like this :

Profile Pic

if a there may be a conflict with the update value we use v3 = Φ(v1,v2)

each arrow represent a variable or a variable state and each node an operator.