[OCaml] Expose Llvm_target.TargetMachine.add_analysis_passes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220846 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Peter Zotov 2014-10-29 08:16:14 +00:00
parent 2e9579037d
commit 57d796af1f
4 changed files with 16 additions and 1 deletions

View File

@ -126,6 +126,8 @@ module TargetMachine = struct
= "llvm_targetmachine_features"
external data_layout : t -> DataLayout.t
= "llvm_targetmachine_data_layout"
external add_analysis_passes : [< Llvm.PassManager.any ] Llvm.PassManager.t -> t -> unit
= "llvm_targetmachine_add_analysis_passes"
external set_verbose_asm : bool -> t -> unit
= "llvm_targetmachine_set_verbose_asm"
external emit_to_file : Llvm.llmodule -> CodeGenFileType.t -> string ->

View File

@ -207,6 +207,10 @@ module TargetMachine : sig
(** Returns the data layout of this target machine. *)
val data_layout : t -> DataLayout.t
(** Adds the target-specific analysis passes to the pass manager.
See [llvm::TargetMachine::addAnalysisPasses]. *)
val add_analysis_passes : [< Llvm.PassManager.any ] Llvm.PassManager.t -> t -> unit
(** Sets the assembly verbosity of this target machine.
See [llvm::TargetMachine::setAsmVerbosity]. *)
val set_verbose_asm : bool -> t -> unit

View File

@ -374,3 +374,10 @@ CAMLprim LLVMMemoryBufferRef llvm_targetmachine_emit_to_memory_buffer(
return Buffer;
}
/* TargetMachine.t -> Llvm.PassManager.t -> unit */
CAMLprim value llvm_targetmachine_add_analysis_passes(LLVMPassManagerRef PM,
value Machine) {
LLVMAddAnalysisPasses(TargetMachine_val(Machine), PM);
return Val_unit;
}

View File

@ -87,7 +87,9 @@ let test_target_machine () =
assert_equal (TM.cpu machine) "";
assert_equal (TM.features machine) "";
ignore (TM.data_layout machine);
TM.set_verbose_asm true machine
TM.set_verbose_asm true machine;
let pm = PassManager.create () in
TM.add_analysis_passes pm machine
(*===-- Code Emission -----------------------------------------------------===*)