Tablegen backend HOWTO?

Can anyone offer me any advice on writing a new backend for tablegen? I
think I want to look at CodeGenDAGPatterns.cpp, but I'm not that familiar
with the code yet. I want to translate X86 (or other) binary into an in-house
intermediate language. If this is easy to do with LLVM-IR, that would be
great, too, though for now I ultimately need to target this other language.

I would greatly appreciate any pointers you can offer.