# Module Llvm.PassManager

    module PassManager: sig .. end

    type 'a t

    type any = [ `Function | `Module ]

    val create : unit -> [ `Module ] t

`PassManager.create ()` constructs a new whole-module pass pipeline. This type of pipeline is suitable for link-time optimization and whole-module transformations. See the constructor of `llvm::PassManager`.

    val create_function : Llvm.llmodule -> [ `Function ] t

`PassManager.create_function m` constructs a new function-by-function pass pipeline over the module `m`. It does not take ownership of `m`. This type of pipeline is suitable for code generation and JIT compilation tasks. See the constructor of `llvm::FunctionPassManager`.

    val run_module : Llvm.llmodule -> [ `Module ] t -> bool

`run_module m pm` initializes, executes on the module `m`, and finalizes all of the passes scheduled in the pass manager `pm`. Returns `true` if any of the passes modified the module, `false` otherwise. See the `llvm::PassManager::run` method.

    val initialize : [ `Function ] t -> bool

`initialize fpm` initializes all of the function passes scheduled in the function pass manager `fpm`. Returns `true` if any of the passes modified the module, `false` otherwise. See the `llvm::FunctionPassManager::doInitialization` method.

    val run_function : Llvm.llvalue -> [ `Function ] t -> bool

`run_function f fpm` executes all of the function passes scheduled in the function pass manager `fpm` over the function `f`. Returns `true` if any of the passes modified `f`, `false` otherwise. See the `llvm::FunctionPassManager::run` method.

    val finalize : [ `Function ] t -> bool

`finalize fpm` finalizes all of the function passes scheduled in the function pass manager `fpm`. Returns `true` if any of the passes modified the module, `false` otherwise. See the `llvm::FunctionPassManager::doFinalization` method.

    val dispose : [< any ] t -> unit

Frees the memory of a pass pipeline. For function pipelines, does not free the module. See the destructor of `llvm::BasePassManager`.