llvm.org GIT mirror llvm / ff12c99
ocaml/C bindings: type->isSized() git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141288 91177308-0d34-0410-b5e6-96231b3b80d8 Torok Edwin 7 years ago
5 changed file(s) with 16 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
166166 (*===-- Types -------------------------------------------------------------===*)
167167 external classify_type : lltype -> TypeKind.t = "llvm_classify_type"
168168 external type_context : lltype -> llcontext = "llvm_type_context"
169 external type_is_sized : lltype -> bool = "llvm_type_is_sized"
169170
170171 (*--... Operations on integer types ........................................--*)
171172 external i1_type : llcontext -> lltype = "llvm_i1_type"
270270 See the method [llvm::Type::getTypeID]. *)
271271 val classify_type : lltype -> TypeKind.t
272272
273 (** [type_is_sized ty] returns whether the type has a size or not.
274 * If it doesn't then it is not safe to call the [TargetData::] methods on it.
275 * *)
276 val type_is_sized : lltype -> bool
277
273278 (** [type_context ty] returns the {!llcontext} corresponding to the type [ty].
274279 See the method [llvm::Type::getContext]. *)
275280 val type_context : lltype -> llcontext
171171 return Val_int(LLVMGetTypeKind(Ty));
172172 }
173173
174 CAMLprim value llvm_type_is_sized(LLVMTypeRef Ty) {
175 return Val_bool(LLVMTypeIsSized(Ty));
176 }
177
174178 /* lltype -> llcontext */
175179 CAMLprim LLVMContextRef llvm_type_context(LLVMTypeRef Ty) {
176180 return LLVMGetTypeContext(Ty);
354354
355355 /** See llvm::LLVMTypeKind::getTypeID. */
356356 LLVMTypeKind LLVMGetTypeKind(LLVMTypeRef Ty);
357 LLVMBool LLVMTypeIsSized(LLVMTypeRef Ty);
357358
358359 /** See llvm::LLVMType::getContext. */
359360 LLVMContextRef LLVMGetTypeContext(LLVMTypeRef Ty);
164164 case Type::X86_MMXTyID:
165165 return LLVMX86_MMXTypeKind;
166166 }
167 }
168
169 LLVMBool LLVMTypeIsSized(LLVMTypeRef Ty)
170 {
171 return unwrap(Ty)->isSized();
167172 }
168173
169174 LLVMContextRef LLVMGetTypeContext(LLVMTypeRef Ty) {