Francesco Bertolaccini
Francesco Bertolaccini

Reputation: 506

Generating SSA for functions that use pointers

I am trying to convert an imperative-style programming language into Administrative Normal Form (ANF) by using the algorithm described in this paper: http://www.sciencedirect.com/science/article/pii/S1571066105825964

In the paper, Zadarnovsky et al. describe an algorithm to convert an SSA program into ANF form, and then proceeds to present an optimization algorithm I am not currently interested in.

The question I have is: how do I convert pointer variables into SSA form?

Upvotes: 0

Views: 387

Answers (1)

qznc
qznc

Reputation: 1173

A pointer is a value, just like an integer or float is a value.

Here is an example from the libfirm documentation representing x.z:

compound member access

This is a data dependency graph (data flow with edge direction inversed) in SSA form. The yellow Address node contains the symbolic address of x. The Member operation extracts the pointer to the z field. The Load operations takes that pointer and loads the value there. Load also takes another value via the blue edge, the memory state. The Proj node represents the loaded value, which can be used by other operations.

Upvotes: 0

Related Questions