[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:53:12 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. *)
+val run_passes
+  : Llvm.llmodule
+  -> string
+  -> Llvm_target.TargetMachine.t
+  -> llpassbuilder_options
+  -> (unit, string) result
+
+(** Creates a new set of options for a PassBuilder. *)
----------------
alan-j-hu wrote:

These are all the functions that this and subsequent functions are wrapping: https://github.com/llvm/llvm-project/blob/main/llvm/lib/Passes/PassBuilderBindings.cpp#L82-L145

The C functions don't have documentation comments, and they wrap member variable assignments, not C++ functions. Should I just make an OCaml document "section" header and point to https://llvm.org/doxygen/classllvm_1_1LLVMPassBuilderOptions.html and https://llvm.org/doxygen/classllvm_1_1PipelineTuningOptions.html ?

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


More information about the llvm-commits mailing list