<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Begin forwarded message:</div><div><br class="webkit-block-placeholder"></div><div><div><div><blockquote type="cite"><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: normal normal normal 12px/normal Helvetica; color: rgb(0, 0, 0); "><b>From: </b></font><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">Erick Tryzelaar <<a href="mailto:idadesub@users.sourceforge.net">idadesub@users.sourceforge.net</a>></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: normal normal normal 12px/normal Helvetica; color: rgb(0, 0, 0); "><b>Date: </b></font><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">March 11, 2008 02:26:39 EDT</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: normal normal normal 12px/normal Helvetica; color: rgb(0, 0, 0); "><b>To: </b></font><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; "><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: normal normal normal 12px/normal Helvetica; color: rgb(0, 0, 0); "><b>Subject: </b></font><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; "><b>[llvm-commits] [PATCH] Expose Pass and PassManager classes to c and ocaml bindings.</b></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: normal normal normal 12px/normal Helvetica; color: rgb(0, 0, 0); "><b>Reply-To: </b></font><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">CVS Commit Messages for LLVM repository <<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a>></font></div></div></blockquote></div><div><div><div><font class="Apple-style-span" face="Helvetica"><br class="webkit-block-placeholder"></font></div><div>Begin forwarded message:</div></div></div></div></div><div><div><br class="Apple-interchange-newline"><blockquote type="cite"><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: normal normal normal 12px/normal Helvetica; color: rgb(0, 0, 0); "><b>From: </b></font><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">Erick Tryzelaar <<a href="mailto:idadesub@users.sourceforge.net">idadesub@users.sourceforge.net</a>></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: normal normal normal 12px/normal Helvetica; color: rgb(0, 0, 0); "><b>Date: </b></font><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">March 11, 2008 02:42:21 EDT</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: normal normal normal 12px/normal Helvetica; color: rgb(0, 0, 0); "><b>To: </b></font><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; "><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: normal normal normal 12px/normal Helvetica; color: rgb(0, 0, 0); "><b>Subject: </b></font><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; "><b>[llvm-commits] [PATCH] Expose scalar transforms to the c and ocaml bindings.</b></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: normal normal normal 12px/normal Helvetica; color: rgb(0, 0, 0); "><b>Reply-To: </b></font><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">CVS Commit Messages for LLVM repository <<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a>><br></font></div></div></blockquote><br><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><span class="Apple-style-span" style="-webkit-text-stroke-width: -1; ">Begin forwarded message:</span></div></div><blockquote type="cite"><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: normal normal normal 12px/normal Helvetica; color: rgb(0, 0, 0); "><b>From: </b></font><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">Erick Tryzelaar <<a href="mailto:idadesub@users.sourceforge.net">idadesub@users.sourceforge.net</a>></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: normal normal normal 12px/normal Helvetica; color: rgb(0, 0, 0); "><b>Date: </b></font><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">March 11, 2008 04:07:13 EDT</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: normal normal normal 12px/normal Helvetica; color: rgb(0, 0, 0); "><b>To: </b></font><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; "><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: normal normal normal 12px/normal Helvetica; color: rgb(0, 0, 0); "><b>Subject: </b></font><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; "><b>[llvm-commits] [PATCH] Expose Pass and PassManager classes to c and ocaml bindings.</b></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: normal normal normal 12px/normal Helvetica; color: rgb(0, 0, 0); "><b>Reply-To: </b></font><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">CVS Commit Messages for LLVM repository <<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a>></font></div></div></blockquote></div><div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br class="khtml-block-placeholder"></div></div></div></div>Hi Erick,<div><br class="webkit-block-placeholder"></div><div>I'm going to take these patches as a basis, but go in a slightly different direction binding the classes. I observe:</div><div><br class="webkit-block-placeholder"></div><div><ul class="MailOutline"><li>The only thing that can be done with an LLVMFunctionPassRef is to convert it to an LLVMPassRef. I'd say it's not worthwhile to expose this type in the bindings.</li><li>Likewise, since Pass::~Pass isn't bound, the only thing that can be done with an LLVMPassRef is to add it to a pipeline or leak it.</li></ul></div><div><br class="webkit-block-placeholder"></div><div>Given these observations, I'm going to hide the memory management by fusing the create+add operations. There will be no need for the LLVMPassRef or LLVMFunctionPassRef types as a result.</div><div><br class="webkit-block-placeholder"></div><div>To do this, and I'm going to also unify the PassManager and FunctionPassManager types, because otherwise each LLVMCreateSomePass routine would need to be overloaded for each type of pipeline; that would be cumbersome. This would be most straightforward by adding a common base class to the two, but Chris is virtual-hostile, so I'll probably new up a discriminated union instead. So there will only be one additional LLVM___Ref type.</div><div><br class="webkit-block-placeholder"></div><div>I hope to provide an interface that can be used like this:</div><div><br class="webkit-block-placeholder"></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; "><font class="Apple-style-span" face="Courier"><font class="Apple-style-span" color="#0000FF">open</font> <i>Llvm</i></font></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; "><font class="Apple-style-span" face="Courier"><font class="Apple-style-span" color="#0000FF">open</font> <i>LLvm_scalar_opts</i></font></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; "><font class="Apple-style-span" face="Courier"><font class="Apple-style-span" color="#0000FF">open</font> <i>Llvm_target</i></font></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; "><font class="Apple-style-span" face="Courier"><br class="webkit-block-placeholder"></font></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; "><font class="Apple-style-span" face="Courier"><font class="Apple-style-span" color="#0000FF">let</font> (++) f x = f x; x<br><br><font class="Apple-style-span" color="#0000FF">let</font> build_pipeline m =<br> <i>FunctionPassManager</i>.create ()<br> ++ add_target_data m<br> ++ add_instruction_combining<br> ++ add_reassociate<br> ++ add_gvn<br> ++ add_cfg_simplification</font></blockquote><div></div></div><div><br></div><div><br class="webkit-block-placeholder"></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; "><font class="Apple-style-span" face="Courier"><font class="Apple-style-span" color="#0000FF">#include</font> <font class="Apple-style-span" color="#666666">"llvm-c/Core.h"</font></font></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; "><font class="Apple-style-span" face="Courier"><font class="Apple-style-span" color="#0000FF">#include</font> <font class="Apple-style-span" color="#666666">"llvm-c/ScalarOpts.h"</font></font></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; "><font class="Apple-style-span" face="Courier"><font class="Apple-style-span" color="#0000FF">#include</font> <font class="Apple-style-span" color="#666666">"llvm-c/Target.h"</font></font></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; "><font class="Apple-style-span" face="Courier"><br class="webkit-block-placeholder"></font></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; "><font class="Apple-style-span" face="Courier"><font class="Apple-style-span" color="#0000FF">static</font> LLVMPassManagerRef BuildPipeline(LLVMModuleRef M) {</font></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; "><font class="Apple-style-span" face="Courier"> LLVMPassManagerRef PM = LLVMCreateFunctionPassManager();</font></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; "><font class="Apple-style-span" face="Courier"> LLVMAddTargetData(PM, M);</font></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; "><font class="Apple-style-span" face="Courier"> LLVMAddInstructionCombining(PM);</font></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; "><font class="Apple-style-span" face="Courier"> LLVMAddReassociation(PM);</font></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; "><font class="Apple-style-span" face="Courier"> LLVMAddGVN(PM);</font></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; "><font class="Apple-style-span" face="Courier"> LLVMAddCFGSimplification(PM);</font></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; "><font class="Apple-style-span" face="Courier"> <font class="Apple-style-span" color="#0000FF">return</font> PM;</font></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; "><font class="Apple-style-span" face="Courier">}</font></blockquote><br></div></div><div>Thanks for all your contributions!</div><div><br class="webkit-block-placeholder"></div><div>— Gordon</div><div><div><div><br class="webkit-block-placeholder"></div></div></div></body></html>