Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
DerivedTypes.h
Go to the documentation of this file.
1//===- llvm/DerivedTypes.h - Classes for handling data types ----*- C++ -*-===//
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 contains the declarations of classes that represent "derived
10// types". These are things like "arrays of x" or "structure of x, y, z" or
11// "function returning x taking (y,z) as parameters", etc...
12//
13// The implementations of these classes live in the Type.cpp file.
14//
15//===----------------------------------------------------------------------===//
16
17#ifndef LLVM_IR_DERIVEDTYPES_H
18#define LLVM_IR_DERIVEDTYPES_H
19
20#include "llvm/ADT/ArrayRef.h"
21#include "llvm/ADT/STLExtras.h"
22#include "llvm/ADT/StringRef.h"
23#include "llvm/IR/Type.h"
24#include "llvm/Support/Casting.h"
25#include "llvm/Support/Compiler.h"
26#include "llvm/Support/TypeSize.h"
27#include <cassert>
28#include <cstdint>
29
30namespacellvm {
31
32classValue;
33classAPInt;
34classLLVMContext;
35template <typename T>classExpected;
36classError;
37
38/// Class to represent integer types. Note that this class is also used to
39/// represent the built-in integer types: Int1Ty, Int8Ty, Int16Ty, Int32Ty and
40/// Int64Ty.
41/// Integer representation type
42classIntegerType :publicType {
43friendclassLLVMContextImpl;
44
45protected:
46explicitIntegerType(LLVMContext &C,unsigned NumBits) :Type(C,IntegerTyID){
47setSubclassData(NumBits);
48 }
49
50public:
51 /// This enum is just used to hold constants we need for IntegerType.
52enum {
53MIN_INT_BITS = 1,///< Minimum number of bits that can be specified
54MAX_INT_BITS = (1<<23)///< Maximum number of bits that can be specified
55 ///< Note that bit width is stored in the Type classes SubclassData field
56 ///< which has 24 bits. SelectionDAG type legalization can require a
57 ///< power of 2 IntegerType, so limit to the largest representable power
58 ///< of 2, 8388608.
59 };
60
61 /// This static method is the primary way of constructing an IntegerType.
62 /// If an IntegerType with the same NumBits value was previously instantiated,
63 /// that instance will be returned. Otherwise a new one will be created. Only
64 /// one instance with a given NumBits value is ever created.
65 /// Get or create an IntegerType instance.
66staticIntegerType *get(LLVMContext &C,unsigned NumBits);
67
68 /// Returns type twice as wide the input type.
69IntegerType *getExtendedType() const{
70returnType::getIntNTy(getContext(), 2 *getScalarSizeInBits());
71 }
72
73 /// Get the number of bits in this IntegerType
74unsignedgetBitWidth() const{returngetSubclassData(); }
75
76 /// Return a bitmask with ones set for all of the bits that can be set by an
77 /// unsigned version of this type. This is 0xFF for i8, 0xFFFF for i16, etc.
78uint64_tgetBitMask() const{
79return~uint64_t(0UL) >> (64-getBitWidth());
80 }
81
82 /// Return a uint64_t with just the most significant bit set (the sign bit, if
83 /// the value is treated as a signed number).
84uint64_tgetSignBit() const{
85return 1ULL << (getBitWidth()-1);
86 }
87
88 /// For example, this is 0xFF for an 8 bit integer, 0xFFFF for i16, etc.
89 /// @returns a bit mask with ones set for all the bits of this type.
90 /// Get a bit mask for this type.
91APIntgetMask()const;
92
93 /// Methods for support type inquiry through isa, cast, and dyn_cast.
94staticboolclassof(constType *T) {
95returnT->getTypeID() ==IntegerTyID;
96 }
97};
98
99unsignedType::getIntegerBitWidth() const{
100return cast<IntegerType>(this)->getBitWidth();
101}
102
103/// Class to represent function types
104///
105classFunctionType :publicType {
106FunctionType(Type *Result,ArrayRef<Type*> Params,bool IsVarArgs);
107
108public:
109FunctionType(constFunctionType &) =delete;
110FunctionType &operator=(constFunctionType &) =delete;
111
112 /// This static method is the primary way of constructing a FunctionType.
113staticFunctionType *get(Type *Result,
114ArrayRef<Type*> Params,boolisVarArg);
115
116 /// Create a FunctionType taking no parameters.
117staticFunctionType *get(Type *Result,boolisVarArg);
118
119 /// Return true if the specified type is valid as a return type.
120staticboolisValidReturnType(Type *RetTy);
121
122 /// Return true if the specified type is valid as an argument type.
123staticboolisValidArgumentType(Type *ArgTy);
124
125boolisVarArg() const{returngetSubclassData()!=0; }
126Type *getReturnType() const{returnContainedTys[0]; }
127
128usingparam_iterator =Type::subtype_iterator;
129
130param_iteratorparam_begin() const{returnContainedTys + 1; }
131param_iteratorparam_end() const{return &ContainedTys[NumContainedTys]; }
132ArrayRef<Type *>params() const{
133returnArrayRef(param_begin(),param_end());
134 }
135
136 /// Parameter type accessors.
137Type *getParamType(unsigned i) const{
138assert(i <getNumParams() &&"getParamType() out of range!");
139returnContainedTys[i + 1];
140 }
141
142 /// Return the number of fixed parameters this function type requires.
143 /// This does not consider varargs.
144unsignedgetNumParams() const{returnNumContainedTys - 1; }
145
146 /// Methods for support type inquiry through isa, cast, and dyn_cast.
147staticboolclassof(constType *T) {
148returnT->getTypeID() ==FunctionTyID;
149 }
150};
151static_assert(alignof(FunctionType) >=alignof(Type *),
152"Alignment sufficient for objects appended to FunctionType");
153
154boolType::isFunctionVarArg() const{
155return cast<FunctionType>(this)->isVarArg();
156}
157
158Type *Type::getFunctionParamType(unsigned i) const{
159return cast<FunctionType>(this)->getParamType(i);
160}
161
162unsignedType::getFunctionNumParams() const{
163return cast<FunctionType>(this)->getNumParams();
164}
165
166/// A handy container for a FunctionType+Callee-pointer pair, which can be
167/// passed around as a single entity. This assists in replacing the use of
168/// PointerType::getElementType() to access the function's type, since that's
169/// slated for removal as part of the [opaque pointer types] project.
170classFunctionCallee {
171public:
172// Allow implicit conversion from types which have a getFunctionType member
173// (e.g. Function and InlineAsm).
174template <typename T,typename U = decltype(&T::getFunctionType)>
175FunctionCallee(T *Fn)
176 : FnTy(Fn ? Fn->getFunctionType() : nullptr), Callee(Fn) {}
177
178FunctionCallee(FunctionType *FnTy,Value *Callee)
179 : FnTy(FnTy), Callee(Callee) {
180assert((FnTy ==nullptr) == (Callee ==nullptr));
181 }
182
183FunctionCallee(std::nullptr_t) {}
184
185FunctionCallee() =default;
186
187FunctionType *getFunctionType() {return FnTy; }
188
189Value *getCallee() {return Callee; }
190
191explicitoperatorbool() {return Callee; }
192
193private:
194FunctionType *FnTy =nullptr;
195Value *Callee =nullptr;
196};
197
198/// Class to represent struct types. There are two different kinds of struct
199/// types: Literal structs and Identified structs.
200///
201/// Literal struct types (e.g. { i32, i32 }) are uniqued structurally, and must
202/// always have a body when created. You can get one of these by using one of
203/// the StructType::get() forms.
204///
205/// Identified structs (e.g. %foo or %42) may optionally have a name and are not
206/// uniqued. The names for identified structs are managed at the LLVMContext
207/// level, so there can only be a single identified struct with a given name in
208/// a particular LLVMContext. Identified structs may also optionally be opaque
209/// (have no body specified). You get one of these by using one of the
210/// StructType::create() forms.
211///
212/// Independent of what kind of struct you have, the body of a struct type are
213/// laid out in memory consecutively with the elements directly one after the
214/// other (if the struct is packed) or (if not packed) with padding between the
215/// elements as defined by DataLayout (which is required to match what the code
216/// generator for a target expects).
217///
218classStructType :publicType {
219StructType(LLVMContext &C) :Type(C,StructTyID) {}
220
221enum {
222 /// This is the contents of the SubClassData field.
223 SCDB_HasBody = 1,
224 SCDB_Packed = 2,
225 SCDB_IsLiteral = 4,
226 SCDB_IsSized = 8,
227 SCDB_ContainsScalableVector = 16,
228 SCDB_NotContainsScalableVector = 32,
229 SCDB_ContainsNonGlobalTargetExtType = 64,
230 SCDB_NotContainsNonGlobalTargetExtType = 128,
231 SCDB_ContainsNonLocalTargetExtType = 64,
232 SCDB_NotContainsNonLocalTargetExtType = 128,
233 };
234
235 /// For a named struct that actually has a name, this is a pointer to the
236 /// symbol table entry (maintained by LLVMContext) for the struct.
237 /// This is null if the type is an literal struct or if it is a identified
238 /// type that has an empty name.
239void *SymbolTableEntry =nullptr;
240
241public:
242StructType(constStructType &) =delete;
243StructType &operator=(constStructType &) =delete;
244
245 /// This creates an identified struct.
246staticStructType *create(LLVMContext &Context,StringRefName);
247staticStructType *create(LLVMContext &Context);
248
249staticStructType *create(ArrayRef<Type *> Elements,StringRefName,
250boolisPacked =false);
251staticStructType *create(ArrayRef<Type *> Elements);
252staticStructType *create(LLVMContext &Context,ArrayRef<Type *> Elements,
253StringRefName,boolisPacked =false);
254staticStructType *create(LLVMContext &Context,ArrayRef<Type *> Elements);
255template <class... Tys>
256static std::enable_if_t<are_base_of<Type, Tys...>::value,StructType *>
257create(StringRefName,Type *elt1, Tys *... elts) {
258assert(elt1 &&"Cannot create a struct type with no elements with this");
259returncreate(ArrayRef<Type *>({elt1, elts...}),Name);
260 }
261
262 /// This static method is the primary way to create a literal StructType.
263staticStructType *get(LLVMContext &Context,ArrayRef<Type*> Elements,
264boolisPacked =false);
265
266 /// Create an empty structure type.
267staticStructType *get(LLVMContext &Context,boolisPacked =false);
268
269 /// This static method is a convenience method for creating structure types by
270 /// specifying the elements as arguments. Note that this method always returns
271 /// a non-packed struct, and requires at least one element type.
272template <class... Tys>
273static std::enable_if_t<are_base_of<Type, Tys...>::value,StructType *>
274get(Type *elt1, Tys *... elts) {
275assert(elt1 &&"Cannot create a struct type with no elements with this");
276LLVMContext &Ctx = elt1->getContext();
277returnStructType::get(Ctx,ArrayRef<Type *>({elt1, elts...}));
278 }
279
280 /// Return the type with the specified name, or null if there is none by that
281 /// name.
282staticStructType *getTypeByName(LLVMContext &C,StringRefName);
283
284boolisPacked() const{return (getSubclassData() & SCDB_Packed) != 0; }
285
286 /// Return true if this type is uniqued by structural equivalence, false if it
287 /// is a struct definition.
288boolisLiteral() const{return (getSubclassData() & SCDB_IsLiteral) != 0; }
289
290 /// Return true if this is a type with an identity that has no body specified
291 /// yet. These prints as 'opaque' in .ll files.
292boolisOpaque() const{return (getSubclassData() & SCDB_HasBody) == 0; }
293
294 /// isSized - Return true if this is a sized type.
295boolisSized(SmallPtrSetImpl<Type *> *Visited =nullptr)const;
296
297 /// Returns true if this struct contains a scalable vector.
298boolisScalableTy(SmallPtrSetImpl<const Type *> &Visited)const;
299usingType::isScalableTy;
300
301 /// Return true if this type is or contains a target extension type that
302 /// disallows being used as a global.
303bool
304containsNonGlobalTargetExtType(SmallPtrSetImpl<const Type *> &Visited)const;
305usingType::containsNonGlobalTargetExtType;
306
307 /// Return true if this type is or contains a target extension type that
308 /// disallows being used as a local.
309bool
310containsNonLocalTargetExtType(SmallPtrSetImpl<const Type *> &Visited)const;
311usingType::containsNonLocalTargetExtType;
312
313 /// Returns true if this struct contains homogeneous scalable vector types.
314 /// Note that the definition of homogeneous scalable vector type is not
315 /// recursive here. That means the following structure will return false
316 /// when calling this function.
317 /// {{<vscale x 2 x i32>, <vscale x 4 x i64>},
318 /// {<vscale x 2 x i32>, <vscale x 4 x i64>}}
319boolcontainsHomogeneousScalableVectorTypes()const;
320
321 /// Return true if this struct is non-empty and all element types are the
322 /// same.
323boolcontainsHomogeneousTypes()const;
324
325 /// Return true if this is a named struct that has a non-empty name.
326boolhasName() const{returnSymbolTableEntry !=nullptr; }
327
328 /// Return the name for this struct type if it has an identity.
329 /// This may return an empty string for an unnamed struct type. Do not call
330 /// this on an literal type.
331StringRefgetName()const;
332
333 /// Change the name of this type to the specified name, or to a name with a
334 /// suffix if there is a collision. Do not call this on an literal type.
335voidsetName(StringRefName);
336
337 /// Specify a body for an opaque identified type, which must not make the type
338 /// recursive.
339voidsetBody(ArrayRef<Type*> Elements,boolisPacked =false);
340
341 /// Specify a body for an opaque identified type or return an error if it
342 /// would make the type recursive.
343ErrorsetBodyOrError(ArrayRef<Type *> Elements,boolisPacked =false);
344
345 /// Return an error if the body for an opaque identified type would make it
346 /// recursive.
347ErrorcheckBody(ArrayRef<Type *> Elements);
348
349 /// Return true if the specified type is valid as a element type.
350staticboolisValidElementType(Type *ElemTy);
351
352// Iterator access to the elements.
353usingelement_iterator =Type::subtype_iterator;
354
355element_iteratorelement_begin() const{returnContainedTys; }
356element_iteratorelement_end() const{return &ContainedTys[NumContainedTys];}
357ArrayRef<Type *>elements() const{
358returnArrayRef(element_begin(),element_end());
359 }
360
361 /// Return true if this is layout identical to the specified struct.
362boolisLayoutIdentical(StructType *Other)const;
363
364 /// Random access to the elements
365unsignedgetNumElements() const{returnNumContainedTys; }
366Type *getElementType(unsignedN) const{
367assert(N <NumContainedTys &&"Element number out of range!");
368returnContainedTys[N];
369 }
370 /// Given an index value into the type, return the type of the element.
371Type *getTypeAtIndex(constValue *V)const;
372Type *getTypeAtIndex(unsignedN) const{returngetElementType(N); }
373boolindexValid(constValue *V)const;
374boolindexValid(unsignedIdx) const{returnIdx <getNumElements(); }
375
376 /// Methods for support type inquiry through isa, cast, and dyn_cast.
377staticboolclassof(constType *T) {
378returnT->getTypeID() ==StructTyID;
379 }
380};
381
382StringRefType::getStructName() const{
383return cast<StructType>(this)->getName();
384}
385
386unsignedType::getStructNumElements() const{
387return cast<StructType>(this)->getNumElements();
388}
389
390Type *Type::getStructElementType(unsignedN) const{
391return cast<StructType>(this)->getElementType(N);
392}
393
394/// Class to represent array types.
395classArrayType :publicType {
396 /// The element type of the array.
397Type *ContainedType;
398 /// Number of elements in the array.
399uint64_t NumElements;
400
401ArrayType(Type *ElType,uint64_t NumEl);
402
403public:
404ArrayType(constArrayType &) =delete;
405ArrayType &operator=(constArrayType &) =delete;
406
407uint64_tgetNumElements() const{return NumElements; }
408Type *getElementType() const{return ContainedType; }
409
410 /// This static method is the primary way to construct an ArrayType
411staticArrayType *get(Type *ElementType,uint64_t NumElements);
412
413 /// Return true if the specified type is valid as a element type.
414staticboolisValidElementType(Type *ElemTy);
415
416 /// Methods for support type inquiry through isa, cast, and dyn_cast.
417staticboolclassof(constType *T) {
418returnT->getTypeID() ==ArrayTyID;
419 }
420};
421
422uint64_tType::getArrayNumElements() const{
423return cast<ArrayType>(this)->getNumElements();
424}
425
426/// Base class of all SIMD vector types
427classVectorType :publicType {
428 /// A fully specified VectorType is of the form <vscale x n x Ty>. 'n' is the
429 /// minimum number of elements of type Ty contained within the vector, and
430 /// 'vscale x' indicates that the total element count is an integer multiple
431 /// of 'n', where the multiple is either guaranteed to be one, or is
432 /// statically unknown at compile time.
433 ///
434 /// If the multiple is known to be 1, then the extra term is discarded in
435 /// textual IR:
436 ///
437 /// <4 x i32> - a vector containing 4 i32s
438 /// <vscale x 4 x i32> - a vector containing an unknown integer multiple
439 /// of 4 i32s
440
441 /// The element type of the vector.
442Type *ContainedType;
443
444protected:
445 /// The element quantity of this vector. The meaning of this value depends
446 /// on the type of vector:
447 /// - For FixedVectorType = <ElementQuantity x ty>, there are
448 /// exactly ElementQuantity elements in this vector.
449 /// - For ScalableVectorType = <vscale x ElementQuantity x ty>,
450 /// there are vscale * ElementQuantity elements in this vector, where
451 /// vscale is a runtime-constant integer greater than 0.
452constunsignedElementQuantity;
453
454VectorType(Type *ElType,unsignedEQ,Type::TypeID TID);
455
456public:
457VectorType(constVectorType &) =delete;
458VectorType &operator=(constVectorType &) =delete;
459
460Type *getElementType() const{return ContainedType; }
461
462 /// This static method is the primary way to construct an VectorType.
463staticVectorType *get(Type *ElementType,ElementCount EC);
464
465staticVectorType *get(Type *ElementType,unsigned NumElements,
466bool Scalable) {
467returnVectorType::get(ElementType,
468ElementCount::get(NumElements, Scalable));
469 }
470
471staticVectorType *get(Type *ElementType,constVectorType *Other) {
472returnVectorType::get(ElementType,Other->getElementCount());
473 }
474
475 /// This static method gets a VectorType with the same number of elements as
476 /// the input type, and the element type is an integer type of the same width
477 /// as the input element type.
478staticVectorType *getInteger(VectorType *VTy) {
479unsigned EltBits = VTy->getElementType()->getPrimitiveSizeInBits();
480assert(EltBits &&"Element size must be of a non-zero size");
481Type *EltTy =IntegerType::get(VTy->getContext(), EltBits);
482returnVectorType::get(EltTy, VTy->getElementCount());
483 }
484
485 /// This static method is like getInteger except that the element types are
486 /// twice as wide as the elements in the input type.
487staticVectorType *getExtendedElementVectorType(VectorType *VTy) {
488assert(VTy->isIntOrIntVectorTy() &&"VTy expected to be a vector of ints.");
489auto *EltTy = cast<IntegerType>(VTy->getElementType());
490returnVectorType::get(EltTy->getExtendedType(), VTy->getElementCount());
491 }
492
493// This static method gets a VectorType with the same number of elements as
494// the input type, and the element type is an integer or float type which
495// is half as wide as the elements in the input type.
496staticVectorType *getTruncatedElementVectorType(VectorType *VTy) {
497Type *EltTy;
498if (VTy->getElementType()->isFloatingPointTy()) {
499switch(VTy->getElementType()->getTypeID()) {
500caseDoubleTyID:
501 EltTy =Type::getFloatTy(VTy->getContext());
502break;
503caseFloatTyID:
504 EltTy =Type::getHalfTy(VTy->getContext());
505break;
506default:
507llvm_unreachable("Cannot create narrower fp vector element type");
508 }
509 }else {
510unsigned EltBits = VTy->getElementType()->getPrimitiveSizeInBits();
511assert((EltBits & 1) == 0 &&
512"Cannot truncate vector element with odd bit-width");
513 EltTy =IntegerType::get(VTy->getContext(), EltBits / 2);
514 }
515returnVectorType::get(EltTy, VTy->getElementCount());
516 }
517
518// This static method returns a VectorType with a larger number of elements
519// of a smaller type than the input element type. For example, a <4 x i64>
520// subdivided twice would return <16 x i16>
521staticVectorType *getSubdividedVectorType(VectorType *VTy,int NumSubdivs) {
522for (int i = 0; i < NumSubdivs; ++i) {
523 VTy =VectorType::getDoubleElementsVectorType(VTy);
524 VTy =VectorType::getTruncatedElementVectorType(VTy);
525 }
526return VTy;
527 }
528
529 /// This static method returns a VectorType with half as many elements as the
530 /// input type and the same element type.
531staticVectorType *getHalfElementsVectorType(VectorType *VTy) {
532auto EltCnt = VTy->getElementCount();
533assert(EltCnt.isKnownEven() &&
534"Cannot halve vector with odd number of elements.");
535returnVectorType::get(VTy->getElementType(),
536 EltCnt.divideCoefficientBy(2));
537 }
538
539 /// This static method returns a VectorType with twice as many elements as the
540 /// input type and the same element type.
541staticVectorType *getDoubleElementsVectorType(VectorType *VTy) {
542auto EltCnt = VTy->getElementCount();
543assert((EltCnt.getKnownMinValue() * 2ull) <= UINT_MAX &&
544"Too many elements in vector");
545returnVectorType::get(VTy->getElementType(), EltCnt * 2);
546 }
547
548 /// Return true if the specified type is valid as a element type.
549staticboolisValidElementType(Type *ElemTy);
550
551 /// Return an ElementCount instance to represent the (possibly scalable)
552 /// number of elements in the vector.
553inlineElementCountgetElementCount()const;
554
555 /// Methods for support type inquiry through isa, cast, and dyn_cast.
556staticboolclassof(constType *T) {
557returnT->getTypeID() ==FixedVectorTyID ||
558T->getTypeID() ==ScalableVectorTyID;
559 }
560};
561
562/// Class to represent fixed width SIMD vectors
563classFixedVectorType :publicVectorType {
564protected:
565FixedVectorType(Type *ElTy,unsigned NumElts)
566 :VectorType(ElTy, NumElts,FixedVectorTyID) {}
567
568public:
569staticFixedVectorType *get(Type *ElementType,unsigned NumElts);
570
571staticFixedVectorType *get(Type *ElementType,constFixedVectorType *FVTy) {
572returnget(ElementType, FVTy->getNumElements());
573 }
574
575staticFixedVectorType *getInteger(FixedVectorType *VTy) {
576return cast<FixedVectorType>(VectorType::getInteger(VTy));
577 }
578
579staticFixedVectorType *getExtendedElementVectorType(FixedVectorType *VTy) {
580return cast<FixedVectorType>(VectorType::getExtendedElementVectorType(VTy));
581 }
582
583staticFixedVectorType *getTruncatedElementVectorType(FixedVectorType *VTy) {
584return cast<FixedVectorType>(
585VectorType::getTruncatedElementVectorType(VTy));
586 }
587
588staticFixedVectorType *getSubdividedVectorType(FixedVectorType *VTy,
589int NumSubdivs) {
590return cast<FixedVectorType>(
591VectorType::getSubdividedVectorType(VTy, NumSubdivs));
592 }
593
594staticFixedVectorType *getHalfElementsVectorType(FixedVectorType *VTy) {
595return cast<FixedVectorType>(VectorType::getHalfElementsVectorType(VTy));
596 }
597
598staticFixedVectorType *getDoubleElementsVectorType(FixedVectorType *VTy) {
599return cast<FixedVectorType>(VectorType::getDoubleElementsVectorType(VTy));
600 }
601
602staticboolclassof(constType *T) {
603returnT->getTypeID() ==FixedVectorTyID;
604 }
605
606unsignedgetNumElements() const{returnElementQuantity; }
607};
608
609/// Class to represent scalable SIMD vectors
610classScalableVectorType :publicVectorType {
611protected:
612ScalableVectorType(Type *ElTy,unsigned MinNumElts)
613 :VectorType(ElTy, MinNumElts,ScalableVectorTyID) {}
614
615public:
616staticScalableVectorType *get(Type *ElementType,unsigned MinNumElts);
617
618staticScalableVectorType *get(Type *ElementType,
619constScalableVectorType *SVTy) {
620returnget(ElementType, SVTy->getMinNumElements());
621 }
622
623staticScalableVectorType *getInteger(ScalableVectorType *VTy) {
624return cast<ScalableVectorType>(VectorType::getInteger(VTy));
625 }
626
627staticScalableVectorType *
628getExtendedElementVectorType(ScalableVectorType *VTy) {
629return cast<ScalableVectorType>(
630VectorType::getExtendedElementVectorType(VTy));
631 }
632
633staticScalableVectorType *
634getTruncatedElementVectorType(ScalableVectorType *VTy) {
635return cast<ScalableVectorType>(
636VectorType::getTruncatedElementVectorType(VTy));
637 }
638
639staticScalableVectorType *getSubdividedVectorType(ScalableVectorType *VTy,
640int NumSubdivs) {
641return cast<ScalableVectorType>(
642VectorType::getSubdividedVectorType(VTy, NumSubdivs));
643 }
644
645staticScalableVectorType *
646getHalfElementsVectorType(ScalableVectorType *VTy) {
647return cast<ScalableVectorType>(VectorType::getHalfElementsVectorType(VTy));
648 }
649
650staticScalableVectorType *
651getDoubleElementsVectorType(ScalableVectorType *VTy) {
652return cast<ScalableVectorType>(
653VectorType::getDoubleElementsVectorType(VTy));
654 }
655
656 /// Get the minimum number of elements in this vector. The actual number of
657 /// elements in the vector is an integer multiple of this value.
658unsignedgetMinNumElements() const{returnElementQuantity; }
659
660staticboolclassof(constType *T) {
661returnT->getTypeID() ==ScalableVectorTyID;
662 }
663};
664
665inlineElementCountVectorType::getElementCount() const{
666returnElementCount::get(ElementQuantity, isa<ScalableVectorType>(this));
667}
668
669/// Class to represent pointers.
670classPointerType :publicType {
671explicitPointerType(LLVMContext &C,unsigned AddrSpace);
672
673public:
674PointerType(constPointerType &) =delete;
675PointerType &operator=(constPointerType &) =delete;
676
677 /// This constructs a pointer to an object of the specified type in a numbered
678 /// address space.
679staticPointerType *get(Type *ElementType,unsignedAddressSpace);
680 /// This constructs an opaque pointer to an object in a numbered address
681 /// space.
682staticPointerType *get(LLVMContext &C,unsignedAddressSpace);
683
684 /// This constructs a pointer to an object of the specified type in the
685 /// default address space (address space zero).
686staticPointerType *getUnqual(Type *ElementType) {
687returnPointerType::get(ElementType, 0);
688 }
689
690 /// This constructs an opaque pointer to an object in the
691 /// default address space (address space zero).
692staticPointerType *getUnqual(LLVMContext &C) {
693returnPointerType::get(C, 0);
694 }
695
696 /// Return true if the specified type is valid as a element type.
697staticboolisValidElementType(Type *ElemTy);
698
699 /// Return true if we can load or store from a pointer to this type.
700staticboolisLoadableOrStorableType(Type *ElemTy);
701
702 /// Return the address space of the Pointer type.
703inlineunsignedgetAddressSpace() const{returngetSubclassData(); }
704
705 /// Implement support type inquiry through isa, cast, and dyn_cast.
706staticboolclassof(constType *T) {
707returnT->getTypeID() ==PointerTyID;
708 }
709};
710
711Type *Type::getExtendedType() const{
712assert(
713isIntOrIntVectorTy() &&
714"Original type expected to be a vector of integers or a scalar integer.");
715if (auto *VTy = dyn_cast<VectorType>(this))
716returnVectorType::getExtendedElementVectorType(
717const_cast<VectorType *>(VTy));
718return cast<IntegerType>(this)->getExtendedType();
719}
720
721Type *Type::getWithNewType(Type *EltTy) const{
722if (auto *VTy = dyn_cast<VectorType>(this))
723returnVectorType::get(EltTy, VTy->getElementCount());
724return EltTy;
725}
726
727Type *Type::getWithNewBitWidth(unsigned NewBitWidth) const{
728assert(
729isIntOrIntVectorTy() &&
730"Original type expected to be a vector of integers or a scalar integer.");
731returngetWithNewType(getIntNTy(getContext(), NewBitWidth));
732}
733
734unsignedType::getPointerAddressSpace() const{
735return cast<PointerType>(getScalarType())->getAddressSpace();
736}
737
738/// Class to represent target extensions types, which are generally
739/// unintrospectable from target-independent optimizations.
740///
741/// Target extension types have a string name, and optionally have type and/or
742/// integer parameters. The exact meaning of any parameters is dependent on the
743/// target.
744classTargetExtType :publicType {
745TargetExtType(LLVMContext &C,StringRef Name,ArrayRef<Type *> Types,
746ArrayRef<unsigned> Ints);
747
748// These strings are ultimately owned by the context.
749StringRef Name;
750unsigned *IntParams;
751
752public:
753TargetExtType(constTargetExtType &) =delete;
754TargetExtType &operator=(constTargetExtType &) =delete;
755
756 /// Return a target extension type having the specified name and optional
757 /// type and integer parameters.
758staticTargetExtType *get(LLVMContext &Context,StringRef Name,
759ArrayRef<Type *> Types = {},
760ArrayRef<unsigned> Ints = {});
761
762 /// Return a target extension type having the specified name and optional
763 /// type and integer parameters, or an appropriate Error if it fails the
764 /// parameters check.
765static Expected<TargetExtType *>getOrError(LLVMContext &Context,
766 StringRef Name,
767 ArrayRef<Type *> Types = {},
768 ArrayRef<unsigned> Ints = {});
769
770 /// Check that a newly created target extension type has the expected number
771 /// of type parameters and integer parameters, returning the type itself if OK
772 /// or an appropriate Error if not.
773static Expected<TargetExtType *>checkParams(TargetExtType *TTy);
774
775 /// Return the name for this target extension type. Two distinct target
776 /// extension types may have the same name if their type or integer parameters
777 /// differ.
778StringRefgetName() const{return Name; }
779
780 /// Return the type parameters for this particular target extension type. If
781 /// there are no parameters, an empty array is returned.
782ArrayRef<Type *>type_params() const{
783returnArrayRef(type_param_begin(),type_param_end());
784 }
785
786usingtype_param_iterator =Type::subtype_iterator;
787type_param_iteratortype_param_begin() const{returnContainedTys; }
788type_param_iteratortype_param_end() const{
789return &ContainedTys[NumContainedTys];
790 }
791
792Type *getTypeParameter(unsigned i) const{returngetContainedType(i); }
793unsignedgetNumTypeParameters() const{returngetNumContainedTypes(); }
794
795 /// Return the integer parameters for this particular target extension type.
796 /// If there are no parameters, an empty array is returned.
797ArrayRef<unsigned>int_params() const{
798returnArrayRef(IntParams,getNumIntParameters());
799 }
800
801unsignedgetIntParameter(unsigned i) const{return IntParams[i]; }
802unsignedgetNumIntParameters() const{returngetSubclassData(); }
803
804enumProperty {
805 /// zeroinitializer is valid for this target extension type.
806HasZeroInit = 1U << 0,
807 /// This type may be used as the value type of a global variable.
808CanBeGlobal = 1U << 1,
809 /// This type may be allocated on the stack, either as the allocated type
810 /// of an alloca instruction or as a byval function parameter.
811CanBeLocal = 1U << 2,
812 };
813
814 /// Returns true if the target extension type contains the given property.
815boolhasProperty(Property Prop)const;
816
817 /// Returns an underlying layout type for the target extension type. This
818 /// type can be used to query size and alignment information, if it is
819 /// appropriate (although note that the layout type may also be void). It is
820 /// not legal to bitcast between this type and the layout type, however.
821Type *getLayoutType()const;
822
823 /// Methods for support type inquiry through isa, cast, and dyn_cast.
824staticboolclassof(constType *T) {returnT->getTypeID() ==TargetExtTyID; }
825};
826
827StringRefType::getTargetExtName() const{
828return cast<TargetExtType>(this)->getName();
829}
830
831}// end namespace llvm
832
833#endif// LLVM_IR_DERIVEDTYPES_H
ArrayRef.h
Casting.h
Compiler.h
RetTy
return RetTy
Definition:DeadArgumentElimination.cpp:361
Idx
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
Definition:DeadArgumentElimination.cpp:353
value
Given that RA is a live value
Definition:DeadArgumentElimination.cpp:716
Name
std::string Name
Definition:ELFObjHandler.cpp:77
Type.h
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
STLExtras.h
This file contains some templates that are useful if you are working with the STL at all.
StringRef.h
TypeSize.h
FunctionType
Definition:ItaniumDemangle.h:823
T
VectorType
Definition:ItaniumDemangle.h:1173
bool
llvm::APInt
Class for arbitrary precision integers.
Definition:APInt.h:78
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition:ArrayRef.h:41
llvm::ArrayType
Class to represent array types.
Definition:DerivedTypes.h:395
llvm::ArrayType::getNumElements
uint64_t getNumElements() const
Definition:DerivedTypes.h:407
llvm::ArrayType::isValidElementType
static bool isValidElementType(Type *ElemTy)
Return true if the specified type is valid as a element type.
Definition:Type.cpp:758
llvm::ArrayType::get
static ArrayType * get(Type *ElementType, uint64_t NumElements)
This static method is the primary way to construct an ArrayType.
llvm::ArrayType::operator=
ArrayType & operator=(const ArrayType &)=delete
llvm::ArrayType::ArrayType
ArrayType(const ArrayType &)=delete
llvm::ArrayType::classof
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition:DerivedTypes.h:417
llvm::ArrayType::getElementType
Type * getElementType() const
Definition:DerivedTypes.h:408
llvm::ElementCount
Definition:TypeSize.h:300
llvm::ElementCount::get
static constexpr ElementCount get(ScalarTy MinVal, bool Scalable)
Definition:TypeSize.h:317
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition:Error.h:160
llvm::FixedVectorType
Class to represent fixed width SIMD vectors.
Definition:DerivedTypes.h:563
llvm::FixedVectorType::getNumElements
unsigned getNumElements() const
Definition:DerivedTypes.h:606
llvm::FixedVectorType::getDoubleElementsVectorType
static FixedVectorType * getDoubleElementsVectorType(FixedVectorType *VTy)
Definition:DerivedTypes.h:598
llvm::FixedVectorType::getInteger
static FixedVectorType * getInteger(FixedVectorType *VTy)
Definition:DerivedTypes.h:575
llvm::FixedVectorType::getSubdividedVectorType
static FixedVectorType * getSubdividedVectorType(FixedVectorType *VTy, int NumSubdivs)
Definition:DerivedTypes.h:588
llvm::FixedVectorType::getExtendedElementVectorType
static FixedVectorType * getExtendedElementVectorType(FixedVectorType *VTy)
Definition:DerivedTypes.h:579
llvm::FixedVectorType::FixedVectorType
FixedVectorType(Type *ElTy, unsigned NumElts)
Definition:DerivedTypes.h:565
llvm::FixedVectorType::get
static FixedVectorType * get(Type *ElementType, const FixedVectorType *FVTy)
Definition:DerivedTypes.h:571
llvm::FixedVectorType::getTruncatedElementVectorType
static FixedVectorType * getTruncatedElementVectorType(FixedVectorType *VTy)
Definition:DerivedTypes.h:583
llvm::FixedVectorType::classof
static bool classof(const Type *T)
Definition:DerivedTypes.h:602
llvm::FixedVectorType::get
static FixedVectorType * get(Type *ElementType, unsigned NumElts)
Definition:Type.cpp:791
llvm::FixedVectorType::getHalfElementsVectorType
static FixedVectorType * getHalfElementsVectorType(FixedVectorType *VTy)
Definition:DerivedTypes.h:594
llvm::FunctionCallee
A handy container for a FunctionType+Callee-pointer pair, which can be passed around as a single enti...
Definition:DerivedTypes.h:170
llvm::FunctionCallee::FunctionCallee
FunctionCallee(T *Fn)
Definition:DerivedTypes.h:175
llvm::FunctionCallee::FunctionCallee
FunctionCallee(std::nullptr_t)
Definition:DerivedTypes.h:183
llvm::FunctionCallee::getFunctionType
FunctionType * getFunctionType()
Definition:DerivedTypes.h:187
llvm::FunctionCallee::getCallee
Value * getCallee()
Definition:DerivedTypes.h:189
llvm::FunctionCallee::FunctionCallee
FunctionCallee()=default
llvm::FunctionCallee::FunctionCallee
FunctionCallee(FunctionType *FnTy, Value *Callee)
Definition:DerivedTypes.h:178
llvm::FunctionType
Class to represent function types.
Definition:DerivedTypes.h:105
llvm::FunctionType::param_begin
param_iterator param_begin() const
Definition:DerivedTypes.h:130
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::FunctionType::getNumParams
unsigned getNumParams() const
Return the number of fixed parameters this function type requires.
Definition:DerivedTypes.h:144
llvm::FunctionType::param_iterator
Type::subtype_iterator param_iterator
Definition:DerivedTypes.h:128
llvm::FunctionType::getParamType
Type * getParamType(unsigned i) const
Parameter type accessors.
Definition:DerivedTypes.h:137
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::FunctionType::FunctionType
FunctionType(const FunctionType &)=delete
llvm::FunctionType::params
ArrayRef< Type * > params() const
Definition:DerivedTypes.h:132
llvm::FunctionType::operator=
FunctionType & operator=(const FunctionType &)=delete
llvm::FunctionType::isVarArg
bool isVarArg() const
Definition:DerivedTypes.h:125
llvm::FunctionType::classof
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition:DerivedTypes.h:147
llvm::FunctionType::getReturnType
Type * getReturnType() const
Definition:DerivedTypes.h:126
llvm::FunctionType::param_end
param_iterator param_end() const
Definition:DerivedTypes.h:131
llvm::FunctionType::get
static FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
llvm::IntegerType
Class to represent integer types.
Definition:DerivedTypes.h:42
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::IntegerType::getSignBit
uint64_t getSignBit() const
Return a uint64_t with just the most significant bit set (the sign bit, if the value is treated as a ...
Definition:DerivedTypes.h:84
llvm::IntegerType::getMask
APInt getMask() const
For example, this is 0xFF for an 8 bit integer, 0xFFFF for i16, etc.
Definition:Type.cpp:335
llvm::IntegerType::getExtendedType
IntegerType * getExtendedType() const
Returns type twice as wide the input type.
Definition:DerivedTypes.h:69
llvm::IntegerType::getBitWidth
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
Definition:DerivedTypes.h:74
llvm::IntegerType::getBitMask
uint64_t getBitMask() const
Return a bitmask with ones set for all of the bits that can be set by an unsigned version of this typ...
Definition:DerivedTypes.h:78
llvm::IntegerType::MIN_INT_BITS
@ MIN_INT_BITS
Minimum number of bits that can be specified.
Definition:DerivedTypes.h:53
llvm::IntegerType::MAX_INT_BITS
@ MAX_INT_BITS
Maximum number of bits that can be specified.
Definition:DerivedTypes.h:54
llvm::IntegerType::classof
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition:DerivedTypes.h:94
llvm::IntegerType::IntegerType
IntegerType(LLVMContext &C, unsigned NumBits)
Definition:DerivedTypes.h:46
llvm::LLVMContextImpl
Definition:LLVMContextImpl.h:1469
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition:LLVMContext.h:67
llvm::PointerType
Class to represent pointers.
Definition:DerivedTypes.h:670
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:869
llvm::PointerType::PointerType
PointerType(const PointerType &)=delete
llvm::PointerType::getUnqual
static PointerType * getUnqual(LLVMContext &C)
This constructs an opaque pointer to an object in the default address space (address space zero).
Definition:DerivedTypes.h:692
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.
llvm::PointerType::classof
static bool classof(const Type *T)
Implement support type inquiry through isa, cast, and dyn_cast.
Definition:DerivedTypes.h:706
llvm::PointerType::isValidElementType
static bool isValidElementType(Type *ElemTy)
Return true if the specified type is valid as a element type.
Definition:Type.cpp:863
llvm::PointerType::operator=
PointerType & operator=(const PointerType &)=delete
llvm::PointerType::getUnqual
static PointerType * getUnqual(Type *ElementType)
This constructs a pointer to an object of the specified type in the default address space (address sp...
Definition:DerivedTypes.h:686
llvm::PointerType::getAddressSpace
unsigned getAddressSpace() const
Return the address space of the Pointer type.
Definition:DerivedTypes.h:703
llvm::ScalableVectorType
Class to represent scalable SIMD vectors.
Definition:DerivedTypes.h:610
llvm::ScalableVectorType::get
static ScalableVectorType * get(Type *ElementType, const ScalableVectorType *SVTy)
Definition:DerivedTypes.h:618
llvm::ScalableVectorType::getInteger
static ScalableVectorType * getInteger(ScalableVectorType *VTy)
Definition:DerivedTypes.h:623
llvm::ScalableVectorType::get
static ScalableVectorType * get(Type *ElementType, unsigned MinNumElts)
Definition:Type.cpp:812
llvm::ScalableVectorType::classof
static bool classof(const Type *T)
Definition:DerivedTypes.h:660
llvm::ScalableVectorType::getExtendedElementVectorType
static ScalableVectorType * getExtendedElementVectorType(ScalableVectorType *VTy)
Definition:DerivedTypes.h:628
llvm::ScalableVectorType::getHalfElementsVectorType
static ScalableVectorType * getHalfElementsVectorType(ScalableVectorType *VTy)
Definition:DerivedTypes.h:646
llvm::ScalableVectorType::getSubdividedVectorType
static ScalableVectorType * getSubdividedVectorType(ScalableVectorType *VTy, int NumSubdivs)
Definition:DerivedTypes.h:639
llvm::ScalableVectorType::getDoubleElementsVectorType
static ScalableVectorType * getDoubleElementsVectorType(ScalableVectorType *VTy)
Definition:DerivedTypes.h:651
llvm::ScalableVectorType::getMinNumElements
unsigned getMinNumElements() const
Get the minimum number of elements in this vector.
Definition:DerivedTypes.h:658
llvm::ScalableVectorType::ScalableVectorType
ScalableVectorType(Type *ElTy, unsigned MinNumElts)
Definition:DerivedTypes.h:612
llvm::ScalableVectorType::getTruncatedElementVectorType
static ScalableVectorType * getTruncatedElementVectorType(ScalableVectorType *VTy)
Definition:DerivedTypes.h:634
llvm::SmallPtrSetImpl
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
Definition:SmallPtrSet.h:363
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition:StringRef.h:51
llvm::StructType
Class to represent struct types.
Definition:DerivedTypes.h:218
llvm::StructType::classof
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition:DerivedTypes.h:377
llvm::StructType::create
static std::enable_if_t< are_base_of< Type, Tys... >::value, StructType * > create(StringRef Name, Type *elt1, Tys *... elts)
Definition:DerivedTypes.h:257
llvm::StructType::indexValid
bool indexValid(const Value *V) const
Definition:Type.cpp:717
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::StructType::element_end
element_iterator element_end() const
Definition:DerivedTypes.h:356
llvm::StructType::StructType
StructType(const StructType &)=delete
llvm::StructType::elements
ArrayRef< Type * > elements() const
Definition:DerivedTypes.h:357
llvm::StructType::setBody
void setBody(ArrayRef< Type * > Elements, bool isPacked=false)
Specify a body for an opaque identified type, which must not make the type recursive.
Definition:Type.cpp:527
llvm::StructType::containsHomogeneousScalableVectorTypes
bool containsHomogeneousScalableVectorTypes() const
Returns true if this struct contains homogeneous scalable vector types.
Definition:Type.cpp:516
llvm::StructType::checkBody
Error checkBody(ArrayRef< Type * > Elements)
Return an error if the body for an opaque identified type would make it recursive.
Definition:Type.cpp:549
llvm::StructType::containsNonLocalTargetExtType
bool containsNonLocalTargetExtType() const
llvm::StructType::containsHomogeneousTypes
bool containsHomogeneousTypes() const
Return true if this struct is non-empty and all element types are the same.
Definition:Type.cpp:522
llvm::StructType::element_begin
element_iterator element_begin() const
Definition:DerivedTypes.h:355
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:731
llvm::StructType::create
static StructType * create(LLVMContext &Context, StringRef Name)
This creates an identified struct.
Definition:Type.cpp:612
llvm::StructType::isPacked
bool isPacked() const
Definition:DerivedTypes.h:284
llvm::StructType::isValidElementType
static bool isValidElementType(Type *ElemTy)
Return true if the specified type is valid as a element type.
Definition:Type.cpp:696
llvm::StructType::getNumElements
unsigned getNumElements() const
Random access to the elements.
Definition:DerivedTypes.h:365
llvm::StructType::isSized
bool isSized(SmallPtrSetImpl< Type * > *Visited=nullptr) const
isSized - Return true if this is a sized type.
Definition:Type.cpp:651
llvm::StructType::getTypeAtIndex
Type * getTypeAtIndex(unsigned N) const
Definition:DerivedTypes.h:372
llvm::StructType::operator=
StructType & operator=(const StructType &)=delete
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:561
llvm::StructType::isLayoutIdentical
bool isLayoutIdentical(StructType *Other) const
Return true if this is layout identical to the specified struct.
Definition:Type.cpp:702
llvm::StructType::isScalableTy
bool isScalableTy() const
llvm::StructType::setBodyOrError
Error setBodyOrError(ArrayRef< Type * > Elements, bool isPacked=false)
Specify a body for an opaque identified type or return an error if it would make the type recursive.
Definition:Type.cpp:531
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:711
llvm::StructType::hasName
bool hasName() const
Return true if this is a named struct that has a non-empty name.
Definition:DerivedTypes.h:326
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:288
llvm::StructType::indexValid
bool indexValid(unsigned Idx) const
Definition:DerivedTypes.h:374
llvm::StructType::containsNonGlobalTargetExtType
bool containsNonGlobalTargetExtType() const
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:292
llvm::StructType::getElementType
Type * getElementType(unsigned N) const
Definition:DerivedTypes.h:366
llvm::StructType::element_iterator
Type::subtype_iterator element_iterator
Definition:DerivedTypes.h:353
llvm::StructType::get
static std::enable_if_t< are_base_of< Type, Tys... >::value, StructType * > get(Type *elt1, Tys *... elts)
This static method is a convenience method for creating structure types by specifying the elements as...
Definition:DerivedTypes.h:274
llvm::StructType::getName
StringRef getName() const
Return the name for this struct type if it has an identity.
Definition:Type.cpp:689
llvm::SymbolTableEntry
Symbol info for RuntimeDyld.
Definition:RuntimeDyldImpl.h:218
llvm::TargetExtType
Class to represent target extensions types, which are generally unintrospectable from target-independ...
Definition:DerivedTypes.h:744
llvm::TargetExtType::type_params
ArrayRef< Type * > type_params() const
Return the type parameters for this particular target extension type.
Definition:DerivedTypes.h:782
llvm::TargetExtType::getNumIntParameters
unsigned getNumIntParameters() const
Definition:DerivedTypes.h:802
llvm::TargetExtType::type_param_end
type_param_iterator type_param_end() const
Definition:DerivedTypes.h:788
llvm::TargetExtType::type_param_iterator
Type::subtype_iterator type_param_iterator
Definition:DerivedTypes.h:786
llvm::TargetExtType::get
static TargetExtType * get(LLVMContext &Context, StringRef Name, ArrayRef< Type * > Types={}, ArrayRef< unsigned > Ints={})
Return a target extension type having the specified name and optional type and integer parameters.
Definition:Type.cpp:895
llvm::TargetExtType::getTypeParameter
Type * getTypeParameter(unsigned i) const
Definition:DerivedTypes.h:792
llvm::TargetExtType::getNumTypeParameters
unsigned getNumTypeParameters() const
Definition:DerivedTypes.h:793
llvm::TargetExtType::int_params
ArrayRef< unsigned > int_params() const
Return the integer parameters for this particular target extension type.
Definition:DerivedTypes.h:797
llvm::TargetExtType::type_param_begin
type_param_iterator type_param_begin() const
Definition:DerivedTypes.h:787
llvm::TargetExtType::checkParams
static Expected< TargetExtType * > checkParams(TargetExtType *TTy)
Check that a newly created target extension type has the expected number of type parameters and integ...
Definition:Type.cpp:929
llvm::TargetExtType::getIntParameter
unsigned getIntParameter(unsigned i) const
Definition:DerivedTypes.h:801
llvm::TargetExtType::TargetExtType
TargetExtType(const TargetExtType &)=delete
llvm::TargetExtType::hasProperty
bool hasProperty(Property Prop) const
Returns true if the target extension type contains the given property.
Definition:Type.cpp:1014
llvm::TargetExtType::operator=
TargetExtType & operator=(const TargetExtType &)=delete
llvm::TargetExtType::Property
Property
Definition:DerivedTypes.h:804
llvm::TargetExtType::HasZeroInit
@ HasZeroInit
zeroinitializer is valid for this target extension type.
Definition:DerivedTypes.h:806
llvm::TargetExtType::CanBeGlobal
@ CanBeGlobal
This type may be used as the value type of a global variable.
Definition:DerivedTypes.h:808
llvm::TargetExtType::CanBeLocal
@ CanBeLocal
This type may be allocated on the stack, either as the allocated type of an alloca instruction or as ...
Definition:DerivedTypes.h:811
llvm::TargetExtType::getName
StringRef getName() const
Return the name for this target extension type.
Definition:DerivedTypes.h:778
llvm::TargetExtType::getOrError
static Expected< TargetExtType * > getOrError(LLVMContext &Context, StringRef Name, ArrayRef< Type * > Types={}, ArrayRef< unsigned > Ints={})
Return a target extension type having the specified name and optional type and integer parameters,...
Definition:Type.cpp:901
llvm::TargetExtType::getLayoutType
Type * getLayoutType() const
Returns an underlying layout type for the target extension type.
Definition:Type.cpp:1010
llvm::TargetExtType::classof
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition:DerivedTypes.h:824
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition:Type.h:45
llvm::Type::getHalfTy
static Type * getHalfTy(LLVMContext &C)
llvm::Type::getIntegerBitWidth
unsigned getIntegerBitWidth() const
llvm::Type::getStructElementType
Type * getStructElementType(unsigned N) const
llvm::Type::isIntOrIntVectorTy
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
Definition:Type.h:243
llvm::Type::getStructName
StringRef getStructName() const
llvm::Type::subtype_iterator
Type *const * subtype_iterator
Definition:Type.h:364
llvm::Type::getStructNumElements
unsigned getStructNumElements() const
llvm::Type::getPointerAddressSpace
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
llvm::Type::getArrayNumElements
uint64_t getArrayNumElements() const
llvm::Type::containsNonLocalTargetExtType
bool containsNonLocalTargetExtType() const
llvm::Type::TypeID
TypeID
Definitions of all of the base types for the Type system.
Definition:Type.h:54
llvm::Type::FunctionTyID
@ FunctionTyID
Functions.
Definition:Type.h:71
llvm::Type::ArrayTyID
@ ArrayTyID
Arrays.
Definition:Type.h:74
llvm::Type::TargetExtTyID
@ TargetExtTyID
Target extension type.
Definition:Type.h:78
llvm::Type::ScalableVectorTyID
@ ScalableVectorTyID
Scalable SIMD vector type.
Definition:Type.h:76
llvm::Type::FloatTyID
@ FloatTyID
32-bit floating point type
Definition:Type.h:58
llvm::Type::StructTyID
@ StructTyID
Structures.
Definition:Type.h:73
llvm::Type::IntegerTyID
@ IntegerTyID
Arbitrary bit width integers.
Definition:Type.h:70
llvm::Type::FixedVectorTyID
@ FixedVectorTyID
Fixed width SIMD vector type.
Definition:Type.h:75
llvm::Type::DoubleTyID
@ DoubleTyID
64-bit floating point type
Definition:Type.h:59
llvm::Type::PointerTyID
@ PointerTyID
Pointers.
Definition:Type.h:72
llvm::Type::getNumContainedTypes
unsigned getNumContainedTypes() const
Return the number of types in the derived type.
Definition:Type.h:390
llvm::Type::NumContainedTys
unsigned NumContainedTys
Keeps track of how many Type*'s there are in the ContainedTys list.
Definition:Type.h:106
llvm::Type::getIntNTy
static IntegerType * getIntNTy(LLVMContext &C, unsigned N)
llvm::Type::getTargetExtName
StringRef getTargetExtName() const
llvm::Type::getScalarSizeInBits
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
llvm::Type::getWithNewBitWidth
Type * getWithNewBitWidth(unsigned NewBitWidth) const
Given an integer or vector type, change the lane bitwidth to NewBitwidth, whilst keeping the old numb...
llvm::Type::getWithNewType
Type * getWithNewType(Type *EltTy) const
Given vector type, change the element type, whilst keeping the old number of elements.
llvm::Type::getContext
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
Definition:Type.h:128
llvm::Type::ContainedTys
Type *const * ContainedTys
A pointer to the array of Types contained by this Type.
Definition:Type.h:113
llvm::Type::getSubclassData
unsigned getSubclassData() const
Definition:Type.h:97
llvm::Type::isFunctionVarArg
bool isFunctionVarArg() const
llvm::Type::setSubclassData
void setSubclassData(unsigned val)
Definition:Type.h:99
llvm::Type::isFloatingPointTy
bool isFloatingPointTy() const
Return true if this is one of the floating-point types.
Definition:Type.h:184
llvm::Type::isScalableTy
bool isScalableTy() const
llvm::Type::getExtendedType
Type * getExtendedType() const
Given scalar/vector integer type, returns a type with elements twice as wide as in the original type.
llvm::Type::getFloatTy
static Type * getFloatTy(LLVMContext &C)
llvm::Type::getTypeID
TypeID getTypeID() const
Return the type id for the type.
Definition:Type.h:136
llvm::Type::getFunctionParamType
Type * getFunctionParamType(unsigned i) const
llvm::Type::getPrimitiveSizeInBits
TypeSize getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
llvm::Type::getContainedType
Type * getContainedType(unsigned i) const
This method is used to implement the type iterator (defined at the end of the file).
Definition:Type.h:384
llvm::Type::containsNonGlobalTargetExtType
bool containsNonGlobalTargetExtType() const
llvm::Type::getFunctionNumParams
unsigned getFunctionNumParams() const
llvm::Type::getScalarType
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
Definition:Type.h:355
llvm::Value
LLVM Value Representation.
Definition:Value.h:74
llvm::VectorType
Base class of all SIMD vector types.
Definition:DerivedTypes.h:427
llvm::VectorType::getHalfElementsVectorType
static VectorType * getHalfElementsVectorType(VectorType *VTy)
This static method returns a VectorType with half as many elements as the input type and the same ele...
Definition:DerivedTypes.h:531
llvm::VectorType::getExtendedElementVectorType
static VectorType * getExtendedElementVectorType(VectorType *VTy)
This static method is like getInteger except that the element types are twice as wide as the elements...
Definition:DerivedTypes.h:487
llvm::VectorType::classof
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition:DerivedTypes.h:556
llvm::VectorType::getElementCount
ElementCount getElementCount() const
Return an ElementCount instance to represent the (possibly scalable) number of elements in the vector...
Definition:DerivedTypes.h:665
llvm::VectorType::getSubdividedVectorType
static VectorType * getSubdividedVectorType(VectorType *VTy, int NumSubdivs)
Definition:DerivedTypes.h:521
llvm::VectorType::getInteger
static VectorType * getInteger(VectorType *VTy)
This static method gets a VectorType with the same number of elements as the input type,...
Definition:DerivedTypes.h:478
llvm::VectorType::get
static VectorType * get(Type *ElementType, ElementCount EC)
This static method is the primary way to construct an VectorType.
llvm::VectorType::ElementQuantity
const unsigned ElementQuantity
The element quantity of this vector.
Definition:DerivedTypes.h:452
llvm::VectorType::get
static VectorType * get(Type *ElementType, const VectorType *Other)
Definition:DerivedTypes.h:471
llvm::VectorType::getTruncatedElementVectorType
static VectorType * getTruncatedElementVectorType(VectorType *VTy)
Definition:DerivedTypes.h:496
llvm::VectorType::isValidElementType
static bool isValidElementType(Type *ElemTy)
Return true if the specified type is valid as a element type.
llvm::VectorType::operator=
VectorType & operator=(const VectorType &)=delete
llvm::VectorType::getDoubleElementsVectorType
static VectorType * getDoubleElementsVectorType(VectorType *VTy)
This static method returns a VectorType with twice as many elements as the input type and the same el...
Definition:DerivedTypes.h:541
llvm::VectorType::get
static VectorType * get(Type *ElementType, unsigned NumElements, bool Scalable)
Definition:DerivedTypes.h:465
llvm::VectorType::VectorType
VectorType(const VectorType &)=delete
llvm::VectorType::getElementType
Type * getElementType() const
Definition:DerivedTypes.h:460
uint64_t
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition:ErrorHandling.h:143
llvm::CallingConv::C
@ C
The default llvm calling convention, compatible with C.
Definition:CallingConv.h:34
llvm::NVPTXAS::AddressSpace
AddressSpace
Definition:NVPTXAddrSpace.h:20
llvm::TargetStackID::Value
Value
Definition:TargetFrameLowering.h:29
llvm::lltok::Error
@ Error
Definition:LLToken.h:21
llvm::msgpack::Type
Type
MessagePack types as defined in the standard, with the exception of Integer being divided into a sign...
Definition:MsgPackReader.h:53
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:AddressRanges.h:18
llvm::are_base_of
std::conjunction< std::is_base_of< T, Ts >... > are_base_of
traits class for checking whether type T is a base class for all the given types in the variadic list...
Definition:STLExtras.h:134
llvm::IRMemLocation::Other
@ Other
Any other memory.
N
#define N
EQ
#define EQ(a, b)
Definition:regexec.c:112

Generated on Thu Jul 17 2025 10:05:03 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp