[LLVMdev] C Types -> LLVM Objects
Chris Lattner
sabre at nondot.org
Sun Oct 30 22:26:56 PST 2005
On Sun, 30 Oct 2005, Evan Jones wrote:
> I am implementing the support library for my toy Python implementation in C.
> Is there a recommended way to import types/functions defined in my C library
> as LLVM type objects into my compiler? I am currently doing this:
>
> - Create a "null" C file that references the important types
> - Load the bytecode of this file when initializing the compiler
> - Load the types and functions out of this "null" module
>
> I'm thinking that a better solution would be to write some tool that takes
> the "null" bytecode and outputs a C++ file so I don't need to link my
> compiler with the bytecode reader, or be able to find the "nullmodule.bc"
> file. Are there any better ways to do this?
Unfortunately, I'm not aware of a better way to do this. If you care
about a few specific functions, you can hard code them into the compiler.
If you care about general functions or a large number of them, this is a
reasonable approach.
-Chris
--
http://nondot.org/sabre/
http://llvm.org/
More information about the llvm-dev
mailing list