LLVM  13.0.0git
Type.cpp
Go to the documentation of this file.
1 //===- Type.cpp - Implement the Type class --------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the Type class for the IR library.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "llvm/IR/Type.h"
14 #include "LLVMContextImpl.h"
15 #include "llvm/ADT/APInt.h"
16 #include "llvm/ADT/None.h"
17 #include "llvm/ADT/SmallString.h"
18 #include "llvm/ADT/StringMap.h"
19 #include "llvm/ADT/StringRef.h"
20 #include "llvm/IR/Constant.h"
21 #include "llvm/IR/Constants.h"
22 #include "llvm/IR/DerivedTypes.h"
23 #include "llvm/IR/LLVMContext.h"
24 #include "llvm/IR/Module.h"
25 #include "llvm/IR/Value.h"
26 #include "llvm/Support/Casting.h"
29 #include "llvm/Support/TypeSize.h"
30 #include <cassert>
31 #include <utility>
32 
33 using namespace llvm;
34 
35 //===----------------------------------------------------------------------===//
36 // Type Class Implementation
37 //===----------------------------------------------------------------------===//
38 
40  switch (IDNumber) {
41  case VoidTyID : return getVoidTy(C);
42  case HalfTyID : return getHalfTy(C);
43  case BFloatTyID : return getBFloatTy(C);
44  case FloatTyID : return getFloatTy(C);
45  case DoubleTyID : return getDoubleTy(C);
46  case X86_FP80TyID : return getX86_FP80Ty(C);
47  case FP128TyID : return getFP128Ty(C);
48  case PPC_FP128TyID : return getPPC_FP128Ty(C);
49  case LabelTyID : return getLabelTy(C);
50  case MetadataTyID : return getMetadataTy(C);
51  case X86_MMXTyID : return getX86_MMXTy(C);
52  case X86_AMXTyID : return getX86_AMXTy(C);
53  case TokenTyID : return getTokenTy(C);
54  default:
55  return nullptr;
56  }
57 }
58 
59 bool Type::isIntegerTy(unsigned Bitwidth) const {
60  return isIntegerTy() && cast<IntegerType>(this)->getBitWidth() == Bitwidth;
61 }
62 
64  // Identity cast means no change so return true
65  if (this == Ty)
66  return true;
67 
68  // They are not convertible unless they are at least first class types
69  if (!this->isFirstClassType() || !Ty->isFirstClassType())
70  return false;
71 
72  // Vector -> Vector conversions are always lossless if the two vector types
73  // have the same size, otherwise not.
74  if (isa<VectorType>(this) && isa<VectorType>(Ty))
76 
77  // 64-bit fixed width vector types can be losslessly converted to x86mmx.
78  if (((isa<FixedVectorType>(this)) && Ty->isX86_MMXTy()) &&
79  getPrimitiveSizeInBits().getFixedSize() == 64)
80  return true;
81  if ((isX86_MMXTy() && isa<FixedVectorType>(Ty)) &&
83  return true;
84 
85  // 8192-bit fixed width vector types can be losslessly converted to x86amx.
86  if (((isa<FixedVectorType>(this)) && Ty->isX86_AMXTy()) &&
87  getPrimitiveSizeInBits().getFixedSize() == 8192)
88  return true;
89  if ((isX86_AMXTy() && isa<FixedVectorType>(Ty)) &&
90  Ty->getPrimitiveSizeInBits().getFixedSize() == 8192)
91  return true;
92 
93  // At this point we have only various mismatches of the first class types
94  // remaining and ptr->ptr. Just select the lossless conversions. Everything
95  // else is not lossless. Conservatively assume we can't losslessly convert
96  // between pointers with different address spaces.
97  if (auto *PTy = dyn_cast<PointerType>(this)) {
98  if (auto *OtherPTy = dyn_cast<PointerType>(Ty))
99  return PTy->getAddressSpace() == OtherPTy->getAddressSpace();
100  return false;
101  }
102  return false; // Other types have no identity values
103 }
104 
105 bool Type::isEmptyTy() const {
106  if (auto *ATy = dyn_cast<ArrayType>(this)) {
107  unsigned NumElements = ATy->getNumElements();
108  return NumElements == 0 || ATy->getElementType()->isEmptyTy();
109  }
110 
111  if (auto *STy = dyn_cast<StructType>(this)) {
112  unsigned NumElements = STy->getNumElements();
113  for (unsigned i = 0; i < NumElements; ++i)
114  if (!STy->getElementType(i)->isEmptyTy())
115  return false;
116  return true;
117  }
118 
119  return false;
120 }
121 
123  switch (getTypeID()) {
124  case Type::HalfTyID: return TypeSize::Fixed(16);
125  case Type::BFloatTyID: return TypeSize::Fixed(16);
126  case Type::FloatTyID: return TypeSize::Fixed(32);
127  case Type::DoubleTyID: return TypeSize::Fixed(64);
128  case Type::X86_FP80TyID: return TypeSize::Fixed(80);
129  case Type::FP128TyID: return TypeSize::Fixed(128);
130  case Type::PPC_FP128TyID: return TypeSize::Fixed(128);
131  case Type::X86_MMXTyID: return TypeSize::Fixed(64);
132  case Type::X86_AMXTyID: return TypeSize::Fixed(8192);
133  case Type::IntegerTyID:
134  return TypeSize::Fixed(cast<IntegerType>(this)->getBitWidth());
137  const VectorType *VTy = cast<VectorType>(this);
138  ElementCount EC = VTy->getElementCount();
140  assert(!ETS.isScalable() && "Vector type should have fixed-width elements");
141  return {ETS.getFixedSize() * EC.getKnownMinValue(), EC.isScalable()};
142  }
143  default: return TypeSize::Fixed(0);
144  }
145 }
146 
147 unsigned Type::getScalarSizeInBits() const {
148  // It is safe to assume that the scalar types have a fixed size.
150 }
151 
153  if (auto *VTy = dyn_cast<VectorType>(this))
154  return VTy->getElementType()->getFPMantissaWidth();
155  assert(isFloatingPointTy() && "Not a floating point type!");
156  if (getTypeID() == HalfTyID) return 11;
157  if (getTypeID() == BFloatTyID) return 8;
158  if (getTypeID() == FloatTyID) return 24;
159  if (getTypeID() == DoubleTyID) return 53;
160  if (getTypeID() == X86_FP80TyID) return 64;
161  if (getTypeID() == FP128TyID) return 113;
162  assert(getTypeID() == PPC_FP128TyID && "unknown fp type");
163  return -1;
164 }
165 
166 bool Type::isSizedDerivedType(SmallPtrSetImpl<Type*> *Visited) const {
167  if (auto *ATy = dyn_cast<ArrayType>(this))
168  return ATy->getElementType()->isSized(Visited);
169 
170  if (auto *VTy = dyn_cast<VectorType>(this))
171  return VTy->getElementType()->isSized(Visited);
172 
173  return cast<StructType>(this)->isSized(Visited);
174 }
175 
176 //===----------------------------------------------------------------------===//
177 // Primitive 'Type' data
178 //===----------------------------------------------------------------------===//
179 
180 Type *Type::getVoidTy(LLVMContext &C) { return &C.pImpl->VoidTy; }
181 Type *Type::getLabelTy(LLVMContext &C) { return &C.pImpl->LabelTy; }
182 Type *Type::getHalfTy(LLVMContext &C) { return &C.pImpl->HalfTy; }
183 Type *Type::getBFloatTy(LLVMContext &C) { return &C.pImpl->BFloatTy; }
184 Type *Type::getFloatTy(LLVMContext &C) { return &C.pImpl->FloatTy; }
185 Type *Type::getDoubleTy(LLVMContext &C) { return &C.pImpl->DoubleTy; }
186 Type *Type::getMetadataTy(LLVMContext &C) { return &C.pImpl->MetadataTy; }
187 Type *Type::getTokenTy(LLVMContext &C) { return &C.pImpl->TokenTy; }
188 Type *Type::getX86_FP80Ty(LLVMContext &C) { return &C.pImpl->X86_FP80Ty; }
189 Type *Type::getFP128Ty(LLVMContext &C) { return &C.pImpl->FP128Ty; }
190 Type *Type::getPPC_FP128Ty(LLVMContext &C) { return &C.pImpl->PPC_FP128Ty; }
191 Type *Type::getX86_MMXTy(LLVMContext &C) { return &C.pImpl->X86_MMXTy; }
192 Type *Type::getX86_AMXTy(LLVMContext &C) { return &C.pImpl->X86_AMXTy; }
193 
194 IntegerType *Type::getInt1Ty(LLVMContext &C) { return &C.pImpl->Int1Ty; }
195 IntegerType *Type::getInt8Ty(LLVMContext &C) { return &C.pImpl->Int8Ty; }
196 IntegerType *Type::getInt16Ty(LLVMContext &C) { return &C.pImpl->Int16Ty; }
197 IntegerType *Type::getInt32Ty(LLVMContext &C) { return &C.pImpl->Int32Ty; }
198 IntegerType *Type::getInt64Ty(LLVMContext &C) { return &C.pImpl->Int64Ty; }
199 IntegerType *Type::getInt128Ty(LLVMContext &C) { return &C.pImpl->Int128Ty; }
200 
202  return IntegerType::get(C, N);
203 }
204 
206  return getHalfTy(C)->getPointerTo(AS);
207 }
208 
210  return getBFloatTy(C)->getPointerTo(AS);
211 }
212 
214  return getFloatTy(C)->getPointerTo(AS);
215 }
216 
218  return getDoubleTy(C)->getPointerTo(AS);
219 }
220 
222  return getX86_FP80Ty(C)->getPointerTo(AS);
223 }
224 
226  return getFP128Ty(C)->getPointerTo(AS);
227 }
228 
230  return getPPC_FP128Ty(C)->getPointerTo(AS);
231 }
232 
234  return getX86_MMXTy(C)->getPointerTo(AS);
235 }
236 
238  return getX86_AMXTy(C)->getPointerTo(AS);
239 }
240 
241 PointerType *Type::getIntNPtrTy(LLVMContext &C, unsigned N, unsigned AS) {
242  return getIntNTy(C, N)->getPointerTo(AS);
243 }
244 
246  return getInt1Ty(C)->getPointerTo(AS);
247 }
248 
250  return getInt8Ty(C)->getPointerTo(AS);
251 }
252 
254  return getInt16Ty(C)->getPointerTo(AS);
255 }
256 
258  return getInt32Ty(C)->getPointerTo(AS);
259 }
260 
262  return getInt64Ty(C)->getPointerTo(AS);
263 }
264 
265 //===----------------------------------------------------------------------===//
266 // IntegerType Implementation
267 //===----------------------------------------------------------------------===//
268 
270  assert(NumBits >= MIN_INT_BITS && "bitwidth too small");
271  assert(NumBits <= MAX_INT_BITS && "bitwidth too large");
272 
273  // Check for the built-in integer types
274  switch (NumBits) {
275  case 1: return cast<IntegerType>(Type::getInt1Ty(C));
276  case 8: return cast<IntegerType>(Type::getInt8Ty(C));
277  case 16: return cast<IntegerType>(Type::getInt16Ty(C));
278  case 32: return cast<IntegerType>(Type::getInt32Ty(C));
279  case 64: return cast<IntegerType>(Type::getInt64Ty(C));
280  case 128: return cast<IntegerType>(Type::getInt128Ty(C));
281  default:
282  break;
283  }
284 
285  IntegerType *&Entry = C.pImpl->IntegerTypes[NumBits];
286 
287  if (!Entry)
288  Entry = new (C.pImpl->Alloc) IntegerType(C, NumBits);
289 
290  return Entry;
291 }
292 
295 }
296 
297 //===----------------------------------------------------------------------===//
298 // FunctionType Implementation
299 //===----------------------------------------------------------------------===//
300 
301 FunctionType::FunctionType(Type *Result, ArrayRef<Type*> Params,
302  bool IsVarArgs)
303  : Type(Result->getContext(), FunctionTyID) {
304  Type **SubTys = reinterpret_cast<Type**>(this+1);
305  assert(isValidReturnType(Result) && "invalid return type for function");
306  setSubclassData(IsVarArgs);
307 
308  SubTys[0] = Result;
309 
310  for (unsigned i = 0, e = Params.size(); i != e; ++i) {
311  assert(isValidArgumentType(Params[i]) &&
312  "Not a valid type for function argument!");
313  SubTys[i+1] = Params[i];
314  }
315 
316  ContainedTys = SubTys;
317  NumContainedTys = Params.size() + 1; // + 1 for result type
318 }
319 
320 // This is the factory function for the FunctionType class.
322  ArrayRef<Type*> Params, bool isVarArg) {
323  LLVMContextImpl *pImpl = ReturnType->getContext().pImpl;
325  FunctionType *FT;
326  // Since we only want to allocate a fresh function type in case none is found
327  // and we don't want to perform two lookups (one for checking if existent and
328  // one for inserting the newly allocated one), here we instead lookup based on
329  // Key and update the reference to the function type in-place to a newly
330  // allocated one if not found.
331  auto Insertion = pImpl->FunctionTypes.insert_as(nullptr, Key);
332  if (Insertion.second) {
333  // The function type was not found. Allocate one and update FunctionTypes
334  // in-place.
335  FT = (FunctionType *)pImpl->Alloc.Allocate(
336  sizeof(FunctionType) + sizeof(Type *) * (Params.size() + 1),
337  alignof(FunctionType));
338  new (FT) FunctionType(ReturnType, Params, isVarArg);
339  *Insertion.first = FT;
340  } else {
341  // The function type was found. Just return it.
342  FT = *Insertion.first;
343  }
344  return FT;
345 }
346 
347 FunctionType *FunctionType::get(Type *Result, bool isVarArg) {
348  return get(Result, None, isVarArg);
349 }
350 
352  return !RetTy->isFunctionTy() && !RetTy->isLabelTy() &&
353  !RetTy->isMetadataTy();
354 }
355 
357  return ArgTy->isFirstClassType();
358 }
359 
360 //===----------------------------------------------------------------------===//
361 // StructType Implementation
362 //===----------------------------------------------------------------------===//
363 
364 // Primitive Constructors.
365 
367  bool isPacked) {
368  LLVMContextImpl *pImpl = Context.pImpl;
370 
371  StructType *ST;
372  // Since we only want to allocate a fresh struct type in case none is found
373  // and we don't want to perform two lookups (one for checking if existent and
374  // one for inserting the newly allocated one), here we instead lookup based on
375  // Key and update the reference to the struct type in-place to a newly
376  // allocated one if not found.
377  auto Insertion = pImpl->AnonStructTypes.insert_as(nullptr, Key);
378  if (Insertion.second) {
379  // The struct type was not found. Allocate one and update AnonStructTypes
380  // in-place.
382  ST->setSubclassData(SCDB_IsLiteral); // Literal struct.
383  ST->setBody(ETypes, isPacked);
384  *Insertion.first = ST;
385  } else {
386  // The struct type was found. Just return it.
387  ST = *Insertion.first;
388  }
389 
390  return ST;
391 }
392 
394  for (Type *Ty : elements()) {
395  if (isa<ScalableVectorType>(Ty))
396  return true;
397  if (auto *STy = dyn_cast<StructType>(Ty))
398  if (STy->containsScalableVectorType())
399  return true;
400  }
401 
402  return false;
403 }
404 
405 void StructType::setBody(ArrayRef<Type*> Elements, bool isPacked) {
406  assert(isOpaque() && "Struct body already set!");
407 
408  setSubclassData(getSubclassData() | SCDB_HasBody);
409  if (isPacked)
410  setSubclassData(getSubclassData() | SCDB_Packed);
411 
412  NumContainedTys = Elements.size();
413 
414  if (Elements.empty()) {
415  ContainedTys = nullptr;
416  return;
417  }
418 
419  ContainedTys = Elements.copy(getContext().pImpl->Alloc).data();
420 }
421 
423  if (Name == getName()) return;
424 
426 
427  using EntryTy = StringMap<StructType *>::MapEntryTy;
428 
429  // If this struct already had a name, remove its symbol table entry. Don't
430  // delete the data yet because it may be part of the new name.
431  if (SymbolTableEntry)
432  SymbolTable.remove((EntryTy *)SymbolTableEntry);
433 
434  // If this is just removing the name, we're done.
435  if (Name.empty()) {
436  if (SymbolTableEntry) {
437  // Delete the old string data.
438  ((EntryTy *)SymbolTableEntry)->Destroy(SymbolTable.getAllocator());
439  SymbolTableEntry = nullptr;
440  }
441  return;
442  }
443 
444  // Look up the entry for the name.
445  auto IterBool =
446  getContext().pImpl->NamedStructTypes.insert(std::make_pair(Name, this));
447 
448  // While we have a name collision, try a random rename.
449  if (!IterBool.second) {
450  SmallString<64> TempStr(Name);
451  TempStr.push_back('.');
452  raw_svector_ostream TmpStream(TempStr);
453  unsigned NameSize = Name.size();
454 
455  do {
456  TempStr.resize(NameSize + 1);
457  TmpStream << getContext().pImpl->NamedStructTypesUniqueID++;
458 
459  IterBool = getContext().pImpl->NamedStructTypes.insert(
460  std::make_pair(TmpStream.str(), this));
461  } while (!IterBool.second);
462  }
463 
464  // Delete the old string data.
465  if (SymbolTableEntry)
466  ((EntryTy *)SymbolTableEntry)->Destroy(SymbolTable.getAllocator());
467  SymbolTableEntry = &*IterBool.first;
468 }
469 
470 //===----------------------------------------------------------------------===//
471 // StructType Helper functions.
472 
475  if (!Name.empty())
476  ST->setName(Name);
477  return ST;
478 }
479 
481  return get(Context, None, isPacked);
482 }
483 
485  StringRef Name, bool isPacked) {
487  ST->setBody(Elements, isPacked);
488  return ST;
489 }
490 
492  return create(Context, Elements, StringRef());
493 }
494 
496  return create(Context, StringRef());
497 }
498 
500  bool isPacked) {
501  assert(!Elements.empty() &&
502  "This method may not be invoked with an empty list");
503  return create(Elements[0]->getContext(), Elements, Name, isPacked);
504 }
505 
507  assert(!Elements.empty() &&
508  "This method may not be invoked with an empty list");
509  return create(Elements[0]->getContext(), Elements, StringRef());
510 }
511 
513  if ((getSubclassData() & SCDB_IsSized) != 0)
514  return true;
515  if (isOpaque())
516  return false;
517 
518  if (Visited && !Visited->insert(const_cast<StructType*>(this)).second)
519  return false;
520 
521  // Okay, our struct is sized if all of the elements are, but if one of the
522  // elements is opaque, the struct isn't sized *yet*, but may become sized in
523  // the future, so just bail out without caching.
524  for (Type *Ty : elements()) {
525  // If the struct contains a scalable vector type, don't consider it sized.
526  // This prevents it from being used in loads/stores/allocas/GEPs.
527  if (isa<ScalableVectorType>(Ty))
528  return false;
529  if (!Ty->isSized(Visited))
530  return false;
531  }
532 
533  // Here we cheat a bit and cast away const-ness. The goal is to memoize when
534  // we find a sized type, as types can only move from opaque to sized, not the
535  // other way.
536  const_cast<StructType*>(this)->setSubclassData(
537  getSubclassData() | SCDB_IsSized);
538  return true;
539 }
540 
542  assert(!isLiteral() && "Literal structs never have names");
543  if (!SymbolTableEntry) return StringRef();
544 
545  return ((StringMapEntry<StructType*> *)SymbolTableEntry)->getKey();
546 }
547 
549  return !ElemTy->isVoidTy() && !ElemTy->isLabelTy() &&
550  !ElemTy->isMetadataTy() && !ElemTy->isFunctionTy() &&
551  !ElemTy->isTokenTy();
552 }
553 
555  if (this == Other) return true;
556 
557  if (isPacked() != Other->isPacked())
558  return false;
559 
560  return elements() == Other->elements();
561 }
562 
564  unsigned Idx = (unsigned)cast<Constant>(V)->getUniqueInteger().getZExtValue();
565  assert(indexValid(Idx) && "Invalid structure index!");
566  return getElementType(Idx);
567 }
568 
569 bool StructType::indexValid(const Value *V) const {
570  // Structure indexes require (vectors of) 32-bit integer constants. In the
571  // vector case all of the indices must be equal.
572  if (!V->getType()->isIntOrIntVectorTy(32))
573  return false;
574  if (isa<ScalableVectorType>(V->getType()))
575  return false;
576  const Constant *C = dyn_cast<Constant>(V);
577  if (C && V->getType()->isVectorTy())
578  C = C->getSplatValue();
579  const ConstantInt *CU = dyn_cast_or_null<ConstantInt>(C);
580  return CU && CU->getZExtValue() < getNumElements();
581 }
582 
584  return C.pImpl->NamedStructTypes.lookup(Name);
585 }
586 
587 //===----------------------------------------------------------------------===//
588 // ArrayType Implementation
589 //===----------------------------------------------------------------------===//
590 
591 ArrayType::ArrayType(Type *ElType, uint64_t NumEl)
592  : Type(ElType->getContext(), ArrayTyID), ContainedType(ElType),
593  NumElements(NumEl) {
594  ContainedTys = &ContainedType;
595  NumContainedTys = 1;
596 }
597 
598 ArrayType *ArrayType::get(Type *ElementType, uint64_t NumElements) {
599  assert(isValidElementType(ElementType) && "Invalid type for array element!");
600 
601  LLVMContextImpl *pImpl = ElementType->getContext().pImpl;
602  ArrayType *&Entry =
603  pImpl->ArrayTypes[std::make_pair(ElementType, NumElements)];
604 
605  if (!Entry)
606  Entry = new (pImpl->Alloc) ArrayType(ElementType, NumElements);
607  return Entry;
608 }
609 
611  return !ElemTy->isVoidTy() && !ElemTy->isLabelTy() &&
612  !ElemTy->isMetadataTy() && !ElemTy->isFunctionTy() &&
613  !ElemTy->isTokenTy() && !ElemTy->isX86_AMXTy() &&
614  !isa<ScalableVectorType>(ElemTy);
615 }
616 
617 //===----------------------------------------------------------------------===//
618 // VectorType Implementation
619 //===----------------------------------------------------------------------===//
620 
622  : Type(ElType->getContext(), TID), ContainedType(ElType),
623  ElementQuantity(EQ) {
624  ContainedTys = &ContainedType;
625  NumContainedTys = 1;
626 }
627 
629  if (EC.isScalable())
630  return ScalableVectorType::get(ElementType, EC.getKnownMinValue());
631  else
632  return FixedVectorType::get(ElementType, EC.getKnownMinValue());
633 }
634 
636  return ElemTy->isIntegerTy() || ElemTy->isFloatingPointTy() ||
637  ElemTy->isPointerTy();
638 }
639 
640 //===----------------------------------------------------------------------===//
641 // FixedVectorType Implementation
642 //===----------------------------------------------------------------------===//
643 
644 FixedVectorType *FixedVectorType::get(Type *ElementType, unsigned NumElts) {
645  assert(NumElts > 0 && "#Elements of a VectorType must be greater than 0");
646  assert(isValidElementType(ElementType) && "Element type of a VectorType must "
647  "be an integer, floating point, or "
648  "pointer type.");
649 
650  auto EC = ElementCount::getFixed(NumElts);
651 
652  LLVMContextImpl *pImpl = ElementType->getContext().pImpl;
653  VectorType *&Entry = ElementType->getContext()
654  .pImpl->VectorTypes[std::make_pair(ElementType, EC)];
655 
656  if (!Entry)
657  Entry = new (pImpl->Alloc) FixedVectorType(ElementType, NumElts);
658  return cast<FixedVectorType>(Entry);
659 }
660 
661 //===----------------------------------------------------------------------===//
662 // ScalableVectorType Implementation
663 //===----------------------------------------------------------------------===//
664 
666  unsigned MinNumElts) {
667  assert(MinNumElts > 0 && "#Elements of a VectorType must be greater than 0");
668  assert(isValidElementType(ElementType) && "Element type of a VectorType must "
669  "be an integer, floating point, or "
670  "pointer type.");
671 
672  auto EC = ElementCount::getScalable(MinNumElts);
673 
674  LLVMContextImpl *pImpl = ElementType->getContext().pImpl;
675  VectorType *&Entry = ElementType->getContext()
676  .pImpl->VectorTypes[std::make_pair(ElementType, EC)];
677 
678  if (!Entry)
679  Entry = new (pImpl->Alloc) ScalableVectorType(ElementType, MinNumElts);
680  return cast<ScalableVectorType>(Entry);
681 }
682 
683 //===----------------------------------------------------------------------===//
684 // PointerType Implementation
685 //===----------------------------------------------------------------------===//
686 
688  assert(EltTy && "Can't get a pointer to <null> type!");
689  assert(isValidElementType(EltTy) && "Invalid type for pointer element!");
690 
691  LLVMContextImpl *CImpl = EltTy->getContext().pImpl;
692 
693  // Since AddressSpace #0 is the common case, we special case it.
694  PointerType *&Entry = AddressSpace == 0 ? CImpl->PointerTypes[EltTy]
695  : CImpl->ASPointerTypes[std::make_pair(EltTy, AddressSpace)];
696 
697  if (!Entry)
698  Entry = new (CImpl->Alloc) PointerType(EltTy, AddressSpace);
699  return Entry;
700 }
701 
702 PointerType::PointerType(Type *E, unsigned AddrSpace)
703  : Type(E->getContext(), PointerTyID), PointeeTy(E) {
704  ContainedTys = &PointeeTy;
705  NumContainedTys = 1;
706  setSubclassData(AddrSpace);
707 }
708 
709 PointerType *Type::getPointerTo(unsigned addrs) const {
710  return PointerType::get(const_cast<Type*>(this), addrs);
711 }
712 
714  return !ElemTy->isVoidTy() && !ElemTy->isLabelTy() &&
715  !ElemTy->isMetadataTy() && !ElemTy->isTokenTy() &&
716  !ElemTy->isX86_AMXTy();
717 }
718 
720  return isValidElementType(ElemTy) && !ElemTy->isFunctionTy();
721 }
i
i
Definition: README.txt:29
llvm::LLVMContextImpl::Alloc
BumpPtrAllocator Alloc
Definition: LLVMContextImpl.h:1434
llvm::LLVMContext::pImpl
LLVMContextImpl *const pImpl
Definition: LLVMContext.h:70
llvm::Type::FloatTyID
@ FloatTyID
32-bit floating point type
Definition: Type.h:59
llvm::ScalableVectorType
Class to represent scalable SIMD vectors.
Definition: DerivedTypes.h:574
MathExtras.h
llvm::Type::DoubleTyID
@ DoubleTyID
64-bit floating point type
Definition: Type.h:60
llvm
Definition: AllocatorList.h:23
llvm::PointerType::isValidElementType
static bool isValidElementType(Type *ElemTy)
Return true if the specified type is valid as a element type.
Definition: Type.cpp:713
llvm::Type::getInt16PtrTy
static PointerType * getInt16PtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:253
llvm::IntegerType::MIN_INT_BITS
@ MIN_INT_BITS
Minimum number of bits that can be specified.
Definition: DerivedTypes.h:51
llvm::Type::getInt1Ty
static IntegerType * getInt1Ty(LLVMContext &C)
Definition: Type.cpp:194
llvm::StringMapEntry
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
Definition: StringMapEntry.h:98
llvm::StructType::getName
StringRef getName() const
Return the name for this struct type if it has an identity.
Definition: Type.cpp:541
llvm::StructType::get
static StructType * get(LLVMContext &Context, ArrayRef< Type * > Elements, bool isPacked=false)
This static method is the primary way to create a literal StructType.
Definition: Type.cpp:366
llvm::Type::getInt8PtrTy
static PointerType * getInt8PtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:249
llvm::Type::isX86_MMXTy
bool isX86_MMXTy() const
Return true if this is X86 MMX.
Definition: Type.h:184
llvm::Type::getFP128Ty
static Type * getFP128Ty(LLVMContext &C)
Definition: Type.cpp:189
llvm::Type::isPointerTy
bool isPointerTy() const
True if this is an instance of PointerType.
Definition: Type.h:229
llvm::ElementCount
Definition: TypeSize.h:386
llvm::TypeSize::getFixedSize
ScalarTy getFixedSize() const
Definition: TypeSize.h:426
llvm::ArrayRef::copy
ArrayRef< T > copy(Allocator &A)
Definition: ArrayRef.h:178
llvm::Type::VoidTyID
@ VoidTyID
type with no size
Definition: Type.h:64
llvm::StringMap::remove
void remove(MapEntryTy *KeyValue)
remove - Remove the specified key/value pair from the map, but do not erase it.
Definition: StringMap.h:353
StringRef.h
llvm::COFF::NameSize
@ NameSize
Definition: COFF.h:58
llvm::PointerType::get
static PointerType * get(Type *ElementType, unsigned AddressSpace)
This constructs a pointer to an object of the specified type in a numbered address space.
Definition: Type.cpp:687
llvm::StructType::setBody
void setBody(ArrayRef< Type * > Elements, bool isPacked=false)
Specify a body for an opaque identified type.
Definition: Type.cpp:405
llvm::Type::getScalarType
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
Definition: Type.h:317
TypeSize.h
llvm::Type::X86_AMXTyID
@ X86_AMXTyID
AMX vectors (8192 bits, X86 specific)
Definition: Type.h:68
llvm::FunctionType::get
static FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
Definition: Type.cpp:321
llvm::Type::getSubclassData
unsigned getSubclassData() const
Definition: Type.h:97
llvm::Type::getTypeID
TypeID getTypeID() const
Return the type id for the type.
Definition: Type.h:136
APInt.h
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:46
Module.h
llvm::StructType::getTypeByName
static StructType * getTypeByName(LLVMContext &C, StringRef Name)
Return the type with the specified name, or null if there is none by that name.
Definition: Type.cpp:583
llvm::Type::getTokenTy
static Type * getTokenTy(LLVMContext &C)
Definition: Type.cpp:187
llvm::Type::getPrimitiveType
static Type * getPrimitiveType(LLVMContext &C, TypeID IDNumber)
Return a type based on an identifier.
Definition: Type.cpp:39
llvm::VectorType::getElementType
Type * getElementType() const
Definition: DerivedTypes.h:424
getBitWidth
static unsigned getBitWidth(Type *Ty, const DataLayout &DL)
Returns the bitwidth of the given scalar or pointer type.
Definition: ValueTracking.cpp:87
llvm::ArrayType
Class to represent array types.
Definition: DerivedTypes.h:359
llvm::StructType::create
static StructType * create(LLVMContext &Context, StringRef Name)
This creates an identified struct.
Definition: Type.cpp:473
llvm::ScalableVectorType::ScalableVectorType
ScalableVectorType(Type *ElTy, unsigned MinNumElts)
Definition: DerivedTypes.h:576
llvm::Type::isFloatingPointTy
bool isFloatingPointTy() const
Return true if this is one of the six floating-point types.
Definition: Type.h:163
llvm::FixedVectorType
Class to represent fixed width SIMD vectors.
Definition: DerivedTypes.h:527
llvm::Type::getInt32PtrTy
static PointerType * getInt32PtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:257
llvm::Type::isMetadataTy
bool isMetadataTy() const
Return true if this is 'metadata'.
Definition: Type.h:196
llvm::Type::getInt8Ty
static IntegerType * getInt8Ty(LLVMContext &C)
Definition: Type.cpp:195
llvm::LLVMContextImpl::AnonStructTypes
StructTypeSet AnonStructTypes
Definition: LLVMContextImpl.h:1442
llvm::LinearPolySize::isScalable
bool isScalable() const
Returns whether the size is scaled by a runtime quantity (vscale).
Definition: TypeSize.h:299
llvm::StructType::setName
void setName(StringRef Name)
Change the name of this type to the specified name, or to a name with a suffix if there is a collisio...
Definition: Type.cpp:422
llvm::Type::getInt32Ty
static IntegerType * getInt32Ty(LLVMContext &C)
Definition: Type.cpp:197
llvm::ArrayRef::empty
bool empty() const
empty - Check if the array is empty.
Definition: ArrayRef.h:158
llvm::FunctionType::isVarArg
bool isVarArg() const
Definition: DerivedTypes.h:122
llvm::Type::getBFloatPtrTy
static PointerType * getBFloatPtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:209
llvm::IntegerType::getMask
APInt getMask() const
For example, this is 0xFF for an 8 bit integer, 0xFFFF for i16, etc.
Definition: Type.cpp:293
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
llvm::ConstantInt
This is the shared class of boolean and integer constants.
Definition: Constants.h:77
llvm::Type::getMetadataTy
static Type * getMetadataTy(LLVMContext &C)
Definition: Type.cpp:186
llvm::Type::getFP128PtrTy
static PointerType * getFP128PtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:225
llvm::Type::MetadataTyID
@ MetadataTyID
Metadata.
Definition: Type.h:66
llvm::Type::getX86_AMXTy
static Type * getX86_AMXTy(LLVMContext &C)
Definition: Type.cpp:192
llvm::LLVMContextImpl::VectorTypes
DenseMap< std::pair< Type *, ElementCount >, VectorType * > VectorTypes
Definition: LLVMContextImpl.h:1447
llvm::LLVMContextImpl::NamedStructTypes
StringMap< StructType * > NamedStructTypes
Definition: LLVMContextImpl.h:1443
Constants.h
llvm::BumpPtrAllocatorImpl::Allocate
LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ATTRIBUTE_RETURNS_NOALIAS void * Allocate(size_t Size, Align Alignment)
Allocate space at the specified alignment.
Definition: Allocator.h:145
SmallString.h
llvm::Type::getPPC_FP128Ty
static Type * getPPC_FP128Ty(LLVMContext &C)
Definition: Type.cpp:190
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::FixedVectorType::FixedVectorType
FixedVectorType(Type *ElTy, unsigned NumElts)
Definition: DerivedTypes.h:529
llvm::StructType::isPacked
bool isPacked() const
Definition: DerivedTypes.h:274
llvm::Type::getDoubleTy
static Type * getDoubleTy(LLVMContext &C)
Definition: Type.cpp:185
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::LLVMContextImpl
Definition: LLVMContextImpl.h:1324
llvm::StructType::isSized
bool isSized(SmallPtrSetImpl< Type * > *Visited=nullptr) const
isSized - Return true if this is a sized type.
Definition: Type.cpp:512
EQ
#define EQ(a, b)
Definition: regexec.c:112
llvm::Type::getPPC_FP128PtrTy
static PointerType * getPPC_FP128PtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:229
llvm::AMDGPU::PALMD::Key
Key
PAL metadata keys.
Definition: AMDGPUMetadata.h:481
llvm::FunctionType::isValidReturnType
static bool isValidReturnType(Type *RetTy)
Return true if the specified type is valid as a return type.
Definition: Type.cpp:351
llvm::Type::isVectorTy
bool isVectorTy() const
True if this is an instance of VectorType.
Definition: Type.h:235
llvm::IntegerType::IntegerType
IntegerType(LLVMContext &C, unsigned NumBits)
Definition: DerivedTypes.h:44
llvm::VectorType::getElementCount
ElementCount getElementCount() const
Return an ElementCount instance to represent the (possibly scalable) number of elements in the vector...
Definition: DerivedTypes.h:629
llvm::TypeSize::Fixed
static TypeSize Fixed(ScalarTy MinVal)
Definition: TypeSize.h:423
llvm::IntegerType
Class to represent integer types.
Definition: DerivedTypes.h:40
llvm::Type::isTokenTy
bool isTokenTy() const
Return true if this is 'token'.
Definition: Type.h:199
llvm::Type::getScalarSizeInBits
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
Definition: Type.cpp:147
LLVMContextImpl.h
llvm::SmallVectorImpl::resize
void resize(size_type N)
Definition: SmallVector.h:606
StringMap.h
llvm::FixedVectorType::get
static FixedVectorType * get(Type *ElementType, unsigned NumElts)
Definition: Type.cpp:644
llvm::Type::getInt1PtrTy
static PointerType * getInt1PtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:245
llvm::Type::isFunctionTy
bool isFunctionTy() const
True if this is an instance of FunctionType.
Definition: Type.h:220
llvm::AddressSpace
AddressSpace
Definition: NVPTXBaseInfo.h:21
llvm::Type::BFloatTyID
@ BFloatTyID
16-bit floating point type (7-bit significand)
Definition: Type.h:58
llvm::None
const NoneType None
Definition: None.h:23
llvm::LinearPolySize< ElementCount >::getFixed
static ElementCount getFixed(ScalarTy MinVal)
Definition: TypeSize.h:284
Type.h
llvm::StringMap
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:108
llvm::SmallString< 64 >
llvm::Type::isIntegerTy
bool isIntegerTy() const
True if this is an instance of IntegerType.
Definition: Type.h:202
llvm::VectorType::isValidElementType
static bool isValidElementType(Type *ElemTy)
Return true if the specified type is valid as a element type.
Definition: Type.cpp:635
llvm::Type::getIntNPtrTy
static PointerType * getIntNPtrTy(LLVMContext &C, unsigned N, unsigned AS=0)
Definition: Type.cpp:241
llvm::VectorType
Base class of all SIMD vector types.
Definition: DerivedTypes.h:391
llvm::Type::getFPMantissaWidth
int getFPMantissaWidth() const
Return the width of the mantissa of this type.
Definition: Type.cpp:152
llvm::Constant
This is an important base class in LLVM.
Definition: Constant.h:41
llvm::detail::DenseSetImpl::insert_as
std::pair< iterator, bool > insert_as(const ValueT &V, const LookupKeyT &LookupKey)
Alternative version of insert that uses a different (and possibly less expensive) key type.
Definition: DenseSet.h:219
llvm::FunctionTypeKeyInfo::KeyTy
Definition: LLVMContextImpl.h:128
llvm::Type::X86_MMXTyID
@ X86_MMXTyID
MMX vectors (64 bits, X86 specific)
Definition: Type.h:67
llvm::ARM_MB::ST
@ ST
Definition: ARMBaseInfo.h:73
llvm::Type::getHalfPtrTy
static PointerType * getHalfPtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:205
llvm::StructType::isOpaque
bool isOpaque() const
Return true if this is a type with an identity that has no body specified yet.
Definition: DerivedTypes.h:282
llvm::IntegerType::MAX_INT_BITS
@ MAX_INT_BITS
Maximum number of bits that can be specified.
Definition: DerivedTypes.h:52
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:68
llvm::numbers::e
constexpr double e
Definition: MathExtras.h:57
llvm::LLVMContextImpl::NamedStructTypesUniqueID
unsigned NamedStructTypesUniqueID
Definition: LLVMContextImpl.h:1444
llvm::Type::getInt64PtrTy
static PointerType * getInt64PtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:261
llvm::LLVMContextImpl::ASPointerTypes
DenseMap< std::pair< Type *, unsigned >, PointerType * > ASPointerTypes
Definition: LLVMContextImpl.h:1449
llvm::FunctionType::isValidArgumentType
static bool isValidArgumentType(Type *ArgTy)
Return true if the specified type is valid as an argument type.
Definition: Type.cpp:356
llvm::PointerType
Class to represent pointers.
Definition: DerivedTypes.h:634
llvm::Type::getX86_MMXPtrTy
static PointerType * getX86_MMXPtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:233
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::LLVMContextImpl::ArrayTypes
DenseMap< std::pair< Type *, uint64_t >, ArrayType * > ArrayTypes
Definition: LLVMContextImpl.h:1446
llvm::Type::isVoidTy
bool isVoidTy() const
Return true if this is 'void'.
Definition: Type.h:139
llvm::StringMap::getAllocator
AllocatorTy & getAllocator()
Definition: StringMap.h:193
llvm::ArrayType::get
static ArrayType * get(Type *ElementType, uint64_t NumElements)
This static method is the primary way to construct an ArrayType.
Definition: Type.cpp:598
llvm::Type::getX86_FP80Ty
static Type * getX86_FP80Ty(LLVMContext &C)
Definition: Type.cpp:188
llvm::Type::getDoublePtrTy
static PointerType * getDoublePtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:217
llvm::ARM::WinEH::ReturnType
ReturnType
Definition: ARMWinEH.h:25
llvm::APInt
Class for arbitrary precision integers.
Definition: APInt.h:70
llvm::Type::FP128TyID
@ FP128TyID
128-bit floating point type (112-bit significand)
Definition: Type.h:62
llvm::Type::setSubclassData
void setSubclassData(unsigned val)
Definition: Type.h:99
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
None.h
llvm::APInt::getAllOnesValue
static APInt getAllOnesValue(unsigned numBits)
Get the all-ones value.
Definition: APInt.h:567
llvm::StructType
Class to represent struct types.
Definition: DerivedTypes.h:212
llvm::Type::PPC_FP128TyID
@ PPC_FP128TyID
128-bit floating point type (two 64-bits, PowerPC)
Definition: Type.h:63
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm::raw_svector_ostream::str
StringRef str() const
Return a StringRef for the vector contents.
Definition: raw_ostream.h:672
llvm::Value::getType
Type * getType() const
All values are typed, get the type of this value.
Definition: Value.h:256
llvm::StructType::indexValid
bool indexValid(const Value *V) const
Definition: Type.cpp:569
llvm::Type::isLabelTy
bool isLabelTy() const
Return true if this is 'label'.
Definition: Type.h:193
llvm::VectorType::VectorType
VectorType(Type *ElType, unsigned EQ, Type::TypeID TID)
Definition: Type.cpp:621
llvm::StructType::getTypeAtIndex
Type * getTypeAtIndex(const Value *V) const
Given an index value into the type, return the type of the element.
Definition: Type.cpp:563
llvm::Type::getContext
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
Definition: Type.h:128
llvm::Type::getInt128Ty
static IntegerType * getInt128Ty(LLVMContext &C)
Definition: Type.cpp:199
llvm::Type::getFloatPtrTy
static PointerType * getFloatPtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:213
llvm::StructType::getNumElements
unsigned getNumElements() const
Random access to the elements.
Definition: DerivedTypes.h:329
llvm::Type::IntegerTyID
@ IntegerTyID
Arbitrary bit width integers.
Definition: Type.h:72
llvm::SymbolTableEntry
Symbol info for RuntimeDyld.
Definition: RuntimeDyldImpl.h:217
Constant.h
llvm::Type::NumContainedTys
unsigned NumContainedTys
Keeps track of how many Type*'s there are in the ContainedTys list.
Definition: Type.h:106
llvm::Type::getInt64Ty
static IntegerType * getInt64Ty(LLVMContext &C)
Definition: Type.cpp:198
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
llvm::Type::getIntNTy
static IntegerType * getIntNTy(LLVMContext &C, unsigned N)
Definition: Type.cpp:201
llvm::Type::getHalfTy
static Type * getHalfTy(LLVMContext &C)
Definition: Type.cpp:182
llvm::StructType::elements
ArrayRef< Type * > elements() const
Definition: DerivedTypes.h:321
llvm::Type::FixedVectorTyID
@ FixedVectorTyID
Fixed width SIMD vector type.
Definition: Type.h:77
llvm::Type::isEmptyTy
bool isEmptyTy() const
Return true if this type is empty, that is, it has no elements or all of its elements are empty.
Definition: Type.cpp:105
llvm::Type::isIntOrIntVectorTy
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
Definition: Type.h:208
llvm::TypeSize
Definition: TypeSize.h:417
Casting.h
llvm::AnonStructTypeKeyInfo::KeyTy
Definition: LLVMContextImpl.h:76
llvm::LinearPolySize< ElementCount >::getScalable
static ElementCount getScalable(ScalarTy MinVal)
Definition: TypeSize.h:287
llvm::Type::getPointerTo
PointerType * getPointerTo(unsigned AddrSpace=0) const
Return a pointer to the current type.
Definition: Type.cpp:709
llvm::Type::TokenTyID
@ TokenTyID
Tokens.
Definition: Type.h:69
llvm::Type::getBFloatTy
static Type * getBFloatTy(LLVMContext &C)
Definition: Type.cpp:183
llvm::Type::ContainedTys
Type *const * ContainedTys
A pointer to the array of Types contained by this Type.
Definition: Type.h:113
llvm::Type::getX86_FP80PtrTy
static PointerType * getX86_FP80PtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:221
llvm::Type::LabelTyID
@ LabelTyID
Labels.
Definition: Type.h:65
llvm::Type::getVoidTy
static Type * getVoidTy(LLVMContext &C)
Definition: Type.cpp:180
llvm::StructType::isValidElementType
static bool isValidElementType(Type *ElemTy)
Return true if the specified type is valid as a element type.
Definition: Type.cpp:548
llvm::PointerType::isLoadableOrStorableType
static bool isLoadableOrStorableType(Type *ElemTy)
Return true if we can load or store from a pointer to this type.
Definition: Type.cpp:719
llvm::StructType::containsScalableVectorType
bool containsScalableVectorType() const
Returns true if this struct contains a scalable vector.
Definition: Type.cpp:393
N
#define N
llvm::ArrayRef::size
size_t size() const
size - Get the array size.
Definition: ArrayRef.h:163
llvm::IntegerType::getBitWidth
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
Definition: DerivedTypes.h:71
llvm::raw_svector_ostream
A raw_ostream that writes to an SmallVector or SmallString.
Definition: raw_ostream.h:647
llvm::StructType::getElementType
Type * getElementType(unsigned N) const
Definition: DerivedTypes.h:330
llvm::Type::getInt16Ty
static IntegerType * getInt16Ty(LLVMContext &C)
Definition: Type.cpp:196
llvm::Type::ScalableVectorTyID
@ ScalableVectorTyID
Scalable SIMD vector type.
Definition: Type.h:78
DerivedTypes.h
llvm::SmallPtrSetImpl
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
Definition: SmallPtrSet.h:343
llvm::ArrayType::isValidElementType
static bool isValidElementType(Type *ElemTy)
Return true if the specified type is valid as a element type.
Definition: Type.cpp:610
llvm::LLVMContextImpl::PointerTypes
DenseMap< Type *, PointerType * > PointerTypes
Definition: LLVMContextImpl.h:1448
llvm::IntegerType::get
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
Definition: Type.cpp:269
llvm::ScalableVectorType::get
static ScalableVectorType * get(Type *ElementType, unsigned MinNumElts)
Definition: Type.cpp:665
llvm::Type::getLabelTy
static Type * getLabelTy(LLVMContext &C)
Definition: Type.cpp:181
LLVMContext.h
llvm::Type::TypeID
TypeID
Definitions of all of the base types for the Type system.
Definition: Type.h:55
raw_ostream.h
llvm::Type::getX86_MMXTy
static Type * getX86_MMXTy(LLVMContext &C)
Definition: Type.cpp:191
llvm::StructType::isLiteral
bool isLiteral() const
Return true if this type is uniqued by structural equivalence, false if it is a struct definition.
Definition: DerivedTypes.h:278
llvm::Type::canLosslesslyBitCastTo
bool canLosslesslyBitCastTo(Type *Ty) const
Return true if this type could be converted with a lossless BitCast to type 'Ty'.
Definition: Type.cpp:63
Value.h
llvm::StructType::isLayoutIdentical
bool isLayoutIdentical(StructType *Other) const
Return true if this is layout identical to the specified struct.
Definition: Type.cpp:554
CU
Definition: AArch64AsmBackend.cpp:515
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
llvm::VectorType::get
static VectorType * get(Type *ElementType, ElementCount EC)
This static method is the primary way to construct an VectorType.
Definition: Type.cpp:628
llvm::Type::getX86_AMXPtrTy
static PointerType * getX86_AMXPtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:237
llvm::Type::HalfTyID
@ HalfTyID
16-bit floating point type
Definition: Type.h:57
llvm::Type::X86_FP80TyID
@ X86_FP80TyID
80-bit floating point type (X87)
Definition: Type.h:61
llvm::Type::getFloatTy
static Type * getFloatTy(LLVMContext &C)
Definition: Type.cpp:184
llvm::Type::isX86_AMXTy
bool isX86_AMXTy() const
Return true if this is X86 AMX.
Definition: Type.h:187
llvm::LLVMContextImpl::FunctionTypes
FunctionTypeSet FunctionTypes
Definition: LLVMContextImpl.h:1440
llvm::Type::isFirstClassType
bool isFirstClassType() const
Return true if the type is "first class", meaning it is a valid type for a Value.
Definition: Type.h:251
Other
Optional< std::vector< StOtherPiece > > Other
Definition: ELFYAML.cpp:1163
llvm::FunctionType
Class to represent function types.
Definition: DerivedTypes.h:102
llvm::Type::getPrimitiveSizeInBits
TypeSize getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
Definition: Type.cpp:122
llvm::SmallPtrSetImpl::insert
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
Definition: SmallPtrSet.h:364