| Pointer
| Opaque
| Vector
+ | Metadata
end
(** The linkage of a global value, accessed with {!linkage} and
module Linkage : sig
type t =
External
+ | Available_externally
| Link_once
| Weak
| Appending
convention from C. *)
end
+module Attribute : sig
+ type t =
+ | Zext
+ | Sext
+ | Noreturn
+ | Inreg
+ | Structret
+ | Nounwind
+ | Noalias
+ | Byval
+ | Nest
+ | Readnone
+ | Readonly
+end
+
(** The predicate for an integer comparison ([icmp]) instruction.
See the [llvm::ICmpInst::Predicate] enumeration. *)
module Icmp : sig
end
+(** {6 Iteration} *)
+
+(** [Before b] and [At_end a] specify positions from the start of the ['b] list
+ of [a]. [llpos] is used to specify positions in and for forward iteration
+ through the various value lists maintained by the LLVM IR. *)
+type ('a, 'b) llpos =
+| At_end of 'a
+| Before of 'b
+
+(** [After b] and [At_start a] specify positions from the end of the ['b] list
+ of [a]. [llrev_pos] is used for reverse iteration through the various value
+ lists maintained by the LLVM IR. *)
+type ('a, 'b) llrev_pos =
+| At_start of 'a
+| After of 'b
+
+
(** {6 Exceptions} *)
exception IoError of string
external delete_type_name : string -> llmodule -> unit
= "llvm_delete_type_name"
+(** [dump_module m] prints the .ll representation of the module [m] to standard
+ error. See the method [llvm::Module::dump]. *)
+external dump_module : llmodule -> unit = "llvm_dump_module"
+
(** {6 Types} *)
= "llvm_const_of_int64"
(** [const_float ty n] returns the floating point constant of type [ty] and
- value [n]. See the method [llvm::ConstantInt::get]. *)
+ value [n]. See the method [llvm::ConstantFP::get]. *)
external const_float : lltype -> float -> llvalue = "llvm_const_float"
(** {7 Constant expressions} *)
+(** [align_of ty] returns the alignof constant for the type [ty]. This is
+ equivalent to [const_ptrtoint (const_gep (const_null (pointer_type {i8,ty}))
+ (const_int i32_type 0) (const_int i32_type 1)) i32_type], but considerably
+ more readable. See the method [llvm::ConstantExpr::getAlignOf]. *)
+external align_of : lltype -> llvalue = "LLVMAlignOf"
+
(** [size_of ty] returns the sizeof constant for the type [ty]. This is
equivalent to [const_ptrtoint (const_gep (const_null (pointer_type ty))
- (const_int i64_type 1)) i64_type], but considerably more readable.
+ (const_int i32_type 1)) i64_type], but considerably more readable.
See the method [llvm::ConstantExpr::getSizeOf]. *)
external size_of : lltype -> llvalue = "LLVMSizeOf"
(** {7 Operations on global variables, functions, and aliases (globals)} *)
+(** [global_parent g] is the enclosing module of the global value [g].
+ See the method [llvm::GlobalValue::getParent]. *)
+external global_parent : llvalue -> llmodule = "LLVMGetGlobalParent"
+
(** [is_declaration g] returns [true] if the global value [g] is a declaration
only. Returns [false] otherwise.
See the method [llvm::GlobalValue::isDeclaration]. *)
See the method [llvm::GlobalVariable::eraseFromParent]. *)
external delete_global : llvalue -> unit = "llvm_delete_global"
+(** [global_begin m] returns the first position in the global variable list of
+ the module [m]. [global_begin] and [global_succ] can be used to iterate
+ over the global list in order.
+ See the method [llvm::Module::global_begin]. *)
+external global_begin : llmodule -> (llmodule, llvalue) llpos
+ = "llvm_global_begin"
+
+(** [global_succ gv] returns the global variable list position succeeding
+ [Before gv].
+ See the method [llvm::Module::global_iterator::operator++]. *)
+external global_succ : llvalue -> (llmodule, llvalue) llpos
+ = "llvm_global_succ"
+
+(** [iter_globals f m] applies function [f] to each of the global variables of
+ module [m] in order. Tail recursive. *)
+val iter_globals : (llvalue -> unit) -> llmodule -> unit
+
+(** [fold_left_globals f init m] is [f (... (f init g1) ...) gN] where
+ [g1,...,gN] are the global variables of module [m]. Tail recursive. *)
+val fold_left_globals : ('a -> llvalue -> 'a) -> 'a -> llmodule -> 'a
+
+(** [global_end m] returns the last position in the global variable list of the
+ module [m]. [global_end] and [global_pred] can be used to iterate over the
+ global list in reverse.
+ See the method [llvm::Module::global_end]. *)
+external global_end : llmodule -> (llmodule, llvalue) llrev_pos
+ = "llvm_global_end"
+
+(** [global_pred gv] returns the global variable list position preceding
+ [After gv].
+ See the method [llvm::Module::global_iterator::operator--]. *)
+external global_pred : llvalue -> (llmodule, llvalue) llrev_pos
+ = "llvm_global_pred"
+
+(** [rev_iter_globals f m] applies function [f] to each of the global variables
+ of module [m] in reverse order. Tail recursive. *)
+val rev_iter_globals : (llvalue -> unit) -> llmodule -> unit
+
+(** [fold_right_globals f m init] is [f g1 (... (f gN init) ...)] where
+ [g1,...,gN] are the global variables of module [m]. Tail recursive. *)
+val fold_right_globals : (llvalue -> 'a -> 'a) -> llmodule -> 'a -> 'a
+
(** [is_global_constant gv] returns [true] if the global variabile [gv] is a
constant. Returns [false] otherwise.
See the method [llvm::GlobalVariable::isConstant]. *)
external set_global_constant : bool -> llvalue -> unit
= "llvm_set_global_constant"
-(** [has_initializer gv] returns [true] if the global variable [gv] has an
- initializer and [false] otherwise.
- See the method [llvm::GlobalVariable::hasInitializer]. *)
-external has_initializer : llvalue -> bool = "llvm_has_initializer"
-
(** [global_initializer gv] returns the initializer for the global variable
[gv]. See the method [llvm::GlobalVariable::getInitializer]. *)
external global_initializer : llvalue -> llvalue = "LLVMGetInitializer"
See the method [llvm::Function::eraseFromParent]. *)
external delete_function : llvalue -> unit = "llvm_delete_function"
-(** [params f] returns the parameters of function [f].
- See the method [llvm::Function::getArgumentList]. *)
-external params : llvalue -> llvalue array = "llvm_params"
-
-(** [param f n] returns the [n]th parameter of function [f].
- See the method [llvm::Function::getArgumentList]. *)
-external param : llvalue -> int -> llvalue = "llvm_param"
+(** [function_begin m] returns the first position in the function list of the
+ module [m]. [function_begin] and [function_succ] can be used to iterate over
+ the function list in order.
+ See the method [llvm::Module::begin]. *)
+external function_begin : llmodule -> (llmodule, llvalue) llpos
+ = "llvm_function_begin"
+
+(** [function_succ gv] returns the function list position succeeding
+ [Before gv].
+ See the method [llvm::Module::iterator::operator++]. *)
+external function_succ : llvalue -> (llmodule, llvalue) llpos
+ = "llvm_function_succ"
+
+(** [iter_functions f m] applies function [f] to each of the functions of module
+ [m] in order. Tail recursive. *)
+val iter_functions : (llvalue -> unit) -> llmodule -> unit
+
+(** [fold_left_function f init m] is [f (... (f init f1) ...) fN] where
+ [f1,...,fN] are the functions of module [m]. Tail recursive. *)
+val fold_left_functions : ('a -> llvalue -> 'a) -> 'a -> llmodule -> 'a
+
+(** [function_end m] returns the last position in the function list of
+ the module [m]. [function_end] and [function_pred] can be used to iterate
+ over the function list in reverse.
+ See the method [llvm::Module::end]. *)
+external function_end : llmodule -> (llmodule, llvalue) llrev_pos
+ = "llvm_function_end"
+
+(** [function_pred gv] returns the function list position preceding [After gv].
+ See the method [llvm::Module::iterator::operator--]. *)
+external function_pred : llvalue -> (llmodule, llvalue) llrev_pos
+ = "llvm_function_pred"
+
+(** [rev_iter_functions f fn] applies function [f] to each of the functions of
+ module [m] in reverse order. Tail recursive. *)
+val rev_iter_functions : (llvalue -> unit) -> llmodule -> unit
+
+(** [fold_right_functions f m init] is [f (... (f init fN) ...) f1] where
+ [f1,...,fN] are the functions of module [m]. Tail recursive. *)
+val fold_right_functions : (llvalue -> 'a -> 'a) -> llmodule -> 'a -> 'a
(** [is_intrinsic f] returns true if the function [f] is an intrinsic.
See the method [llvm::Function::isIntrinsic]. *)
external set_function_call_conv : int -> llvalue -> unit
= "llvm_set_function_call_conv"
-(** [collector f] returns [Some name] if the function [f] has a garbage
+(** [gc f] returns [Some name] if the function [f] has a garbage
collection algorithm specified and [None] otherwise.
- See the method [llvm::Function::getCollector]. *)
-external collector : llvalue -> string option = "llvm_collector"
+ See the method [llvm::Function::getGC]. *)
+external gc : llvalue -> string option = "llvm_gc"
+
+(** [set_gc gc f] sets the collection algorithm for the function [f] to
+ [gc]. See the method [llvm::Function::setGC]. *)
+external set_gc : string option -> llvalue -> unit = "llvm_set_gc"
+
+(** [add_function_attr f a] adds attribute [a] to the return type of function
+ [f]. *)
+external add_function_attr : llvalue -> Attribute.t -> unit
+ = "llvm_add_function_attr"
+
+(** [remove_function_attr f a] removes attribute [a] from the return type of
+ function [f]. *)
+external remove_function_attr : llvalue -> Attribute.t -> unit
+ = "llvm_remove_function_attr"
+
+(** {7 Operations on params} *)
+
+(** [params f] returns the parameters of function [f].
+ See the method [llvm::Function::getArgumentList]. *)
+external params : llvalue -> llvalue array = "llvm_params"
+
+(** [param f n] returns the [n]th parameter of function [f].
+ See the method [llvm::Function::getArgumentList]. *)
+external param : llvalue -> int -> llvalue = "llvm_param"
+
+(** [param_parent p] returns the parent function that owns the parameter.
+ See the method [llvm::Argument::getParent]. *)
+external param_parent : llvalue -> llvalue = "LLVMGetParamParent"
+
+(** [param_begin f] returns the first position in the parameter list of the
+ function [f]. [param_begin] and [param_succ] can be used to iterate over
+ the parameter list in order.
+ See the method [llvm::Function::arg_begin]. *)
+external param_begin : llvalue -> (llvalue, llvalue) llpos = "llvm_param_begin"
+
+(** [param_succ bb] returns the parameter list position succeeding
+ [Before bb].
+ See the method [llvm::Function::arg_iterator::operator++]. *)
+external param_succ : llvalue -> (llvalue, llvalue) llpos = "llvm_param_succ"
+
+(** [iter_params f fn] applies function [f] to each of the parameters
+ of function [fn] in order. Tail recursive. *)
+val iter_params : (llvalue -> unit) -> llvalue -> unit
+
+(** [fold_left_params f init fn] is [f (... (f init b1) ...) bN] where
+ [b1,...,bN] are the parameters of function [fn]. Tail recursive. *)
+val fold_left_params : ('a -> llvalue -> 'a) -> 'a -> llvalue -> 'a
-(** [set_collector gc f] sets the collection algorithm for the function [f] to
- [gc]. See the method [llvm::Function::setCollector]. *)
-external set_collector : string option -> llvalue -> unit = "llvm_set_collector"
+(** [param_end f] returns the last position in the parameter list of
+ the function [f]. [param_end] and [param_pred] can be used to iterate
+ over the parameter list in reverse.
+ See the method [llvm::Function::arg_end]. *)
+external param_end : llvalue -> (llvalue, llvalue) llrev_pos = "llvm_param_end"
+(** [param_pred gv] returns the function list position preceding [After gv].
+ See the method [llvm::Function::arg_iterator::operator--]. *)
+external param_pred : llvalue -> (llvalue, llvalue) llrev_pos
+ = "llvm_param_pred"
+
+(** [rev_iter_params f fn] applies function [f] to each of the parameters
+ of function [fn] in reverse order. Tail recursive. *)
+val rev_iter_params : (llvalue -> unit) -> llvalue -> unit
+
+(** [fold_right_params f fn init] is [f (... (f init bN) ...) b1] where
+ [b1,...,bN] are the parameters of function [fn]. Tail recursive. *)
+val fold_right_params : (llvalue -> 'a -> 'a) -> llvalue -> 'a -> 'a
+
+(** [add_param p a] adds attribute [a] to parameter [p]. *)
+external add_param_attr : llvalue -> Attribute.t -> unit = "llvm_add_param_attr"
+
+(** [remove_param_attr p a] removes attribute [a] from parameter [p]. *)
+external remove_param_attr : llvalue -> Attribute.t -> unit
+ = "llvm_remove_param_attr"
+
+(** [set_param_alignment p a] set the alignment of parameter [p] to [a]. *)
+external set_param_alignment : llvalue -> int -> unit
+ = "llvm_set_param_alignment"
(** {7 Operations on basic blocks} *)
external insert_block : string -> llbasicblock -> llbasicblock
= "llvm_insert_block"
+(** [block_parent bb] returns the parent function that owns the basic block.
+ See the method [llvm::BasicBlock::getParent]. *)
+external block_parent : llbasicblock -> llvalue = "LLVMGetBasicBlockParent"
+
+(** [block_begin f] returns the first position in the basic block list of the
+ function [f]. [block_begin] and [block_succ] can be used to iterate over
+ the basic block list in order.
+ See the method [llvm::Function::begin]. *)
+external block_begin : llvalue -> (llvalue, llbasicblock) llpos
+ = "llvm_block_begin"
+
+(** [block_succ bb] returns the basic block list position succeeding
+ [Before bb].
+ See the method [llvm::Function::iterator::operator++]. *)
+external block_succ : llbasicblock -> (llvalue, llbasicblock) llpos
+ = "llvm_block_succ"
+
+(** [iter_blocks f fn] applies function [f] to each of the basic blocks
+ of function [fn] in order. Tail recursive. *)
+val iter_blocks : (llbasicblock -> unit) -> llvalue -> unit
+
+(** [fold_left_blocks f init fn] is [f (... (f init b1) ...) bN] where
+ [b1,...,bN] are the basic blocks of function [fn]. Tail recursive. *)
+val fold_left_blocks : ('a -> llbasicblock -> 'a) -> 'a -> llvalue -> 'a
+
+(** [block_end f] returns the last position in the basic block list of
+ the function [f]. [block_end] and [block_pred] can be used to iterate
+ over the basic block list in reverse.
+ See the method [llvm::Function::end]. *)
+external block_end : llvalue -> (llvalue, llbasicblock) llrev_pos
+ = "llvm_block_end"
+
+(** [block_pred gv] returns the function list position preceding [After gv].
+ See the method [llvm::Function::iterator::operator--]. *)
+external block_pred : llbasicblock -> (llvalue, llbasicblock) llrev_pos
+ = "llvm_block_pred"
+
+(** [rev_iter_blocks f fn] applies function [f] to each of the basic blocks
+ of function [fn] in reverse order. Tail recursive. *)
+val rev_iter_blocks : (llbasicblock -> unit) -> llvalue -> unit
+
+(** [fold_right_blocks f fn init] is [f (... (f init bN) ...) b1] where
+ [b1,...,bN] are the basic blocks of function [fn]. Tail recursive. *)
+val fold_right_blocks : (llbasicblock -> 'a -> 'a) -> llvalue -> 'a -> 'a
+
(** [value_of_block bb] losslessly casts [bb] to an [llvalue]. *)
external value_of_block : llbasicblock -> llvalue = "LLVMBasicBlockAsValue"
external block_of_value : llvalue -> llbasicblock = "LLVMValueAsBasicBlock"
+(** {7 Operations on instructions} *)
+
+(** [instr_parent i] is the enclosing basic block of the instruction [i].
+ See the method [llvm::Instruction::getParent]. *)
+external instr_parent : llvalue -> llbasicblock = "LLVMGetInstructionParent"
+
+(** [instr_begin bb] returns the first position in the instruction list of the
+ basic block [bb]. [instr_begin] and [instr_succ] can be used to iterate over
+ the instruction list in order.
+ See the method [llvm::BasicBlock::begin]. *)
+external instr_begin : llbasicblock -> (llbasicblock, llvalue) llpos
+ = "llvm_instr_begin"
+
+(** [instr_succ i] returns the instruction list position succeeding [Before i].
+ See the method [llvm::BasicBlock::iterator::operator++]. *)
+external instr_succ : llvalue -> (llbasicblock, llvalue) llpos
+ = "llvm_instr_succ"
+
+(** [iter_instrs f bb] applies function [f] to each of the instructions of basic
+ block [bb] in order. Tail recursive. *)
+val iter_instrs: (llvalue -> unit) -> llbasicblock -> unit
+
+(** [fold_left_instrs f init bb] is [f (... (f init g1) ...) gN] where
+ [g1,...,gN] are the instructions of basic block [bb]. Tail recursive. *)
+val fold_left_instrs: ('a -> llvalue -> 'a) -> 'a -> llbasicblock -> 'a
+
+(** [instr_end bb] returns the last position in the instruction list of the
+ basic block [bb]. [instr_end] and [instr_pred] can be used to iterate over
+ the instruction list in reverse.
+ See the method [llvm::BasicBlock::end]. *)
+external instr_end : llbasicblock -> (llbasicblock, llvalue) llrev_pos
+ = "llvm_instr_end"
+
+(** [instr_pred i] returns the instruction list position preceding [After i].
+ See the method [llvm::BasicBlock::iterator::operator--]. *)
+external instr_pred : llvalue -> (llbasicblock, llvalue) llrev_pos
+ = "llvm_instr_pred"
+
+(** [fold_right_instrs f bb init] is [f (... (f init fN) ...) f1] where
+ [f1,...,fN] are the instructions of basic block [bb]. Tail recursive. *)
+val fold_right_instrs: (llvalue -> 'a -> 'a) -> llbasicblock -> 'a -> 'a
+
+
(** {7 Operations on call sites} *)
(** [instruction_call_conv ci] is the calling convention for the call or invoke
external instruction_call_conv: llvalue -> int
= "llvm_instruction_call_conv"
-(** [set_inst_call_conv cc ci] sets the calling convention for the call or
- invoke instruction [ci] to the integer [cc], which can be one of the values
- from the module {!CallConv}. See the method [llvm::CallInst::setCallingConv]
+(** [set_instruction_call_conv cc ci] sets the calling convention for the call
+ or invoke instruction [ci] to the integer [cc], which can be one of the
+ values from the module {!CallConv}.
+ See the method [llvm::CallInst::setCallingConv]
and [llvm::InvokeInst::setCallingConv]. *)
external set_instruction_call_conv: int -> llvalue -> unit
= "llvm_set_instruction_call_conv"
+(** [add_instruction_param_attr ci i a] adds attribute [a] to the [i]th
+ parameter of the call or invoke instruction [ci]. [i]=0 denotes the return
+ value. *)
+external add_instruction_param_attr : llvalue -> int -> Attribute.t -> unit
+ = "llvm_add_instruction_param_attr"
+
+(** [remove_instruction_param_attr ci i a] removes attribute [a] from the
+ [i]th parameter of the call or invoke instruction [ci]. [i]=0 denotes the
+ return value. *)
+external remove_instruction_param_attr : llvalue -> int -> Attribute.t -> unit
+ = "llvm_remove_instruction_param_attr"
+
+(** {Operations on call instructions (only)} *)
+
+(** [is_tail_call ci] is [true] if the call instruction [ci] is flagged as
+ eligible for tail call optimization, [false] otherwise.
+ See the method [llvm::CallInst::isTailCall]. *)
+external is_tail_call : llvalue -> bool = "llvm_is_tail_call"
+
+(** [set_tail_call tc ci] flags the call instruction [ci] as eligible for tail
+ call optimization if [tc] is [true], clears otherwise.
+ See the method [llvm::CallInst::setTailCall]. *)
+external set_tail_call : bool -> llvalue -> unit = "llvm_set_tail_call"
(** {7 Operations on phi nodes} *)
(** {6 Instruction builders} *)
-(** [builder] creates an instruction builder with no position. It is invalid to
- use this builder until its position is set with {!position_before} or
+(** [builder ()] creates an instruction builder with no position. It is invalid
+ to use this builder until its position is set with {!position_before} or
{!position_at_end}. See the constructor for [llvm::LLVMBuilder]. *)
-external builder: unit-> llbuilder
- = "llvm_builder"
+external builder : unit -> llbuilder = "llvm_builder"
+
+(** [builder_at ip] creates an instruction builder positioned at [ip].
+ See the constructor for [llvm::LLVMBuilder]. *)
+val builder_at : (llbasicblock, llvalue) llpos -> llbuilder
(** [builder_before ins] creates an instruction builder positioned before the
instruction [isn]. See the constructor for [llvm::LLVMBuilder]. *)
-external builder_before : llvalue -> llbuilder = "llvm_builder_before"
+val builder_before : llvalue -> llbuilder
(** [builder_at_end bb] creates an instruction builder positioned at the end of
the basic block [bb]. See the constructor for [llvm::LLVMBuilder]. *)
-external builder_at_end : llbasicblock -> llbuilder = "llvm_builder_at_end"
+val builder_at_end : llbasicblock -> llbuilder
+
+(** [position_builder ip bb] moves the instruction builder [bb] to the position
+ [ip].
+ See the constructor for [llvm::LLVMBuilder]. *)
+external position_builder : (llbasicblock, llvalue) llpos -> llbuilder -> unit
+ = "llvm_position_builder"
(** [position_before ins b] moves the instruction builder [b] to before the
instruction [isn]. See the method [llvm::LLVMBuilder::SetInsertPoint]. *)
-external position_before : llvalue -> llbuilder -> unit = "llvm_position_before"
+val position_before : llvalue -> llbuilder -> unit
(** [position_at_end bb b] moves the instruction builder [b] to the end of the
basic block [bb]. See the method [llvm::LLVMBuilder::SetInsertPoint]. *)
-external position_at_end : llbasicblock -> llbuilder -> unit
- = "llvm_position_at_end"
+val position_at_end : llbasicblock -> llbuilder -> unit
+
+(** [insertion_block b] returns the basic block that the builder [b] is
+ positioned to insert into. Raises [Not_Found] if the instruction builder is
+ uninitialized.
+ See the method [llvm::LLVMBuilder::GetInsertBlock]. *)
+external insertion_block : llbuilder -> llbasicblock = "llvm_insertion_block"
(** {7 Terminators} *)
external build_cond_br : llvalue -> llbasicblock -> llbasicblock -> llbuilder ->
llvalue = "llvm_build_cond_br"
-(** [build_switch case elsebb b] creates an empty
+(** [build_switch case elsebb count b] creates an empty
[switch %case, %elsebb]
- instruction at the position specified by the instruction builder [b].
+ instruction at the position specified by the instruction builder [b] with
+ space reserved for [count] cases.
See the method [llvm::LLVMBuilder::CreateSwitch]. *)
external build_switch : llvalue -> llbasicblock -> int -> llbuilder -> llvalue
= "llvm_build_switch"
+(** [add_case sw onval bb] causes switch instruction [sw] to branch to [bb]
+ when its input matches the constant [onval].
+ See the method [llvm::SwitchInst::addCase]. **)
+external add_case : llvalue -> llvalue -> llbasicblock -> unit
+ = "llvm_add_case"
+
(** [build_invoke fn args tobb unwindbb name b] creates an
[%name = invoke %fn(args) to %tobb unwind %unwindbb]
instruction at the position specified by the instruction builder [b].
(** Disposes of a memory buffer. *)
external dispose : llmemorybuffer -> unit = "llvm_memorybuffer_dispose"
end
+
+
+(** {6 Pass Managers} *)
+
+module PassManager : sig
+ (** *)
+ type 'a t
+ type any = [ `Module | `Function ]
+
+ (** [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]. *)
+ external create : unit -> [ `Module ] t = "llvm_passmanager_create"
+
+ (** [PassManager.create_function mp] constructs a new function-by-function
+ pass pipeline over the module provider [mp]. It does not take ownership of
+ [mp]. This type of pipeline is suitable for code generation and JIT
+ compilation tasks.
+ See the constructor of [llvm::FunctionPassManager]. *)
+ external create_function : llmoduleprovider -> [ `Function ] t
+ = "LLVMCreateFunctionPassManager"
+
+ (** [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. *)
+ external run_module : llmodule -> [ `Module ] t -> bool
+ = "llvm_passmanager_run_module"
+
+ (** [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. *)
+ external initialize : [ `Function ] t -> bool = "llvm_passmanager_initialize"
+
+ (** [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. *)
+ external run_function : llvalue -> [ `Function ] t -> bool
+ = "llvm_passmanager_run_function"
+
+ (** [finalize fpm] finalizes all of the function passes scheduled in in the
+ function pass manager [fpm]. Returns [true] if any of the passes
+ modified the module, [false] otherwise.
+ See the [llvm::FunctionPassManager::doFinalization] method. *)
+ external finalize : [ `Function ] t -> bool = "llvm_passmanager_finalize"
+
+ (** Frees the memory of a pass pipeline. For function pipelines, does not free
+ the module provider.
+ See the destructor of [llvm::BasePassManager]. *)
+ external dispose : [< any ] t -> unit = "llvm_passmanager_dispose"
+end