Mixing multiple targets in llvm IR

We have a case where LLVM IR may have 2 targets mixed together. Lets call it host and device. Assuming that compiling once for host and once for device is stupid and it should never happen. Can anyone see a way to make Modules switch target contexts on the fly per function or - Adding a pass that splits the modules and then another pass which rejoins them before emitting the final foo.o|s

FWIW, the required module split seems to have something common with “fat IRs” design recently discussed here: http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-October/066290.html

Do you see a way for us to (ab)use this beyond subtargets? The device target may not have much or anything in common with the host target