diff options
-rw-r--r-- | bindings/ocaml/transforms/scalar/llvm_scalar_opts.ml | 8 | ||||
-rw-r--r-- | bindings/ocaml/transforms/scalar/llvm_scalar_opts.mli | 12 | ||||
-rw-r--r-- | bindings/ocaml/transforms/scalar/scalar_opts_ocaml.c | 12 | ||||
-rw-r--r-- | include/llvm-c/Transforms/Scalar.h | 6 | ||||
-rw-r--r-- | lib/Transforms/Scalar/Scalar.cpp | 8 |
5 files changed, 46 insertions, 0 deletions
diff --git a/bindings/ocaml/transforms/scalar/llvm_scalar_opts.ml b/bindings/ocaml/transforms/scalar/llvm_scalar_opts.ml index 8b6b7f9..b4563b7 100644 --- a/bindings/ocaml/transforms/scalar/llvm_scalar_opts.ml +++ b/bindings/ocaml/transforms/scalar/llvm_scalar_opts.ml @@ -13,6 +13,14 @@ external add_constant_propagation : [<Llvm.PassManager.any] Llvm.PassManager.t external add_instruction_combining : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit = "llvm_add_instruction_combining" +external +add_memory_to_register_promotion : [<Llvm.PassManager.any] Llvm.PassManager.t + -> unit + = "llvm_add_memory_to_register_promotion" +external +add_memory_to_register_demotion : [<Llvm.PassManager.any] Llvm.PassManager.t + -> unit + = "llvm_add_memory_to_register_demotion" external add_reassociation : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit = "llvm_add_reassociation" diff --git a/bindings/ocaml/transforms/scalar/llvm_scalar_opts.mli b/bindings/ocaml/transforms/scalar/llvm_scalar_opts.mli index 19efaa0..6fcce04 100644 --- a/bindings/ocaml/transforms/scalar/llvm_scalar_opts.mli +++ b/bindings/ocaml/transforms/scalar/llvm_scalar_opts.mli @@ -22,6 +22,18 @@ external add_instruction_combining : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit = "llvm_add_instruction_combining" +(** 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 diff --git a/bindings/ocaml/transforms/scalar/scalar_opts_ocaml.c b/bindings/ocaml/transforms/scalar/scalar_opts_ocaml.c index 5ceb369..87c1060 100644 --- a/bindings/ocaml/transforms/scalar/scalar_opts_ocaml.c +++ b/bindings/ocaml/transforms/scalar/scalar_opts_ocaml.c @@ -32,6 +32,18 @@ CAMLprim value llvm_add_instruction_combining(LLVMPassManagerRef PM) { } /* [<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; diff --git a/include/llvm-c/Transforms/Scalar.h b/include/llvm-c/Transforms/Scalar.h index 00e8c35..6e0ff12 100644 --- a/include/llvm-c/Transforms/Scalar.h +++ b/include/llvm-c/Transforms/Scalar.h @@ -31,6 +31,12 @@ void LLVMAddConstantPropagationPass(LLVMPassManagerRef PM); /** See llvm::createInstructionCombiningPass function. */ void LLVMAddInstructionCombiningPass(LLVMPassManagerRef PM); +/** See llvm::createPromoteMemoryToRegisterPass function. */ +void LLVMAddPromoteMemoryToRegisterPass(LLVMPassManagerRef PM); + +/** See llvm::demotePromoteMemoryToRegisterPass function. */ +void LLVMAddDemoteMemoryToRegisterPass(LLVMPassManagerRef PM); + /** See llvm::createReassociatePass function. */ void LLVMAddReassociatePass(LLVMPassManagerRef PM); diff --git a/lib/Transforms/Scalar/Scalar.cpp b/lib/Transforms/Scalar/Scalar.cpp index 08b6bb3..838f52b 100644 --- a/lib/Transforms/Scalar/Scalar.cpp +++ b/lib/Transforms/Scalar/Scalar.cpp @@ -26,6 +26,14 @@ void LLVMAddInstructionCombiningPass(LLVMPassManagerRef PM) { unwrap(PM)->add(createInstructionCombiningPass()); } +void LLVMAddPromoteMemoryToRegisterPass(LLVMPassManagerRef PM) { + unwrap(PM)->add(createPromoteMemoryToRegisterPass()); +} + +void LLVMAddDemoteMemoryToRegisterPass(LLVMPassManagerRef PM) { + unwrap(PM)->add(createDemoteRegisterToMemoryPass()); +} + void LLVMAddReassociatePass(LLVMPassManagerRef PM) { unwrap(PM)->add(createReassociatePass()); } |