[LLVMdev] Integrating LLVM in an existing project

Chris Lattner sabre at nondot.org
Thu Apr 5 10:25:43 PDT 2007


On Thu, 5 Apr 2007, Nicolas Geoffray wrote:
> On top of this execution environment we have implemented a java virtual
> machine and a .net virtual machine. They
> are both functional and we achieve reasonable performance (1/3 of IBM's
> JVM or Mono).

Cool.

> This algorithm does not work with llvm because creating labels (which
> correspond to creating basic blocks) does not imply that the label (ie
> the basic block) will have an address. Even without optimizations
> enabled in llvm, some basicblocks are not emitted (obviously because
> some basic blocks are useless).

Right.

> We can not use current exception handling in llvm, see
> http://www.nondot.org/sabre/LLVMNotes/ExceptionHandlingChanges.txt.

Why not?

> We can not use the llvm.dbg.stoppoint feature because it is not
> implemented in llvm's JIT.

llvm.dbg.stoppoint isn't really what you want, this is really for debug 
info support.

> So here are a few questions whose answers will help me go through this issue
> 1) Is the Chris' exception handling note actually implemented or is it
> still in project? And how difficult do you expect it to be? (Even if I
> have implemented some stuff in llvm, I am still not entirely comfortable
> with the code)

There are two separate issues here:

1. catching exceptions from function calls
2. catching exceptions from "non call" instructions like divides, etc.

The LLVM IR, as it stands now, is expressive enough to describe #1, but 
not #2.  The notes above talk solely about how to extend the IR to support 
#2.  Reid has an interest in implementing #2 at some point, which will be 
a great improvement for some applications.

There is an extra wrinkle here though.  Zero-cost C++ exception handling 
(i.e. #1) is about 3/4 of the way implemented in the C front-end and code 
generator, but it is not yet completed (notably, JIT support is missing). 
This work is also currently stalled.

If you'd be interested in helping with any of these projects, please let 
me know!

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list