diff options
author | Erick Tryzelaar <idadesub@users.sourceforge.net> | 2009-08-16 23:37:03 +0000 |
---|---|---|
committer | Erick Tryzelaar <idadesub@users.sourceforge.net> | 2009-08-16 23:37:03 +0000 |
commit | 45d6ac2cc13f7881687c2d7f03f9b9892fd85e6e (patch) | |
tree | 837c8a8dec14edd390965b6777e880a70b6f6c9b /bindings/ocaml/llvm/llvm_ocaml.c | |
parent | e0a1bf64c9885df16bf596447d037f1c75f92637 (diff) |
Expose creating constant ints and floats from strings to ocaml.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79214 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings/ocaml/llvm/llvm_ocaml.c')
-rw-r--r-- | bindings/ocaml/llvm/llvm_ocaml.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/bindings/ocaml/llvm/llvm_ocaml.c b/bindings/ocaml/llvm/llvm_ocaml.c index 88c9a23109..69bd0a2fbc 100644 --- a/bindings/ocaml/llvm/llvm_ocaml.c +++ b/bindings/ocaml/llvm/llvm_ocaml.c @@ -388,11 +388,24 @@ CAMLprim LLVMValueRef llvm_const_of_int64(LLVMTypeRef IntTy, value N, return LLVMConstInt(IntTy, Int64_val(N), Bool_val(SExt)); } +/* lltype -> string -> int -> llvalue */ +CAMLprim LLVMValueRef llvm_const_int_of_string(LLVMTypeRef IntTy, value S, + value Radix) { + return LLVMConstIntOfStringAndSize(IntTy, String_val(S), caml_string_length(S), + Int_val(Radix)); +} + /* lltype -> float -> llvalue */ CAMLprim LLVMValueRef llvm_const_float(LLVMTypeRef RealTy, value N) { return LLVMConstReal(RealTy, Double_val(N)); } +/* lltype -> string -> llvalue */ +CAMLprim LLVMValueRef llvm_const_float_of_string(LLVMTypeRef RealTy, value S) { + return LLVMConstRealOfStringAndSize(RealTy, String_val(S), + caml_string_length(S)); +} + /*--... Operations on composite constants ..................................--*/ /* string -> llvalue */ |