Fix a comment typo.
[oota-llvm.git] / include / llvm / CodeGen / ValueTypes.h
1 //===- CodeGen/ValueTypes.h - Low-Level Target independ. types --*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
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.
13 //
14 //===----------------------------------------------------------------------===//
15
16 #ifndef LLVM_CODEGEN_VALUETYPES_H
17 #define LLVM_CODEGEN_VALUETYPES_H
18
19 #include <cassert>
20 #include <string>
21 #include "llvm/System/DataTypes.h"
22 #include "llvm/Support/MathExtras.h"
23
24 namespace llvm {
25   class Type;
26   class LLVMContext;
27   struct EVT;
28
29   /// MVT - Machine Value Type.  Every type that is supported natively by some
30   /// processor targeted by LLVM occurs here.  This means that any legal value
31   /// type can be represented by a MVT.
32   class MVT {
33   public:
34     enum SimpleValueType {
35       // If you change this numbering, you must change the values in
36       // ValueTypes.td as well!
37       Other          =   0,   // This is a non-standard value
38       i1             =   1,   // This is a 1 bit integer value
39       i8             =   2,   // This is an 8 bit integer value
40       i16            =   3,   // This is a 16 bit integer value
41       i32            =   4,   // This is a 32 bit integer value
42       i64            =   5,   // This is a 64 bit integer value
43       i128           =   6,   // This is a 128 bit integer value
44
45       FIRST_INTEGER_VALUETYPE = i1,
46       LAST_INTEGER_VALUETYPE  = i128,
47
48       f32            =   7,   // This is a 32 bit floating point value
49       f64            =   8,   // This is a 64 bit floating point value
50       f80            =   9,   // This is a 80 bit floating point value
51       f128           =  10,   // This is a 128 bit floating point value
52       ppcf128        =  11,   // This is a PPC 128-bit floating point value
53
54       v2i8           =  12,   //  2 x i8
55       v4i8           =  13,   //  4 x i8
56       v8i8           =  14,   //  8 x i8
57       v16i8          =  15,   // 16 x i8
58       v32i8          =  16,   // 32 x i8
59       v2i16          =  17,   //  2 x i16
60       v4i16          =  18,   //  4 x i16
61       v8i16          =  19,   //  8 x i16
62       v16i16         =  20,   // 16 x i16
63       v2i32          =  21,   //  2 x i32
64       v4i32          =  22,   //  4 x i32
65       v8i32          =  23,   //  8 x i32
66       v1i64          =  24,   //  1 x i64
67       v2i64          =  25,   //  2 x i64
68       v4i64          =  26,   //  4 x i64
69       v8i64          =  27,   //  8 x i64
70
71       v2f32          =  28,   //  2 x f32
72       v4f32          =  29,   //  4 x f32
73       v8f32          =  30,   //  8 x f32
74       v2f64          =  31,   //  2 x f64
75       v4f64          =  32,   //  4 x f64
76
77       FIRST_VECTOR_VALUETYPE = v2i8,
78       LAST_VECTOR_VALUETYPE  = v4f64,
79
80       x86mmx         =  33,   // This is an X86 MMX value
81
82       Flag           =  34,   // This glues nodes together during pre-RA sched
83
84       isVoid         =  35,   // This has no value
85
86       LAST_VALUETYPE =  36,   // This always remains at the end of the list.
87
88       // This is the current maximum for LAST_VALUETYPE.
89       // MVT::MAX_ALLOWED_VALUETYPE is used for asserts and to size bit vectors
90       // This value must be a multiple of 32.
91       MAX_ALLOWED_VALUETYPE = 64,
92
93       // Metadata - This is MDNode or MDString.
94       Metadata       = 250,
95
96       // iPTRAny - An int value the size of the pointer of the current
97       // target to any address space. This must only be used internal to
98       // tblgen. Other than for overloading, we treat iPTRAny the same as iPTR.
99       iPTRAny        = 251,
100
101       // vAny - A vector with any length and element size. This is used
102       // for intrinsics that have overloadings based on vector types.
103       // This is only for tblgen's consumption!
104       vAny           = 252,
105
106       // fAny - Any floating-point or vector floating-point value. This is used
107       // for intrinsics that have overloadings based on floating-point types.
108       // This is only for tblgen's consumption!
109       fAny           = 253,
110
111       // iAny - An integer or vector integer value of any bit width. This is
112       // used for intrinsics that have overloadings based on integer bit widths.
113       // This is only for tblgen's consumption!
114       iAny           = 254,
115
116       // iPTR - An int value the size of the pointer of the current
117       // target.  This should only be used internal to tblgen!
118       iPTR           = 255,
119
120       // LastSimpleValueType - The greatest valid SimpleValueType value.
121       LastSimpleValueType = 255,
122
123       // INVALID_SIMPLE_VALUE_TYPE - Simple value types greater than or equal
124       // to this are considered extended value types.
125       INVALID_SIMPLE_VALUE_TYPE = LastSimpleValueType + 1
126     };
127
128     SimpleValueType SimpleTy;
129
130     MVT() : SimpleTy((SimpleValueType)(INVALID_SIMPLE_VALUE_TYPE)) {}
131     MVT(SimpleValueType SVT) : SimpleTy(SVT) { }
132
133     bool operator>(const MVT& S)  const { return SimpleTy >  S.SimpleTy; }
134     bool operator<(const MVT& S)  const { return SimpleTy <  S.SimpleTy; }
135     bool operator==(const MVT& S) const { return SimpleTy == S.SimpleTy; }
136     bool operator!=(const MVT& S) const { return SimpleTy != S.SimpleTy; }
137     bool operator>=(const MVT& S) const { return SimpleTy >= S.SimpleTy; }
138     bool operator<=(const MVT& S) const { return SimpleTy <= S.SimpleTy; }
139
140     /// isFloatingPoint - Return true if this is a FP, or a vector FP type.
141     bool isFloatingPoint() const {
142       return ((SimpleTy >= MVT::f32 && SimpleTy <= MVT::ppcf128) ||
143         (SimpleTy >= MVT::v2f32 && SimpleTy <= MVT::v4f64));
144     }
145
146     /// isInteger - Return true if this is an integer, or a vector integer type.
147     bool isInteger() const {
148       return ((SimpleTy >= MVT::FIRST_INTEGER_VALUETYPE &&
149                SimpleTy <= MVT::LAST_INTEGER_VALUETYPE) ||
150                (SimpleTy >= MVT::v2i8 && SimpleTy <= MVT::v8i64));
151     }
152
153     /// isVector - Return true if this is a vector value type.
154     bool isVector() const {
155       return (SimpleTy >= MVT::FIRST_VECTOR_VALUETYPE &&
156               SimpleTy <= MVT::LAST_VECTOR_VALUETYPE);
157     }
158
159     /// isPow2VectorType - Returns true if the given vector is a power of 2.
160     bool isPow2VectorType() const {
161       unsigned NElts = getVectorNumElements();
162       return !(NElts & (NElts - 1));
163     }
164
165     /// getPow2VectorType - Widens the length of the given vector MVT up to
166     /// the nearest power of 2 and returns that type.
167     MVT getPow2VectorType() const {
168       if (isPow2VectorType())
169         return *this;
170
171       unsigned NElts = getVectorNumElements();
172       unsigned Pow2NElts = 1 << Log2_32_Ceil(NElts);
173       return MVT::getVectorVT(getVectorElementType(), Pow2NElts);
174     }
175
176     /// getScalarType - If this is a vector type, return the element type,
177     /// otherwise return this.
178     MVT getScalarType() const {
179       return isVector() ? getVectorElementType() : *this;
180     }
181
182     MVT getVectorElementType() const {
183       switch (SimpleTy) {
184       default:
185         return (MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE);
186       case v2i8 :
187       case v4i8 :
188       case v8i8 :
189       case v16i8:
190       case v32i8: return i8;
191       case v2i16:
192       case v4i16:
193       case v8i16:
194       case v16i16: return i16;
195       case v2i32:
196       case v4i32:
197       case v8i32: return i32;
198       case v1i64:
199       case v2i64:
200       case v4i64:
201       case v8i64: return i64;
202       case v2f32:
203       case v4f32:
204       case v8f32: return f32;
205       case v2f64:
206       case v4f64: return f64;
207       }
208     }
209
210     unsigned getVectorNumElements() const {
211       switch (SimpleTy) {
212       default:
213         return ~0U;
214       case v32i8: return 32;
215       case v16i8:
216       case v16i16: return 16;
217       case v8i8 :
218       case v8i16:
219       case v8i32:
220       case v8i64:
221       case v8f32: return 8;
222       case v4i8:
223       case v4i16:
224       case v4i32:
225       case v4i64:
226       case v4f32:
227       case v4f64: return 4;
228       case v2i8:
229       case v2i16:
230       case v2i32:
231       case v2i64:
232       case v2f32:
233       case v2f64: return 2;
234       case v1i64: return 1;
235       }
236     }
237
238     unsigned getSizeInBits() const {
239       switch (SimpleTy) {
240       case iPTR:
241         assert(0 && "Value type size is target-dependent. Ask TLI.");
242       case iPTRAny:
243       case iAny:
244       case fAny:
245         assert(0 && "Value type is overloaded.");
246       default:
247         assert(0 && "getSizeInBits called on extended MVT.");
248       case i1  :  return 1;
249       case i8  :  return 8;
250       case i16 :
251       case v2i8:  return 16;
252       case f32 :
253       case i32 :
254       case v4i8:
255       case v2i16: return 32;
256       case x86mmx:
257       case f64 :
258       case i64 :
259       case v8i8:
260       case v4i16:
261       case v2i32:
262       case v1i64:
263       case v2f32: return 64;
264       case f80 :  return 80;
265       case f128:
266       case ppcf128:
267       case i128:
268       case v16i8:
269       case v8i16:
270       case v4i32:
271       case v2i64:
272       case v4f32:
273       case v2f64: return 128;
274       case v32i8:
275       case v16i16:
276       case v8i32:
277       case v4i64:
278       case v8f32:
279       case v4f64: return 256;
280       case v8i64: return 512;
281       }
282     }
283
284     /// getStoreSize - Return the number of bytes overwritten by a store
285     /// of the specified value type.
286     unsigned getStoreSize() const {
287       return (getSizeInBits() + 7) / 8;
288     }
289
290     /// getStoreSizeInBits - Return the number of bits overwritten by a store
291     /// of the specified value type.
292     unsigned getStoreSizeInBits() const {
293       return getStoreSize() * 8;
294     }
295
296     static MVT getFloatingPointVT(unsigned BitWidth) {
297       switch (BitWidth) {
298       default:
299         assert(false && "Bad bit width!");
300       case 32:
301         return MVT::f32;
302       case 64:
303         return MVT::f64;
304       case 80:
305         return MVT::f80;
306       case 128:
307         return MVT::f128;
308       }
309     }
310
311     static MVT getIntegerVT(unsigned BitWidth) {
312       switch (BitWidth) {
313       default:
314         return (MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE);
315       case 1:
316         return MVT::i1;
317       case 8:
318         return MVT::i8;
319       case 16:
320         return MVT::i16;
321       case 32:
322         return MVT::i32;
323       case 64:
324         return MVT::i64;
325       case 128:
326         return MVT::i128;
327       }
328     }
329
330     static MVT getVectorVT(MVT VT, unsigned NumElements) {
331       switch (VT.SimpleTy) {
332       default:
333         break;
334       case MVT::i8:
335         if (NumElements == 2)  return MVT::v2i8;
336         if (NumElements == 4)  return MVT::v4i8;
337         if (NumElements == 8)  return MVT::v8i8;
338         if (NumElements == 16) return MVT::v16i8;
339         if (NumElements == 32) return MVT::v32i8;
340         break;
341       case MVT::i16:
342         if (NumElements == 2)  return MVT::v2i16;
343         if (NumElements == 4)  return MVT::v4i16;
344         if (NumElements == 8)  return MVT::v8i16;
345         if (NumElements == 16) return MVT::v16i16;
346         break;
347       case MVT::i32:
348         if (NumElements == 2)  return MVT::v2i32;
349         if (NumElements == 4)  return MVT::v4i32;
350         if (NumElements == 8)  return MVT::v8i32;
351         break;
352       case MVT::i64:
353         if (NumElements == 1)  return MVT::v1i64;
354         if (NumElements == 2)  return MVT::v2i64;
355         if (NumElements == 4)  return MVT::v4i64;
356         if (NumElements == 8)  return MVT::v8i64;
357         break;
358       case MVT::f32:
359         if (NumElements == 2)  return MVT::v2f32;
360         if (NumElements == 4)  return MVT::v4f32;
361         if (NumElements == 8)  return MVT::v8f32;
362         break;
363       case MVT::f64:
364         if (NumElements == 2)  return MVT::v2f64;
365         if (NumElements == 4)  return MVT::v4f64;
366         break;
367       }
368       return (MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE);
369     }
370   };
371
372
373   /// EVT - Extended Value Type.  Capable of holding value types which are not
374   /// native for any processor (such as the i12345 type), as well as the types
375   /// a MVT can represent.
376   struct EVT {
377   private:
378     MVT V;
379     const Type *LLVMTy;
380
381   public:
382     EVT() : V((MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE)),
383             LLVMTy(0) {}
384     EVT(MVT::SimpleValueType SVT) : V(SVT), LLVMTy(0) { }
385     EVT(MVT S) : V(S), LLVMTy(0) {}
386
387     bool operator==(EVT VT) const {
388       return !(*this != VT);
389     }
390     bool operator!=(EVT VT) const {
391       if (V.SimpleTy != VT.V.SimpleTy)
392         return true;
393       if (V.SimpleTy == MVT::INVALID_SIMPLE_VALUE_TYPE)
394         return LLVMTy != VT.LLVMTy;
395       return false;
396     }
397
398     /// getFloatingPointVT - Returns the EVT that represents a floating point
399     /// type with the given number of bits.  There are two floating point types
400     /// with 128 bits - this returns f128 rather than ppcf128.
401     static EVT getFloatingPointVT(unsigned BitWidth) {
402       return MVT::getFloatingPointVT(BitWidth);
403     }
404
405     /// getIntegerVT - Returns the EVT that represents an integer with the given
406     /// number of bits.
407     static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth) {
408       MVT M = MVT::getIntegerVT(BitWidth);
409       if (M.SimpleTy != MVT::INVALID_SIMPLE_VALUE_TYPE)
410         return M;
411       return getExtendedIntegerVT(Context, BitWidth);
412     }
413
414     /// getVectorVT - Returns the EVT that represents a vector NumElements in
415     /// length, where each element is of type VT.
416     static EVT getVectorVT(LLVMContext &Context, EVT VT, unsigned NumElements) {
417       MVT M = MVT::getVectorVT(VT.V, NumElements);
418       if (M.SimpleTy != MVT::INVALID_SIMPLE_VALUE_TYPE)
419         return M;
420       return getExtendedVectorVT(Context, VT, NumElements);
421     }
422
423     /// getIntVectorWithNumElements - Return any integer vector type that has
424     /// the specified number of elements.
425     static EVT getIntVectorWithNumElements(LLVMContext &C, unsigned NumElts) {
426       switch (NumElts) {
427       default: return getVectorVT(C, MVT::i8, NumElts);
428       case  1: return MVT::v1i64;
429       case  2: return MVT::v2i32;
430       case  4: return MVT::v4i16;
431       case  8: return MVT::v8i8;
432       case 16: return MVT::v16i8;
433       }
434       return MVT::INVALID_SIMPLE_VALUE_TYPE;
435     }
436
437     /// isSimple - Test if the given EVT is simple (as opposed to being
438     /// extended).
439     bool isSimple() const {
440       return V.SimpleTy <= MVT::LastSimpleValueType;
441     }
442
443     /// isExtended - Test if the given EVT is extended (as opposed to
444     /// being simple).
445     bool isExtended() const {
446       return !isSimple();
447     }
448
449     /// isFloatingPoint - Return true if this is a FP, or a vector FP type.
450     bool isFloatingPoint() const {
451       return isSimple() ? V.isFloatingPoint() : isExtendedFloatingPoint();
452     }
453
454     /// isInteger - Return true if this is an integer, or a vector integer type.
455     bool isInteger() const {
456       return isSimple() ? V.isInteger() : isExtendedInteger();
457     }
458
459     /// isVector - Return true if this is a vector value type.
460     bool isVector() const {
461       return isSimple() ? V.isVector() : isExtendedVector();
462     }
463
464     /// is64BitVector - Return true if this is a 64-bit vector type.
465     bool is64BitVector() const {
466       if (!isSimple())
467         return isExtended64BitVector();
468
469       return (V == MVT::v8i8  || V==MVT::v4i16 || V==MVT::v2i32 ||
470               V == MVT::v1i64 || V==MVT::v2f32);
471     }
472
473     /// is128BitVector - Return true if this is a 128-bit vector type.
474     bool is128BitVector() const {
475       if (!isSimple())
476         return isExtended128BitVector();
477       return (V==MVT::v16i8 || V==MVT::v8i16 || V==MVT::v4i32 ||
478               V==MVT::v2i64 || V==MVT::v4f32 || V==MVT::v2f64);
479     }
480
481     /// is256BitVector - Return true if this is a 256-bit vector type.
482     inline bool is256BitVector() const {
483       if (!isSimple())
484         return isExtended256BitVector();
485       return (V == MVT::v8f32  || V == MVT::v4f64 || V == MVT::v32i8 ||
486               V == MVT::v16i16 || V == MVT::v8i32 || V == MVT::v4i64);
487     }
488
489     /// is512BitVector - Return true if this is a 512-bit vector type.
490     inline bool is512BitVector() const {
491       return isSimple() ? (V == MVT::v8i64) : isExtended512BitVector();
492     }
493
494     /// isOverloaded - Return true if this is an overloaded type for TableGen.
495     bool isOverloaded() const {
496       return (V==MVT::iAny || V==MVT::fAny || V==MVT::vAny || V==MVT::iPTRAny);
497     }
498
499     /// isByteSized - Return true if the bit size is a multiple of 8.
500     bool isByteSized() const {
501       return (getSizeInBits() & 7) == 0;
502     }
503
504     /// isRound - Return true if the size is a power-of-two number of bytes.
505     bool isRound() const {
506       unsigned BitSize = getSizeInBits();
507       return BitSize >= 8 && !(BitSize & (BitSize - 1));
508     }
509
510     /// bitsEq - Return true if this has the same number of bits as VT.
511     bool bitsEq(EVT VT) const {
512       if (EVT::operator==(VT)) return true;
513       return getSizeInBits() == VT.getSizeInBits();
514     }
515
516     /// bitsGT - Return true if this has more bits than VT.
517     bool bitsGT(EVT VT) const {
518       if (EVT::operator==(VT)) return false;
519       return getSizeInBits() > VT.getSizeInBits();
520     }
521
522     /// bitsGE - Return true if this has no less bits than VT.
523     bool bitsGE(EVT VT) const {
524       if (EVT::operator==(VT)) return true;
525       return getSizeInBits() >= VT.getSizeInBits();
526     }
527
528     /// bitsLT - Return true if this has less bits than VT.
529     bool bitsLT(EVT VT) const {
530       if (EVT::operator==(VT)) return false;
531       return getSizeInBits() < VT.getSizeInBits();
532     }
533
534     /// bitsLE - Return true if this has no more bits than VT.
535     bool bitsLE(EVT VT) const {
536       if (EVT::operator==(VT)) return true;
537       return getSizeInBits() <= VT.getSizeInBits();
538     }
539
540
541     /// getSimpleVT - Return the SimpleValueType held in the specified
542     /// simple EVT.
543     MVT getSimpleVT() const {
544       assert(isSimple() && "Expected a SimpleValueType!");
545       return V;
546     }
547
548     /// getScalarType - If this is a vector type, return the element type,
549     /// otherwise return this.
550     EVT getScalarType() const {
551       return isVector() ? getVectorElementType() : *this;
552     }
553
554     /// getVectorElementType - Given a vector type, return the type of
555     /// each element.
556     EVT getVectorElementType() const {
557       assert(isVector() && "Invalid vector type!");
558       if (isSimple())
559         return V.getVectorElementType();
560       return getExtendedVectorElementType();
561     }
562
563     /// getVectorNumElements - Given a vector type, return the number of
564     /// elements it contains.
565     unsigned getVectorNumElements() const {
566       assert(isVector() && "Invalid vector type!");
567       if (isSimple())
568         return V.getVectorNumElements();
569       return getExtendedVectorNumElements();
570     }
571
572     /// getSizeInBits - Return the size of the specified value type in bits.
573     unsigned getSizeInBits() const {
574       if (isSimple())
575         return V.getSizeInBits();
576       return getExtendedSizeInBits();
577     }
578
579     /// getStoreSize - Return the number of bytes overwritten by a store
580     /// of the specified value type.
581     unsigned getStoreSize() const {
582       return (getSizeInBits() + 7) / 8;
583     }
584
585     /// getStoreSizeInBits - Return the number of bits overwritten by a store
586     /// of the specified value type.
587     unsigned getStoreSizeInBits() const {
588       return getStoreSize() * 8;
589     }
590
591     /// getRoundIntegerType - Rounds the bit-width of the given integer EVT up
592     /// to the nearest power of two (and at least to eight), and returns the
593     /// integer EVT with that number of bits.
594     EVT getRoundIntegerType(LLVMContext &Context) const {
595       assert(isInteger() && !isVector() && "Invalid integer type!");
596       unsigned BitWidth = getSizeInBits();
597       if (BitWidth <= 8)
598         return EVT(MVT::i8);
599       return getIntegerVT(Context, 1 << Log2_32_Ceil(BitWidth));
600     }
601
602     /// getHalfSizedIntegerVT - Finds the smallest simple value type that is
603     /// greater than or equal to half the width of this EVT. If no simple
604     /// value type can be found, an extended integer value type of half the
605     /// size (rounded up) is returned.
606     EVT getHalfSizedIntegerVT(LLVMContext &Context) const {
607       assert(isInteger() && !isVector() && "Invalid integer type!");
608       unsigned EVTSize = getSizeInBits();
609       for (unsigned IntVT = MVT::FIRST_INTEGER_VALUETYPE;
610           IntVT <= MVT::LAST_INTEGER_VALUETYPE; ++IntVT) {
611         EVT HalfVT = EVT((MVT::SimpleValueType)IntVT);
612         if (HalfVT.getSizeInBits() * 2 >= EVTSize)
613           return HalfVT;
614       }
615       return getIntegerVT(Context, (EVTSize + 1) / 2);
616     }
617
618     /// isPow2VectorType - Returns true if the given vector is a power of 2.
619     bool isPow2VectorType() const {
620       unsigned NElts = getVectorNumElements();
621       return !(NElts & (NElts - 1));
622     }
623
624     /// getPow2VectorType - Widens the length of the given vector EVT up to
625     /// the nearest power of 2 and returns that type.
626     EVT getPow2VectorType(LLVMContext &Context) const {
627       if (!isPow2VectorType()) {
628         unsigned NElts = getVectorNumElements();
629         unsigned Pow2NElts = 1 <<  Log2_32_Ceil(NElts);
630         return EVT::getVectorVT(Context, getVectorElementType(), Pow2NElts);
631       }
632       else {
633         return *this;
634       }
635     }
636
637     /// getEVTString - This function returns value type as a string,
638     /// e.g. "i32".
639     std::string getEVTString() const;
640
641     /// getTypeForEVT - This method returns an LLVM type corresponding to the
642     /// specified EVT.  For integer types, this returns an unsigned type.  Note
643     /// that this will abort for types that cannot be represented.
644     const Type *getTypeForEVT(LLVMContext &Context) const;
645
646     /// getEVT - Return the value type corresponding to the specified type.
647     /// This returns all pointers as iPTR.  If HandleUnknown is true, unknown
648     /// types are returned as Other, otherwise they are invalid.
649     static EVT getEVT(const Type *Ty, bool HandleUnknown = false);
650
651     intptr_t getRawBits() {
652       if (isSimple())
653         return V.SimpleTy;
654       else
655         return (intptr_t)(LLVMTy);
656     }
657
658     /// compareRawBits - A meaningless but well-behaved order, useful for
659     /// constructing containers.
660     struct compareRawBits {
661       bool operator()(EVT L, EVT R) const {
662         if (L.V.SimpleTy == R.V.SimpleTy)
663           return L.LLVMTy < R.LLVMTy;
664         else
665           return L.V.SimpleTy < R.V.SimpleTy;
666       }
667     };
668
669   private:
670     // Methods for handling the Extended-type case in functions above.
671     // These are all out-of-line to prevent users of this header file
672     // from having a dependency on Type.h.
673     static EVT getExtendedIntegerVT(LLVMContext &C, unsigned BitWidth);
674     static EVT getExtendedVectorVT(LLVMContext &C, EVT VT,
675                                    unsigned NumElements);
676     bool isExtendedFloatingPoint() const;
677     bool isExtendedInteger() const;
678     bool isExtendedVector() const;
679     bool isExtended64BitVector() const;
680     bool isExtended128BitVector() const;
681     bool isExtended256BitVector() const;
682     bool isExtended512BitVector() const;
683     EVT getExtendedVectorElementType() const;
684     unsigned getExtendedVectorNumElements() const;
685     unsigned getExtendedSizeInBits() const;
686   };
687
688 } // End llvm namespace
689
690 #endif