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("getSizeInBits called on extended MVT.");
349 llvm_unreachable("Value type is non-standard value, Other.");
351 llvm_unreachable("Value type size is target-dependent. Ask TLI.");
356 llvm_unreachable("Value type is overloaded.");
358 llvm_unreachable("Value type is metadata.");
368 case v1i16: return 16;
375 case v1i32: return 32;
384 case v2f32: return 64;
385 case f80 : return 80;
394 case v2f64: return 128;
400 case v4f64: return 256;
406 case v8f64: return 512;
407 case v16i64:return 1024;
411 /// getStoreSize - Return the number of bytes overwritten by a store
412 /// of the specified value type.
413 unsigned getStoreSize() const {
414 return (getSizeInBits() + 7) / 8;
417 /// getStoreSizeInBits - Return the number of bits overwritten by a store
418 /// of the specified value type.
419 unsigned getStoreSizeInBits() const {
420 return getStoreSize() * 8;
423 /// Return true if this has more bits than VT.
424 bool bitsGT(MVT VT) const {
425 return getSizeInBits() > VT.getSizeInBits();
428 /// Return true if this has no less bits than VT.
429 bool bitsGE(MVT VT) const {
430 return getSizeInBits() >= VT.getSizeInBits();
433 /// Return true if this has less bits than VT.
434 bool bitsLT(MVT VT) const {
435 return getSizeInBits() < VT.getSizeInBits();
438 /// Return true if this has no more bits than VT.
439 bool bitsLE(MVT VT) const {
440 return getSizeInBits() <= VT.getSizeInBits();
444 static MVT getFloatingPointVT(unsigned BitWidth) {
447 llvm_unreachable("Bad bit width!");
461 static MVT getIntegerVT(unsigned BitWidth) {
464 return (MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE);
480 static MVT getVectorVT(MVT VT, unsigned NumElements) {
481 switch (VT.SimpleTy) {
485 if (NumElements == 2) return MVT::v2i1;
486 if (NumElements == 4) return MVT::v4i1;
487 if (NumElements == 8) return MVT::v8i1;
488 if (NumElements == 16) return MVT::v16i1;
489 if (NumElements == 32) return MVT::v32i1;
490 if (NumElements == 64) return MVT::v64i1;
493 if (NumElements == 2) return MVT::v2i8;
494 if (NumElements == 4) return MVT::v4i8;
495 if (NumElements == 8) return MVT::v8i8;
496 if (NumElements == 16) return MVT::v16i8;
497 if (NumElements == 32) return MVT::v32i8;
498 if (NumElements == 64) return MVT::v64i8;
501 if (NumElements == 1) return MVT::v1i16;
502 if (NumElements == 2) return MVT::v2i16;
503 if (NumElements == 4) return MVT::v4i16;
504 if (NumElements == 8) return MVT::v8i16;
505 if (NumElements == 16) return MVT::v16i16;
506 if (NumElements == 32) return MVT::v32i16;
509 if (NumElements == 1) return MVT::v1i32;
510 if (NumElements == 2) return MVT::v2i32;
511 if (NumElements == 4) return MVT::v4i32;
512 if (NumElements == 8) return MVT::v8i32;
513 if (NumElements == 16) return MVT::v16i32;
516 if (NumElements == 1) return MVT::v1i64;
517 if (NumElements == 2) return MVT::v2i64;
518 if (NumElements == 4) return MVT::v4i64;
519 if (NumElements == 8) return MVT::v8i64;
520 if (NumElements == 16) return MVT::v16i64;
523 if (NumElements == 2) return MVT::v2f16;
526 if (NumElements == 2) return MVT::v2f32;
527 if (NumElements == 4) return MVT::v4f32;
528 if (NumElements == 8) return MVT::v8f32;
529 if (NumElements == 16) return MVT::v16f32;
532 if (NumElements == 2) return MVT::v2f64;
533 if (NumElements == 4) return MVT::v4f64;
534 if (NumElements == 8) return MVT::v8f64;
537 return (MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE);
540 /// Return the value type corresponding to the specified type. This returns
541 /// all pointers as iPTR. If HandleUnknown is true, unknown types are
542 /// returned as Other, otherwise they are invalid.
543 static MVT getVT(Type *Ty, bool HandleUnknown = false);
548 /// EVT - Extended Value Type. Capable of holding value types which are not
549 /// native for any processor (such as the i12345 type), as well as the types
550 /// a MVT can represent.
557 EVT() : V((MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE)),
559 EVT(MVT::SimpleValueType SVT) : V(SVT), LLVMTy(0) { }
560 EVT(MVT S) : V(S), LLVMTy(0) {}
562 bool operator==(EVT VT) const {
563 return !(*this != VT);
565 bool operator!=(EVT VT) const {
566 if (V.SimpleTy != VT.V.SimpleTy)
569 return LLVMTy != VT.LLVMTy;
573 /// getFloatingPointVT - Returns the EVT that represents a floating point
574 /// type with the given number of bits. There are two floating point types
575 /// with 128 bits - this returns f128 rather than ppcf128.
576 static EVT getFloatingPointVT(unsigned BitWidth) {
577 return MVT::getFloatingPointVT(BitWidth);
580 /// getIntegerVT - Returns the EVT that represents an integer with the given
582 static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth) {
583 MVT M = MVT::getIntegerVT(BitWidth);
586 return getExtendedIntegerVT(Context, BitWidth);
589 /// getVectorVT - Returns the EVT that represents a vector NumElements in
590 /// length, where each element is of type VT.
591 static EVT getVectorVT(LLVMContext &Context, EVT VT, unsigned NumElements) {
592 MVT M = MVT::getVectorVT(VT.V, NumElements);
595 return getExtendedVectorVT(Context, VT, NumElements);
598 /// changeVectorElementTypeToInteger - Return a vector with the same number
599 /// of elements as this vector, but with the element type converted to an
600 /// integer type with the same bitwidth.
601 EVT changeVectorElementTypeToInteger() const {
603 return changeExtendedVectorElementTypeToInteger();
604 MVT EltTy = getSimpleVT().getVectorElementType();
605 unsigned BitWidth = EltTy.getSizeInBits();
606 MVT IntTy = MVT::getIntegerVT(BitWidth);
607 MVT VecTy = MVT::getVectorVT(IntTy, getVectorNumElements());
608 assert(VecTy.SimpleTy >= 0 &&
609 "Simple vector VT not representable by simple integer vector VT!");
613 /// isSimple - Test if the given EVT is simple (as opposed to being
615 bool isSimple() const {
616 return V.SimpleTy >= 0;
619 /// isExtended - Test if the given EVT is extended (as opposed to
621 bool isExtended() const {
625 /// isFloatingPoint - Return true if this is a FP, or a vector FP type.
626 bool isFloatingPoint() const {
627 return isSimple() ? V.isFloatingPoint() : isExtendedFloatingPoint();
630 /// isInteger - Return true if this is an integer, or a vector integer type.
631 bool isInteger() const {
632 return isSimple() ? V.isInteger() : isExtendedInteger();
635 /// isVector - Return true if this is a vector value type.
636 bool isVector() const {
637 return isSimple() ? V.isVector() : isExtendedVector();
640 /// is16BitVector - Return true if this is a 16-bit vector type.
641 bool is16BitVector() const {
642 return isSimple() ? V.is16BitVector() : isExtended16BitVector();
645 /// is32BitVector - Return true if this is a 32-bit vector type.
646 bool is32BitVector() const {
647 return isSimple() ? V.is32BitVector() : isExtended32BitVector();
650 /// is64BitVector - Return true if this is a 64-bit vector type.
651 bool is64BitVector() const {
652 return isSimple() ? V.is64BitVector() : isExtended64BitVector();
655 /// is128BitVector - Return true if this is a 128-bit vector type.
656 bool is128BitVector() const {
657 return isSimple() ? V.is128BitVector() : isExtended128BitVector();
660 /// is256BitVector - Return true if this is a 256-bit vector type.
661 bool is256BitVector() const {
662 return isSimple() ? V.is256BitVector() : isExtended256BitVector();
665 /// is512BitVector - Return true if this is a 512-bit vector type.
666 bool is512BitVector() const {
667 return isSimple() ? V.is512BitVector() : isExtended512BitVector();
670 /// is1024BitVector - Return true if this is a 1024-bit vector type.
671 bool is1024BitVector() const {
672 return isSimple() ? V.is1024BitVector() : isExtended1024BitVector();
675 /// isOverloaded - Return true if this is an overloaded type for TableGen.
676 bool isOverloaded() const {
677 return (V==MVT::iAny || V==MVT::fAny || V==MVT::vAny || V==MVT::iPTRAny);
680 /// isByteSized - Return true if the bit size is a multiple of 8.
681 bool isByteSized() const {
682 return (getSizeInBits() & 7) == 0;
685 /// isRound - Return true if the size is a power-of-two number of bytes.
686 bool isRound() const {
687 unsigned BitSize = getSizeInBits();
688 return BitSize >= 8 && !(BitSize & (BitSize - 1));
691 /// bitsEq - Return true if this has the same number of bits as VT.
692 bool bitsEq(EVT VT) const {
693 if (EVT::operator==(VT)) return true;
694 return getSizeInBits() == VT.getSizeInBits();
697 /// bitsGT - Return true if this has more bits than VT.
698 bool bitsGT(EVT VT) const {
699 if (EVT::operator==(VT)) return false;
700 return getSizeInBits() > VT.getSizeInBits();
703 /// bitsGE - Return true if this has no less bits than VT.
704 bool bitsGE(EVT VT) const {
705 if (EVT::operator==(VT)) return true;
706 return getSizeInBits() >= VT.getSizeInBits();
709 /// bitsLT - Return true if this has less bits than VT.
710 bool bitsLT(EVT VT) const {
711 if (EVT::operator==(VT)) return false;
712 return getSizeInBits() < VT.getSizeInBits();
715 /// bitsLE - Return true if this has no more bits than VT.
716 bool bitsLE(EVT VT) const {
717 if (EVT::operator==(VT)) return true;
718 return getSizeInBits() <= VT.getSizeInBits();
722 /// getSimpleVT - Return the SimpleValueType held in the specified
724 MVT getSimpleVT() const {
725 assert(isSimple() && "Expected a SimpleValueType!");
729 /// getScalarType - If this is a vector type, return the element type,
730 /// otherwise return this.
731 EVT getScalarType() const {
732 return isVector() ? getVectorElementType() : *this;
735 /// getVectorElementType - Given a vector type, return the type of
737 EVT getVectorElementType() const {
738 assert(isVector() && "Invalid vector type!");
740 return V.getVectorElementType();
741 return getExtendedVectorElementType();
744 /// getVectorNumElements - Given a vector type, return the number of
745 /// elements it contains.
746 unsigned getVectorNumElements() const {
747 assert(isVector() && "Invalid vector type!");
749 return V.getVectorNumElements();
750 return getExtendedVectorNumElements();
753 /// getSizeInBits - Return the size of the specified value type in bits.
754 unsigned getSizeInBits() const {
756 return V.getSizeInBits();
757 return getExtendedSizeInBits();
760 /// getStoreSize - Return the number of bytes overwritten by a store
761 /// of the specified value type.
762 unsigned getStoreSize() const {
763 return (getSizeInBits() + 7) / 8;
766 /// getStoreSizeInBits - Return the number of bits overwritten by a store
767 /// of the specified value type.
768 unsigned getStoreSizeInBits() const {
769 return getStoreSize() * 8;
772 /// getRoundIntegerType - Rounds the bit-width of the given integer EVT up
773 /// to the nearest power of two (and at least to eight), and returns the
774 /// integer EVT with that number of bits.
775 EVT getRoundIntegerType(LLVMContext &Context) const {
776 assert(isInteger() && !isVector() && "Invalid integer type!");
777 unsigned BitWidth = getSizeInBits();
780 return getIntegerVT(Context, 1 << Log2_32_Ceil(BitWidth));
783 /// getHalfSizedIntegerVT - Finds the smallest simple value type that is
784 /// greater than or equal to half the width of this EVT. If no simple
785 /// value type can be found, an extended integer value type of half the
786 /// size (rounded up) is returned.
787 EVT getHalfSizedIntegerVT(LLVMContext &Context) const {
788 assert(isInteger() && !isVector() && "Invalid integer type!");
789 unsigned EVTSize = getSizeInBits();
790 for (unsigned IntVT = MVT::FIRST_INTEGER_VALUETYPE;
791 IntVT <= MVT::LAST_INTEGER_VALUETYPE; ++IntVT) {
792 EVT HalfVT = EVT((MVT::SimpleValueType)IntVT);
793 if (HalfVT.getSizeInBits() * 2 >= EVTSize)
796 return getIntegerVT(Context, (EVTSize + 1) / 2);
799 /// isPow2VectorType - Returns true if the given vector is a power of 2.
800 bool isPow2VectorType() const {
801 unsigned NElts = getVectorNumElements();
802 return !(NElts & (NElts - 1));
805 /// getPow2VectorType - Widens the length of the given vector EVT up to
806 /// the nearest power of 2 and returns that type.
807 EVT getPow2VectorType(LLVMContext &Context) const {
808 if (!isPow2VectorType()) {
809 unsigned NElts = getVectorNumElements();
810 unsigned Pow2NElts = 1 << Log2_32_Ceil(NElts);
811 return EVT::getVectorVT(Context, getVectorElementType(), Pow2NElts);
818 /// getEVTString - This function returns value type as a string,
820 std::string getEVTString() const;
822 /// getTypeForEVT - This method returns an LLVM type corresponding to the
823 /// specified EVT. For integer types, this returns an unsigned type. Note
824 /// that this will abort for types that cannot be represented.
825 Type *getTypeForEVT(LLVMContext &Context) const;
827 /// getEVT - Return the value type corresponding to the specified type.
828 /// This returns all pointers as iPTR. If HandleUnknown is true, unknown
829 /// types are returned as Other, otherwise they are invalid.
830 static EVT getEVT(Type *Ty, bool HandleUnknown = false);
832 intptr_t getRawBits() const {
836 return (intptr_t)(LLVMTy);
839 /// compareRawBits - A meaningless but well-behaved order, useful for
840 /// constructing containers.
841 struct compareRawBits {
842 bool operator()(EVT L, EVT R) const {
843 if (L.V.SimpleTy == R.V.SimpleTy)
844 return L.LLVMTy < R.LLVMTy;
846 return L.V.SimpleTy < R.V.SimpleTy;
851 // Methods for handling the Extended-type case in functions above.
852 // These are all out-of-line to prevent users of this header file
853 // from having a dependency on Type.h.
854 EVT changeExtendedVectorElementTypeToInteger() const;
855 static EVT getExtendedIntegerVT(LLVMContext &C, unsigned BitWidth);
856 static EVT getExtendedVectorVT(LLVMContext &C, EVT VT,
857 unsigned NumElements);
858 bool isExtendedFloatingPoint() const;
859 bool isExtendedInteger() const;
860 bool isExtendedVector() const;
861 bool isExtended16BitVector() const;
862 bool isExtended32BitVector() const;
863 bool isExtended64BitVector() const;
864 bool isExtended128BitVector() const;
865 bool isExtended256BitVector() const;
866 bool isExtended512BitVector() const;
867 bool isExtended1024BitVector() const;
868 EVT getExtendedVectorElementType() const;
869 unsigned getExtendedVectorNumElements() const;
870 unsigned getExtendedSizeInBits() const;
873 } // End llvm namespace