[LLVMdev] [PATCH][RFC] Add llvm.codegen Intrinsic To Support Embedded LLVM IR Code Generation

dag at cray.com dag at cray.com
Mon May 7 15:14:37 PDT 2012


Tobias Grosser <tobias at grosser.es> writes:

>> I forgot to address this one.  With current OpenCL and CUDA
>> specifications, there's no need to do multiple .o files.  In my mind,
>> llc should output one .o (one .s, etc.).  Anything else wreaks havoc on
>> build systems.
>
> Yes, that's what I am advocating for. There is no need for all this
> complexity. Both standards store the embedded code as a string in the
> host module. That is exactly what the llvm.codegen intrinsic
> models. It requires zero further changes to the code generation
> backend.

But why do you need an intrinsic to do that?  Just generate the code to
a file and suck it into a string, maybe with an external "linker" tool.

If you just want something to work, that should be sufficient.  If you
want some long-term design/implementation I don't think llvm.codegen is
it.

> In contrast, extending LLVM-IR to support heterogeneous modules
> requires us to add logic to the llvm code generation that knows how to
> link the different sub-modules.

We already have the Linker.

                                -Dave



More information about the llvm-dev mailing list