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 @@ -135,6 +135,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 @@ -92,6 +92,9 @@ /** See llvm::createLoopUnswitchPass function. */ void LLVMAddLoopUnswitchPass(LLVMPassManagerRef PM); +/** See llvm::createLowerAtomicPass function. */ +void LLVMAddLowerAtomicPass(LLVMPassManagerRef PM); + /** See llvm::createMemCpyOptPass function. */ void LLVMAddMemCpyOptPass(LLVMPassManagerRef PM); Index: lib/Transforms/Scalar/Scalar.cpp =================================================================== --- lib/Transforms/Scalar/Scalar.cpp +++ lib/Transforms/Scalar/Scalar.cpp @@ -194,6 +194,10 @@ unwrap(PM)->add(createLoopUnswitchPass()); } +void LLVMAddLowerAtomicPass(LLVMPassManagerRef PM) { + unwrap(PM)->add(createLowerAtomicPass()); +} + void LLVMAddMemCpyOptPass(LLVMPassManagerRef PM) { unwrap(PM)->add(createMemCpyOptPass()); }