diff options
author | Gordon Henriksen <gordonhenriksen@mac.com> | 2008-03-16 04:20:44 +0000 |
---|---|---|
committer | Gordon Henriksen <gordonhenriksen@mac.com> | 2008-03-16 04:20:44 +0000 |
commit | 032176bfc0e0b07e3fa6addeb3ac73cd977d1d76 (patch) | |
tree | 20ecdfb5d2de1feff014fa4cc4f03282fc481213 /test/Bindings | |
parent | 76d72daac239517dd47b3ab462af7642fd10fefd (diff) | |
download | external_llvm-032176bfc0e0b07e3fa6addeb3ac73cd977d1d76.zip external_llvm-032176bfc0e0b07e3fa6addeb3ac73cd977d1d76.tar.gz external_llvm-032176bfc0e0b07e3fa6addeb3ac73cd977d1d76.tar.bz2 |
C and Objective Caml bindings for PassManagers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48413 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Bindings')
-rw-r--r-- | test/Bindings/Ocaml/vmcore.ml | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/test/Bindings/Ocaml/vmcore.ml b/test/Bindings/Ocaml/vmcore.ml index cfa22d5..696157e 100644 --- a/test/Bindings/Ocaml/vmcore.ml +++ b/test/Bindings/Ocaml/vmcore.ml @@ -34,6 +34,7 @@ let suite name f = let filename = Sys.argv.(1) let m = create_module filename +let mp = ModuleProvider.create m (*===-- Target ------------------------------------------------------------===*) @@ -836,6 +837,30 @@ let test_module_provider () = ModuleProvider.dispose mp +(*===-- Pass Managers -----------------------------------------------------===*) + +let test_pass_manager () = + let (++) x f = ignore (f x); x in + + begin group "module pass manager"; + ignore (PassManager.create () + ++ PassManager.run_module m + ++ PassManager.dispose) + end; + + begin group "function pass manager"; + let fty = function_type void_type [| |] in + let fn = define_function "FunctionPassManager" fty m in + ignore (build_ret_void (builder_at_end (entry_block fn))); + + ignore (PassManager.create_function mp + ++ PassManager.initialize + ++ PassManager.run_function fn + ++ PassManager.finalize + ++ PassManager.dispose) + end + + (*===-- Writer ------------------------------------------------------------===*) let test_writer () = @@ -847,7 +872,7 @@ let test_writer () = group "writer"; insist (write_bitcode_file m filename); - dispose_module m + ModuleProvider.dispose mp (*===-- Driver ------------------------------------------------------------===*) @@ -862,5 +887,6 @@ let _ = suite "basic blocks" test_basic_blocks; suite "builder" test_builder; suite "module provider" test_module_provider; - suite "writer" test_writer; + suite "pass manager" test_pass_manager; + suite "writer" test_writer; (* Keep this last; it disposes m. *) exit !exit_status |