Skip to content
Snippets Groups Projects
Commit c110fbc2 authored by Jeroen Ketema's avatar Jeroen Ketema
Browse files

[OCaml] Reinstate data_layout

Expose LLVMCreateTargetMachineData as data_layout.

As r263530 did for go. From that commit: "LLVMGetTargetDataLayout was
removed from the C API, and then TargetMachine.TargetData was removed.
Later, LLVMCreateTargetMachineData was added to the C API"

Differential Revision: http://reviews.llvm.org/D18677

llvm-svn: 265115
parent db6db505
No related branches found
No related tags found
No related merge requests found
...@@ -121,6 +121,8 @@ module TargetMachine = struct ...@@ -121,6 +121,8 @@ module TargetMachine = struct
= "llvm_targetmachine_cpu" = "llvm_targetmachine_cpu"
external features : t -> string external features : t -> string
= "llvm_targetmachine_features" = "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 external add_analysis_passes : [< Llvm.PassManager.any ] Llvm.PassManager.t -> t -> unit
= "llvm_targetmachine_add_analysis_passes" = "llvm_targetmachine_add_analysis_passes"
external set_verbose_asm : bool -> t -> unit external set_verbose_asm : bool -> t -> unit
......
...@@ -194,6 +194,9 @@ module TargetMachine : sig ...@@ -194,6 +194,9 @@ module TargetMachine : sig
[llvm::TargetMachine::getCPU]. *) [llvm::TargetMachine::getCPU]. *)
val cpu : t -> string val cpu : t -> string
(** Returns the data layout of this target machine. *)
val data_layout : t -> DataLayout.t
(** Returns the feature string used while creating this target machine. See (** Returns the feature string used while creating this target machine. See
[llvm::TargetMachine::getFeatureString]. *) [llvm::TargetMachine::getFeatureString]. *)
val features : t -> string val features : t -> string
......
...@@ -296,6 +296,12 @@ CAMLprim value llvm_targetmachine_features(value Machine) { ...@@ -296,6 +296,12 @@ CAMLprim value llvm_targetmachine_features(value Machine) {
TargetMachine_val(Machine))); TargetMachine_val(Machine)));
} }
/* TargetMachine.t -> DataLayout.t */
CAMLprim value llvm_targetmachine_data_layout(value Machine) {
return llvm_alloc_data_layout(LLVMCreateTargetDataLayout(
TargetMachine_val(Machine)));
}
/* bool -> TargetMachine.t -> unit */ /* bool -> TargetMachine.t -> unit */
CAMLprim value llvm_targetmachine_set_verbose_asm(value Verb, value Machine) { CAMLprim value llvm_targetmachine_set_verbose_asm(value Verb, value Machine) {
LLVMSetTargetMachineAsmVerbosity(TargetMachine_val(Machine), Bool_val(Verb)); LLVMSetTargetMachineAsmVerbosity(TargetMachine_val(Machine), Bool_val(Verb));
......
...@@ -81,6 +81,7 @@ let test_target_machine () = ...@@ -81,6 +81,7 @@ let test_target_machine () =
assert_equal (TM.triple machine) (Target.default_triple ()); assert_equal (TM.triple machine) (Target.default_triple ());
assert_equal (TM.cpu machine) ""; assert_equal (TM.cpu machine) "";
assert_equal (TM.features 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 let pm = PassManager.create () in
TM.add_analysis_passes pm machine TM.add_analysis_passes pm machine
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment