aboutsummaryrefslogtreecommitdiffstats
path: root/bindings/ocaml/llvm/llvm_ocaml.c
diff options
context:
space:
mode:
authorGordon Henriksen <gordonhenriksen@mac.com>2007-10-07 00:13:35 +0000
committerGordon Henriksen <gordonhenriksen@mac.com>2007-10-07 00:13:35 +0000
commit0a38ee31bfb08104eb6fc763b67ded44b01266f8 (patch)
treede2716f4caa6d2d7296465c0c0750b507a959648 /bindings/ocaml/llvm/llvm_ocaml.c
parent3ed72368453d39942c9a3e0f41242485d9f3cfdf (diff)
downloadexternal_llvm-0a38ee31bfb08104eb6fc763b67ded44b01266f8.zip
external_llvm-0a38ee31bfb08104eb6fc763b67ded44b01266f8.tar.gz
external_llvm-0a38ee31bfb08104eb6fc763b67ded44b01266f8.tar.bz2
C and Objective Caml bindings for PATypeHolder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42713 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings/ocaml/llvm/llvm_ocaml.c')
-rw-r--r--bindings/ocaml/llvm/llvm_ocaml.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/bindings/ocaml/llvm/llvm_ocaml.c b/bindings/ocaml/llvm/llvm_ocaml.c
index 6bccd28..4d72182 100644
--- a/bindings/ocaml/llvm/llvm_ocaml.c
+++ b/bindings/ocaml/llvm/llvm_ocaml.c
@@ -195,6 +195,38 @@ CAMLprim LLVMTypeRef llvm_opaque_type(value Unit) {
return LLVMOpaqueType();
}
+/*--... Operations on type handles .........................................--*/
+
+#define Typehandle_val(v) (*(LLVMTypeHandleRef *)(Data_custom_val(v)))
+
+void llvm_finalize_handle(value TH) {
+ LLVMDisposeTypeHandle(Typehandle_val(TH));
+}
+
+static struct custom_operations typehandle_ops = {
+ (char *) "LLVMTypeHandle",
+ llvm_finalize_handle,
+ custom_compare_default,
+ custom_hash_default,
+ custom_serialize_default,
+ custom_deserialize_default
+};
+
+CAMLprim value llvm_handle_to_type(LLVMTypeRef PATy) {
+ value TH = alloc_custom(&typehandle_ops, sizeof(LLVMBuilderRef), 0, 1);
+ Typehandle_val(TH) = LLVMCreateTypeHandle(PATy);
+ return TH;
+}
+
+CAMLprim LLVMTypeRef llvm_type_of_handle(value TH) {
+ return LLVMResolveTypeHandle(Typehandle_val(TH));
+}
+
+CAMLprim value llvm_refine_type(LLVMTypeRef AbstractTy, LLVMTypeRef ConcreteTy){
+ LLVMRefineAbstractType(AbstractTy, ConcreteTy);
+ return Val_unit;
+}
+
/*===-- VALUES ------------------------------------------------------------===*/