summaryrefslogtreecommitdiffstats
path: root/llvm/bindings
diff options
context:
space:
mode:
authorPeter Zotov <whitequark@whitequark.org>2013-11-05 11:56:20 +0000
committerPeter Zotov <whitequark@whitequark.org>2013-11-05 11:56:20 +0000
commit28f6876ecca2ed6b179c51eea767f80899b5eaf9 (patch)
treefd632314a6174216e8f19edd29cb42503a594f88 /llvm/bindings
parentce7a91b2778f7cc3adf714c25734f219937af1ea (diff)
downloadbcm5719-llvm-28f6876ecca2ed6b179c51eea767f80899b5eaf9.tar.gz
bcm5719-llvm-28f6876ecca2ed6b179c51eea767f80899b5eaf9.zip
[OCaml] (PR16318) Add missing argument to Llvm.const_intcast
llvm-svn: 194065
Diffstat (limited to 'llvm/bindings')
-rw-r--r--llvm/bindings/ocaml/llvm/llvm.ml3
-rw-r--r--llvm/bindings/ocaml/llvm/llvm.mli10
-rw-r--r--llvm/bindings/ocaml/llvm/llvm_ocaml.c6
3 files changed, 14 insertions, 5 deletions
diff --git a/llvm/bindings/ocaml/llvm/llvm.ml b/llvm/bindings/ocaml/llvm/llvm.ml
index e5ffd59599f..1bf91f45186 100644
--- a/llvm/bindings/ocaml/llvm/llvm.ml
+++ b/llvm/bindings/ocaml/llvm/llvm.ml
@@ -529,7 +529,8 @@ external const_trunc_or_bitcast : llvalue -> lltype -> llvalue
= "LLVMConstTruncOrBitCast"
external const_pointercast : llvalue -> lltype -> llvalue
= "LLVMConstPointerCast"
-external const_intcast : llvalue -> lltype -> llvalue = "LLVMConstIntCast"
+external const_intcast : llvalue -> lltype -> is_signed:bool -> llvalue
+ = "llvm_const_intcast"
external const_fpcast : llvalue -> lltype -> llvalue = "LLVMConstFPCast"
external const_select : llvalue -> llvalue -> llvalue -> llvalue
= "LLVMConstSelect"
diff --git a/llvm/bindings/ocaml/llvm/llvm.mli b/llvm/bindings/ocaml/llvm/llvm.mli
index 8d08c0a83b4..f70fd60b34f 100644
--- a/llvm/bindings/ocaml/llvm/llvm.mli
+++ b/llvm/bindings/ocaml/llvm/llvm.mli
@@ -1118,10 +1118,12 @@ val const_trunc_or_bitcast : llvalue -> lltype -> llvalue
See the method [llvm::ConstantExpr::getPointerCast]. *)
val const_pointercast : llvalue -> lltype -> llvalue
-(** [const_intcast c ty] returns a constant zext, bitcast, or trunc for integer
- -> integer casts of constant [c] to type [ty].
- See the method [llvm::ConstantExpr::getIntCast]. *)
-val const_intcast : llvalue -> lltype -> llvalue
+(** [const_intcast c ty ~is_signed] returns a constant sext/zext, bitcast,
+ or trunc for integer -> integer casts of constant [c] to type [ty].
+ When converting a narrower value to a wider one, whether sext or zext
+ will be used is controlled by [is_signed].
+ See the method [llvm::ConstantExpr::getIntegerCast]. *)
+val const_intcast : llvalue -> lltype -> is_signed:bool -> llvalue
(** [const_fpcast c ty] returns a constant fpext, bitcast, or fptrunc for fp ->
fp casts of constant [c] to type [ty].
diff --git a/llvm/bindings/ocaml/llvm/llvm_ocaml.c b/llvm/bindings/ocaml/llvm/llvm_ocaml.c
index 46c170b44f3..e7ebde26efc 100644
--- a/llvm/bindings/ocaml/llvm/llvm_ocaml.c
+++ b/llvm/bindings/ocaml/llvm/llvm_ocaml.c
@@ -771,6 +771,12 @@ CAMLprim LLVMValueRef llvm_const_in_bounds_gep(LLVMValueRef ConstantVal,
Wosize_val(Indices));
}
+/* llvalue -> lltype -> is_signed:bool -> llvalue */
+CAMLprim LLVMValueRef llvm_const_intcast(LLVMValueRef CV, LLVMTypeRef T,
+ value IsSigned) {
+ return LLVMConstIntCast(CV, T, Bool_val(IsSigned));
+}
+
/* llvalue -> int array -> llvalue */
CAMLprim LLVMValueRef llvm_const_extractvalue(LLVMValueRef Aggregate,
value Indices) {
OpenPOWER on IntegriCloud