[LLVMdev] Adding CFG edges for null pointer exceptions?

Duncan Sands baldrick at free.fr
Mon Feb 1 00:11:11 PST 2010


Hi James,

> Is it possible to add edges to the CFG from instructions that reference 
> memory to exception landing pads? I want to do this so that I can 
> convert SEGV signals into exceptions that can be safely unwound and 
> caught. My compiler's existing code generator handles this by having a 
> combined memory dereference and jump on null instruction. LLVM doesn't 
> seem to have anything similar - I was thinking I might simulate this by 
> adding a new instrinsic for potentially faulting memory references. Does 
> anyone have any ideas on this?

see http://llvm.org/PR1269 (support for non-call exceptions).  If you are only
interested in null dereferences, I suggest you insert explicit checks for null
pointers for the moment, branching to a "throw" if one is found.

Ciao,

Duncan.



More information about the llvm-dev mailing list