1 //===-- Type.cpp - Implement the Type class -------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements the Type class for the IR library.
12 //===----------------------------------------------------------------------===//
14 #include "llvm/IR/Type.h"
15 #include "LLVMContextImpl.h"
16 #include "llvm/ADT/SmallString.h"
17 #include "llvm/IR/Module.h"
22 //===----------------------------------------------------------------------===//
23 // Type Class Implementation
24 //===----------------------------------------------------------------------===//
26 Type *Type::getPrimitiveType(LLVMContext &C, TypeID IDNumber) {
28 case VoidTyID : return getVoidTy(C);
29 case HalfTyID : return getHalfTy(C);
30 case FloatTyID : return getFloatTy(C);
31 case DoubleTyID : return getDoubleTy(C);
32 case X86_FP80TyID : return getX86_FP80Ty(C);
33 case FP128TyID : return getFP128Ty(C);
34 case PPC_FP128TyID : return getPPC_FP128Ty(C);
35 case LabelTyID : return getLabelTy(C);
36 case MetadataTyID : return getMetadataTy(C);
37 case X86_MMXTyID : return getX86_MMXTy(C);
38 case TokenTyID : return getTokenTy(C);
44 Type *Type::getScalarType() const {
45 if (auto *VTy = dyn_cast<VectorType>(this))
46 return VTy->getElementType();
47 return const_cast<Type*>(this);
50 bool Type::isIntegerTy(unsigned Bitwidth) const {
51 return isIntegerTy() && cast<IntegerType>(this)->getBitWidth() == Bitwidth;
54 bool Type::canLosslesslyBitCastTo(Type *Ty) const {
55 // Identity cast means no change so return true
59 // They are not convertible unless they are at least first class types
60 if (!this->isFirstClassType() || !Ty->isFirstClassType())
63 // Vector -> Vector conversions are always lossless if the two vector types
64 // have the same size, otherwise not. Also, 64-bit vector types can be
65 // converted to x86mmx.
66 if (auto *thisPTy = dyn_cast<VectorType>(this)) {
67 if (auto *thatPTy = dyn_cast<VectorType>(Ty))
68 return thisPTy->getBitWidth() == thatPTy->getBitWidth();
69 if (Ty->getTypeID() == Type::X86_MMXTyID &&
70 thisPTy->getBitWidth() == 64)
74 if (this->getTypeID() == Type::X86_MMXTyID)
75 if (auto *thatPTy = dyn_cast<VectorType>(Ty))
76 if (thatPTy->getBitWidth() == 64)
79 // At this point we have only various mismatches of the first class types
80 // remaining and ptr->ptr. Just select the lossless conversions. Everything
81 // else is not lossless. Conservatively assume we can't losslessly convert
82 // between pointers with different address spaces.
83 if (auto *PTy = dyn_cast<PointerType>(this)) {
84 if (auto *OtherPTy = dyn_cast<PointerType>(Ty))
85 return PTy->getAddressSpace() == OtherPTy->getAddressSpace();
88 return false; // Other types have no identity values
91 bool Type::isEmptyTy() const {
92 if (auto *ATy = dyn_cast<ArrayType>(this)) {
93 unsigned NumElements = ATy->getNumElements();
94 return NumElements == 0 || ATy->getElementType()->isEmptyTy();
97 if (auto *STy = dyn_cast<StructType>(this)) {
98 unsigned NumElements = STy->getNumElements();
99 for (unsigned i = 0; i < NumElements; ++i)
100 if (!STy->getElementType(i)->isEmptyTy())
108 unsigned Type::getPrimitiveSizeInBits() const {
109 switch (getTypeID()) {
110 case Type::HalfTyID: return 16;
111 case Type::FloatTyID: return 32;
112 case Type::DoubleTyID: return 64;
113 case Type::X86_FP80TyID: return 80;
114 case Type::FP128TyID: return 128;
115 case Type::PPC_FP128TyID: return 128;
116 case Type::X86_MMXTyID: return 64;
117 case Type::IntegerTyID: return cast<IntegerType>(this)->getBitWidth();
118 case Type::VectorTyID: return cast<VectorType>(this)->getBitWidth();
123 unsigned Type::getScalarSizeInBits() const {
124 return getScalarType()->getPrimitiveSizeInBits();
127 int Type::getFPMantissaWidth() const {
128 if (auto *VTy = dyn_cast<VectorType>(this))
129 return VTy->getElementType()->getFPMantissaWidth();
130 assert(isFloatingPointTy() && "Not a floating point type!");
131 if (getTypeID() == HalfTyID) return 11;
132 if (getTypeID() == FloatTyID) return 24;
133 if (getTypeID() == DoubleTyID) return 53;
134 if (getTypeID() == X86_FP80TyID) return 64;
135 if (getTypeID() == FP128TyID) return 113;
136 assert(getTypeID() == PPC_FP128TyID && "unknown fp type");
140 bool Type::isSizedDerivedType(SmallPtrSetImpl<Type*> *Visited) const {
141 if (auto *ATy = dyn_cast<ArrayType>(this))
142 return ATy->getElementType()->isSized(Visited);
144 if (auto *VTy = dyn_cast<VectorType>(this))
145 return VTy->getElementType()->isSized(Visited);
147 return cast<StructType>(this)->isSized(Visited);
150 //===----------------------------------------------------------------------===//
151 // Primitive 'Type' data
152 //===----------------------------------------------------------------------===//
154 Type *Type::getVoidTy(LLVMContext &C) { return &C.pImpl->VoidTy; }
155 Type *Type::getLabelTy(LLVMContext &C) { return &C.pImpl->LabelTy; }
156 Type *Type::getHalfTy(LLVMContext &C) { return &C.pImpl->HalfTy; }
157 Type *Type::getFloatTy(LLVMContext &C) { return &C.pImpl->FloatTy; }
158 Type *Type::getDoubleTy(LLVMContext &C) { return &C.pImpl->DoubleTy; }
159 Type *Type::getMetadataTy(LLVMContext &C) { return &C.pImpl->MetadataTy; }
160 Type *Type::getTokenTy(LLVMContext &C) { return &C.pImpl->TokenTy; }
161 Type *Type::getX86_FP80Ty(LLVMContext &C) { return &C.pImpl->X86_FP80Ty; }
162 Type *Type::getFP128Ty(LLVMContext &C) { return &C.pImpl->FP128Ty; }
163 Type *Type::getPPC_FP128Ty(LLVMContext &C) { return &C.pImpl->PPC_FP128Ty; }
164 Type *Type::getX86_MMXTy(LLVMContext &C) { return &C.pImpl->X86_MMXTy; }
166 IntegerType *Type::getInt1Ty(LLVMContext &C) { return &C.pImpl->Int1Ty; }
167 IntegerType *Type::getInt8Ty(LLVMContext &C) { return &C.pImpl->Int8Ty; }
168 IntegerType *Type::getInt16Ty(LLVMContext &C) { return &C.pImpl->Int16Ty; }
169 IntegerType *Type::getInt32Ty(LLVMContext &C) { return &C.pImpl->Int32Ty; }
170 IntegerType *Type::getInt64Ty(LLVMContext &C) { return &C.pImpl->Int64Ty; }
171 IntegerType *Type::getInt128Ty(LLVMContext &C) { return &C.pImpl->Int128Ty; }
173 IntegerType *Type::getIntNTy(LLVMContext &C, unsigned N) {
174 return IntegerType::get(C, N);
177 PointerType *Type::getHalfPtrTy(LLVMContext &C, unsigned AS) {
178 return getHalfTy(C)->getPointerTo(AS);
181 PointerType *Type::getFloatPtrTy(LLVMContext &C, unsigned AS) {
182 return getFloatTy(C)->getPointerTo(AS);
185 PointerType *Type::getDoublePtrTy(LLVMContext &C, unsigned AS) {
186 return getDoubleTy(C)->getPointerTo(AS);
189 PointerType *Type::getX86_FP80PtrTy(LLVMContext &C, unsigned AS) {
190 return getX86_FP80Ty(C)->getPointerTo(AS);
193 PointerType *Type::getFP128PtrTy(LLVMContext &C, unsigned AS) {
194 return getFP128Ty(C)->getPointerTo(AS);
197 PointerType *Type::getPPC_FP128PtrTy(LLVMContext &C, unsigned AS) {
198 return getPPC_FP128Ty(C)->getPointerTo(AS);
201 PointerType *Type::getX86_MMXPtrTy(LLVMContext &C, unsigned AS) {
202 return getX86_MMXTy(C)->getPointerTo(AS);
205 PointerType *Type::getIntNPtrTy(LLVMContext &C, unsigned N, unsigned AS) {
206 return getIntNTy(C, N)->getPointerTo(AS);
209 PointerType *Type::getInt1PtrTy(LLVMContext &C, unsigned AS) {
210 return getInt1Ty(C)->getPointerTo(AS);
213 PointerType *Type::getInt8PtrTy(LLVMContext &C, unsigned AS) {
214 return getInt8Ty(C)->getPointerTo(AS);
217 PointerType *Type::getInt16PtrTy(LLVMContext &C, unsigned AS) {
218 return getInt16Ty(C)->getPointerTo(AS);
221 PointerType *Type::getInt32PtrTy(LLVMContext &C, unsigned AS) {
222 return getInt32Ty(C)->getPointerTo(AS);
225 PointerType *Type::getInt64PtrTy(LLVMContext &C, unsigned AS) {
226 return getInt64Ty(C)->getPointerTo(AS);
230 //===----------------------------------------------------------------------===//
231 // IntegerType Implementation
232 //===----------------------------------------------------------------------===//
234 IntegerType *IntegerType::get(LLVMContext &C, unsigned NumBits) {
235 assert(NumBits >= MIN_INT_BITS && "bitwidth too small");
236 assert(NumBits <= MAX_INT_BITS && "bitwidth too large");
238 // Check for the built-in integer types
240 case 1: return cast<IntegerType>(Type::getInt1Ty(C));
241 case 8: return cast<IntegerType>(Type::getInt8Ty(C));
242 case 16: return cast<IntegerType>(Type::getInt16Ty(C));
243 case 32: return cast<IntegerType>(Type::getInt32Ty(C));
244 case 64: return cast<IntegerType>(Type::getInt64Ty(C));
245 case 128: return cast<IntegerType>(Type::getInt128Ty(C));
250 IntegerType *&Entry = C.pImpl->IntegerTypes[NumBits];
253 Entry = new (C.pImpl->TypeAllocator) IntegerType(C, NumBits);
258 bool IntegerType::isPowerOf2ByteWidth() const {
259 unsigned BitWidth = getBitWidth();
260 return (BitWidth > 7) && isPowerOf2_32(BitWidth);
263 APInt IntegerType::getMask() const {
264 return APInt::getAllOnesValue(getBitWidth());
267 //===----------------------------------------------------------------------===//
268 // FunctionType Implementation
269 //===----------------------------------------------------------------------===//
271 FunctionType::FunctionType(Type *Result, ArrayRef<Type*> Params,
273 : Type(Result->getContext(), FunctionTyID) {
274 Type **SubTys = reinterpret_cast<Type**>(this+1);
275 assert(isValidReturnType(Result) && "invalid return type for function");
276 setSubclassData(IsVarArgs);
280 for (unsigned i = 0, e = Params.size(); i != e; ++i) {
281 assert(isValidArgumentType(Params[i]) &&
282 "Not a valid type for function argument!");
283 SubTys[i+1] = Params[i];
286 ContainedTys = SubTys;
287 NumContainedTys = Params.size() + 1; // + 1 for result type
290 // This is the factory function for the FunctionType class.
291 FunctionType *FunctionType::get(Type *ReturnType,
292 ArrayRef<Type*> Params, bool isVarArg) {
293 LLVMContextImpl *pImpl = ReturnType->getContext().pImpl;
294 FunctionTypeKeyInfo::KeyTy Key(ReturnType, Params, isVarArg);
295 auto I = pImpl->FunctionTypes.find_as(Key);
298 if (I == pImpl->FunctionTypes.end()) {
299 FT = (FunctionType*) pImpl->TypeAllocator.
300 Allocate(sizeof(FunctionType) + sizeof(Type*) * (Params.size() + 1),
301 AlignOf<FunctionType>::Alignment);
302 new (FT) FunctionType(ReturnType, Params, isVarArg);
303 pImpl->FunctionTypes.insert(FT);
311 FunctionType *FunctionType::get(Type *Result, bool isVarArg) {
312 return get(Result, None, isVarArg);
315 bool FunctionType::isValidReturnType(Type *RetTy) {
316 return !RetTy->isFunctionTy() && !RetTy->isLabelTy() &&
317 !RetTy->isMetadataTy();
320 bool FunctionType::isValidArgumentType(Type *ArgTy) {
321 return ArgTy->isFirstClassType();
324 //===----------------------------------------------------------------------===//
325 // StructType Implementation
326 //===----------------------------------------------------------------------===//
328 // Primitive Constructors.
330 StructType *StructType::get(LLVMContext &Context, ArrayRef<Type*> ETypes,
332 LLVMContextImpl *pImpl = Context.pImpl;
333 AnonStructTypeKeyInfo::KeyTy Key(ETypes, isPacked);
334 auto I = pImpl->AnonStructTypes.find_as(Key);
337 if (I == pImpl->AnonStructTypes.end()) {
338 // Value not found. Create a new type!
339 ST = new (Context.pImpl->TypeAllocator) StructType(Context);
340 ST->setSubclassData(SCDB_IsLiteral); // Literal struct.
341 ST->setBody(ETypes, isPacked);
342 Context.pImpl->AnonStructTypes.insert(ST);
350 void StructType::setBody(ArrayRef<Type*> Elements, bool isPacked) {
351 assert(isOpaque() && "Struct body already set!");
353 setSubclassData(getSubclassData() | SCDB_HasBody);
355 setSubclassData(getSubclassData() | SCDB_Packed);
357 NumContainedTys = Elements.size();
359 if (Elements.empty()) {
360 ContainedTys = nullptr;
364 ContainedTys = Elements.copy(getContext().pImpl->TypeAllocator).data();
367 void StructType::setName(StringRef Name) {
368 if (Name == getName()) return;
370 StringMap<StructType *> &SymbolTable = getContext().pImpl->NamedStructTypes;
371 typedef StringMap<StructType *>::MapEntryTy EntryTy;
373 // If this struct already had a name, remove its symbol table entry. Don't
374 // delete the data yet because it may be part of the new name.
375 if (SymbolTableEntry)
376 SymbolTable.remove((EntryTy *)SymbolTableEntry);
378 // If this is just removing the name, we're done.
380 if (SymbolTableEntry) {
381 // Delete the old string data.
382 ((EntryTy *)SymbolTableEntry)->Destroy(SymbolTable.getAllocator());
383 SymbolTableEntry = nullptr;
388 // Look up the entry for the name.
390 getContext().pImpl->NamedStructTypes.insert(std::make_pair(Name, this));
392 // While we have a name collision, try a random rename.
393 if (!IterBool.second) {
394 SmallString<64> TempStr(Name);
395 TempStr.push_back('.');
396 raw_svector_ostream TmpStream(TempStr);
397 unsigned NameSize = Name.size();
400 TempStr.resize(NameSize + 1);
401 TmpStream << getContext().pImpl->NamedStructTypesUniqueID++;
403 IterBool = getContext().pImpl->NamedStructTypes.insert(
404 std::make_pair(TmpStream.str(), this));
405 } while (!IterBool.second);
408 // Delete the old string data.
409 if (SymbolTableEntry)
410 ((EntryTy *)SymbolTableEntry)->Destroy(SymbolTable.getAllocator());
411 SymbolTableEntry = &*IterBool.first;
414 //===----------------------------------------------------------------------===//
415 // StructType Helper functions.
417 StructType *StructType::create(LLVMContext &Context, StringRef Name) {
418 StructType *ST = new (Context.pImpl->TypeAllocator) StructType(Context);
424 StructType *StructType::get(LLVMContext &Context, bool isPacked) {
425 return get(Context, None, isPacked);
428 StructType *StructType::get(Type *type, ...) {
429 assert(type && "Cannot create a struct type with no elements with this");
430 LLVMContext &Ctx = type->getContext();
432 SmallVector<llvm::Type*, 8> StructFields;
435 StructFields.push_back(type);
436 type = va_arg(ap, llvm::Type*);
438 auto *Ret = llvm::StructType::get(Ctx, StructFields);
443 StructType *StructType::create(LLVMContext &Context, ArrayRef<Type*> Elements,
444 StringRef Name, bool isPacked) {
445 StructType *ST = create(Context, Name);
446 ST->setBody(Elements, isPacked);
450 StructType *StructType::create(LLVMContext &Context, ArrayRef<Type*> Elements) {
451 return create(Context, Elements, StringRef());
454 StructType *StructType::create(LLVMContext &Context) {
455 return create(Context, StringRef());
458 StructType *StructType::create(ArrayRef<Type*> Elements, StringRef Name,
460 assert(!Elements.empty() &&
461 "This method may not be invoked with an empty list");
462 return create(Elements[0]->getContext(), Elements, Name, isPacked);
465 StructType *StructType::create(ArrayRef<Type*> Elements) {
466 assert(!Elements.empty() &&
467 "This method may not be invoked with an empty list");
468 return create(Elements[0]->getContext(), Elements, StringRef());
471 StructType *StructType::create(StringRef Name, Type *type, ...) {
472 assert(type && "Cannot create a struct type with no elements with this");
473 LLVMContext &Ctx = type->getContext();
475 SmallVector<llvm::Type*, 8> StructFields;
478 StructFields.push_back(type);
479 type = va_arg(ap, llvm::Type*);
481 auto *Ret = llvm::StructType::create(Ctx, StructFields, Name);
486 bool StructType::isSized(SmallPtrSetImpl<Type*> *Visited) const {
487 if ((getSubclassData() & SCDB_IsSized) != 0)
492 if (Visited && !Visited->insert(const_cast<StructType*>(this)).second)
495 // Okay, our struct is sized if all of the elements are, but if one of the
496 // elements is opaque, the struct isn't sized *yet*, but may become sized in
497 // the future, so just bail out without caching.
498 for (element_iterator I = element_begin(), E = element_end(); I != E; ++I)
499 if (!(*I)->isSized(Visited))
502 // Here we cheat a bit and cast away const-ness. The goal is to memoize when
503 // we find a sized type, as types can only move from opaque to sized, not the
505 const_cast<StructType*>(this)->setSubclassData(
506 getSubclassData() | SCDB_IsSized);
510 StringRef StructType::getName() const {
511 assert(!isLiteral() && "Literal structs never have names");
512 if (!SymbolTableEntry) return StringRef();
514 return ((StringMapEntry<StructType*> *)SymbolTableEntry)->getKey();
517 void StructType::setBody(Type *type, ...) {
518 assert(type && "Cannot create a struct type with no elements with this");
520 SmallVector<llvm::Type*, 8> StructFields;
523 StructFields.push_back(type);
524 type = va_arg(ap, llvm::Type*);
526 setBody(StructFields);
530 bool StructType::isValidElementType(Type *ElemTy) {
531 return !ElemTy->isVoidTy() && !ElemTy->isLabelTy() &&
532 !ElemTy->isMetadataTy() && !ElemTy->isFunctionTy() &&
533 !ElemTy->isTokenTy();
536 bool StructType::isLayoutIdentical(StructType *Other) const {
537 if (this == Other) return true;
539 if (isPacked() != Other->isPacked())
542 return elements() == Other->elements();
545 StructType *Module::getTypeByName(StringRef Name) const {
546 return getContext().pImpl->NamedStructTypes.lookup(Name);
550 //===----------------------------------------------------------------------===//
551 // CompositeType Implementation
552 //===----------------------------------------------------------------------===//
554 Type *CompositeType::getTypeAtIndex(const Value *V) const {
555 if (auto *STy = dyn_cast<StructType>(this)) {
557 (unsigned)cast<Constant>(V)->getUniqueInteger().getZExtValue();
558 assert(indexValid(Idx) && "Invalid structure index!");
559 return STy->getElementType(Idx);
562 return cast<SequentialType>(this)->getElementType();
565 Type *CompositeType::getTypeAtIndex(unsigned Idx) const{
566 if (auto *STy = dyn_cast<StructType>(this)) {
567 assert(indexValid(Idx) && "Invalid structure index!");
568 return STy->getElementType(Idx);
571 return cast<SequentialType>(this)->getElementType();
574 bool CompositeType::indexValid(const Value *V) const {
575 if (auto *STy = dyn_cast<StructType>(this)) {
576 // Structure indexes require (vectors of) 32-bit integer constants. In the
577 // vector case all of the indices must be equal.
578 if (!V->getType()->getScalarType()->isIntegerTy(32))
580 const Constant *C = dyn_cast<Constant>(V);
581 if (C && V->getType()->isVectorTy())
582 C = C->getSplatValue();
583 const ConstantInt *CU = dyn_cast_or_null<ConstantInt>(C);
584 return CU && CU->getZExtValue() < STy->getNumElements();
587 // Sequential types can be indexed by any integer.
588 return V->getType()->isIntOrIntVectorTy();
591 bool CompositeType::indexValid(unsigned Idx) const {
592 if (auto *STy = dyn_cast<StructType>(this))
593 return Idx < STy->getNumElements();
594 // Sequential types can be indexed by any integer.
599 //===----------------------------------------------------------------------===//
600 // ArrayType Implementation
601 //===----------------------------------------------------------------------===//
603 ArrayType::ArrayType(Type *ElType, uint64_t NumEl)
604 : SequentialType(ArrayTyID, ElType) {
608 ArrayType *ArrayType::get(Type *ElementType, uint64_t NumElements) {
609 assert(isValidElementType(ElementType) && "Invalid type for array element!");
611 LLVMContextImpl *pImpl = ElementType->getContext().pImpl;
613 pImpl->ArrayTypes[std::make_pair(ElementType, NumElements)];
616 Entry = new (pImpl->TypeAllocator) ArrayType(ElementType, NumElements);
620 bool ArrayType::isValidElementType(Type *ElemTy) {
621 return !ElemTy->isVoidTy() && !ElemTy->isLabelTy() &&
622 !ElemTy->isMetadataTy() && !ElemTy->isFunctionTy() &&
623 !ElemTy->isTokenTy();
626 //===----------------------------------------------------------------------===//
627 // VectorType Implementation
628 //===----------------------------------------------------------------------===//
630 VectorType::VectorType(Type *ElType, unsigned NumEl)
631 : SequentialType(VectorTyID, ElType) {
635 VectorType *VectorType::get(Type *ElementType, unsigned NumElements) {
636 assert(NumElements > 0 && "#Elements of a VectorType must be greater than 0");
637 assert(isValidElementType(ElementType) && "Element type of a VectorType must "
638 "be an integer, floating point, or "
641 LLVMContextImpl *pImpl = ElementType->getContext().pImpl;
642 VectorType *&Entry = ElementType->getContext().pImpl
643 ->VectorTypes[std::make_pair(ElementType, NumElements)];
646 Entry = new (pImpl->TypeAllocator) VectorType(ElementType, NumElements);
650 bool VectorType::isValidElementType(Type *ElemTy) {
651 return ElemTy->isIntegerTy() || ElemTy->isFloatingPointTy() ||
652 ElemTy->isPointerTy();
655 //===----------------------------------------------------------------------===//
656 // PointerType Implementation
657 //===----------------------------------------------------------------------===//
659 PointerType *PointerType::get(Type *EltTy, unsigned AddressSpace) {
660 assert(EltTy && "Can't get a pointer to <null> type!");
661 assert(isValidElementType(EltTy) && "Invalid type for pointer element!");
663 LLVMContextImpl *CImpl = EltTy->getContext().pImpl;
665 // Since AddressSpace #0 is the common case, we special case it.
666 PointerType *&Entry = AddressSpace == 0 ? CImpl->PointerTypes[EltTy]
667 : CImpl->ASPointerTypes[std::make_pair(EltTy, AddressSpace)];
670 Entry = new (CImpl->TypeAllocator) PointerType(EltTy, AddressSpace);
675 PointerType::PointerType(Type *E, unsigned AddrSpace)
676 : SequentialType(PointerTyID, E) {
678 const unsigned oldNCT = NumContainedTys;
680 setSubclassData(AddrSpace);
681 // Check for miscompile. PR11652.
682 assert(oldNCT == NumContainedTys && "bitfield written out of bounds?");
685 PointerType *Type::getPointerTo(unsigned addrs) const {
686 return PointerType::get(const_cast<Type*>(this), addrs);
689 bool PointerType::isValidElementType(Type *ElemTy) {
690 return !ElemTy->isVoidTy() && !ElemTy->isLabelTy() &&
691 !ElemTy->isMetadataTy() && !ElemTy->isTokenTy();
694 bool PointerType::isLoadableOrStorableType(Type *ElemTy) {
695 return isValidElementType(ElemTy) && !ElemTy->isFunctionTy();