[LLVMdev] [Caml-list] Ocaml(opt) & llvm

Chris Lattner sabre at nondot.org
Wed Nov 28 22:24:25 PST 2007

On Nov 28, 2007, at 10:16 PM, Gordon Henriksen wrote:

>> It only works if values are not held in registers across throws
>> though, which is kinda lame ...
> Though I'm primarily interested in this model only from an
> interoperability perspective, reloading the register file for a throw
> seems a comparatively small price to pay compared to, say,
> symbolically unwinding the stack. :) More importantly, the common case
> through code does not require a register file save/restore.

The issue is in the non-throw case.  Consider a function like this:

  int x = ...
  try {

    use (x);

  } catch (...) {
    print x;

Because the 'throw' doesn't restore the callee-save registers as the  
stack is unwound, the compiler can't put X in a register across the x+ 
+ and use of x in the try block.


More information about the llvm-dev mailing list