summaryrefslogtreecommitdiff
path: root/bindings/ocaml/executionengine
diff options
context:
space:
mode:
authorPeter Zotov <whitequark@whitequark.org>2013-11-15 02:51:44 +0000
committerPeter Zotov <whitequark@whitequark.org>2013-11-15 02:51:44 +0000
commit04deb4957ab253c02bce9d982d69396954744a41 (patch)
treeac823aa6545828dd0ea3426c81bbdaa81c917b63 /bindings/ocaml/executionengine
parent68f4dae1c078df09c9b19a0bda9bc8b8d0aae9be (diff)
downloadllvm-04deb4957ab253c02bce9d982d69396954744a41.tar.gz
llvm-04deb4957ab253c02bce9d982d69396954744a41.tar.bz2
llvm-04deb4957ab253c02bce9d982d69396954744a41.tar.xz
[OCaml] Refactor Llvm_target interface
This commit brings the module structure, argument order and primitive names in Llvm_target in order with the rest of the bindings, in preparation for adding TargetMachine API. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194773 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings/ocaml/executionengine')
-rw-r--r--bindings/ocaml/executionengine/executionengine_ocaml.c18
-rw-r--r--bindings/ocaml/executionengine/llvm_executionengine.ml4
-rw-r--r--bindings/ocaml/executionengine/llvm_executionengine.mli5
3 files changed, 17 insertions, 10 deletions
diff --git a/bindings/ocaml/executionengine/executionengine_ocaml.c b/bindings/ocaml/executionengine/executionengine_ocaml.c
index 3d2c8b09e7..4b44a91066 100644
--- a/bindings/ocaml/executionengine/executionengine_ocaml.c
+++ b/bindings/ocaml/executionengine/executionengine_ocaml.c
@@ -324,10 +324,18 @@ CAMLprim value llvm_ee_free_machine_code(LLVMValueRef F,
return Val_unit;
}
-extern value llvm_alloc_target_data(LLVMTargetDataRef TargetData);
+extern value llvm_alloc_data_layout(LLVMTargetDataRef TargetData);
-/* ExecutionEngine.t -> Llvm_target.TargetData.t */
-CAMLprim value llvm_ee_get_target_data(LLVMExecutionEngineRef EE) {
- LLVMTargetDataRef TD = LLVMGetExecutionEngineTargetData(EE);
- return llvm_alloc_target_data(TD);
+/* ExecutionEngine.t -> Llvm_target.DataLayout.t */
+CAMLprim value llvm_ee_get_data_layout(LLVMExecutionEngineRef EE) {
+ value DataLayout;
+ LLVMTargetDataRef OrigDataLayout;
+ OrigDataLayout = LLVMGetExecutionEngineTargetData(EE);
+
+ char* TargetDataCStr;
+ TargetDataCStr = LLVMCopyStringRepOfTargetData(OrigDataLayout);
+ DataLayout = llvm_alloc_data_layout(LLVMCreateTargetData(TargetDataCStr));
+ LLVMDisposeMessage(TargetDataCStr);
+
+ return DataLayout;
}
diff --git a/bindings/ocaml/executionengine/llvm_executionengine.ml b/bindings/ocaml/executionengine/llvm_executionengine.ml
index 01991540c0..a738df765d 100644
--- a/bindings/ocaml/executionengine/llvm_executionengine.ml
+++ b/bindings/ocaml/executionengine/llvm_executionengine.ml
@@ -83,8 +83,8 @@ module ExecutionEngine = struct
external free_machine_code: Llvm.llvalue -> t -> unit
= "llvm_ee_free_machine_code"
- external target_data: t -> Llvm_target.DataLayout.t
- = "llvm_ee_get_target_data"
+ external data_layout : t -> Llvm_target.DataLayout.t
+ = "llvm_ee_get_data_layout"
(* The following are not bound. Patches are welcome.
diff --git a/bindings/ocaml/executionengine/llvm_executionengine.mli b/bindings/ocaml/executionengine/llvm_executionengine.mli
index 1aa250f363..16f08930a7 100644
--- a/bindings/ocaml/executionengine/llvm_executionengine.mli
+++ b/bindings/ocaml/executionengine/llvm_executionengine.mli
@@ -147,9 +147,8 @@ module ExecutionEngine: sig
used to store the machine code for the function [f]. *)
val free_machine_code : Llvm.llvalue -> t -> unit
- (** [target_data ee] is the target data owned by the execution engine
- [ee]. *)
- val target_data : t -> Llvm_target.DataLayout.t
+ (** [data_layout ee] is the data layout of the execution engine [ee]. *)
+ val data_layout : t -> Llvm_target.DataLayout.t
end
val initialize_native_target : unit -> bool