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