While properly distinguishing DXBC and TPF seems a good idea, I am not a fan of having very long source files which mix different logical pieces of code. I find them difficult to read and to understand. So I'd keep separate the parsing and emitting code, both for SM4 and SM1.
(also, I find a bit funny the way we handle copyright lines in headers: it seems they are added by the first person checking in a file and never updated any more; not that it's a big problem for me, just funny)