aboutsummaryrefslogtreecommitdiffstats
path: root/bindings/ocaml/llvm/llvm_ocaml.c
diff options
context:
space:
mode:
authorGordon Henriksen <gordonhenriksen@mac.com>2007-09-18 18:07:51 +0000
committerGordon Henriksen <gordonhenriksen@mac.com>2007-09-18 18:07:51 +0000
commit4a8b7f9bece4b7f71e4a8b73dfd83f36194cb658 (patch)
treebe1d6313447d5e51529a9e2409b02a2303799e46 /bindings/ocaml/llvm/llvm_ocaml.c
parent64b349c825bddaaaaaeb556d5ea00925e26b9244 (diff)
downloadexternal_llvm-4a8b7f9bece4b7f71e4a8b73dfd83f36194cb658.zip
external_llvm-4a8b7f9bece4b7f71e4a8b73dfd83f36194cb658.tar.gz
external_llvm-4a8b7f9bece4b7f71e4a8b73dfd83f36194cb658.tar.bz2
Tests of the ocaml (and thus C) bindings for constants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42101 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings/ocaml/llvm/llvm_ocaml.c')
-rw-r--r--bindings/ocaml/llvm/llvm_ocaml.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/bindings/ocaml/llvm/llvm_ocaml.c b/bindings/ocaml/llvm/llvm_ocaml.c
index 3191cb0..ae07fb2 100644
--- a/bindings/ocaml/llvm/llvm_ocaml.c
+++ b/bindings/ocaml/llvm/llvm_ocaml.c
@@ -248,10 +248,20 @@ CAMLprim value llvm_make_undef(value Ty) {
}
/* llvalue -> bool */
+CAMLprim value llvm_is_constant(value Ty) {
+ return Val_bool(LLVMIsConstant((LLVMValueRef) Ty));
+}
+
+/* llvalue -> bool */
CAMLprim value llvm_is_null(value Val) {
return Val_bool(LLVMIsNull((LLVMValueRef) Val));
}
+/* llvalue -> bool */
+CAMLprim value llvm_is_undef(value Ty) {
+ return Val_bool(LLVMIsUndef((LLVMValueRef) Ty));
+}
+
/*--... Operations on scalar constants .....................................--*/
/* lltype -> int -> bool -> llvalue */
@@ -266,6 +276,12 @@ CAMLprim value llvm_make_int_constant(value IntTy, value N, value SExt) {
return (value) LLVMGetIntConstant((LLVMTypeRef) IntTy, N2, Bool_val(SExt));
}
+/* lltype -> Int64.t -> bool -> llvalue */
+CAMLprim value llvm_make_int64_constant(value IntTy, value N, value SExt) {
+ return (value) LLVMGetIntConstant((LLVMTypeRef) IntTy, Int64_val(N),
+ Bool_val(SExt));
+}
+
/* lltype -> float -> llvalue */
CAMLprim value llvm_make_real_constant(value RealTy, value N) {
return (value) LLVMGetRealConstant((LLVMTypeRef) RealTy, Double_val(N));
@@ -276,7 +292,7 @@ CAMLprim value llvm_make_real_constant(value RealTy, value N) {
/* string -> bool -> llvalue */
CAMLprim value llvm_make_string_constant(value Str, value NullTerminate) {
return (value) LLVMGetStringConstant(String_val(Str),
- Wosize_val(Str),
+ caml_string_length(Str),
Bool_val(NullTerminate) == 0);
}