[llvm] r342435 - [LLVM-C][OCaml] Add C and OCaml APIs for llvm::StructType::isLiteral
whitequark via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 17 18:47:37 PDT 2018
Author: whitequark
Date: Mon Sep 17 18:47:37 2018
New Revision: 342435
URL: http://llvm.org/viewvc/llvm-project?rev=342435&view=rev
Log:
[LLVM-C][OCaml] Add C and OCaml APIs for llvm::StructType::isLiteral
Summary:
This patch adds LLVMIsLiteralStruct to the C API to expose
StructType::isLiteral. This is then used to implement the analogous
addition to the OCaml API.
Reviewers: whitequark, deadalnix
Reviewed By: whitequark
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D52209
Modified:
llvm/trunk/bindings/ocaml/llvm/llvm.ml
llvm/trunk/bindings/ocaml/llvm/llvm.mli
llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c
llvm/trunk/include/llvm-c/Core.h
llvm/trunk/lib/IR/Core.cpp
Modified: llvm/trunk/bindings/ocaml/llvm/llvm.ml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm.ml?rev=342435&r1=342434&r2=342435&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/llvm/llvm.ml (original)
+++ llvm/trunk/bindings/ocaml/llvm/llvm.ml Mon Sep 17 18:47:37 2018
@@ -469,6 +469,7 @@ external struct_element_types : lltype -
= "llvm_struct_element_types"
external is_packed : lltype -> bool = "llvm_is_packed"
external is_opaque : lltype -> bool = "llvm_is_opaque"
+external is_literal : lltype -> bool = "llvm_is_literal"
(*--... Operations on pointer, vector, and array types .....................--*)
Modified: llvm/trunk/bindings/ocaml/llvm/llvm.mli
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm.mli?rev=342435&r1=342434&r2=342435&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/llvm/llvm.mli (original)
+++ llvm/trunk/bindings/ocaml/llvm/llvm.mli Mon Sep 17 18:47:37 2018
@@ -665,6 +665,10 @@ val is_packed : lltype -> bool
[false] otherwise. See the method [llvm::StructType::isOpaque]. *)
val is_opaque : lltype -> bool
+(** [is_literal sty] returns [true] if the structure type [sty] is literal.
+ [false] otherwise. See the method [llvm::StructType::isLiteral]. *)
+val is_literal : lltype -> bool
+
(** {7 Operations on pointer, vector, and array types} *)
Modified: llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c?rev=342435&r1=342434&r2=342435&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c (original)
+++ llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Mon Sep 17 18:47:37 2018
@@ -510,6 +510,11 @@ CAMLprim value llvm_is_opaque(LLVMTypeRe
return Val_bool(LLVMIsOpaqueStruct(StructTy));
}
+/* lltype -> bool */
+CAMLprim value llvm_is_literal(LLVMTypeRef StructTy) {
+ return Val_bool(LLVMIsLiteralStruct(StructTy));
+}
+
/*--... Operations on array, pointer, and vector types .....................--*/
/* lltype -> lltype array */
Modified: llvm/trunk/include/llvm-c/Core.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=342435&r1=342434&r2=342435&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/Core.h (original)
+++ llvm/trunk/include/llvm-c/Core.h Mon Sep 17 18:47:37 2018
@@ -1279,6 +1279,13 @@ LLVMBool LLVMIsPackedStruct(LLVMTypeRef
LLVMBool LLVMIsOpaqueStruct(LLVMTypeRef StructTy);
/**
+ * Determine whether a structure is literal.
+ *
+ * @see llvm::StructType::isLiteral()
+ */
+LLVMBool LLVMIsLiteralStruct(LLVMTypeRef StructTy);
+
+/**
* @}
*/
Modified: llvm/trunk/lib/IR/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Core.cpp?rev=342435&r1=342434&r2=342435&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Core.cpp (original)
+++ llvm/trunk/lib/IR/Core.cpp Mon Sep 17 18:47:37 2018
@@ -706,6 +706,10 @@ LLVMBool LLVMIsOpaqueStruct(LLVMTypeRef
return unwrap<StructType>(StructTy)->isOpaque();
}
+LLVMBool LLVMIsLiteralStruct(LLVMTypeRef StructTy) {
+ return unwrap<StructType>(StructTy)->isLiteral();
+}
+
LLVMTypeRef LLVMGetTypeByName(LLVMModuleRef M, const char *Name) {
return wrap(unwrap(M)->getTypeByName(Name));
}
More information about the llvm-commits
mailing list