[LLVMdev] Integrating LLVM in an existing project

Chris Lattner sabre at nondot.org
Fri Apr 6 10:31:54 PDT 2007

On Fri, 6 Apr 2007, Nicolas Geoffray wrote:

> Like you say, it's not functional for non-calls instructions. Besides, 
> having to change all CalInst to InvokeInst is just too much pain in our 
> current vm.


> Actually, why is it missing? What's the difference between the code 
> generator and the JIT?

There are two things missing:

1. Testing and working out the set of remaining bugs
2. Extending the JIT to emit the EH tables to memory somewhere, and
    register them with the EH runtime.

> The thing is, I know very little on exception handling (our 
> setjmp/longjmp mechanism in our vms is functional but not really 
> optimized) and zip on LLVM.

I don't know, you seem to know something about the code generator :)

> I looked at Reid's notes for implementing #2, and I'm not sure I can 
> help without having a month or two (of spare time) to learn LLVM's 
> internals.

Right, I wouldn't suggest tackling this unless you are willing to see it 
through all the way.

> However, I'd be interested to look at how exception handling can be 
> implemented in the JIT. What's the current situation?

The static code generator works for many simple cases, but it is currently 
disabled.  To enable it, uncomment this line in 


Based on that, you should be able to compile simple C++ codes that throw 
and catch exceptions.  The next step would be to make a .bc file, run it 
through the JIT, see how it explodes :)



More information about the llvm-dev mailing list