[llvm] [OCaml][NPM] Add OCaml bindings to new pass manager (PR #66421)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 14 14:41:32 PDT 2023


================
@@ -0,0 +1,85 @@
+(*===-- llvm_passbuilder.mli - LLVM OCaml Interface ------------*- OCaml -*-===*
+ *
+ * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+ * See https://llvm.org/LICENSE.txt for license information.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ *
+ *===----------------------------------------------------------------------===*)
+
+type llpassbuilder_options
+
+(** [run_passes m passes tm opts] runs a set of passes over a module. The
+    format of the string [passes] is the same as opt's -passes argument for
+    the new pass manager. Individual passes may be specified, separated by
+    commas. Full pipelines may also be invoked. *)
----------------
alan-j-hu wrote:

This is the definition of `LLVMRunPasses`, which seems to exist for the C API: https://github.com/llvm/llvm-project/blob/0a1aa6cda2758b0926a95f87d39ffefb1cb90200/llvm/lib/Passes/PassBuilderBindings.cpp#L46

This seems to be the corresponding C++ function: https://llvm.org/doxygen/classllvm_1_1PassManager.html#aef5d9142acafceffd14c76b8ddd0fd4e where `ModulePassManager` is an alias for `PassManager<Module>`: https://llvm.org/doxygen/namespacellvm.html#a083c8f57e0e3a1011bf2ea8673700558

Should I just put down the C function `LLVMRunPasses`? Or should I put down `ModulePassManager::run`? What would be easiest for readers to understand and look up? I think that the C API function has enough additional functionality that the wrapped C++ function doesn't have that I should refer to the C function if I were to put a crossref. What do you think?

https://github.com/llvm/llvm-project/pull/66421


More information about the llvm-commits mailing list