Make the var reordering magic slightly more Halide-codebase idiomatic.

E.g. we use anonymous namespaces instead of static.