[llvm-commits] [llvm] r48602 - in /llvm/trunk: bindings/ocaml/transforms/scalar/llvm_scalar_opts.ml bindings/ocaml/transforms/scalar/llvm_scalar_opts.mli bindings/ocaml/transforms/scalar/scalar_opts_ocaml.c include/llvm-c/Transforms/Scalar.h lib/Transforms/Scalar/Scalar.cpp

Gordon Henriksen gordonhenriksen at mac.com
Thu Mar 20 10:16:09 PDT 2008


Author: gordon
Date: Thu Mar 20 12:16:03 2008
New Revision: 48602

URL: http://llvm.org/viewvc/llvm-project?rev=48602&view=rev
Log:
C and Objective Caml bindings for mem2reg and reg2mem.

Patch by Erick Tryzelaar.

Modified:
    llvm/trunk/bindings/ocaml/transforms/scalar/llvm_scalar_opts.ml
    llvm/trunk/bindings/ocaml/transforms/scalar/llvm_scalar_opts.mli
    llvm/trunk/bindings/ocaml/transforms/scalar/scalar_opts_ocaml.c
    llvm/trunk/include/llvm-c/Transforms/Scalar.h
    llvm/trunk/lib/Transforms/Scalar/Scalar.cpp

Modified: llvm/trunk/bindings/ocaml/transforms/scalar/llvm_scalar_opts.ml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/transforms/scalar/llvm_scalar_opts.ml?rev=48602&r1=48601&r2=48602&view=diff

==============================================================================
--- llvm/trunk/bindings/ocaml/transforms/scalar/llvm_scalar_opts.ml (original)
+++ llvm/trunk/bindings/ocaml/transforms/scalar/llvm_scalar_opts.ml Thu Mar 20 12:16:03 2008
@@ -13,6 +13,14 @@
 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"

Modified: llvm/trunk/bindings/ocaml/transforms/scalar/llvm_scalar_opts.mli
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/transforms/scalar/llvm_scalar_opts.mli?rev=48602&r1=48601&r2=48602&view=diff

==============================================================================
--- llvm/trunk/bindings/ocaml/transforms/scalar/llvm_scalar_opts.mli (original)
+++ llvm/trunk/bindings/ocaml/transforms/scalar/llvm_scalar_opts.mli Thu Mar 20 12:16:03 2008
@@ -22,6 +22,18 @@
                                      -> 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

Modified: llvm/trunk/bindings/ocaml/transforms/scalar/scalar_opts_ocaml.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/transforms/scalar/scalar_opts_ocaml.c?rev=48602&r1=48601&r2=48602&view=diff

==============================================================================
--- llvm/trunk/bindings/ocaml/transforms/scalar/scalar_opts_ocaml.c (original)
+++ llvm/trunk/bindings/ocaml/transforms/scalar/scalar_opts_ocaml.c Thu Mar 20 12:16:03 2008
@@ -32,6 +32,18 @@
 }
 
 /* [<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;

Modified: llvm/trunk/include/llvm-c/Transforms/Scalar.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Transforms/Scalar.h?rev=48602&r1=48601&r2=48602&view=diff

==============================================================================
--- llvm/trunk/include/llvm-c/Transforms/Scalar.h (original)
+++ llvm/trunk/include/llvm-c/Transforms/Scalar.h Thu Mar 20 12:16:03 2008
@@ -31,6 +31,12 @@
 /** 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);
 

Modified: llvm/trunk/lib/Transforms/Scalar/Scalar.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Scalar.cpp?rev=48602&r1=48601&r2=48602&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/Scalar.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/Scalar.cpp Thu Mar 20 12:16:03 2008
@@ -26,6 +26,14 @@
   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());
 }





More information about the llvm-commits mailing list