Index: bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.ml =================================================================== --- bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.ml +++ bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.ml @@ -64,6 +64,9 @@ external add_partially_inline_lib_calls : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit = "llvm_add_partially_inline_lib_calls" +external add_lower_atomic + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_lower_atomic" external add_lower_switch : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit = "llvm_add_lower_switch" Index: bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.mli =================================================================== --- bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.mli +++ bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.mli @@ -107,6 +107,11 @@ : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit = "llvm_add_partially_inline_lib_calls" +(** See the [llvm::createLowerAtomicPass] function. *) +external add_lower_atomic + : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit + = "llvm_add_lower_atomic" + (** See the [llvm::createLowerSwitchPass] function. *) external add_lower_switch : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit Index: bindings/ocaml/transforms/scalar_opts/scalar_opts_ocaml.c =================================================================== --- bindings/ocaml/transforms/scalar_opts/scalar_opts_ocaml.c +++ bindings/ocaml/transforms/scalar_opts/scalar_opts_ocaml.c @@ -134,6 +134,12 @@ } /* [ unit */ +CAMLprim value llvm_add_lower_atomic(LLVMPassManagerRef PM) { + LLVMAddLowerAtomicPass(PM); + return Val_unit; +} + +/* [ unit */ CAMLprim value llvm_add_lower_switch(LLVMPassManagerRef PM) { LLVMAddLowerSwitchPass(PM); return Val_unit; Index: include/llvm-c/Transforms/Scalar.h =================================================================== --- include/llvm-c/Transforms/Scalar.h +++ include/llvm-c/Transforms/Scalar.h @@ -98,6 +98,9 @@ /** See llvm::createPartiallyInlineLibCallsPass function. */ void LLVMAddPartiallyInlineLibCallsPass(LLVMPassManagerRef PM); +/** See llvm::createLowerAtomicPass function. */ +void LLVMAddLowerAtomicPass(LLVMPassManagerRef PM); + /** See llvm::createReassociatePass function. */ void LLVMAddReassociatePass(LLVMPassManagerRef PM); Index: lib/Transforms/Scalar/Scalar.cpp =================================================================== --- lib/Transforms/Scalar/Scalar.cpp +++ lib/Transforms/Scalar/Scalar.cpp @@ -202,6 +202,10 @@ unwrap(PM)->add(createPartiallyInlineLibCallsPass()); } +void LLVMAddLowerAtomicPass(LLVMPassManagerRef PM) { + unwrap(PM)->add(createLowerAtomicPass()); +} + void LLVMAddReassociatePass(LLVMPassManagerRef PM) { unwrap(PM)->add(createReassociatePass()); }