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

Gordon Henriksen gordonhenriksen at mac.com
Wed Nov 28 22:34:54 PST 2007


On Nov 29, 2007, at 01:24, Chris Lattner wrote:

> 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 {
>    x++;
>    foo();
>
>    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.

Okay; didn't see that interaction. I'll scrutinize the codegen more  
closely for this stuff before proceeding. I didn't apply any register  
pressure in my example cases.

— Gordon





More information about the llvm-dev mailing list