diff options
author | Gordon Henriksen <gordonhenriksen@mac.com> | 2007-12-27 20:13:47 +0000 |
---|---|---|
committer | Gordon Henriksen <gordonhenriksen@mac.com> | 2007-12-27 20:13:47 +0000 |
commit | 2476de6ea689c0a004547564677c275d480419d3 (patch) | |
tree | 054cd740a91cb46aa8c2a2a06a55510aff2864ce /bindings/ocaml/llvm | |
parent | c19a9cb76905b22abde0c4ca8ccd376daa643cd1 (diff) | |
download | external_llvm-2476de6ea689c0a004547564677c275d480419d3.zip external_llvm-2476de6ea689c0a004547564677c275d480419d3.tar.gz external_llvm-2476de6ea689c0a004547564677c275d480419d3.tar.bz2 |
Adding bindings for target triple and data layout.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45369 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings/ocaml/llvm')
-rw-r--r-- | bindings/ocaml/llvm/llvm.ml | 8 | ||||
-rw-r--r-- | bindings/ocaml/llvm/llvm.mli | 21 | ||||
-rw-r--r-- | bindings/ocaml/llvm/llvm_ocaml.c | 22 |
3 files changed, 51 insertions, 0 deletions
diff --git a/bindings/ocaml/llvm/llvm.ml b/bindings/ocaml/llvm/llvm.ml index b5d1d3d..457677b 100644 --- a/bindings/ocaml/llvm/llvm.ml +++ b/bindings/ocaml/llvm/llvm.ml @@ -107,6 +107,14 @@ let _ = register_exns (IoError "") external create_module : string -> llmodule = "llvm_create_module" external dispose_module : llmodule -> unit = "llvm_dispose_module" +external target_triple: llmodule -> string + = "llvm_target_triple" +external set_target_triple: string -> llmodule -> unit + = "llvm_set_target_triple" +external data_layout: llmodule -> string + = "llvm_data_layout" +external set_data_layout: string -> llmodule -> unit + = "llvm_set_data_layout" external define_type_name : string -> lltype -> llmodule -> bool = "llvm_add_type_name" external delete_type_name : string -> llmodule -> unit diff --git a/bindings/ocaml/llvm/llvm.mli b/bindings/ocaml/llvm/llvm.mli index 8d9d212..8f2c921 100644 --- a/bindings/ocaml/llvm/llvm.mli +++ b/bindings/ocaml/llvm/llvm.mli @@ -162,6 +162,27 @@ external create_module : string -> llmodule = "llvm_create_module" [llvm::Module::~Module]. **) external dispose_module : llmodule -> unit = "llvm_dispose_module" +(** [target_triple m] is the target specifier for the module [m], something like + [i686-apple-darwin8]. See the method [llvm::Module::getTargetTriple]. **) +external target_triple: llmodule -> string + = "llvm_target_triple" + +(** [target_triple triple m] changes the target specifier for the module [m] to + the string [triple]. See the method [llvm::Module::setTargetTriple]. **) +external set_target_triple: string -> llmodule -> unit + = "llvm_set_target_triple" + +(** [data_layout m] is the data layout specifier for the module [m], something + like [e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-...-a0:0:64-f80:128:128]. See the + method [llvm::Module::getDataLayout]. **) +external data_layout: llmodule -> string + = "llvm_data_layout" + +(** [set_data_layout s m] changes the data layout specifier for the module [m] + to the string [s]. See the method [llvm::Module::setDataLayout]. **) +external set_data_layout: string -> llmodule -> unit + = "llvm_set_data_layout" + (** [define_type_name name ty m] adds a named type to the module's symbol table. Returns [true] if successful. If such a name already exists, then no entry is added and [false] is returned. See the [llvm::Module::addTypeName] diff --git a/bindings/ocaml/llvm/llvm_ocaml.c b/bindings/ocaml/llvm/llvm_ocaml.c index d8856e7..d095550 100644 --- a/bindings/ocaml/llvm/llvm_ocaml.c +++ b/bindings/ocaml/llvm/llvm_ocaml.c @@ -62,6 +62,28 @@ CAMLprim value llvm_dispose_module(LLVMModuleRef M) { return Val_unit; } +/* llmodule -> string */ +CAMLprim value llvm_target_triple(LLVMModuleRef M) { + return copy_string(LLVMGetTarget(M)); +} + +/* string -> llmodule -> unit */ +CAMLprim value llvm_set_target_triple(value Trip, LLVMModuleRef M) { + LLVMSetTarget(M, String_val(Trip)); + return Val_unit; +} + +/* llmodule -> string */ +CAMLprim value llvm_data_layout(LLVMModuleRef M) { + return copy_string(LLVMGetDataLayout(M)); +} + +/* string -> llmodule -> unit */ +CAMLprim value llvm_set_data_layout(value Layout, LLVMModuleRef M) { + LLVMSetDataLayout(M, String_val(Layout)); + return Val_unit; +} + /* string -> lltype -> llmodule -> bool */ CAMLprim value llvm_add_type_name(value Name, LLVMTypeRef Ty, LLVMModuleRef M) { int res = LLVMAddTypeName(M, String_val(Name), Ty); |