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 an 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 v8f16 = 42, // 8 x f16
98 v2f32 = 43, // 2 x f32
99 v4f32 = 44, // 4 x f32
100 v8f32 = 45, // 8 x f32
101 v16f32 = 46, // 16 x f32
102 v2f64 = 47, // 2 x f64
103 v4f64 = 48, // 4 x f64
104 v8f64 = 49, // 8 x f64
106 FIRST_FP_VECTOR_VALUETYPE = v2f16,
107 LAST_FP_VECTOR_VALUETYPE = v8f64,
109 FIRST_VECTOR_VALUETYPE = v2i1,
110 LAST_VECTOR_VALUETYPE = v8f64,
112 x86mmx = 50, // This is an X86 MMX value
114 Glue = 51, // This glues nodes together during pre-RA sched
116 isVoid = 52, // This has no value
118 Untyped = 53, // This value takes a register, but has
119 // unspecified type. The register class
120 // will be determined by the opcode.
122 LAST_VALUETYPE = 54, // This always remains at the end of the list.
124 // This is the current maximum for LAST_VALUETYPE.
125 // MVT::MAX_ALLOWED_VALUETYPE is used for asserts and to size bit vectors
126 // This value must be a multiple of 32.
127 MAX_ALLOWED_VALUETYPE = 64,
129 // Metadata - This is MDNode or MDString.
132 // iPTRAny - An int value the size of the pointer of the current
133 // target to any address space. This must only be used internal to
134 // tblgen. Other than for overloading, we treat iPTRAny the same as iPTR.
137 // vAny - A vector with any length and element size. This is used
138 // for intrinsics that have overloadings based on vector types.
139 // This is only for tblgen's consumption!
142 // fAny - Any floating-point or vector floating-point value. This is used
143 // for intrinsics that have overloadings based on floating-point types.
144 // This is only for tblgen's consumption!
147 // iAny - An integer or vector integer value of any bit width. This is
148 // used for intrinsics that have overloadings based on integer bit widths.
149 // This is only for tblgen's consumption!
152 // iPTR - An int value the size of the pointer of the current
153 // target. This should only be used internal to tblgen!
157 SimpleValueType SimpleTy;
159 MVT() : SimpleTy((SimpleValueType)(INVALID_SIMPLE_VALUE_TYPE)) {}
160 MVT(SimpleValueType SVT) : SimpleTy(SVT) { }
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; }
167 bool operator<=(const MVT& S) const { return SimpleTy <= S.SimpleTy; }
169 /// isFloatingPoint - Return true if this is a FP, or a vector FP type.
170 bool isFloatingPoint() const {
171 return ((SimpleTy >= MVT::FIRST_FP_VALUETYPE &&
172 SimpleTy <= MVT::LAST_FP_VALUETYPE) ||
173 (SimpleTy >= MVT::FIRST_FP_VECTOR_VALUETYPE &&
174 SimpleTy <= MVT::LAST_FP_VECTOR_VALUETYPE));
177 /// isInteger - Return true if this is an integer, or a vector integer type.
178 bool isInteger() const {
179 return ((SimpleTy >= MVT::FIRST_INTEGER_VALUETYPE &&
180 SimpleTy <= MVT::LAST_INTEGER_VALUETYPE) ||
181 (SimpleTy >= MVT::FIRST_INTEGER_VECTOR_VALUETYPE &&
182 SimpleTy <= MVT::LAST_INTEGER_VECTOR_VALUETYPE));
185 /// isVector - Return true if this is a vector value type.
186 bool isVector() const {
187 return (SimpleTy >= MVT::FIRST_VECTOR_VALUETYPE &&
188 SimpleTy <= MVT::LAST_VECTOR_VALUETYPE);
191 /// is16BitVector - Return true if this is a 16-bit vector type.
192 bool is16BitVector() const {
193 return (SimpleTy == MVT::v2i8 || SimpleTy == MVT::v1i16 ||
194 SimpleTy == MVT::v16i1);
197 /// is32BitVector - Return true if this is a 32-bit vector type.
198 bool is32BitVector() const {
199 return (SimpleTy == MVT::v4i8 || SimpleTy == MVT::v2i16 ||
200 SimpleTy == MVT::v1i32);
203 /// is64BitVector - Return true if this is a 64-bit vector type.
204 bool is64BitVector() const {
205 return (SimpleTy == MVT::v8i8 || SimpleTy == MVT::v4i16 ||
206 SimpleTy == MVT::v2i32 || SimpleTy == MVT::v1i64 ||
207 SimpleTy == MVT::v2f32);
210 /// is128BitVector - Return true if this is a 128-bit vector type.
211 bool is128BitVector() const {
212 return (SimpleTy == MVT::v16i8 || SimpleTy == MVT::v8i16 ||
213 SimpleTy == MVT::v4i32 || SimpleTy == MVT::v2i64 ||
214 SimpleTy == MVT::v4f32 || SimpleTy == MVT::v2f64);
217 /// is256BitVector - Return true if this is a 256-bit vector type.
218 bool is256BitVector() const {
219 return (SimpleTy == MVT::v8f32 || SimpleTy == MVT::v4f64 ||
220 SimpleTy == MVT::v32i8 || SimpleTy == MVT::v16i16 ||
221 SimpleTy == MVT::v8i32 || SimpleTy == MVT::v4i64);
224 /// is512BitVector - Return true if this is a 512-bit vector type.
225 bool is512BitVector() const {
226 return (SimpleTy == MVT::v8f64 || SimpleTy == MVT::v16f32 ||
227 SimpleTy == MVT::v64i8 || SimpleTy == MVT::v32i16 ||
228 SimpleTy == MVT::v8i64 || SimpleTy == MVT::v16i32);
231 /// is1024BitVector - Return true if this is a 1024-bit vector type.
232 bool is1024BitVector() const {
233 return (SimpleTy == MVT::v16i64);
236 /// isPow2VectorType - Returns true if the given vector is a power of 2.
237 bool isPow2VectorType() const {
238 unsigned NElts = getVectorNumElements();
239 return !(NElts & (NElts - 1));
242 /// getPow2VectorType - Widens the length of the given vector MVT up to
243 /// the nearest power of 2 and returns that type.
244 MVT getPow2VectorType() const {
245 if (isPow2VectorType())
248 unsigned NElts = getVectorNumElements();
249 unsigned Pow2NElts = 1 << Log2_32_Ceil(NElts);
250 return MVT::getVectorVT(getVectorElementType(), Pow2NElts);
253 /// getScalarType - If this is a vector type, return the element type,
254 /// otherwise return this.
255 MVT getScalarType() const {
256 return isVector() ? getVectorElementType() : *this;
259 MVT getVectorElementType() const {
262 llvm_unreachable("Not a vector MVT!");
268 case v64i1: return i1;
274 case v64i8: return i8;
280 case v32i16: return i16;
285 case v16i32: return i32;
290 case v16i64: return i64;
292 case v8f16: return f16;
296 case v16f32: return f32;
299 case v8f64: return f64;
303 unsigned getVectorNumElements() const {
306 llvm_unreachable("Not a vector MVT!");
309 case v32i16: return 32;
311 case v64i8: return 64;
317 case v16f32: return 16;
325 case v8f64: return 8;
332 case v4f64: return 4;
340 case v2f64: return 2;
343 case v1i64: return 1;
347 unsigned getSizeInBits() const {
350 llvm_unreachable("getSizeInBits called on extended MVT.");
352 llvm_unreachable("Value type is non-standard value, Other.");
354 llvm_unreachable("Value type size is target-dependent. Ask TLI.");
359 llvm_unreachable("Value type is overloaded.");
361 llvm_unreachable("Value type is metadata.");
371 case v1i16: return 16;
378 case v1i32: return 32;
387 case v2f32: return 64;
388 case f80 : return 80;
398 case v2f64: return 128;
404 case v4f64: return 256;
410 case v8f64: return 512;
411 case v16i64:return 1024;
415 /// getStoreSize - Return the number of bytes overwritten by a store
416 /// of the specified value type.
417 unsigned getStoreSize() const {
418 return (getSizeInBits() + 7) / 8;
421 /// getStoreSizeInBits - Return the number of bits overwritten by a store
422 /// of the specified value type.
423 unsigned getStoreSizeInBits() const {
424 return getStoreSize() * 8;
427 /// Return true if this has more bits than VT.
428 bool bitsGT(MVT VT) const {
429 return getSizeInBits() > VT.getSizeInBits();
432 /// Return true if this has no less bits than VT.
433 bool bitsGE(MVT VT) const {
434 return getSizeInBits() >= VT.getSizeInBits();
437 /// Return true if this has less bits than VT.
438 bool bitsLT(MVT VT) const {
439 return getSizeInBits() < VT.getSizeInBits();
442 /// Return true if this has no more bits than VT.
443 bool bitsLE(MVT VT) const {
444 return getSizeInBits() <= VT.getSizeInBits();
448 static MVT getFloatingPointVT(unsigned BitWidth) {
451 llvm_unreachable("Bad bit width!");
465 static MVT getIntegerVT(unsigned BitWidth) {
468 return (MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE);
484 static MVT getVectorVT(MVT VT, unsigned NumElements) {
485 switch (VT.SimpleTy) {
489 if (NumElements == 2) return MVT::v2i1;
490 if (NumElements == 4) return MVT::v4i1;
491 if (NumElements == 8) return MVT::v8i1;
492 if (NumElements == 16) return MVT::v16i1;
493 if (NumElements == 32) return MVT::v32i1;
494 if (NumElements == 64) return MVT::v64i1;
497 if (NumElements == 2) return MVT::v2i8;
498 if (NumElements == 4) return MVT::v4i8;
499 if (NumElements == 8) return MVT::v8i8;
500 if (NumElements == 16) return MVT::v16i8;
501 if (NumElements == 32) return MVT::v32i8;
502 if (NumElements == 64) return MVT::v64i8;
505 if (NumElements == 1) return MVT::v1i16;
506 if (NumElements == 2) return MVT::v2i16;
507 if (NumElements == 4) return MVT::v4i16;
508 if (NumElements == 8) return MVT::v8i16;
509 if (NumElements == 16) return MVT::v16i16;
510 if (NumElements == 32) return MVT::v32i16;
513 if (NumElements == 1) return MVT::v1i32;
514 if (NumElements == 2) return MVT::v2i32;
515 if (NumElements == 4) return MVT::v4i32;
516 if (NumElements == 8) return MVT::v8i32;
517 if (NumElements == 16) return MVT::v16i32;
520 if (NumElements == 1) return MVT::v1i64;
521 if (NumElements == 2) return MVT::v2i64;
522 if (NumElements == 4) return MVT::v4i64;
523 if (NumElements == 8) return MVT::v8i64;
524 if (NumElements == 16) return MVT::v16i64;
527 if (NumElements == 2) return MVT::v2f16;
528 if (NumElements == 8) return MVT::v8f16;
531 if (NumElements == 2) return MVT::v2f32;
532 if (NumElements == 4) return MVT::v4f32;
533 if (NumElements == 8) return MVT::v8f32;
534 if (NumElements == 16) return MVT::v16f32;
537 if (NumElements == 2) return MVT::v2f64;
538 if (NumElements == 4) return MVT::v4f64;
539 if (NumElements == 8) return MVT::v8f64;
542 return (MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE);
545 /// Return the value type corresponding to the specified type. This returns
546 /// all pointers as iPTR. If HandleUnknown is true, unknown types are
547 /// returned as Other, otherwise they are invalid.
548 static MVT getVT(Type *Ty, bool HandleUnknown = false);
553 /// EVT - Extended Value Type. Capable of holding value types which are not
554 /// native for any processor (such as the i12345 type), as well as the types
555 /// a MVT can represent.
562 EVT() : V((MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE)),
564 EVT(MVT::SimpleValueType SVT) : V(SVT), LLVMTy(0) { }
565 EVT(MVT S) : V(S), LLVMTy(0) {}
567 bool operator==(EVT VT) const {
568 return !(*this != VT);
570 bool operator!=(EVT VT) const {
571 if (V.SimpleTy != VT.V.SimpleTy)
574 return LLVMTy != VT.LLVMTy;
578 /// getFloatingPointVT - Returns the EVT that represents a floating point
579 /// type with the given number of bits. There are two floating point types
580 /// with 128 bits - this returns f128 rather than ppcf128.
581 static EVT getFloatingPointVT(unsigned BitWidth) {
582 return MVT::getFloatingPointVT(BitWidth);
585 /// getIntegerVT - Returns the EVT that represents an integer with the given
587 static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth) {
588 MVT M = MVT::getIntegerVT(BitWidth);
591 return getExtendedIntegerVT(Context, BitWidth);
594 /// getVectorVT - Returns the EVT that represents a vector NumElements in
595 /// length, where each element is of type VT.
596 static EVT getVectorVT(LLVMContext &Context, EVT VT, unsigned NumElements) {
597 MVT M = MVT::getVectorVT(VT.V, NumElements);
600 return getExtendedVectorVT(Context, VT, NumElements);
603 /// changeVectorElementTypeToInteger - Return a vector with the same number
604 /// of elements as this vector, but with the element type converted to an
605 /// integer type with the same bitwidth.
606 EVT changeVectorElementTypeToInteger() const {
608 return changeExtendedVectorElementTypeToInteger();
609 MVT EltTy = getSimpleVT().getVectorElementType();
610 unsigned BitWidth = EltTy.getSizeInBits();
611 MVT IntTy = MVT::getIntegerVT(BitWidth);
612 MVT VecTy = MVT::getVectorVT(IntTy, getVectorNumElements());
613 assert(VecTy.SimpleTy >= 0 &&
614 "Simple vector VT not representable by simple integer vector VT!");
618 /// isSimple - Test if the given EVT is simple (as opposed to being
620 bool isSimple() const {
621 return V.SimpleTy >= 0;
624 /// isExtended - Test if the given EVT is extended (as opposed to
626 bool isExtended() const {
630 /// isFloatingPoint - Return true if this is a FP, or a vector FP type.
631 bool isFloatingPoint() const {
632 return isSimple() ? V.isFloatingPoint() : isExtendedFloatingPoint();
635 /// isInteger - Return true if this is an integer, or a vector integer type.
636 bool isInteger() const {
637 return isSimple() ? V.isInteger() : isExtendedInteger();
640 /// isVector - Return true if this is a vector value type.
641 bool isVector() const {
642 return isSimple() ? V.isVector() : isExtendedVector();
645 /// is16BitVector - Return true if this is a 16-bit vector type.
646 bool is16BitVector() const {
647 return isSimple() ? V.is16BitVector() : isExtended16BitVector();
650 /// is32BitVector - Return true if this is a 32-bit vector type.
651 bool is32BitVector() const {
652 return isSimple() ? V.is32BitVector() : isExtended32BitVector();
655 /// is64BitVector - Return true if this is a 64-bit vector type.
656 bool is64BitVector() const {
657 return isSimple() ? V.is64BitVector() : isExtended64BitVector();
660 /// is128BitVector - Return true if this is a 128-bit vector type.
661 bool is128BitVector() const {
662 return isSimple() ? V.is128BitVector() : isExtended128BitVector();
665 /// is256BitVector - Return true if this is a 256-bit vector type.
666 bool is256BitVector() const {
667 return isSimple() ? V.is256BitVector() : isExtended256BitVector();
670 /// is512BitVector - Return true if this is a 512-bit vector type.
671 bool is512BitVector() const {
672 return isSimple() ? V.is512BitVector() : isExtended512BitVector();
675 /// is1024BitVector - Return true if this is a 1024-bit vector type.
676 bool is1024BitVector() const {
677 return isSimple() ? V.is1024BitVector() : isExtended1024BitVector();
680 /// isOverloaded - Return true if this is an overloaded type for TableGen.
681 bool isOverloaded() const {
682 return (V==MVT::iAny || V==MVT::fAny || V==MVT::vAny || V==MVT::iPTRAny);
685 /// isByteSized - Return true if the bit size is a multiple of 8.
686 bool isByteSized() const {
687 return (getSizeInBits() & 7) == 0;
690 /// isRound - Return true if the size is a power-of-two number of bytes.
691 bool isRound() const {
692 unsigned BitSize = getSizeInBits();
693 return BitSize >= 8 && !(BitSize & (BitSize - 1));
696 /// bitsEq - Return true if this has the same number of bits as VT.
697 bool bitsEq(EVT VT) const {
698 if (EVT::operator==(VT)) return true;
699 return getSizeInBits() == VT.getSizeInBits();
702 /// bitsGT - Return true if this has more bits than VT.
703 bool bitsGT(EVT VT) const {
704 if (EVT::operator==(VT)) return false;
705 return getSizeInBits() > VT.getSizeInBits();
708 /// bitsGE - Return true if this has no less bits than VT.
709 bool bitsGE(EVT VT) const {
710 if (EVT::operator==(VT)) return true;
711 return getSizeInBits() >= VT.getSizeInBits();
714 /// bitsLT - Return true if this has less bits than VT.
715 bool bitsLT(EVT VT) const {
716 if (EVT::operator==(VT)) return false;
717 return getSizeInBits() < VT.getSizeInBits();
720 /// bitsLE - Return true if this has no more bits than VT.
721 bool bitsLE(EVT VT) const {
722 if (EVT::operator==(VT)) return true;
723 return getSizeInBits() <= VT.getSizeInBits();
727 /// getSimpleVT - Return the SimpleValueType held in the specified
729 MVT getSimpleVT() const {
730 assert(isSimple() && "Expected a SimpleValueType!");
734 /// getScalarType - If this is a vector type, return the element type,
735 /// otherwise return this.
736 EVT getScalarType() const {
737 return isVector() ? getVectorElementType() : *this;
740 /// getVectorElementType - Given a vector type, return the type of
742 EVT getVectorElementType() const {
743 assert(isVector() && "Invalid vector type!");
745 return V.getVectorElementType();
746 return getExtendedVectorElementType();
749 /// getVectorNumElements - Given a vector type, return the number of
750 /// elements it contains.
751 unsigned getVectorNumElements() const {
752 assert(isVector() && "Invalid vector type!");
754 return V.getVectorNumElements();
755 return getExtendedVectorNumElements();
758 /// getSizeInBits - Return the size of the specified value type in bits.
759 unsigned getSizeInBits() const {
761 return V.getSizeInBits();
762 return getExtendedSizeInBits();
765 /// getStoreSize - Return the number of bytes overwritten by a store
766 /// of the specified value type.
767 unsigned getStoreSize() const {
768 return (getSizeInBits() + 7) / 8;
771 /// getStoreSizeInBits - Return the number of bits overwritten by a store
772 /// of the specified value type.
773 unsigned getStoreSizeInBits() const {
774 return getStoreSize() * 8;
777 /// getRoundIntegerType - Rounds the bit-width of the given integer EVT up
778 /// to the nearest power of two (and at least to eight), and returns the
779 /// integer EVT with that number of bits.
780 EVT getRoundIntegerType(LLVMContext &Context) const {
781 assert(isInteger() && !isVector() && "Invalid integer type!");
782 unsigned BitWidth = getSizeInBits();
785 return getIntegerVT(Context, 1 << Log2_32_Ceil(BitWidth));
788 /// getHalfSizedIntegerVT - Finds the smallest simple value type that is
789 /// greater than or equal to half the width of this EVT. If no simple
790 /// value type can be found, an extended integer value type of half the
791 /// size (rounded up) is returned.
792 EVT getHalfSizedIntegerVT(LLVMContext &Context) const {
793 assert(isInteger() && !isVector() && "Invalid integer type!");
794 unsigned EVTSize = getSizeInBits();
795 for (unsigned IntVT = MVT::FIRST_INTEGER_VALUETYPE;
796 IntVT <= MVT::LAST_INTEGER_VALUETYPE; ++IntVT) {
797 EVT HalfVT = EVT((MVT::SimpleValueType)IntVT);
798 if (HalfVT.getSizeInBits() * 2 >= EVTSize)
801 return getIntegerVT(Context, (EVTSize + 1) / 2);
804 /// isPow2VectorType - Returns true if the given vector is a power of 2.
805 bool isPow2VectorType() const {
806 unsigned NElts = getVectorNumElements();
807 return !(NElts & (NElts - 1));
810 /// getPow2VectorType - Widens the length of the given vector EVT up to
811 /// the nearest power of 2 and returns that type.
812 EVT getPow2VectorType(LLVMContext &Context) const {
813 if (!isPow2VectorType()) {
814 unsigned NElts = getVectorNumElements();
815 unsigned Pow2NElts = 1 << Log2_32_Ceil(NElts);
816 return EVT::getVectorVT(Context, getVectorElementType(), Pow2NElts);
823 /// getEVTString - This function returns value type as a string,
825 std::string getEVTString() const;
827 /// getTypeForEVT - This method returns an LLVM type corresponding to the
828 /// specified EVT. For integer types, this returns an unsigned type. Note
829 /// that this will abort for types that cannot be represented.
830 Type *getTypeForEVT(LLVMContext &Context) const;
832 /// getEVT - Return the value type corresponding to the specified type.
833 /// This returns all pointers as iPTR. If HandleUnknown is true, unknown
834 /// types are returned as Other, otherwise they are invalid.
835 static EVT getEVT(Type *Ty, bool HandleUnknown = false);
837 intptr_t getRawBits() const {
841 return (intptr_t)(LLVMTy);
844 /// compareRawBits - A meaningless but well-behaved order, useful for
845 /// constructing containers.
846 struct compareRawBits {
847 bool operator()(EVT L, EVT R) const {
848 if (L.V.SimpleTy == R.V.SimpleTy)
849 return L.LLVMTy < R.LLVMTy;
851 return L.V.SimpleTy < R.V.SimpleTy;
856 // Methods for handling the Extended-type case in functions above.
857 // These are all out-of-line to prevent users of this header file
858 // from having a dependency on Type.h.
859 EVT changeExtendedVectorElementTypeToInteger() const;
860 static EVT getExtendedIntegerVT(LLVMContext &C, unsigned BitWidth);
861 static EVT getExtendedVectorVT(LLVMContext &C, EVT VT,
862 unsigned NumElements);
863 bool isExtendedFloatingPoint() const;
864 bool isExtendedInteger() const;
865 bool isExtendedVector() const;
866 bool isExtended16BitVector() const;
867 bool isExtended32BitVector() const;
868 bool isExtended64BitVector() const;
869 bool isExtended128BitVector() const;
870 bool isExtended256BitVector() const;
871 bool isExtended512BitVector() const;
872 bool isExtended1024BitVector() const;
873 EVT getExtendedVectorElementType() const;
874 unsigned getExtendedVectorNumElements() const;
875 unsigned getExtendedSizeInBits() const;
878 } // End llvm namespace