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