<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><html>Hi Erick,</html><html><br></html><html>Thanks, good analysis. I have some feedback below and inline.</html><html><br></html><html>On 2008-03-20, at 02:59, Erick Tryzelaar wrote:</html><br class="Apple-interchange-newline"><blockquote type="cite">Use some of the new features that gordonh provided. However, I don't think we need to use everything:<br><br>Since the LLVMGetLastInstruction actually returns one past the last instruction that is mainly used for c++style iteration. Since we already have to protect against next_instr and etc from returning a null pointer, we can already model "last_instr" as "None".<br></blockquote><div><br></div><div>That's not correct; that function doesn't return an iterator, it actually returns the last instruction (or null if the block is empty). This is the tip of the tail of the doubly linked list (≠ <font class="Apple-style-span" face="Courier">List.tl</font>), and is the terminator instruction—very important to following the CFG.</div><div><br></div><blockquote type="cite">I don't think we need position_builder as proposed. It's more of a convenience function so that you don't have to write "match next_instr i with ...", but I don't think you need it that often, and it's trivial to write a function in the client to do that for us.</blockquote><div><blockquote type="cite"><br></blockquote></div></div><div><blockquote type="cite">I've added a couple wrapper scripts that (I think) would be more common, position_at_start and position_after, that will also safely handle builders without any instructions in them.</blockquote><div><br></div><div><font class="Apple-style-span" face="Courier">position_builder b bb (first_instr bb)</font> and <font class="Apple-style-span" face="Courier">position_builder b bb (last_instr bb)</font> handle empty blocks correctly. Both the <font class="Apple-style-span" face="Courier">*_instr</font> functions return <font class="Apple-style-span" face="Courier">None</font>, making <font class="Apple-style-span" face="Courier">position_builder</font> use the only valid iterator (<font class="Apple-style-span" face="Courier">unwrap(bb)->begin() == unwrap(bb)->end()<span class="Apple-style-span" style="font-family: 'Trebuchet MS'; "> by definition).</span></font></div><div><br></div><blockquote type="cite">Finally, I migrated a couple functions from llvm_ocaml.c to llvm.ml. While this probably doesn't make a difference, it might allow ocaml to do some more optimizations.</blockquote><div><blockquote type="cite"><br></blockquote></div><blockquote type="cite" class=""><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">diff --git bindings/ocaml/llvm/llvm.ml bindings/ocaml/llvm/llvm.ml</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">index ac05a4d..37a11fe 100644</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">--- bindings/ocaml/llvm/llvm.ml</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+++ bindings/ocaml/llvm/llvm.ml</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">@@ -335,6 +335,35 @@ external insert_block : string -> llbasicblock -> llbasicblock</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Andale Mono; min-height: 11.0px"> <br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; "> (*--... Operations on instructions .........................................--*)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; "> external instr_parent : llvalue -> llbasicblock = "LLVMGetInstructionParent"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+external instr_parent : llvalue -> llbasicblock = "LLVMGetInstructionParent"</div></blockquote><div><br></div><div>?</div><br><blockquote type="cite" class=""><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+external first_instr: llbasicblock -> llvalue option = "llvm_first_instr"</div></blockquote><div><br></div><div><font class="Apple-style-span" face="Courier">last_instr bb</font> is the terminator and quite important for navigating the CFG.</div><div><br></div><div>Actually, analysis and transformation algorithms would be well-served <font class="Apple-style-span" face="Courier">initial_instr</font>/<font class="Apple-style-span" face="Courier">terminator</font> bindings which raise <font class="Apple-style-span" face="Courier">Not_found</font> instead of yielding <font class="Apple-style-span" face="Courier">None</font>. This would serve well such clients since they would not have to explicitly handle the case of an empty block or one with with no terminator, neither of which occur in valid IR.</div><div><br></div><div>It would not serve well my <font class="Apple-style-span" face="Courier">position_builder</font> use case, so perhaps there should be redundant bindings to serve the two needs? Hm.</div><br><blockquote type="cite" class=""><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+external next_instr: llvalue -> llvalue option = "llvm_next_instr"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+external prev_instr: llvalue -> llvalue option = "llvm_prev_instr"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+let iter_block f bb =</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  let rec aux i =</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+    match i with</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+    | None -> ()</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+    | Some next -> f next; aux (next_instr next)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  in</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  aux (first_instr bb)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+let fold_left_block f init bb =</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  let rec aux init i =</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+    match i with</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+    | None -> init</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+    | Some next -> aux (f init next) (next_instr next)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  in</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  aux init (first_instr bb)</div></blockquote><div><br></div><div>Nice.</div><br><blockquote type="cite" class=""><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+let fold_right_block f bb init =</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  let rec aux i init =</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+    match i with</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+    | None -> init</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+    | Some next -> f next (aux (next_instr next) init)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  in</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  aux (first_instr bb) init</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+</div></blockquote><div><br></div><div>This isn't tail recursive but it could be if you bound <font class="Apple-style-span" face="Courier">LLVMGetLastInstruction</font> and used <font class="Apple-style-span" face="Courier">prev_instr<span class="Apple-style-span" style="font-family: 'Trebuchet MS'; ">.</span></font></div></div><div><br><blockquote type="cite" class=""><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Andale Mono; min-height: 11.0px"> <br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; "> (*--... Operations on call sites ...........................................--*)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; "> external instruction_call_conv: llvalue -> int</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">@@ -349,14 +378,42 @@ external incoming : llvalue -> (llvalue * llbasicblock) list = "llvm_incoming"</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Andale Mono; min-height: 11.0px"> <br class="webkit-block-placeholder"></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Andale Mono; min-height: 11.0px"> <br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; "> (*===-- Instruction builders ----------------------------------------------===*)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">-external builder: unit-> llbuilder = "llvm_builder"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">-external builder_before : llvalue -> llbuilder = "llvm_builder_before"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">-external builder_at_end : llbasicblock -> llbuilder = "llvm_builder_at_end"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+external builder : unit -> llbuilder = "llvm_builder"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; "> external position_before : llvalue -> llbuilder -> unit = "llvm_position_before"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; "> external position_at_end : llbasicblock -> llbuilder -> unit</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">                          = "llvm_position_at_end"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; "> external insertion_block : llbuilder -> llbasicblock = "llvm_insertion_block"</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Andale Mono; min-height: 11.0px"> <br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+let position_after i b =</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  match next_instr i with</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  | Some i -> position_before i b</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  | None -> position_at_end (insertion_block b) b</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+let position_at_start bb b =</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  match first_instr bb with</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  | Some i -> position_before i b</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  | None -> position_at_end bb b</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+let builder_before i =</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  let b = builder () in</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  position_before i b;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  b</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+let builder_after i =</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  let b = builder () in</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  position_after i b;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  b</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+let builder_at_start bb =</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  let b = builder () in</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  position_at_start bb b;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  b</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+let builder_at_end bb =</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  let b = builder () in</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  position_at_end bb b;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  b</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+</div></blockquote><div><br></div><div>I was trying to avoid this n x m explosion, although it is probably bounded at 8 = <font class="Apple-style-span" face="Courier">{builder,position}_{before,after,at_end,at_start}</font>. In its place, I advocate the composable concepts of:</div><div><br></div><ol class="MailOutline"><li>IR navigation (<font class="Apple-style-span" face="Courier"><span class="Apple-style-span" style="font-family: 'Trebuchet MS'; "><font class="Apple-style-span" face="Courier">first</font>, </span>next</font>, <font class="Apple-style-span" face="Courier">last</font>, <font class="Apple-style-span" face="Courier">prev</font>). This is useful in other contexts.</li><li>A pair of builder positioning functions (<font class="Apple-style-span" face="Courier">builder_at</font>, <font class="Apple-style-span" face="Courier">position_builder</font>) that are as expressive as <font class="Apple-style-span" face="Courier">LLVMBuilder(BasicBlock*, BasicBlock::iterator)</font>.</li></ol><div><br></div><div>Your first e-mail implied you were for such a concept, although I think you over engineered it slightly. A perfect functional concept for LLVM's <font class="Apple-style-span" face="Courier">ilist</font> iterator would be thus:</div><div><div><div><br></div></div><blockquote class="webkit-indent-blockquote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><span class="Apple-style-span" style="font-family: Courier; "><font class="Apple-style-span" color="#0000FF">type</font> 'a 'b llposition =</span><br><span class="Apple-style-span" style="font-family: Courier; ">| <i>Before</i> of 'a</span></blockquote><blockquote class="webkit-indent-blockquote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><span class="Apple-style-span" style="font-family: Courier; ">| <i>At_end</i> of 'b</span></blockquote><div><br></div><div>With this, <font class="Apple-style-span" face="Courier">position_builder</font> would simply have type <font class="Apple-style-span" face="Courier">llvalue llbasicblock llposition -> llbuilder -> <span class="Apple-style-span" style="font-family: 'Trebuchet MS'; "><font class="Apple-style-span" face="Courier">unit</font> and I would seriously consider deleting </span>{builder,position}_{at_end,before}<span class="Apple-style-span" style="font-family: 'Trebuchet MS'; "> since they are trivial:</span></font></div><div><br></div></div></div><blockquote class="webkit-indent-blockquote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><span class="Apple-style-span" style="font-family: Courier; "><font class="Apple-style-span" color="#0000FF">external</font> builder : unit -> llbuilder</span></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><font class="Apple-style-span" face="Courier"><span class="Apple-style-span" style="font-family: 'Trebuchet MS'; "><span class="Apple-style-span" style="font-family: Courier; "><font class="Apple-style-span" color="#0000FF">external</font> position_builder : llvalue llbasicblock llposition -> llbuilder</span><div><font class="Apple-style-span" face="Courier"><br></font></div></span></font></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><font class="Apple-style-span" face="Courier"><font class="Apple-style-span" color="#0000FF">let</font> builder_at ip =<br>  <font class="Apple-style-span" color="#0000FF">let</font> b = builder () in<br>  position_builder ip b;<br>  b<br><br><font class="Apple-style-span" color="#0000FF">let</font> builder_at_end bb = builder_at (<i>At_end</i> bb)<br><font class="Apple-style-span" color="#0000FF">let</font> builder_before i = builder_at (<i>Before</i> i)<br><span class="Apple-style-span" style="color: rgb(0, 0, 255); ">let</span> builder_at_start bb = builder_at (first_instr bb)<br><span class="Apple-style-span" style="color: rgb(0, 0, 255); ">let</span> builder_after i = builder_at (succ_instr i)<br><span class="Apple-style-span" style="color: rgb(0, 0, 255); ">let</span> position_at_end bb = position_builder (<i>At_end</i> bb)<br><span class="Apple-style-span" style="color: rgb(0, 0, 255); ">let</span> position_before i = position_builder (<i>Before</i> i)<br><span class="Apple-style-span" style="color: rgb(0, 0, 255); ">let</span> position_at_start bb = position_builder (first_instr bb)<br><span class="Apple-style-span" style="color: rgb(0, 0, 255); ">let</span> position_after i = position_builder (succ_instr i)</font></blockquote><div><div><br></div><blockquote type="cite" class=""><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; "> (*--... Terminators ........................................................--*)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; "> external build_ret_void : llbuilder -> llvalue = "llvm_build_ret_void"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; "> external build_ret : llvalue -> llbuilder -> llvalue = "llvm_build_ret"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">diff --git bindings/ocaml/llvm/llvm.mli bindings/ocaml/llvm/llvm.mli</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">index 5996ecd..854f6e5 100644</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">--- bindings/ocaml/llvm/llvm.mli</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+++ bindings/ocaml/llvm/llvm.mli</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">@@ -898,6 +898,26 @@ external block_of_value : llvalue -> llbasicblock = "LLVMValueAsBasicBlock"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">     See the method [llvm::Instruction::getParent]. *)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; "> external instr_parent : llvalue -> llbasicblock = "LLVMGetInstructionParent"</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Andale Mono; min-height: 11.0px"> <br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+(** [first_instr bb] is the first instruction of a basic block. *)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+external first_instr: llbasicblock -> llvalue option = "llvm_first_instr"</div></blockquote><div><br></div><div>s/a basic block/the basic block [bb]/</div>Please mention the <font class="Apple-style-span" face="Courier">None</font> case.<div>Likewise in other instances.</div><br><blockquote type="cite" class=""><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+(** [next_instr bb] is the instruction after 'i'. *)</div></blockquote><div><br></div><div>s/bb/i/</div><div>s/'i'/the instruction [i]/</div><div>Likewise below.</div><br><blockquote type="cite" class=""><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+external next_instr: llvalue -> llvalue option = "llvm_next_instr<span class="Apple-style-span" style="font-size: 12px; -webkit-text-stroke-width: -1; ">"</span></div></blockquote><blockquote type="cite" class=""><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+(** [prev_instr bb] is the instruction after 'i'. *)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+external prev_instr: llvalue -> llvalue option = "llvm_prev_instr"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+(** [iter_block bb] iterates over all the instructions in the basic block. *)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+val iter_block: (llvalue -> unit) -> llbasicblock -> unit</div></blockquote><blockquote type="cite" class=""><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+(** [fold_left_block f bb] folds left the function f over all the instructions</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+    in the basic block. *)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+val fold_left_block: ('a -> llvalue -> 'a) -> 'a -> llbasicblock -> 'a</div></blockquote><div><br></div><div>s/the function/the function [f]/</div><div>Likewise below.</div><br><blockquote type="cite" class=""><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+(** [fold_right_block bb f] folds right the function f over all the instructions</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+    in the basic block. *)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+val fold_right_block: (llvalue -> 'a -> 'a) -> llbasicblock -> 'a -> 'a</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Andale Mono; min-height: 11.0px"> <br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; "> (** {7 Operations on call sites} *)</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Andale Mono; min-height: 11.0px"> <br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">@@ -940,16 +960,33 @@ external builder: unit-> llbuilder</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Andale Mono; min-height: 11.0px"> <br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; "> (** [builder_before ins] creates an instruction builder positioned before the</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">     instruction [isn]. See the constructor for [llvm::LLVMBuilder]. *)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">-external builder_before : llvalue -> llbuilder = "llvm_builder_before"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+val builder_before : llvalue -> llbuilder</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+(** [builder_after ins] creates an instruction builder positioned after the</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+    instruction [isn]. See the constructor for [llvm::LLVMBuilder]. *)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+val builder_after: llvalue -> llbuilder</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+(** [builder_at_start bb] creates an instruction builder positioned at the start</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+    of the basic block [bb]. See the constructor for [llvm::LLVMBuilder]. *)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+val builder_at_start: llbasicblock -> llbuilder</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Andale Mono; min-height: 11.0px"> <br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; "> (** [builder_at_end bb] creates an instruction builder positioned at the end of</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">     the basic block [bb]. See the constructor for [llvm::LLVMBuilder]. *)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">-external builder_at_end : llbasicblock -> llbuilder = "llvm_builder_at_end"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+val builder_at_end : llbasicblock -> llbuilder</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Andale Mono; min-height: 11.0px"> <br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; "> (** [position_before ins b] moves the instruction builder [b] to before the</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">     instruction [isn]. See the method [llvm::LLVMBuilder::SetInsertPoint]. *)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; "> external position_before : llvalue -> llbuilder -> unit = "llvm_position_before"</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Andale Mono; min-height: 11.0px"> <br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+(** [position_after ins b] moves the instruction builder [b] to after the</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+    instruction [isn]. See the method [llvm::LLVMBuilder::SetInsertPoint]. *)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+val position_after : llvalue -> llbuilder -> unit</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+(** [position_at_start bb b] moves the instruction builder [b] to the start of</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+    the of basic block [bb]. See the method</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+    [llvm::LLVMBuilder::SetInsertPoint]. *)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+val position_at_start : llbasicblock -> llbuilder -> unit</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; "> (** [position_at_end bb b] moves the instruction builder [b] to the end of the</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">     basic block [bb]. See the method [llvm::LLVMBuilder::SetInsertPoint]. *)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; "> external position_at_end : llbasicblock -> llbuilder -> unit</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">diff --git bindings/ocaml/llvm/llvm_ocaml.c bindings/ocaml/llvm/llvm_ocaml.c</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">index c966091..eb9bda3 100644</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">--- bindings/ocaml/llvm/llvm_ocaml.c</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+++ bindings/ocaml/llvm/llvm_ocaml.c</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">@@ -660,6 +660,44 @@ CAMLprim value llvm_value_is_block(LLVMValueRef Val) {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">   return Val_bool(LLVMValueIsBasicBlock(Val));</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; "> }</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Andale Mono; min-height: 11.0px"> <br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+/*--... Operations on instructions .........................................--*/</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+/* llbasicblock -> llvalue option */</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+CAMLprim value llvm_first_instr(LLVMBasicBlockRef BB) {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  CAMLparam0();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  LLVMValueRef Instr;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  if ((Instr = LLVMGetFirstInstruction(BB))) {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+    value Option = alloc(1, 0);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+    Field(Option, 0) = (value) Instr;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+    CAMLreturn(Option);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  }</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  CAMLreturn(Val_int(0));</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+}</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+/* llbasicblock -> llvalue option */</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+CAMLprim value llvm_next_instr(LLVMValueRef I) {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  CAMLparam0();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  LLVMValueRef Instr;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  if ((Instr = LLVMGetNextInstruction(I))) {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+    value Option = alloc(1, 0);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+    Field(Option, 0) = (value) Instr;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+    CAMLreturn(Option);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  }</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  CAMLreturn(Val_int(0));</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+}</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+/* llbasicblock -> llvalue option */</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+CAMLprim value llvm_prev_instr(LLVMValueRef I) {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  CAMLparam0();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  LLVMValueRef Instr;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  if ((Instr = LLVMGetPreviousInstruction(I))) {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+    value Option = alloc(1, 0);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+    Field(Option, 0) = (value) Instr;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+    CAMLreturn(Option);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  }</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+  CAMLreturn(Val_int(0));</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+}</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">+</div></blockquote><div><br></div>Looks good.</div><div><br><blockquote type="cite" class=""><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; "> /*--... Operations on call sites ...........................................--*/</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Andale Mono; min-height: 11.0px"> <br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; "> /* llvalue -> int */</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">@@ -735,20 +773,6 @@ CAMLprim value llvm_builder(value Unit) {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">   return alloc_builder(LLVMCreateBuilder());</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; "> }</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Andale Mono; min-height: 11.0px"> <br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">-/* llvalue -> llbuilder */</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">-CAMLprim value llvm_builder_before(LLVMValueRef Inst) {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">-  LLVMBuilderRef B = LLVMCreateBuilder();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">-  LLVMPositionBuilderBefore(B, Inst);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">-  return alloc_builder(B);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">-}</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">-</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">-/* llbasicblock -> llbuilder */</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">-CAMLprim value llvm_builder_at_end(LLVMBasicBlockRef BB) {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">-  LLVMBuilderRef B = LLVMCreateBuilder();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">-  LLVMPositionBuilderAtEnd(B, BB);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">-  return alloc_builder(B);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">-}</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">-</div></blockquote><div><br></div><div>Nice.</div><br><blockquote type="cite" class=""><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; "> /* llvalue -> llbuilder -> unit */</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; "> CAMLprim value llvm_position_before(LLVMValueRef Inst, value B) {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal 'Andale Mono'; ">   LLVMPositionBuilderBefore(Builder_val(B), Inst);</div><div><font class="Apple-style-span" face="'Andale Mono'" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br></span></font></div></blockquote><span class="Apple-style-span" style="-webkit-text-stroke-width: -1; "><div><br></div>Thanks Erick!</span></div><div><span class="Apple-style-span" style="-webkit-text-stroke-width: -1;"><br></span></div><div><span class="Apple-style-span" style="-webkit-text-stroke-width: -1; ">— Gordon</span></div><div apple-content-edited="true"> </div><br></body></html>