[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

llvm-svn: 342435
This commit is contained in:
whitequark 2018-09-18 01:47:37 +00:00
parent 89a3ac70aa
commit 881fd24d9c
5 changed files with 21 additions and 0 deletions

View File

@ -469,6 +469,7 @@ external struct_element_types : lltype -> lltype array
= "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 .....................--*)

View File

@ -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} *)

View File

@ -510,6 +510,11 @@ CAMLprim value llvm_is_opaque(LLVMTypeRef StructTy) {
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 */

View File

@ -1278,6 +1278,13 @@ LLVMBool LLVMIsPackedStruct(LLVMTypeRef StructTy);
*/
LLVMBool LLVMIsOpaqueStruct(LLVMTypeRef StructTy);
/**
* Determine whether a structure is literal.
*
* @see llvm::StructType::isLiteral()
*/
LLVMBool LLVMIsLiteralStruct(LLVMTypeRef StructTy);
/**
* @}
*/

View File

@ -706,6 +706,10 @@ LLVMBool LLVMIsOpaqueStruct(LLVMTypeRef StructTy) {
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));
}