Small refactoring of CodeGen classes to fix naming of CodeGen, make LLVM logic common.

This PR makes the naming of our CodeGen classes a bit more logical and eliminates duplicated code in compiling for LLVM. I originally started on this while tracking down the optimize_module crash, which turned out to be something else, but I feel this is an improvement to the code and sets up some other changes as follows:

1) Adding a top-level CodeGen class which is independent of LLVM. This should make some parts of StmtCompiler cleaner and can make it clear that functionality such as function_takes_user_context is not connected to LLVM.

2) CodeGen_Posix should go away. It has nothing to do with Posix and can either be folded in to CodeGen_LLVM, or made into a helper class. (CodeGen_Allocation or some such.)

3) All LLVM specific codegen for GPU backends should be built on Halide IR so that we can do things like call GPU code from the C backend. (There is not much of a use case for doing this from C, but it makes a lot of sense for a JavaScript backend, which I hope we will have.) Hopefully this will allow getting rid of the templated CodeGen_GPU_Host classes.
I like having a directory for all the backends. Do you prefer calling it
"CodeGen" or "Backends"? ( I think my preference is to call it "Backends",
remove "CodeGen" from the file names and maybe leave CodeGen.{h,cpp} at the
top level. Oh and all file names are bicapitalized with no underscores.
(Though runtime is different...)

Happy to do this as part f this refactor, though it may indicate timing
this after other PRs to avoid merge hassle.

-Z-


On Nov 23, 2014, at 3:58 PM, Andrew Adams <notifications@github.com> wrote:

In src/LLVM_Runtime_Linker.cpp:

> @@ -0,0 +1,545 @@
> +#include "LLVM_Runtime_Linker.h"

It would be nice if we were consistent about underscores vs not in
multi-word file names. The CodeGen_* files are what started this mess.
Perhaps they should really be in CodeGen folder. Any thoughts?

—
Reply to this email directly or view it on GitHub
<https://github.com/halide/Halide/pull/560/files#r20769460>.