<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<div><div>Thanks for the quick reply, Anton. </div><div><br class="webkit-block-placeholder"></div><div>On 2007-08-12, at 16:43, Anton Korobeynikov wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hello, Gordon.</div><div><br></div><div>Just a quick thinko (that's why I'm sending this e-mail personally):</div></blockquote><div><br class="webkit-block-placeholder"></div><div>No problem. I hope you don't mind me redirecting back to the list, though…</div><br><blockquote type="cite"><div><span class="Apple-style-span" style="-webkit-text-stroke-width: -1; ">maybe current infrastructure used for eh/debug info emission can be extended to handle ocaml data?</span></div></blockquote><div><br></div><div><div>Perhaps. I'm pretty sure the code to generate this stuff doesn't belong in LLVM proper like DWARF support does, though; this is not even a vague approximation of a standard. :)</div><br><blockquote type="cite">Now it emits just DWARF information. Probably, we can think about extending it to emit some "random" information. For example, there is a term "landing pad", which corresponds to catch-block in C++. Internally, landing pad is just pair of labels plus some additional info. Labels appears from lowering of invoke inst, maybe something like this can be used to emit necessary information?</blockquote><div><br class="webkit-block-placeholder"></div><div>Oo, that sounds like the right track. Maybe I could tack an optional something onto the call/invoke instructions that says "export a return address label", like this:</div><div><br class="webkit-block-placeholder"></div><div><div><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier" size="2">    %tmp.1 = i8* call @_camlPervasives__print_endline_298(i8* %greeting.0) ret internal i8* @L103</font></font></div><br></div><div>And then adjust the code generators to insert the specified label. Afterwards, @L103 would be a normal constant and I could build the frame table as a plain old LLVM constant.</div><div><br class="webkit-block-placeholder"></div><blockquote type="cite"><span class="Apple-style-span" style="-webkit-text-stroke-width: -1; ">Some amount of intrinsics plus additional lowering code.</span></blockquote><br></div><div><div>I can think of two ways to use an intrinsic toward this end, both of which seem unfortunately flawed:</div><div><br class="webkit-block-placeholder"></div><div><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier" size="2"><span class="Apple-style-span" style="font-size: 10px;">    ; Annotation on the call instruction.</span></font></font></div><div><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier" size="2"><span class="Apple-style-span" style="font-size: 10px;">    %tmp.1 = i8* call @_camlPervasives__print_endline_298(i8* %greeting.0)</span></font></font></div><div><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier" size="2"><span class="Apple-style-span" style="font-size: 10px;">    call void @llvm.var.annotate(i8* %tmp.1, i8* "L103", i8* null, i32 0)</span></font></font></div><div><br class="webkit-block-placeholder"></div><div>The code generator can notice the annotation and insert the label. But… what if the callee had a void return type? There's no register to annotate.</div><div><br class="webkit-block-placeholder"></div><div><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier" size="2"><span class="Apple-style-span" style="font-size: 10px;">    ; A freestanding call immediately following the call instruction.</span></font></font></div><div><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier" size="2"><span class="Apple-style-span" style="font-size: 10px;">    %tmp.1 = i8* call @_camlPervasives__print_endline_298(i8* %greeting.0)</span></font></font></div><div><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" face="Courier" size="2"><span class="Apple-style-span" style="font-size: 10px;">    call void @llvm.pcmarker(i32 103)</span></font></font></div><div><br></div><div>The marker can just be lowered to a label. But… what about caller-save calling convention? The PC marker won't be on the right instruction. If I'm just imagining this problem, then this may be the solution to this problem.</div></div><div><br></div><blockquote type="cite"><div><span class="Apple-style-span" style="-webkit-text-stroke-width: -1; ">Even more, maybe some present functionaly can be trivially extended, or annotation intrinsic used for this?</span></div></blockquote><br></div><div>Hopefully Chris has something up his sleeve! I don't think llvm.var.annotate works, though as pointed out above.</div><div><br class="webkit-block-placeholder"></div><div>— Gordon</div><div> </div><br></body></html>