1 //===- CodeGen/ValueTypes.h - Low-Level Target independ. types --*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the set of low-level target independent types which various
11 // values in the code generator are. This allows the target specific behavior
12 // of instructions to be described to target independent passes.
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_CODEGEN_VALUETYPES_H
17 #define LLVM_CODEGEN_VALUETYPES_H
19 #include "llvm/Support/DataTypes.h"
20 #include "llvm/Support/ErrorHandling.h"
21 #include "llvm/Support/MathExtras.h"
30 /// MVT - Machine Value Type. Every type that is supported natively by some
31 /// processor targeted by LLVM occurs here. This means that any legal value
32 /// type can be represented by a MVT.
35 enum SimpleValueType {
36 // INVALID_SIMPLE_VALUE_TYPE - Simple value types less than zero are
37 // considered extended value types.
38 INVALID_SIMPLE_VALUE_TYPE = -1,
40 // If you change this numbering, you must change the values in
41 // ValueTypes.td as well!
42 Other = 0, // This is a non-standard value
43 i1 = 1, // This is a 1 bit integer value
44 i8 = 2, // This is an 8 bit integer value
45 i16 = 3, // This is a 16 bit integer value
46 i32 = 4, // This is a 32 bit integer value
47 i64 = 5, // This is a 64 bit integer value
48 i128 = 6, // This is a 128 bit integer value
50 FIRST_INTEGER_VALUETYPE = i1,
51 LAST_INTEGER_VALUETYPE = i128,
53 f16 = 7, // This is a 16 bit floating point value
54 f32 = 8, // This is a 32 bit floating point value
55 f64 = 9, // This is a 64 bit floating point value
56 f80 = 10, // This is a 80 bit floating point value
57 f128 = 11, // This is a 128 bit floating point value
58 ppcf128 = 12, // This is a PPC 128-bit floating point value
60 FIRST_FP_VALUETYPE = f16,
61 LAST_FP_VALUETYPE = ppcf128,
66 v16i1 = 16, // 16 x i1
67 v32i1 = 17, // 32 x i1
68 v64i1 = 18, // 64 x i1
73 v16i8 = 22, // 16 x i8
74 v32i8 = 23, // 32 x i8
75 v64i8 = 24, // 64 x i8
76 v1i16 = 25, // 1 x i16
77 v2i16 = 26, // 2 x i16
78 v4i16 = 27, // 4 x i16
79 v8i16 = 28, // 8 x i16
80 v16i16 = 29, // 16 x i16
81 v32i16 = 30, // 32 x i16
82 v1i32 = 31, // 1 x i32
83 v2i32 = 32, // 2 x i32
84 v4i32 = 33, // 4 x i32
85 v8i32 = 34, // 8 x i32
86 v16i32 = 35, // 16 x i32
87 v1i64 = 36, // 1 x i64
88 v2i64 = 37, // 2 x i64
89 v4i64 = 38, // 4 x i64
90 v8i64 = 39, // 8 x i64
91 v16i64 = 40, // 16 x i64
93 FIRST_INTEGER_VECTOR_VALUETYPE = v2i1,
94 LAST_INTEGER_VECTOR_VALUETYPE = v16i64,
96 v2f16 = 41, // 2 x f16
97 v2f32 = 42, // 2 x f32
98 v4f32 = 43, // 4 x f32
99 v8f32 = 44, // 8 x f32
100 v16f32 = 45, // 16 x f32
101 v2f64 = 46, // 2 x f64
102 v4f64 = 47, // 4 x f64
103 v8f64 = 48, // 8 x f64
105 FIRST_FP_VECTOR_VALUETYPE = v2f16,
106 LAST_FP_VECTOR_VALUETYPE = v8f64,
108 FIRST_VECTOR_VALUETYPE = v2i1,
109 LAST_VECTOR_VALUETYPE = v8f64,
111 x86mmx = 49, // This is an X86 MMX value
113 Glue = 50, // This glues nodes together during pre-RA sched
115 isVoid = 51, // This has no value
117 Untyped = 52, // This value takes a register, but has
118 // unspecified type. The register class
119 // will be determined by the opcode.
121 LAST_VALUETYPE = 53, // This always remains at the end of the list.
123 // This is the current maximum for LAST_VALUETYPE.
124 // MVT::MAX_ALLOWED_VALUETYPE is used for asserts and to size bit vectors
125 // This value must be a multiple of 32.
126 MAX_ALLOWED_VALUETYPE = 64,
128 // Metadata - This is MDNode or MDString.
131 // iPTRAny - An int value the size of the pointer of the current
132 // target to any address space. This must only be used internal to
133 // tblgen. Other than for overloading, we treat iPTRAny the same as iPTR.
136 // vAny - A vector with any length and element size. This is used
137 // for intrinsics that have overloadings based on vector types.
138 // This is only for tblgen's consumption!
141 // fAny - Any floating-point or vector floating-point value. This is used
142 // for intrinsics that have overloadings based on floating-point types.
143 // This is only for tblgen's consumption!
146 // iAny - An integer or vector integer value of any bit width. This is
147 // used for intrinsics that have overloadings based on integer bit widths.
148 // This is only for tblgen's consumption!
151 // iPTR - An int value the size of the pointer of the current
152 // target. This should only be used internal to tblgen!
156 SimpleValueType SimpleTy;
158 MVT() : SimpleTy((SimpleValueType)(INVALID_SIMPLE_VALUE_TYPE)) {}
159 MVT(SimpleValueType SVT) : SimpleTy(SVT) { }
161 bool operator>(const MVT& S) const { return SimpleTy > S.SimpleTy; }
162 bool operator<(const MVT& S) const { return SimpleTy < S.SimpleTy; }
163 bool operator==(const MVT& S) const { return SimpleTy == S.SimpleTy; }
164 bool operator!=(const MVT& S) const { return SimpleTy != S.SimpleTy; }
165 bool operator>=(const MVT& S) const { return SimpleTy >= S.SimpleTy; }
166 bool operator<=(const MVT& S) const { return SimpleTy <= S.SimpleTy; }
168 /// isFloatingPoint - Return true if this is a FP, or a vector FP type.
169 bool isFloatingPoint() const {
170 return ((SimpleTy >= MVT::FIRST_FP_VALUETYPE &&
171 SimpleTy <= MVT::LAST_FP_VALUETYPE) ||
172 (SimpleTy >= MVT::FIRST_FP_VECTOR_VALUETYPE &&
173 SimpleTy <= MVT::LAST_FP_VECTOR_VALUETYPE));
176 /// isInteger - Return true if this is an integer, or a vector integer type.
177 bool isInteger() const {
178 return ((SimpleTy >= MVT::FIRST_INTEGER_VALUETYPE &&
179 SimpleTy <= MVT::LAST_INTEGER_VALUETYPE) ||
180 (SimpleTy >= MVT::FIRST_INTEGER_VECTOR_VALUETYPE &&
181 SimpleTy <= MVT::LAST_INTEGER_VECTOR_VALUETYPE));
184 /// isVector - Return true if this is a vector value type.
185 bool isVector() const {
186 return (SimpleTy >= MVT::FIRST_VECTOR_VALUETYPE &&
187 SimpleTy <= MVT::LAST_VECTOR_VALUETYPE);
190 /// is16BitVector - Return true if this is a 16-bit vector type.
191 bool is16BitVector() const {
192 return (SimpleTy == MVT::v2i8 || SimpleTy == MVT::v1i16 ||
193 SimpleTy == MVT::v16i1);
196 /// is32BitVector - Return true if this is a 32-bit vector type.
197 bool is32BitVector() const {
198 return (SimpleTy == MVT::v4i8 || SimpleTy == MVT::v2i16 ||
199 SimpleTy == MVT::v1i32);
202 /// is64BitVector - Return true if this is a 64-bit vector type.
203 bool is64BitVector() const {
204 return (SimpleTy == MVT::v8i8 || SimpleTy == MVT::v4i16 ||
205 SimpleTy == MVT::v2i32 || SimpleTy == MVT::v1i64 ||
206 SimpleTy == MVT::v2f32);
209 /// is128BitVector - Return true if this is a 128-bit vector type.
210 bool is128BitVector() const {
211 return (SimpleTy == MVT::v16i8 || SimpleTy == MVT::v8i16 ||
212 SimpleTy == MVT::v4i32 || SimpleTy == MVT::v2i64 ||
213 SimpleTy == MVT::v4f32 || SimpleTy == MVT::v2f64);
216 /// is256BitVector - Return true if this is a 256-bit vector type.
217 bool is256BitVector() const {
218 return (SimpleTy == MVT::v8f32 || SimpleTy == MVT::v4f64 ||
219 SimpleTy == MVT::v32i8 || SimpleTy == MVT::v16i16 ||
220 SimpleTy == MVT::v8i32 || SimpleTy == MVT::v4i64);
223 /// is512BitVector - Return true if this is a 512-bit vector type.
224 bool is512BitVector() const {
225 return (SimpleTy == MVT::v8f64 || SimpleTy == MVT::v16f32 ||
226 SimpleTy == MVT::v64i8 || SimpleTy == MVT::v32i16 ||
227 SimpleTy == MVT::v8i64 || SimpleTy == MVT::v16i32);
230 /// is1024BitVector - Return true if this is a 1024-bit vector type.
231 bool is1024BitVector() const {
232 return (SimpleTy == MVT::v16i64);
235 /// isPow2VectorType - Returns true if the given vector is a power of 2.
236 bool isPow2VectorType() const {
237 unsigned NElts = getVectorNumElements();
238 return !(NElts & (NElts - 1));
241 /// getPow2VectorType - Widens the length of the given vector MVT up to
242 /// the nearest power of 2 and returns that type.
243 MVT getPow2VectorType() const {
244 if (isPow2VectorType())
247 unsigned NElts = getVectorNumElements();
248 unsigned Pow2NElts = 1 << Log2_32_Ceil(NElts);
249 return MVT::getVectorVT(getVectorElementType(), Pow2NElts);
252 /// getScalarType - If this is a vector type, return the element type,
253 /// otherwise return this.
254 MVT getScalarType() const {
255 return isVector() ? getVectorElementType() : *this;
258 MVT getVectorElementType() const {
261 llvm_unreachable("Not a vector MVT!");
267 case v64i1: return i1;
273 case v64i8: return i8;
279 case v32i16: return i16;
284 case v16i32: return i32;
289 case v16i64: return i64;
290 case v2f16: return f16;
294 case v16f32: return f32;
297 case v8f64: return f64;
301 unsigned getVectorNumElements() const {
304 llvm_unreachable("Not a vector MVT!");
307 case v32i16: return 32;
309 case v64i8: return 64;
315 case v16f32: return 16;
322 case v8f64: return 8;
329 case v4f64: return 4;
337 case v2f64: return 2;
340 case v1i64: return 1;
344 unsigned getSizeInBits() const {
347 llvm_unreachable("Value type size is target-dependent. Ask TLI.");
352 llvm_unreachable("Value type is overloaded.");
354 llvm_unreachable("Value type is metadata.");
356 llvm_unreachable("getSizeInBits called on extended MVT.");
366 case v1i16: return 16;
373 case v1i32: return 32;
382 case v2f32: return 64;
383 case f80 : return 80;
392 case v2f64: return 128;
398 case v4f64: return 256;
404 case v8f64: return 512;
405 case v16i64:return 1024;
409 /// getStoreSize - Return the number of bytes overwritten by a store
410 /// of the specified value type.
411 unsigned getStoreSize() const {
412 return (getSizeInBits() + 7) / 8;
415 /// getStoreSizeInBits - Return the number of bits overwritten by a store
416 /// of the specified value type.
417 unsigned getStoreSizeInBits() const {
418 return getStoreSize() * 8;
421 /// Return true if this has more bits than VT.
422 bool bitsGT(MVT VT) const {
423 return getSizeInBits() > VT.getSizeInBits();
426 /// Return true if this has no less bits than VT.
427 bool bitsGE(MVT VT) const {
428 return getSizeInBits() >= VT.getSizeInBits();
431 /// Return true if this has less bits than VT.
432 bool bitsLT(MVT VT) const {
433 return getSizeInBits() < VT.getSizeInBits();
436 /// Return true if this has no more bits than VT.
437 bool bitsLE(MVT VT) const {
438 return getSizeInBits() <= VT.getSizeInBits();
442 static MVT getFloatingPointVT(unsigned BitWidth) {
445 llvm_unreachable("Bad bit width!");
459 static MVT getIntegerVT(unsigned BitWidth) {
462 return (MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE);
478 static MVT getVectorVT(MVT VT, unsigned NumElements) {
479 switch (VT.SimpleTy) {
483 if (NumElements == 2) return MVT::v2i1;
484 if (NumElements == 4) return MVT::v4i1;
485 if (NumElements == 8) return MVT::v8i1;
486 if (NumElements == 16) return MVT::v16i1;
487 if (NumElements == 32) return MVT::v32i1;
488 if (NumElements == 64) return MVT::v64i1;
491 if (NumElements == 2) return MVT::v2i8;
492 if (NumElements == 4) return MVT::v4i8;
493 if (NumElements == 8) return MVT::v8i8;
494 if (NumElements == 16) return MVT::v16i8;
495 if (NumElements == 32) return MVT::v32i8;
496 if (NumElements == 64) return MVT::v64i8;
499 if (NumElements == 1) return MVT::v1i16;
500 if (NumElements == 2) return MVT::v2i16;
501 if (NumElements == 4) return MVT::v4i16;
502 if (NumElements == 8) return MVT::v8i16;
503 if (NumElements == 16) return MVT::v16i16;
504 if (NumElements == 32) return MVT::v32i16;
507 if (NumElements == 1) return MVT::v1i32;
508 if (NumElements == 2) return MVT::v2i32;
509 if (NumElements == 4) return MVT::v4i32;
510 if (NumElements == 8) return MVT::v8i32;
511 if (NumElements == 16) return MVT::v16i32;
514 if (NumElements == 1) return MVT::v1i64;
515 if (NumElements == 2) return MVT::v2i64;
516 if (NumElements == 4) return MVT::v4i64;
517 if (NumElements == 8) return MVT::v8i64;
518 if (NumElements == 16) return MVT::v16i64;
521 if (NumElements == 2) return MVT::v2f16;
524 if (NumElements == 2) return MVT::v2f32;
525 if (NumElements == 4) return MVT::v4f32;
526 if (NumElements == 8) return MVT::v8f32;
527 if (NumElements == 16) return MVT::v16f32;
530 if (NumElements == 2) return MVT::v2f64;
531 if (NumElements == 4) return MVT::v4f64;
532 if (NumElements == 8) return MVT::v8f64;
535 return (MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE);
538 /// Return the value type corresponding to the specified type. This returns
539 /// all pointers as iPTR. If HandleUnknown is true, unknown types are
540 /// returned as Other, otherwise they are invalid.
541 static MVT getVT(Type *Ty, bool HandleUnknown = false);
546 /// EVT - Extended Value Type. Capable of holding value types which are not
547 /// native for any processor (such as the i12345 type), as well as the types
548 /// a MVT can represent.
555 EVT() : V((MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE)),
557 EVT(MVT::SimpleValueType SVT) : V(SVT), LLVMTy(0) { }
558 EVT(MVT S) : V(S), LLVMTy(0) {}
560 bool operator==(EVT VT) const {
561 return !(*this != VT);
563 bool operator!=(EVT VT) const {
564 if (V.SimpleTy != VT.V.SimpleTy)
567 return LLVMTy != VT.LLVMTy;
571 /// getFloatingPointVT - Returns the EVT that represents a floating point
572 /// type with the given number of bits. There are two floating point types
573 /// with 128 bits - this returns f128 rather than ppcf128.
574 static EVT getFloatingPointVT(unsigned BitWidth) {
575 return MVT::getFloatingPointVT(BitWidth);
578 /// getIntegerVT - Returns the EVT that represents an integer with the given
580 static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth) {
581 MVT M = MVT::getIntegerVT(BitWidth);
584 return getExtendedIntegerVT(Context, BitWidth);
587 /// getVectorVT - Returns the EVT that represents a vector NumElements in
588 /// length, where each element is of type VT.
589 static EVT getVectorVT(LLVMContext &Context, EVT VT, unsigned NumElements) {
590 MVT M = MVT::getVectorVT(VT.V, NumElements);
593 return getExtendedVectorVT(Context, VT, NumElements);
596 /// changeVectorElementTypeToInteger - Return a vector with the same number
597 /// of elements as this vector, but with the element type converted to an
598 /// integer type with the same bitwidth.
599 EVT changeVectorElementTypeToInteger() const {
601 return changeExtendedVectorElementTypeToInteger();
602 MVT EltTy = getSimpleVT().getVectorElementType();
603 unsigned BitWidth = EltTy.getSizeInBits();
604 MVT IntTy = MVT::getIntegerVT(BitWidth);
605 MVT VecTy = MVT::getVectorVT(IntTy, getVectorNumElements());
606 assert(VecTy.SimpleTy >= 0 &&
607 "Simple vector VT not representable by simple integer vector VT!");
611 /// isSimple - Test if the given EVT is simple (as opposed to being
613 bool isSimple() const {
614 return V.SimpleTy >= 0;
617 /// isExtended - Test if the given EVT is extended (as opposed to
619 bool isExtended() const {
623 /// isFloatingPoint - Return true if this is a FP, or a vector FP type.
624 bool isFloatingPoint() const {
625 return isSimple() ? V.isFloatingPoint() : isExtendedFloatingPoint();
628 /// isInteger - Return true if this is an integer, or a vector integer type.
629 bool isInteger() const {
630 return isSimple() ? V.isInteger() : isExtendedInteger();
633 /// isVector - Return true if this is a vector value type.
634 bool isVector() const {
635 return isSimple() ? V.isVector() : isExtendedVector();
638 /// is16BitVector - Return true if this is a 16-bit vector type.
639 bool is16BitVector() const {
640 return isSimple() ? V.is16BitVector() : isExtended16BitVector();
643 /// is32BitVector - Return true if this is a 32-bit vector type.
644 bool is32BitVector() const {
645 return isSimple() ? V.is32BitVector() : isExtended32BitVector();
648 /// is64BitVector - Return true if this is a 64-bit vector type.
649 bool is64BitVector() const {
650 return isSimple() ? V.is64BitVector() : isExtended64BitVector();
653 /// is128BitVector - Return true if this is a 128-bit vector type.
654 bool is128BitVector() const {
655 return isSimple() ? V.is128BitVector() : isExtended128BitVector();
658 /// is256BitVector - Return true if this is a 256-bit vector type.
659 bool is256BitVector() const {
660 return isSimple() ? V.is256BitVector() : isExtended256BitVector();
663 /// is512BitVector - Return true if this is a 512-bit vector type.
664 bool is512BitVector() const {
665 return isSimple() ? V.is512BitVector() : isExtended512BitVector();
668 /// is1024BitVector - Return true if this is a 1024-bit vector type.
669 bool is1024BitVector() const {
670 return isSimple() ? V.is1024BitVector() : isExtended1024BitVector();
673 /// isOverloaded - Return true if this is an overloaded type for TableGen.
674 bool isOverloaded() const {
675 return (V==MVT::iAny || V==MVT::fAny || V==MVT::vAny || V==MVT::iPTRAny);
678 /// isByteSized - Return true if the bit size is a multiple of 8.
679 bool isByteSized() const {
680 return (getSizeInBits() & 7) == 0;
683 /// isRound - Return true if the size is a power-of-two number of bytes.
684 bool isRound() const {
685 unsigned BitSize = getSizeInBits();
686 return BitSize >= 8 && !(BitSize & (BitSize - 1));
689 /// bitsEq - Return true if this has the same number of bits as VT.
690 bool bitsEq(EVT VT) const {
691 if (EVT::operator==(VT)) return true;
692 return getSizeInBits() == VT.getSizeInBits();
695 /// bitsGT - Return true if this has more bits than VT.
696 bool bitsGT(EVT VT) const {
697 if (EVT::operator==(VT)) return false;
698 return getSizeInBits() > VT.getSizeInBits();
701 /// bitsGE - Return true if this has no less bits than VT.
702 bool bitsGE(EVT VT) const {
703 if (EVT::operator==(VT)) return true;
704 return getSizeInBits() >= VT.getSizeInBits();
707 /// bitsLT - Return true if this has less bits than VT.
708 bool bitsLT(EVT VT) const {
709 if (EVT::operator==(VT)) return false;
710 return getSizeInBits() < VT.getSizeInBits();
713 /// bitsLE - Return true if this has no more bits than VT.
714 bool bitsLE(EVT VT) const {
715 if (EVT::operator==(VT)) return true;
716 return getSizeInBits() <= VT.getSizeInBits();
720 /// getSimpleVT - Return the SimpleValueType held in the specified
722 MVT getSimpleVT() const {
723 assert(isSimple() && "Expected a SimpleValueType!");
727 /// getScalarType - If this is a vector type, return the element type,
728 /// otherwise return this.
729 EVT getScalarType() const {
730 return isVector() ? getVectorElementType() : *this;
733 /// getVectorElementType - Given a vector type, return the type of
735 EVT getVectorElementType() const {
736 assert(isVector() && "Invalid vector type!");
738 return V.getVectorElementType();
739 return getExtendedVectorElementType();
742 /// getVectorNumElements - Given a vector type, return the number of
743 /// elements it contains.
744 unsigned getVectorNumElements() const {
745 assert(isVector() && "Invalid vector type!");
747 return V.getVectorNumElements();
748 return getExtendedVectorNumElements();
751 /// getSizeInBits - Return the size of the specified value type in bits.
752 unsigned getSizeInBits() const {
754 return V.getSizeInBits();
755 return getExtendedSizeInBits();
758 /// getStoreSize - Return the number of bytes overwritten by a store
759 /// of the specified value type.
760 unsigned getStoreSize() const {
761 return (getSizeInBits() + 7) / 8;
764 /// getStoreSizeInBits - Return the number of bits overwritten by a store
765 /// of the specified value type.
766 unsigned getStoreSizeInBits() const {
767 return getStoreSize() * 8;
770 /// getRoundIntegerType - Rounds the bit-width of the given integer EVT up
771 /// to the nearest power of two (and at least to eight), and returns the
772 /// integer EVT with that number of bits.
773 EVT getRoundIntegerType(LLVMContext &Context) const {
774 assert(isInteger() && !isVector() && "Invalid integer type!");
775 unsigned BitWidth = getSizeInBits();
778 return getIntegerVT(Context, 1 << Log2_32_Ceil(BitWidth));
781 /// getHalfSizedIntegerVT - Finds the smallest simple value type that is
782 /// greater than or equal to half the width of this EVT. If no simple
783 /// value type can be found, an extended integer value type of half the
784 /// size (rounded up) is returned.
785 EVT getHalfSizedIntegerVT(LLVMContext &Context) const {
786 assert(isInteger() && !isVector() && "Invalid integer type!");
787 unsigned EVTSize = getSizeInBits();
788 for (unsigned IntVT = MVT::FIRST_INTEGER_VALUETYPE;
789 IntVT <= MVT::LAST_INTEGER_VALUETYPE; ++IntVT) {
790 EVT HalfVT = EVT((MVT::SimpleValueType)IntVT);
791 if (HalfVT.getSizeInBits() * 2 >= EVTSize)
794 return getIntegerVT(Context, (EVTSize + 1) / 2);
797 /// isPow2VectorType - Returns true if the given vector is a power of 2.
798 bool isPow2VectorType() const {
799 unsigned NElts = getVectorNumElements();
800 return !(NElts & (NElts - 1));
803 /// getPow2VectorType - Widens the length of the given vector EVT up to
804 /// the nearest power of 2 and returns that type.
805 EVT getPow2VectorType(LLVMContext &Context) const {
806 if (!isPow2VectorType()) {
807 unsigned NElts = getVectorNumElements();
808 unsigned Pow2NElts = 1 << Log2_32_Ceil(NElts);
809 return EVT::getVectorVT(Context, getVectorElementType(), Pow2NElts);
816 /// getEVTString - This function returns value type as a string,
818 std::string getEVTString() const;
820 /// getTypeForEVT - This method returns an LLVM type corresponding to the
821 /// specified EVT. For integer types, this returns an unsigned type. Note
822 /// that this will abort for types that cannot be represented.
823 Type *getTypeForEVT(LLVMContext &Context) const;
825 /// getEVT - Return the value type corresponding to the specified type.
826 /// This returns all pointers as iPTR. If HandleUnknown is true, unknown
827 /// types are returned as Other, otherwise they are invalid.
828 static EVT getEVT(Type *Ty, bool HandleUnknown = false);
830 intptr_t getRawBits() const {
834 return (intptr_t)(LLVMTy);
837 /// compareRawBits - A meaningless but well-behaved order, useful for
838 /// constructing containers.
839 struct compareRawBits {
840 bool operator()(EVT L, EVT R) const {
841 if (L.V.SimpleTy == R.V.SimpleTy)
842 return L.LLVMTy < R.LLVMTy;
844 return L.V.SimpleTy < R.V.SimpleTy;
849 // Methods for handling the Extended-type case in functions above.
850 // These are all out-of-line to prevent users of this header file
851 // from having a dependency on Type.h.
852 EVT changeExtendedVectorElementTypeToInteger() const;
853 static EVT getExtendedIntegerVT(LLVMContext &C, unsigned BitWidth);
854 static EVT getExtendedVectorVT(LLVMContext &C, EVT VT,
855 unsigned NumElements);
856 bool isExtendedFloatingPoint() const;
857 bool isExtendedInteger() const;
858 bool isExtendedVector() const;
859 bool isExtended16BitVector() const;
860 bool isExtended32BitVector() const;
861 bool isExtended64BitVector() const;
862 bool isExtended128BitVector() const;
863 bool isExtended256BitVector() const;
864 bool isExtended512BitVector() const;
865 bool isExtended1024BitVector() const;
866 EVT getExtendedVectorElementType() const;
867 unsigned getExtendedVectorNumElements() const;
868 unsigned getExtendedSizeInBits() const;
871 } // End llvm namespace