implement decl substitution

This adds decl substitution, to let local variables work.  Decl
substitution is when a reference to a variable D is replaced by a
dereference of some other variable, like "*__D_PTR".  The substituted
variable is referenced by name, so the user has to ensure it is
declared by some means.