[OCaml] Synchronize transformations with LLVM-C.

Also, rearrange the functions in a way that allows to quickly
compare C headers and .mli/glue files.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220842 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Peter Zotov 2014-10-29 08:15:21 +00:00
parent 68a70cdbfb
commit 360c7ed497
12 changed files with 572 additions and 473 deletions

View File

@ -55,12 +55,6 @@ CAMLprim value llvm_add_always_inliner(LLVMPassManagerRef PM) {
return Val_unit; return Val_unit;
} }
/* [`Module] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_always_inliner_pass(LLVMPassManagerRef PM) {
LLVMAddAlwaysInlinerPass(PM);
return Val_unit;
}
/* [`Module] Llvm.PassManager.t -> unit */ /* [`Module] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_global_dce(LLVMPassManagerRef PM) { CAMLprim value llvm_add_global_dce(LLVMPassManagerRef PM) {
LLVMAddGlobalDCEPass(PM); LLVMAddGlobalDCEPass(PM);
@ -74,7 +68,7 @@ CAMLprim value llvm_add_global_optimizer(LLVMPassManagerRef PM) {
} }
/* [`Module] Llvm.PassManager.t -> unit */ /* [`Module] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_ipc_propagation(LLVMPassManagerRef PM) { CAMLprim value llvm_add_ip_constant_propagation(LLVMPassManagerRef PM) {
LLVMAddIPConstantPropagationPass(PM); LLVMAddIPConstantPropagationPass(PM);
return Val_unit; return Val_unit;
} }
@ -91,7 +85,7 @@ CAMLprim value llvm_add_ipsccp(LLVMPassManagerRef PM) {
return Val_unit; return Val_unit;
} }
/* [`Module] Llvm.PassManager.t -> bool -> unit */ /* [`Module] Llvm.PassManager.t -> all_but_main:bool -> unit */
CAMLprim value llvm_add_internalize(LLVMPassManagerRef PM, value AllButMain) { CAMLprim value llvm_add_internalize(LLVMPassManagerRef PM, value AllButMain) {
LLVMAddInternalizePass(PM, Bool_val(AllButMain)); LLVMAddInternalizePass(PM, Bool_val(AllButMain));
return Val_unit; return Val_unit;

View File

@ -7,31 +7,45 @@
* *
*===----------------------------------------------------------------------===*) *===----------------------------------------------------------------------===*)
external add_argument_promotion : [ | `Module ] Llvm.PassManager.t -> unit = external add_argument_promotion
"llvm_add_argument_promotion" : [ `Module ] Llvm.PassManager.t -> unit
external add_constant_merge : [ | `Module ] Llvm.PassManager.t -> unit = = "llvm_add_argument_promotion"
"llvm_add_constant_merge" external add_constant_merge
external add_dead_arg_elimination : : [ `Module ] Llvm.PassManager.t -> unit
[ | `Module ] Llvm.PassManager.t -> unit = "llvm_add_dead_arg_elimination" = "llvm_add_constant_merge"
external add_function_attrs : [ | `Module ] Llvm.PassManager.t -> unit = external add_dead_arg_elimination
"llvm_add_function_attrs" : [ `Module ] Llvm.PassManager.t -> unit
external add_function_inlining : [ | `Module ] Llvm.PassManager.t -> unit = = "llvm_add_dead_arg_elimination"
"llvm_add_function_inlining" external add_function_attrs
external add_always_inliner : [ | `Module ] Llvm.PassManager.t -> unit = : [ `Module ] Llvm.PassManager.t -> unit
"llvm_add_always_inliner" = "llvm_add_function_attrs"
external add_global_dce : [ | `Module ] Llvm.PassManager.t -> unit = external add_function_inlining
"llvm_add_global_dce" : [ `Module ] Llvm.PassManager.t -> unit
external add_global_optimizer : [ | `Module ] Llvm.PassManager.t -> unit = = "llvm_add_function_inlining"
"llvm_add_global_optimizer" external add_always_inliner
external add_ipc_propagation : [ | `Module ] Llvm.PassManager.t -> unit = : [ `Module ] Llvm.PassManager.t -> unit
"llvm_add_ipc_propagation" = "llvm_add_always_inliner"
external add_prune_eh : [ | `Module ] Llvm.PassManager.t -> unit = external add_global_dce
"llvm_add_prune_eh" : [ `Module ] Llvm.PassManager.t -> unit
external add_ipsccp : [ | `Module ] Llvm.PassManager.t -> unit = = "llvm_add_global_dce"
"llvm_add_ipsccp" external add_global_optimizer
external add_internalize : [ | `Module ] Llvm.PassManager.t -> bool -> unit = : [ `Module ] Llvm.PassManager.t -> unit
"llvm_add_internalize" = "llvm_add_global_optimizer"
external add_strip_dead_prototypes : external add_ipc_propagation
[ | `Module ] Llvm.PassManager.t -> unit = "llvm_add_strip_dead_prototypes" : [ `Module ] Llvm.PassManager.t -> unit
external add_strip_symbols : [ | `Module ] Llvm.PassManager.t -> unit = = "llvm_add_ip_constant_propagation"
"llvm_add_strip_symbols" external add_prune_eh
: [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_prune_eh"
external add_ipsccp
: [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_ipsccp"
external add_internalize
: [ `Module ] Llvm.PassManager.t -> all_but_main:bool -> unit
= "llvm_add_internalize"
external add_strip_dead_prototypes
: [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_strip_dead_prototypes"
external add_strip_symbols
: [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_strip_symbols"

View File

@ -12,58 +12,72 @@
This interface provides an OCaml API for LLVM interprocedural optimizations, the This interface provides an OCaml API for LLVM interprocedural optimizations, the
classes in the [LLVMIPO] library. *) classes in the [LLVMIPO] library. *)
(** See llvm::createAddArgumentPromotionPass *) (** See the [llvm::createAddArgumentPromotionPass] function. *)
external add_argument_promotion : [ | `Module ] Llvm.PassManager.t -> unit = external add_argument_promotion
"llvm_add_argument_promotion" : [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_argument_promotion"
(** See llvm::createConstantMergePass function. *) (** See the [llvm::createConstantMergePass] function. *)
external add_constant_merge : [ | `Module ] Llvm.PassManager.t -> unit = external add_constant_merge
"llvm_add_constant_merge" : [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_constant_merge"
(** See llvm::createDeadArgEliminationPass function. *) (** See the [llvm::createDeadArgEliminationPass] function. *)
external add_dead_arg_elimination : external add_dead_arg_elimination
[ | `Module ] Llvm.PassManager.t -> unit = "llvm_add_dead_arg_elimination" : [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_dead_arg_elimination"
(** See llvm::createFunctionAttrsPass function. *) (** See the [llvm::createFunctionAttrsPass] function. *)
external add_function_attrs : [ | `Module ] Llvm.PassManager.t -> unit = external add_function_attrs
"llvm_add_function_attrs" : [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_function_attrs"
(** See llvm::createFunctionInliningPass function. *) (** See the [llvm::createFunctionInliningPass] function. *)
external add_function_inlining : [ | `Module ] Llvm.PassManager.t -> unit = external add_function_inlining
"llvm_add_function_inlining" : [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_function_inlining"
(** See llvm::createAlwaysInlinerPass function. *) (** See the [llvm::createAlwaysInlinerPass] function. *)
external add_always_inliner : [ | `Module ] Llvm.PassManager.t -> unit = external add_always_inliner
"llvm_add_always_inliner" : [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_always_inliner"
(** See llvm::createGlobalDCEPass function. *) (** See the [llvm::createGlobalDCEPass] function. *)
external add_global_dce : [ | `Module ] Llvm.PassManager.t -> unit = external add_global_dce
"llvm_add_global_dce" : [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_global_dce"
(** See llvm::createGlobalOptimizerPass function. *) (** See the [llvm::createGlobalOptimizerPass] function. *)
external add_global_optimizer : [ | `Module ] Llvm.PassManager.t -> unit = external add_global_optimizer
"llvm_add_global_optimizer" : [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_global_optimizer"
(** See llvm::createIPConstantPropagationPass function. *) (** See the [llvm::createIPConstantPropagationPass] function. *)
external add_ipc_propagation : [ | `Module ] Llvm.PassManager.t -> unit = external add_ipc_propagation
"llvm_add_ipc_propagation" : [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_ip_constant_propagation"
(** See llvm::createPruneEHPass function. *) (** See the [llvm::createPruneEHPass] function. *)
external add_prune_eh : [ | `Module ] Llvm.PassManager.t -> unit = external add_prune_eh
"llvm_add_prune_eh" : [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_prune_eh"
(** See llvm::createIPSCCPPass function. *) (** See the [llvm::createIPSCCPPass] function. *)
external add_ipsccp : [ | `Module ] Llvm.PassManager.t -> unit = external add_ipsccp
"llvm_add_ipsccp" : [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_ipsccp"
(** See llvm::createInternalizePass function. *) (** See the [llvm::createInternalizePass] function. *)
external add_internalize : [ | `Module ] Llvm.PassManager.t -> bool -> unit = external add_internalize
"llvm_add_internalize" : [ `Module ] Llvm.PassManager.t -> all_but_main:bool -> unit
= "llvm_add_internalize"
(** See llvm::createStripDeadPrototypesPass function. *) (** See the [llvm::createStripDeadPrototypesPass] function. *)
external add_strip_dead_prototypes : external add_strip_dead_prototypes
[ | `Module ] Llvm.PassManager.t -> unit = "llvm_add_strip_dead_prototypes" : [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_strip_dead_prototypes"
(** See llvm::createStripSymbolsPass function. *) (** See the [llvm::createStripSymbolsPass] function. *)
external add_strip_symbols : [ | `Module ] Llvm.PassManager.t -> unit = external add_strip_symbols
"llvm_add_strip_symbols" : [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_strip_symbols"

View File

@ -14,41 +14,41 @@
type t type t
(** See [llvm::PassManagerBuilder]. *) (** See the [llvm::PassManagerBuilder] function. *)
external create : unit -> t external create : unit -> t
= "llvm_pmbuilder_create" = "llvm_pmbuilder_create"
(** See [llvm::PassManagerBuilder::OptLevel]. *) (** See the [llvm::PassManagerBuilder::OptLevel] function. *)
external set_opt_level : int -> t -> unit external set_opt_level : int -> t -> unit
= "llvm_pmbuilder_set_opt_level" = "llvm_pmbuilder_set_opt_level"
(** See [llvm::PassManagerBuilder::SizeLevel]. *) (** See the [llvm::PassManagerBuilder::SizeLevel] function. *)
external set_size_level : int -> t -> unit external set_size_level : int -> t -> unit
= "llvm_pmbuilder_set_size_level" = "llvm_pmbuilder_set_size_level"
(** See [llvm::PassManagerBuilder::DisableUnitAtATime]. *) (** See the [llvm::PassManagerBuilder::DisableUnitAtATime] function. *)
external set_disable_unit_at_a_time : bool -> t -> unit external set_disable_unit_at_a_time : bool -> t -> unit
= "llvm_pmbuilder_set_disable_unit_at_a_time" = "llvm_pmbuilder_set_disable_unit_at_a_time"
(** See [llvm::PassManagerBuilder::DisableUnrollLoops]. *) (** See the [llvm::PassManagerBuilder::DisableUnrollLoops] function. *)
external set_disable_unroll_loops : bool -> t -> unit external set_disable_unroll_loops : bool -> t -> unit
= "llvm_pmbuilder_set_disable_unroll_loops" = "llvm_pmbuilder_set_disable_unroll_loops"
(** See [llvm::PassManagerBuilder::Inliner]. *) (** See the [llvm::PassManagerBuilder::Inliner] function. *)
external use_inliner_with_threshold : int -> t -> unit external use_inliner_with_threshold : int -> t -> unit
= "llvm_pmbuilder_use_inliner_with_threshold" = "llvm_pmbuilder_use_inliner_with_threshold"
(** See [llvm::PassManagerBuilder::populateFunctionPassManager]. *) (** See the [llvm::PassManagerBuilder::populateFunctionPassManager] function. *)
external populate_function_pass_manager external populate_function_pass_manager
: [ `Function ] Llvm.PassManager.t -> t -> unit : [ `Function ] Llvm.PassManager.t -> t -> unit
= "llvm_pmbuilder_populate_function_pass_manager" = "llvm_pmbuilder_populate_function_pass_manager"
(** See [llvm::PassManagerBuilder::populateModulePassManager]. *) (** See the [llvm::PassManagerBuilder::populateModulePassManager] function. *)
external populate_module_pass_manager external populate_module_pass_manager
: [ `Module ] Llvm.PassManager.t -> t -> unit : [ `Module ] Llvm.PassManager.t -> t -> unit
= "llvm_pmbuilder_populate_module_pass_manager" = "llvm_pmbuilder_populate_module_pass_manager"
(** See [llvm::PassManagerBuilder::populateLTOPassManager]. *) (** See the [llvm::PassManagerBuilder::populateLTOPassManager] function. *)
external populate_lto_pass_manager external populate_lto_pass_manager
: [ `Module ] Llvm.PassManager.t -> internalize:bool -> run_inliner:bool -> t -> unit : [ `Module ] Llvm.PassManager.t -> internalize:bool -> run_inliner:bool -> t -> unit
= "llvm_pmbuilder_populate_lto_pass_manager" = "llvm_pmbuilder_populate_lto_pass_manager"

View File

@ -1,4 +1,4 @@
(*===-- llvm_scalar_opts.ml - LLVM OCaml Interface -------------*- OCaml -*-===* (*===-- llvm_scalar_opts.ml - LLVM OCaml Interface ------------*- OCaml -*-===*
* *
* The LLVM Compiler Infrastructure * The LLVM Compiler Infrastructure
* *
@ -7,108 +7,114 @@
* *
*===----------------------------------------------------------------------===*) *===----------------------------------------------------------------------===*)
external add_constant_propagation : [<Llvm.PassManager.any] Llvm.PassManager.t external add_aggressive_dce
-> unit : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_constant_propagation" = "llvm_add_aggressive_dce"
external add_sccp : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit external add_alignment_from_assumptions
= "llvm_add_sccp" : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
external add_dead_store_elimination : [<Llvm.PassManager.any] Llvm.PassManager.t = "llvm_add_alignment_from_assumptions"
-> unit external add_cfg_simplification
= "llvm_add_dead_store_elimination" : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
external add_aggressive_dce : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit = "llvm_add_cfg_simplification"
= "llvm_add_aggressive_dce" external add_dead_store_elimination
external : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
add_scalar_repl_aggregation : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit = "llvm_add_dead_store_elimination"
= "llvm_add_scalar_repl_aggregation" external add_scalarizer
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
external = "llvm_add_scalarizer"
add_scalar_repl_aggregation_ssa : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit external add_merged_load_store_motion
= "llvm_add_scalar_repl_aggregation_ssa" : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_merged_load_store_motion"
external external add_gvn
add_scalar_repl_aggregation_with_threshold : int -> [<Llvm.PassManager.any] Llvm.PassManager.t : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
-> unit = "llvm_add_gvn"
= "llvm_add_scalar_repl_aggregation_with_threshold" external add_ind_var_simplification
external add_ind_var_simplification : [<Llvm.PassManager.any] Llvm.PassManager.t : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
-> unit = "llvm_add_ind_var_simplify"
= "llvm_add_ind_var_simplification" external add_instruction_combination
external : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
add_instruction_combination : [<Llvm.PassManager.any] Llvm.PassManager.t = "llvm_add_instruction_combining"
-> unit external add_jump_threading
= "llvm_add_instruction_combination" : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
external add_licm : [<Llvm.PassManager.any] Llvm.PassManager.t = "llvm_add_jump_threading"
-> unit external add_licm
= "llvm_add_licm" : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
external add_loop_unswitch : [<Llvm.PassManager.any] Llvm.PassManager.t = "llvm_add_licm"
-> unit external add_loop_deletion
= "llvm_add_loop_unswitch" : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
external add_loop_unroll : [<Llvm.PassManager.any] Llvm.PassManager.t = "llvm_add_loop_deletion"
-> unit external add_loop_idiom
= "llvm_add_loop_unroll" : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
external add_loop_rotation : [<Llvm.PassManager.any] Llvm.PassManager.t = "llvm_add_loop_idiom"
-> unit external add_loop_rotation
= "llvm_add_loop_rotation" : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
external = "llvm_add_loop_rotate"
add_memory_to_register_promotion : [<Llvm.PassManager.any] Llvm.PassManager.t external add_loop_reroll
-> unit : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_memory_to_register_promotion" = "llvm_add_loop_reroll"
external external add_loop_unroll
add_memory_to_register_demotion : [<Llvm.PassManager.any] Llvm.PassManager.t : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
-> unit = "llvm_add_loop_unroll"
= "llvm_add_memory_to_register_demotion" external add_loop_unswitch
external add_reassociation : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_reassociation" = "llvm_add_loop_unswitch"
external add_jump_threading : [<Llvm.PassManager.any] Llvm.PassManager.t external add_memcpy_opt
-> unit : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_jump_threading" = "llvm_add_memcpy_opt"
external add_cfg_simplification : [<Llvm.PassManager.any] Llvm.PassManager.t external add_partially_inline_lib_calls
-> unit : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_cfg_simplification" = "llvm_add_partially_inline_lib_calls"
external external add_lower_switch
add_tail_call_elimination : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_tail_call_elimination" = "llvm_add_lower_switch"
external add_gvn : [<Llvm.PassManager.any] Llvm.PassManager.t external add_memory_to_register_promotion
-> unit : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_gvn" = "llvm_add_promote_memory_to_register"
external add_memcpy_opt : [<Llvm.PassManager.any] Llvm.PassManager.t external add_reassociation
-> unit : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_memcpy_opt" = "llvm_add_reassociation"
external add_loop_deletion : [<Llvm.PassManager.any] Llvm.PassManager.t external add_sccp
-> unit : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_loop_deletion" = "llvm_add_sccp"
external add_scalar_repl_aggregation
external add_loop_idiom : [<Llvm.PassManager.any] Llvm.PassManager.t : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
-> unit = "llvm_add_scalar_repl_aggregates"
= "llvm_add_loop_idiom" external add_scalar_repl_aggregation_ssa
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
external = "llvm_add_scalar_repl_aggregates_ssa"
add_lib_call_simplification : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit external add_scalar_repl_aggregation_with_threshold
= "llvm_add_lib_call_simplification" : int -> [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_scalar_repl_aggregates_with_threshold"
external external add_lib_call_simplification
add_verifier : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_verifier" = "llvm_add_simplify_lib_calls"
external add_tail_call_elimination
external : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
add_correlated_value_propagation : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit = "llvm_add_tail_call_elimination"
= "llvm_add_correlated_value_propagation" external add_constant_propagation
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
external = "llvm_add_constant_propagation"
add_early_cse : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit external add_memory_to_register_demotion
= "llvm_add_early_cse" : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_demote_memory_to_register"
external external add_verifier
add_lower_expect_intrinsic : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_lower_expect_intrinsic" = "llvm_add_verifier"
external add_correlated_value_propagation
external : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
add_type_based_alias_analysis : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit = "llvm_add_correlated_value_propagation"
= "llvm_add_type_based_alias_analysis" external add_early_cse
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
external = "llvm_add_early_cse"
add_basic_alias_analysis : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit external add_lower_expect_intrinsic
= "llvm_add_basic_alias_analysis" : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_lower_expect_intrinsic"
external external add_type_based_alias_analysis
add_partially_inline_lib_calls : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_partially_inline_lib_calls" = "llvm_add_type_based_alias_analysis"
external add_scoped_no_alias_alias_analysis
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_scoped_no_alias_aa"
external add_basic_alias_analysis
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_basic_alias_analysis"

View File

@ -1,4 +1,4 @@
(*===-- llvm_scalar_opts.mli - LLVM OCaml Interface ------------*- OCaml -*-===* (*===-- llvm_scalar_opts.mli - LLVM OCaml Interface -----------*- OCaml -*-===*
* *
* The LLVM Compiler Infrastructure * The LLVM Compiler Infrastructure
* *
@ -12,157 +12,187 @@
This interface provides an OCaml API for LLVM scalar transforms, the This interface provides an OCaml API for LLVM scalar transforms, the
classes in the [LLVMScalarOpts] library. *) classes in the [LLVMScalarOpts] library. *)
(** See the [llvm::createConstantPropagationPass] function. *) (** See the [llvm::createAggressiveDCEPass] function. *)
external add_constant_propagation : [<Llvm.PassManager.any] Llvm.PassManager.t external add_aggressive_dce
-> unit : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_constant_propagation" = "llvm_add_aggressive_dce"
(** See the [llvm::createSCCPPass] function. *) (** See the [llvm::createAlignmentFromAssumptionsPass] function. *)
external add_sccp : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit external add_alignment_from_assumptions
= "llvm_add_sccp" : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_alignment_from_assumptions"
(** See [llvm::createDeadStoreEliminationPass] function. *)
external add_dead_store_elimination : [<Llvm.PassManager.any] Llvm.PassManager.t
-> unit
= "llvm_add_dead_store_elimination"
(** See The [llvm::createAggressiveDCEPass] function. *)
external add_aggressive_dce : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit
= "llvm_add_aggressive_dce"
(** See the [llvm::createScalarReplAggregatesPass] function. *)
external
add_scalar_repl_aggregation : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit
= "llvm_add_scalar_repl_aggregation"
(** See the [llvm::createScalarReplAggregatesPassSSA] function. *)
external
add_scalar_repl_aggregation_ssa : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit
= "llvm_add_scalar_repl_aggregation_ssa"
(** See the [llvm::createScalarReplAggregatesWithThreshold] function. *)
external
add_scalar_repl_aggregation_with_threshold : int -> [<Llvm.PassManager.any] Llvm.PassManager.t
-> unit
= "llvm_add_scalar_repl_aggregation_with_threshold"
(** See the [llvm::createIndVarSimplifyPass] function. *)
external add_ind_var_simplification : [<Llvm.PassManager.any] Llvm.PassManager.t
-> unit
= "llvm_add_ind_var_simplification"
(** See the [llvm::createInstructionCombiningPass] function. *)
external
add_instruction_combination : [<Llvm.PassManager.any] Llvm.PassManager.t
-> unit
= "llvm_add_instruction_combination"
(** See the [llvm::createLICMPass] function. *)
external add_licm : [<Llvm.PassManager.any] Llvm.PassManager.t
-> unit
= "llvm_add_licm"
(** See the [llvm::createLoopUnswitchPass] function. *)
external add_loop_unswitch : [<Llvm.PassManager.any] Llvm.PassManager.t
-> unit
= "llvm_add_loop_unswitch"
(** See the [llvm::createLoopUnrollPass] function. *)
external add_loop_unroll : [<Llvm.PassManager.any] Llvm.PassManager.t
-> unit
= "llvm_add_loop_unroll"
(** See the [llvm::createLoopRotatePass] function. *)
external add_loop_rotation : [<Llvm.PassManager.any] Llvm.PassManager.t
-> unit
= "llvm_add_loop_rotation"
(** See the [llvm::createPromoteMemoryToRegisterPass] function. *)
external
add_memory_to_register_promotion : [<Llvm.PassManager.any] Llvm.PassManager.t
-> unit
= "llvm_add_memory_to_register_promotion"
(** See the [llvm::createDemoteMemoryToRegisterPass] function. *)
external
add_memory_to_register_demotion : [<Llvm.PassManager.any] Llvm.PassManager.t
-> unit
= "llvm_add_memory_to_register_demotion"
(** See the [llvm::createReassociatePass] function. *)
external add_reassociation : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit
= "llvm_add_reassociation"
(** See the [llvm::createJumpThreadingPass] function. *)
external add_jump_threading : [<Llvm.PassManager.any] Llvm.PassManager.t
-> unit
= "llvm_add_jump_threading"
(** See the [llvm::createCFGSimplificationPass] function. *) (** See the [llvm::createCFGSimplificationPass] function. *)
external add_cfg_simplification : [<Llvm.PassManager.any] Llvm.PassManager.t external add_cfg_simplification
-> unit : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_cfg_simplification" = "llvm_add_cfg_simplification"
(** See the [llvm::createTailCallEliminationPass] function. *) (** See [llvm::createDeadStoreEliminationPass] function. *)
external external add_dead_store_elimination
add_tail_call_elimination : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_tail_call_elimination" = "llvm_add_dead_store_elimination"
(** See [llvm::createScalarizerPass] function. *)
external add_scalarizer
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_scalarizer"
(** See [llvm::createMergedLoadStoreMotionPass] function. *)
external add_merged_load_store_motion
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_merged_load_store_motion"
(** See the [llvm::createGVNPass] function. *) (** See the [llvm::createGVNPass] function. *)
external add_gvn : [<Llvm.PassManager.any] Llvm.PassManager.t external add_gvn
-> unit : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_gvn" = "llvm_add_gvn"
(** See the [llvm::createMemCpyOptPass] function. *) (** See the [llvm::createIndVarSimplifyPass] function. *)
external add_memcpy_opt : [<Llvm.PassManager.any] Llvm.PassManager.t external add_ind_var_simplification
-> unit : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_memcpy_opt" = "llvm_add_ind_var_simplify"
(** See the [llvm::createInstructionCombiningPass] function. *)
external add_instruction_combination
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_instruction_combining"
(** See the [llvm::createJumpThreadingPass] function. *)
external add_jump_threading
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_jump_threading"
(** See the [llvm::createLICMPass] function. *)
external add_licm
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_licm"
(** See the [llvm::createLoopDeletionPass] function. *) (** See the [llvm::createLoopDeletionPass] function. *)
external add_loop_deletion : [<Llvm.PassManager.any] Llvm.PassManager.t external add_loop_deletion
-> unit : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_loop_deletion" = "llvm_add_loop_deletion"
external add_loop_idiom : [<Llvm.PassManager.any] Llvm.PassManager.t (** See the [llvm::createLoopIdiomPass] function. *)
-> unit external add_loop_idiom
= "llvm_add_loop_idiom" : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_loop_idiom"
(** See the [llvm::createSimplifyLibCallsPass] function. *) (** See the [llvm::createLoopRotatePass] function. *)
external external add_loop_rotation
add_lib_call_simplification : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_lib_call_simplification" = "llvm_add_loop_rotate"
(** See the [llvm::createVerifierPass] function. *) (** See the [llvm::createLoopRerollPass] function. *)
external external add_loop_reroll
add_verifier : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_verifier" = "llvm_add_loop_reroll"
(** See the [llvm::createCorrelatedValuePropagationPass] function. *) (** See the [llvm::createLoopUnrollPass] function. *)
external external add_loop_unroll
add_correlated_value_propagation : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_correlated_value_propagation" = "llvm_add_loop_unroll"
(** See the [llvm::createEarlyCSE] function. *) (** See the [llvm::createLoopUnswitchPass] function. *)
external external add_loop_unswitch
add_early_cse : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_early_cse" = "llvm_add_loop_unswitch"
(** See the [llvm::createLowerExpectIntrinsicPass] function. *) (** See the [llvm::createMemCpyOptPass] function. *)
external external add_memcpy_opt
add_lower_expect_intrinsic : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_lower_expect_intrinsic" = "llvm_add_memcpy_opt"
(** See the [llvm::createTypeBasedAliasAnalysisPass] function. *)
external
add_type_based_alias_analysis : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit
= "llvm_add_type_based_alias_analysis"
(** See the [llvm::createBasicAliasAnalysisPass] function. *)
external
add_basic_alias_analysis : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit
= "llvm_add_basic_alias_analysis"
(** See the [llvm::createPartiallyInlineLibCallsPass] function. *) (** See the [llvm::createPartiallyInlineLibCallsPass] function. *)
external external add_partially_inline_lib_calls
add_partially_inline_lib_calls : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_partially_inline_lib_calls" = "llvm_add_partially_inline_lib_calls"
(** See the [llvm::createLowerSwitchPass] function. *)
external add_lower_switch
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_lower_switch"
(** See the [llvm::createPromoteMemoryToRegisterPass] function. *)
external add_memory_to_register_promotion
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_promote_memory_to_register"
(** See the [llvm::createReassociatePass] function. *)
external add_reassociation
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_reassociation"
(** See the [llvm::createSCCPPass] function. *)
external add_sccp
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_sccp"
(** See the [llvm::createScalarReplAggregatesPass] function. *)
external add_scalar_repl_aggregation
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_scalar_repl_aggregates"
(** See the [llvm::createScalarReplAggregatesPassSSA] function. *)
external add_scalar_repl_aggregation_ssa
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_scalar_repl_aggregates_ssa"
(** See the [llvm::createScalarReplAggregatesWithThreshold] function. *)
external add_scalar_repl_aggregation_with_threshold
: int -> [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_scalar_repl_aggregates_with_threshold"
(** See the [llvm::createSimplifyLibCallsPass] function. *)
external add_lib_call_simplification
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_simplify_lib_calls"
(** See the [llvm::createTailCallEliminationPass] function. *)
external add_tail_call_elimination
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_tail_call_elimination"
(** See the [llvm::createConstantPropagationPass] function. *)
external add_constant_propagation
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_constant_propagation"
(** See the [llvm::createDemoteMemoryToRegisterPass] function. *)
external add_memory_to_register_demotion
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_demote_memory_to_register"
(** See the [llvm::createVerifierPass] function. *)
external add_verifier
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_verifier"
(** See the [llvm::createCorrelatedValuePropagationPass] function. *)
external add_correlated_value_propagation
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_correlated_value_propagation"
(** See the [llvm::createEarlyCSE] function. *)
external add_early_cse
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_early_cse"
(** See the [llvm::createLowerExpectIntrinsicPass] function. *)
external add_lower_expect_intrinsic
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_lower_expect_intrinsic"
(** See the [llvm::createTypeBasedAliasAnalysisPass] function. *)
external add_type_based_alias_analysis
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_type_based_alias_analysis"
(** See the [llvm::createScopedNoAliasAAPass] function. *)
external add_scoped_no_alias_alias_analysis
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_scoped_no_alias_aa"
(** See the [llvm::createBasicAliasAnalysisPass] function. *)
external add_basic_alias_analysis
: [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit
= "llvm_add_basic_alias_analysis"

View File

@ -19,24 +19,6 @@
#include "caml/mlvalues.h" #include "caml/mlvalues.h"
#include "caml/misc.h" #include "caml/misc.h"
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_constant_propagation(LLVMPassManagerRef PM) {
LLVMAddConstantPropagationPass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_sccp(LLVMPassManagerRef PM) {
LLVMAddSCCPPass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_dead_store_elimination(LLVMPassManagerRef PM) {
LLVMAddDeadStoreEliminationPass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_aggressive_dce(LLVMPassManagerRef PM) { CAMLprim value llvm_add_aggressive_dce(LLVMPassManagerRef PM) {
LLVMAddAggressiveDCEPass(PM); LLVMAddAggressiveDCEPass(PM);
@ -44,81 +26,8 @@ CAMLprim value llvm_add_aggressive_dce(LLVMPassManagerRef PM) {
} }
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_scalar_repl_aggregation(LLVMPassManagerRef PM) { CAMLprim value llvm_add_alignment_from_assumptions(LLVMPassManagerRef PM) {
LLVMAddScalarReplAggregatesPass(PM); LLVMAddAlignmentFromAssumptionsPass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_scalar_repl_aggregation_ssa(LLVMPassManagerRef PM) {
LLVMAddScalarReplAggregatesPassSSA(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> int -> unit */
CAMLprim value llvm_add_scalar_repl_aggregation_with_threshold(value threshold,
LLVMPassManagerRef PM) {
LLVMAddScalarReplAggregatesPassWithThreshold(PM, Int_val(threshold));
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_ind_var_simplification(LLVMPassManagerRef PM) {
LLVMAddIndVarSimplifyPass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_instruction_combination(LLVMPassManagerRef PM) {
LLVMAddInstructionCombiningPass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_licm(LLVMPassManagerRef PM) {
LLVMAddLICMPass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_loop_unswitch(LLVMPassManagerRef PM) {
LLVMAddLoopUnswitchPass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_loop_unroll(LLVMPassManagerRef PM) {
LLVMAddLoopUnrollPass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_loop_rotation(LLVMPassManagerRef PM) {
LLVMAddLoopRotatePass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_memory_to_register_promotion(LLVMPassManagerRef PM) {
LLVMAddPromoteMemoryToRegisterPass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_memory_to_register_demotion(LLVMPassManagerRef PM) {
LLVMAddDemoteMemoryToRegisterPass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_reassociation(LLVMPassManagerRef PM) {
LLVMAddReassociatePass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_jump_threading(LLVMPassManagerRef PM) {
LLVMAddJumpThreadingPass(PM);
return Val_unit; return Val_unit;
} }
@ -129,8 +38,14 @@ CAMLprim value llvm_add_cfg_simplification(LLVMPassManagerRef PM) {
} }
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_tail_call_elimination(LLVMPassManagerRef PM) { CAMLprim value llvm_add_dead_store_elimination(LLVMPassManagerRef PM) {
LLVMAddTailCallEliminationPass(PM); LLVMAddDeadStoreEliminationPass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_scalarizer(LLVMPassManagerRef PM) {
LLVMAddScalarizerPass(PM);
return Val_unit; return Val_unit;
} }
@ -147,8 +62,26 @@ CAMLprim value llvm_add_gvn(LLVMPassManagerRef PM) {
} }
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_memcpy_opt(LLVMPassManagerRef PM) { CAMLprim value llvm_add_ind_var_simplify(LLVMPassManagerRef PM) {
LLVMAddMemCpyOptPass(PM); LLVMAddIndVarSimplifyPass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_instruction_combining(LLVMPassManagerRef PM) {
LLVMAddInstructionCombiningPass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_jump_threading(LLVMPassManagerRef PM) {
LLVMAddJumpThreadingPass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_licm(LLVMPassManagerRef PM) {
LLVMAddLICMPass(PM);
return Val_unit; return Val_unit;
} }
@ -165,11 +98,108 @@ CAMLprim value llvm_add_loop_idiom(LLVMPassManagerRef PM) {
} }
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_lib_call_simplification(LLVMPassManagerRef PM) { CAMLprim value llvm_add_loop_rotate(LLVMPassManagerRef PM) {
LLVMAddLoopRotatePass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_loop_reroll(LLVMPassManagerRef PM) {
LLVMAddLoopRerollPass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_loop_unroll(LLVMPassManagerRef PM) {
LLVMAddLoopUnrollPass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_loop_unswitch(LLVMPassManagerRef PM) {
LLVMAddLoopUnswitchPass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_memcpy_opt(LLVMPassManagerRef PM) {
LLVMAddMemCpyOptPass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_partially_inline_lib_calls(LLVMPassManagerRef PM) {
LLVMAddPartiallyInlineLibCallsPass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_lower_switch(LLVMPassManagerRef PM) {
LLVMAddLowerSwitchPass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_promote_memory_to_register(LLVMPassManagerRef PM) {
LLVMAddPromoteMemoryToRegisterPass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_reassociation(LLVMPassManagerRef PM) {
LLVMAddReassociatePass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_sccp(LLVMPassManagerRef PM) {
LLVMAddSCCPPass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_scalar_repl_aggregates(LLVMPassManagerRef PM) {
LLVMAddScalarReplAggregatesPass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_scalar_repl_aggregates_ssa(LLVMPassManagerRef PM) {
LLVMAddScalarReplAggregatesPassSSA(PM);
return Val_unit;
}
/* int -> [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_scalar_repl_aggregates_with_threshold(value threshold,
LLVMPassManagerRef PM) {
LLVMAddScalarReplAggregatesPassWithThreshold(PM, Int_val(threshold));
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_simplify_lib_calls(LLVMPassManagerRef PM) {
LLVMAddSimplifyLibCallsPass(PM); LLVMAddSimplifyLibCallsPass(PM);
return Val_unit; return Val_unit;
} }
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_tail_call_elimination(LLVMPassManagerRef PM) {
LLVMAddTailCallEliminationPass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_constant_propagation(LLVMPassManagerRef PM) {
LLVMAddConstantPropagationPass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_demote_memory_to_register(LLVMPassManagerRef PM) {
LLVMAddDemoteMemoryToRegisterPass(PM);
return Val_unit;
}
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_verifier(LLVMPassManagerRef PM) { CAMLprim value llvm_add_verifier(LLVMPassManagerRef PM) {
LLVMAddVerifierPass(PM); LLVMAddVerifierPass(PM);
@ -201,13 +231,13 @@ CAMLprim value llvm_add_type_based_alias_analysis(LLVMPassManagerRef PM) {
} }
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_basic_alias_analysis(LLVMPassManagerRef PM) { CAMLprim value llvm_add_scoped_no_alias_aa(LLVMPassManagerRef PM) {
LLVMAddBasicAliasAnalysisPass(PM); LLVMAddScopedNoAliasAAPass(PM);
return Val_unit; return Val_unit;
} }
/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ /* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_add_partially_inline_lib_calls(LLVMPassManagerRef PM) { CAMLprim value llvm_add_basic_alias_analysis(LLVMPassManagerRef PM) {
LLVMAddPartiallyInlineLibCallsPass(PM); LLVMAddBasicAliasAnalysisPass(PM);
return Val_unit; return Val_unit;
} }

View File

@ -7,9 +7,12 @@
* *
*===----------------------------------------------------------------------===*) *===----------------------------------------------------------------------===*)
external add_bb_vectorize : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit external add_bb_vectorize
= "llvm_add_bb_vectorize" : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit
external add_loop_vectorize : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit = "llvm_add_bb_vectorize"
= "llvm_add_loop_vectorize" external add_loop_vectorize
external add_slp_vectorize : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit
= "llvm_add_slp_vectorize" = "llvm_add_loop_vectorize"
external add_slp_vectorize
: [<Llvm.PassManager.any] Llvm.PassManager.t -> unit
= "llvm_add_slp_vectorize"

View File

@ -13,13 +13,16 @@
classes in the [LLVMVectorize] library. *) classes in the [LLVMVectorize] library. *)
(** See the [llvm::createBBVectorizePass] function. *) (** See the [llvm::createBBVectorizePass] function. *)
external add_bb_vectorize : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit external add_bb_vectorize
= "llvm_add_bb_vectorize" : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit
= "llvm_add_bb_vectorize"
(** See the [llvm::createLoopVectorizePass] function. *) (** See the [llvm::createLoopVectorizePass] function. *)
external add_loop_vectorize : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit external add_loop_vectorize
= "llvm_add_loop_vectorize" : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit
= "llvm_add_loop_vectorize"
(** See [llvm::createSLPVectorizerPass] function. *) (** See the [llvm::createSLPVectorizerPass] function. *)
external add_slp_vectorize : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit external add_slp_vectorize
= "llvm_add_slp_vectorize" : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit
= "llvm_add_slp_vectorize"

View File

@ -36,7 +36,7 @@ let m = create_module context filename
(*===-- Transforms --------------------------------------------------------===*) (*===-- Transforms --------------------------------------------------------===*)
let test_transforms () = let test_transforms () =
let (++) x f = ignore (f x); x in let (++) x f = f x; x in
let fty = function_type i8_type [| |] in let fty = function_type i8_type [| |] in
let fn = define_function "fn" fty m in let fn = define_function "fn" fty m in
@ -58,7 +58,7 @@ let test_transforms () =
++ add_ipc_propagation ++ add_ipc_propagation
++ add_prune_eh ++ add_prune_eh
++ add_ipsccp ++ add_ipsccp
++ add_internalize ++ add_internalize ~all_but_main:true
++ add_strip_dead_prototypes ++ add_strip_dead_prototypes
++ add_strip_symbols ++ add_strip_symbols
++ PassManager.run_module m ++ PassManager.run_module m

View File

@ -35,45 +35,50 @@ let m = create_module context filename
(*===-- Transforms --------------------------------------------------------===*) (*===-- Transforms --------------------------------------------------------===*)
let test_transforms () = let test_transforms () =
let (++) x f = ignore (f x); x in let (++) x f = f x; x in
let fty = function_type void_type [| |] in let fty = function_type void_type [| |] in
let fn = define_function "fn" fty m in let fn = define_function "fn" fty m in
ignore (build_ret_void (builder_at_end context (entry_block fn))); ignore (build_ret_void (builder_at_end context (entry_block fn)));
ignore (PassManager.create_function m ignore (PassManager.create_function m
++ add_verifier
++ add_constant_propagation
++ add_sccp
++ add_dead_store_elimination
++ add_aggressive_dce ++ add_aggressive_dce
++ add_alignment_from_assumptions
++ add_cfg_simplification
++ add_dead_store_elimination
++ add_scalarizer
++ add_merged_load_store_motion
++ add_gvn
++ add_ind_var_simplification
++ add_instruction_combination
++ add_jump_threading
++ add_licm
++ add_loop_deletion
++ add_loop_idiom
++ add_loop_rotation
++ add_loop_reroll
++ add_loop_unroll
++ add_loop_unswitch
++ add_memcpy_opt
++ add_partially_inline_lib_calls
++ add_lower_switch
++ add_memory_to_register_promotion
++ add_reassociation
++ add_sccp
++ add_scalar_repl_aggregation ++ add_scalar_repl_aggregation
++ add_scalar_repl_aggregation_ssa ++ add_scalar_repl_aggregation_ssa
++ add_scalar_repl_aggregation_with_threshold 4 ++ add_scalar_repl_aggregation_with_threshold 4
++ add_ind_var_simplification
++ add_instruction_combination
++ add_licm
++ add_loop_unswitch
++ add_loop_unroll
++ add_loop_rotation
++ add_memory_to_register_promotion
++ add_memory_to_register_demotion
++ add_reassociation
++ add_jump_threading
++ add_cfg_simplification
++ add_tail_call_elimination
++ add_gvn
++ add_memcpy_opt
++ add_loop_deletion
++ add_loop_idiom
++ add_lib_call_simplification ++ add_lib_call_simplification
++ add_tail_call_elimination
++ add_constant_propagation
++ add_memory_to_register_demotion
++ add_verifier
++ add_correlated_value_propagation ++ add_correlated_value_propagation
++ add_early_cse ++ add_early_cse
++ add_lower_expect_intrinsic ++ add_lower_expect_intrinsic
++ add_type_based_alias_analysis ++ add_type_based_alias_analysis
++ add_scoped_no_alias_alias_analysis
++ add_basic_alias_analysis ++ add_basic_alias_analysis
++ add_partially_inline_lib_calls
++ add_verifier
++ PassManager.initialize ++ PassManager.initialize
++ PassManager.run_function fn ++ PassManager.run_function fn
++ PassManager.finalize ++ PassManager.finalize

View File

@ -35,7 +35,7 @@ let m = create_module context filename
(*===-- Transforms --------------------------------------------------------===*) (*===-- Transforms --------------------------------------------------------===*)
let test_transforms () = let test_transforms () =
let (++) x f = ignore (f x); x in let (++) x f = f x; x in
let fty = function_type void_type [| |] in let fty = function_type void_type [| |] in
let fn = define_function "fn" fty m in let fn = define_function "fn" fty m in