Emit only one function of the module to native code

Hi

I use llvm-3.1. I have a large module and i want to emit native code (or assembly) for one function.

I tried to replace the PassManager in llc by a FunctionPassManager but I have a crash so this is probably not the good way to do it. (cf attached my simple test)

Is it possible to write one function from the module? What is the good way to do it?

Thanks in advance.

Christophe

test.c (132 Bytes)

test.bc (720 Bytes)

proto.cpp (4.8 KB)

llvm-extract and then llc?

-eric

Ok thanks,
I thought there was a more direct way to do it…

2012/11/19 Eric Christopher <echristo@gmail.com>

Ok thanks,
I thought there was a more direct way to do it...

I think this is supposed to be possible. llvm-gcc had logic for emitting code
for each function immediately after generating it, but it was ifdef'd out with
the remark that it was buggy. You might want to take a look at how llvm-gcc
was trying to do it. Since no-one is actually doing this kind of thing AFAIK,
it is likely that you will hit some bugs in the code generators even if your
approach is valid.

Ciao, Duncan.

Thanks i will look into it.