[<<][meta][>>][..]Sun May 2 15:47:20 EDT 2010
SSA IN/OUT parameterization
In the light of previous post, what is the problem? All code I'm
using depends on SSA form, but what I want is an abstracted SSA/DSN
form that allows me to bind network outputs to externally allocated
So this essentially needs a functional representation. An SSA
structure is a function that has sharing and internal node allocation
figured out (i.e. more abstractly it can be parameterized by an
internal node allocator), but can be patched into a larger node
So, SSA is form is NodeAlloc -> Inputs -> Outputs -> Network.
Actually, it's simple: nodes need to be parameterized, the rest of the
behaviour can be fixed.
- abstract node-alloc
- parameterize output assign (default = node alloc)
So, in Term.hs, `nameNodes' is where the intermediate nodes are named.
This is mostly a wrapper around `nameShared' from Shared.hs while
shared node construction is performed separately using the
Approach: stick to numeric node tags, but replace the [0..] sequence
by a parameter `regnums'. OK.
Next to open up: Function.
data Let = Let String String [String] deriving Show
data Function = Function [String] [Let] [String]
This is already fully serialized, and all node names are Strings. It
might be simpler to keep this representation, and focus on performing
substitutions on the symbol names.
r0 <- mul ar br
r1 <- mul ai bi
r2 <- negate r1
r3 <- add r0 r2
r4 <- mul ar bi
r5 <- mul ai br
r6 <- add r4 r5
out: r3 r6
Maybe a guiding remark: do I want to keep an SSA-converted network
around to re-use, or is it simpler to recompile from the memo-term
form and use only Haskell function composition?
What purpose does `Function' serve? To decouple the Term form from
the C/ASM code generation?
I'm making this too difficult. Let's start over.
Maybe I need to pick one and stick with it? Compose only in Haskell,
or also in the lower-level code? This might be important for re-using
function composition in the low-level language instead of using only