ValueTypes.h revision 195340
1198629Srrs//===- CodeGen/ValueTypes.h - Low-Level Target independ. types --*- C++ -*-===// 2198629Srrs// 3198629Srrs// The LLVM Compiler Infrastructure 4198629Srrs// 5198629Srrs// This file is distributed under the University of Illinois Open Source 6198629Srrs// License. See LICENSE.TXT for details. 7198629Srrs// 8198629Srrs//===----------------------------------------------------------------------===// 9198629Srrs// 10198629Srrs// This file defines the set of low-level target independent types which various 11198629Srrs// values in the code generator are. This allows the target specific behavior 12198629Srrs// of instructions to be described to target independent passes. 13198629Srrs// 14198629Srrs//===----------------------------------------------------------------------===// 15198629Srrs 16198629Srrs#ifndef LLVM_CODEGEN_VALUETYPES_H 17198629Srrs#define LLVM_CODEGEN_VALUETYPES_H 18198629Srrs 19198629Srrs#include <cassert> 20198629Srrs#include <string> 21198629Srrs#include "llvm/Support/DataTypes.h" 22198629Srrs#include "llvm/Support/MathExtras.h" 23198629Srrs 24198629Srrsnamespace llvm { 25198629Srrs class Type; 26198629Srrs 27198629Srrs struct MVT { // MVT = Machine Value Type 28198629Srrs public: 29211994Sjchandra enum SimpleValueType { 30211994Sjchandra // If you change this numbering, you must change the values in 31211994Sjchandra // ValueTypes.td as well! 32198629Srrs Other = 0, // This is a non-standard value 33212366Sjchandra i1 = 1, // This is a 1 bit integer value 34198629Srrs i8 = 2, // This is an 8 bit integer value 35212366Sjchandra i16 = 3, // This is a 16 bit integer value 36212366Sjchandra i32 = 4, // This is a 32 bit integer value 37212366Sjchandra i64 = 5, // This is a 64 bit integer value 38212366Sjchandra i128 = 6, // This is a 128 bit integer value 39212366Sjchandra 40212366Sjchandra FIRST_INTEGER_VALUETYPE = i1, 41198629Srrs LAST_INTEGER_VALUETYPE = i128, 42212366Sjchandra 43198629Srrs f32 = 7, // This is a 32 bit floating point value 44212366Sjchandra f64 = 8, // This is a 64 bit floating point value 45212366Sjchandra f80 = 9, // This is a 80 bit floating point value 46212366Sjchandra f128 = 10, // This is a 128 bit floating point value 47198629Srrs ppcf128 = 11, // This is a PPC 128-bit floating point value 48212366Sjchandra Flag = 12, // This is a condition code or machine flag. 49198629Srrs 50212366Sjchandra isVoid = 13, // This has no value 51212366Sjchandra 52212366Sjchandra v2i8 = 14, // 2 x i8 53212366Sjchandra v4i8 = 15, // 4 x i8 54212366Sjchandra v8i8 = 16, // 8 x i8 55212366Sjchandra v16i8 = 17, // 16 x i8 56212366Sjchandra v32i8 = 18, // 32 x i8 57212366Sjchandra v2i16 = 19, // 2 x i16 58212366Sjchandra v4i16 = 20, // 4 x i16 59212366Sjchandra v8i16 = 21, // 8 x i16 60212366Sjchandra v16i16 = 22, // 16 x i16 61198629Srrs v2i32 = 23, // 2 x i32 62198629Srrs v3i32 = 24, // 3 x i32 63212366Sjchandra v4i32 = 25, // 4 x i32 64212366Sjchandra v8i32 = 26, // 8 x i32 65198629Srrs v1i64 = 27, // 1 x i64 66212366Sjchandra v2i64 = 28, // 2 x i64 67212366Sjchandra v4i64 = 29, // 4 x i64 68212366Sjchandra 69212366Sjchandra v2f32 = 30, // 2 x f32 70212366Sjchandra v3f32 = 31, // 3 x f32 71212366Sjchandra v4f32 = 32, // 4 x f32 72212366Sjchandra v8f32 = 33, // 8 x f32 73212366Sjchandra v2f64 = 34, // 2 x f64 74212366Sjchandra v4f64 = 35, // 4 x f64 75212366Sjchandra 76212366Sjchandra FIRST_VECTOR_VALUETYPE = v2i8, 77198629Srrs LAST_VECTOR_VALUETYPE = v4f64, 78198629Srrs 79212366Sjchandra LAST_VALUETYPE = 36, // This always remains at the end of the list. 80212366Sjchandra 81212366Sjchandra // This is the current maximum for LAST_VALUETYPE. 82212366Sjchandra // MVT::MAX_ALLOWED_VALUETYPE is used for asserts and to size bit vectors 83198629Srrs // This value must be a multiple of 32. 84212366Sjchandra MAX_ALLOWED_VALUETYPE = 64, 85212366Sjchandra 86212366Sjchandra // iPTRAny - An int value the size of the pointer of the current 87212366Sjchandra // target to any address space. This must only be used internal to 88212366Sjchandra // tblgen. Other than for overloading, we treat iPTRAny the same as iPTR. 89212366Sjchandra iPTRAny = 252, 90212366Sjchandra 91212366Sjchandra // fAny - Any floating-point or vector floating-point value. This is used 92212366Sjchandra // for intrinsics that have overloadings based on floating-point types. 93212366Sjchandra // This is only for tblgen's consumption! 94212366Sjchandra fAny = 253, 95212366Sjchandra 96212366Sjchandra // iAny - An integer or vector integer value of any bit width. This is 97212366Sjchandra // used for intrinsics that have overloadings based on integer bit widths. 98212366Sjchandra // This is only for tblgen's consumption! 99212366Sjchandra iAny = 254, 100198629Srrs 101198629Srrs // iPTR - An int value the size of the pointer of the current 102212366Sjchandra // target. This should only be used internal to tblgen! 103212366Sjchandra iPTR = 255, 104198629Srrs 105212366Sjchandra // LastSimpleValueType - The greatest valid SimpleValueType value. 106198629Srrs LastSimpleValueType = 255 107198629Srrs }; 108198629Srrs 109198629Srrs private: 110212366Sjchandra /// This union holds low-level value types. Valid values include any of 111212366Sjchandra /// the values in the SimpleValueType enum, or any value returned from one 112212366Sjchandra /// of the MVT methods. Any value type equal to one of the SimpleValueType 113212366Sjchandra /// enum values is a "simple" value type. All others are "extended". 114212366Sjchandra /// 115212366Sjchandra /// Note that simple doesn't necessary mean legal for the target machine. 116212366Sjchandra /// All legal value types must be simple, but often there are some simple 117212366Sjchandra /// value types that are not legal. 118212366Sjchandra /// 119212366Sjchandra union { 120212366Sjchandra uintptr_t V; 121212366Sjchandra const Type *LLVMTy; 122212366Sjchandra }; 123212366Sjchandra 124212366Sjchandra public: 125198629Srrs MVT() {} 126212366Sjchandra MVT(SimpleValueType S) : V(S) {} 127212366Sjchandra 128212366Sjchandra bool operator==(const MVT VT) const { 129212366Sjchandra return getRawBits() == VT.getRawBits(); 130212366Sjchandra } 131212366Sjchandra bool operator!=(const MVT VT) const { 132212366Sjchandra return getRawBits() != VT.getRawBits(); 133212366Sjchandra } 134212366Sjchandra 135212366Sjchandra /// getFloatingPointVT - Returns the MVT that represents a floating point 136212366Sjchandra /// type with the given number of bits. There are two floating point types 137212366Sjchandra /// with 128 bits - this returns f128 rather than ppcf128. 138212366Sjchandra static MVT getFloatingPointVT(unsigned BitWidth) { 139212366Sjchandra switch (BitWidth) { 140198629Srrs default: 141212366Sjchandra assert(false && "Bad bit width!"); 142212366Sjchandra case 32: 143212366Sjchandra return f32; 144212366Sjchandra case 64: 145212366Sjchandra return f64; 146212366Sjchandra case 80: 147212366Sjchandra return f80; 148198629Srrs case 128: 149212366Sjchandra return f128; 150212366Sjchandra } 151212366Sjchandra } 152212366Sjchandra 153212366Sjchandra /// getIntegerVT - Returns the MVT that represents an integer with the given 154212366Sjchandra /// number of bits. 155212366Sjchandra static MVT getIntegerVT(unsigned BitWidth) { 156212366Sjchandra switch (BitWidth) { 157212366Sjchandra default: 158212366Sjchandra break; 159212366Sjchandra case 1: 160198629Srrs return i1; 161212366Sjchandra case 8: 162212366Sjchandra return i8; 163212366Sjchandra case 16: 164212366Sjchandra return i16; 165212366Sjchandra case 32: 166212366Sjchandra return i32; 167212366Sjchandra case 64: 168198629Srrs return i64; 169212366Sjchandra case 128: 170212366Sjchandra return i128; 171212366Sjchandra } 172212366Sjchandra return getExtendedIntegerVT(BitWidth); 173212366Sjchandra } 174212366Sjchandra 175212366Sjchandra /// getVectorVT - Returns the MVT that represents a vector NumElements in 176212366Sjchandra /// length, where each element is of type VT. 177212366Sjchandra static MVT getVectorVT(MVT VT, unsigned NumElements) { 178212366Sjchandra switch (VT.V) { 179212366Sjchandra default: 180212366Sjchandra break; 181212366Sjchandra case i8: 182212366Sjchandra if (NumElements == 2) return v2i8; 183212366Sjchandra if (NumElements == 4) return v4i8; 184198629Srrs if (NumElements == 8) return v8i8; 185212366Sjchandra if (NumElements == 16) return v16i8; 186212366Sjchandra if (NumElements == 32) return v32i8; 187212366Sjchandra break; 188212366Sjchandra case i16: 189212366Sjchandra if (NumElements == 2) return v2i16; 190212366Sjchandra if (NumElements == 4) return v4i16; 191212366Sjchandra if (NumElements == 8) return v8i16; 192211994Sjchandra if (NumElements == 16) return v16i16; 193212366Sjchandra break; 194212366Sjchandra case i32: 195212366Sjchandra if (NumElements == 2) return v2i32; 196212366Sjchandra if (NumElements == 3) return v3i32; 197212366Sjchandra if (NumElements == 4) return v4i32; 198212366Sjchandra if (NumElements == 8) return v8i32; 199212366Sjchandra break; 200212366Sjchandra case i64: 201212366Sjchandra if (NumElements == 1) return v1i64; 202212366Sjchandra if (NumElements == 2) return v2i64; 203212366Sjchandra if (NumElements == 4) return v4i64; 204211994Sjchandra break; 205212366Sjchandra case f32: 206212366Sjchandra if (NumElements == 2) return v2f32; 207212366Sjchandra if (NumElements == 3) return v3f32; 208212366Sjchandra if (NumElements == 4) return v4f32; 209212366Sjchandra if (NumElements == 8) return v8f32; 210212366Sjchandra break; 211212366Sjchandra case f64: 212211994Sjchandra if (NumElements == 2) return v2f64; 213212366Sjchandra if (NumElements == 4) return v4f64; 214211994Sjchandra break; 215212366Sjchandra } 216212366Sjchandra return getExtendedVectorVT(VT, NumElements); 217212366Sjchandra } 218212366Sjchandra 219212366Sjchandra /// getIntVectorWithNumElements - Return any integer vector type that has 220212366Sjchandra /// the specified number of elements. 221212366Sjchandra static MVT getIntVectorWithNumElements(unsigned NumElts) { 222212366Sjchandra switch (NumElts) { 223212366Sjchandra default: return getVectorVT(i8, NumElts); 224212366Sjchandra case 1: return v1i64; 225212366Sjchandra case 2: return v2i32; 226212366Sjchandra case 3: return v3i32; 227212366Sjchandra case 4: return v4i16; 228212366Sjchandra case 8: return v8i8; 229212366Sjchandra case 16: return v16i8; 230212366Sjchandra } 231212366Sjchandra } 232212366Sjchandra 233211994Sjchandra /// isSimple - Test if the given MVT is simple (as opposed to being 234212366Sjchandra /// extended). 235212366Sjchandra bool isSimple() const { 236212366Sjchandra return V <= LastSimpleValueType; 237212366Sjchandra } 238212366Sjchandra 239212366Sjchandra /// isExtended - Test if the given MVT is extended (as opposed to 240212366Sjchandra /// being simple). 241212366Sjchandra bool isExtended() const { 242212366Sjchandra return !isSimple(); 243212366Sjchandra } 244212366Sjchandra 245212366Sjchandra /// isFloatingPoint - Return true if this is a FP, or a vector FP type. 246212366Sjchandra bool isFloatingPoint() const { 247212366Sjchandra return isSimple() ? 248212366Sjchandra ((V >= f32 && V <= ppcf128) || 249212366Sjchandra (V >= v2f32 && V <= v4f64)) : isExtendedFloatingPoint(); 250212366Sjchandra } 251211994Sjchandra 252212366Sjchandra /// isInteger - Return true if this is an integer, or a vector integer type. 253212366Sjchandra bool isInteger() const { 254212366Sjchandra return isSimple() ? 255212366Sjchandra ((V >= FIRST_INTEGER_VALUETYPE && V <= LAST_INTEGER_VALUETYPE) || 256212366Sjchandra (V >= v2i8 && V <= v4i64)) : isExtendedInteger(); 257212366Sjchandra } 258212366Sjchandra 259212366Sjchandra /// isVector - Return true if this is a vector value type. 260212366Sjchandra bool isVector() const { 261212366Sjchandra return isSimple() ? 262212366Sjchandra (V >= FIRST_VECTOR_VALUETYPE && V <= LAST_VECTOR_VALUETYPE) : 263212366Sjchandra isExtendedVector(); 264212366Sjchandra } 265212366Sjchandra 266212366Sjchandra /// is64BitVector - Return true if this is a 64-bit vector type. 267211994Sjchandra bool is64BitVector() const { 268212366Sjchandra return isSimple() ? 269212366Sjchandra (V==v8i8 || V==v4i16 || V==v2i32 || V==v1i64 || V==v2f32) : 270212366Sjchandra isExtended64BitVector(); 271212366Sjchandra } 272212366Sjchandra 273212366Sjchandra /// is128BitVector - Return true if this is a 128-bit vector type. 274212366Sjchandra bool is128BitVector() const { 275212366Sjchandra return isSimple() ? 276212366Sjchandra (V==v16i8 || V==v8i16 || V==v4i32 || 277212366Sjchandra V==v2i64 || V==v4f32 || V==v2f64) : 278212366Sjchandra isExtended128BitVector(); 279212366Sjchandra } 280212366Sjchandra 281212366Sjchandra /// is256BitVector - Return true if this is a 256-bit vector type. 282212366Sjchandra inline bool is256BitVector() const { 283212366Sjchandra return isSimple() ? 284212366Sjchandra (V==v8f32 || V==v4f64 || V==v32i8 || V==v16i16 || V==v8i32 || 285211994Sjchandra V==v4i64) : isExtended256BitVector(); 286212366Sjchandra } 287211994Sjchandra 288212366Sjchandra /// isByteSized - Return true if the bit size is a multiple of 8. 289212366Sjchandra bool isByteSized() const { 290212366Sjchandra return (getSizeInBits() & 7) == 0; 291211994Sjchandra } 292212366Sjchandra 293212366Sjchandra /// isRound - Return true if the size is a power-of-two number of bytes. 294211994Sjchandra bool isRound() const { 295212366Sjchandra unsigned BitSize = getSizeInBits(); 296212366Sjchandra return BitSize >= 8 && !(BitSize & (BitSize - 1)); 297212366Sjchandra } 298211994Sjchandra 299212366Sjchandra /// bitsEq - Return true if this has the same number of bits as VT. 300212366Sjchandra bool bitsEq(MVT VT) const { 301211994Sjchandra return getSizeInBits() == VT.getSizeInBits(); 302212366Sjchandra } 303212366Sjchandra 304212366Sjchandra /// bitsGT - Return true if this has more bits than VT. 305211994Sjchandra bool bitsGT(MVT VT) const { 306212366Sjchandra return getSizeInBits() > VT.getSizeInBits(); 307212366Sjchandra } 308212366Sjchandra 309212366Sjchandra /// bitsGE - Return true if this has no less bits than VT. 310212366Sjchandra bool bitsGE(MVT VT) const { 311212366Sjchandra return getSizeInBits() >= VT.getSizeInBits(); 312212366Sjchandra } 313212366Sjchandra 314211994Sjchandra /// bitsLT - Return true if this has less bits than VT. 315211994Sjchandra bool bitsLT(MVT VT) const { 316211994Sjchandra return getSizeInBits() < VT.getSizeInBits(); 317211994Sjchandra } 318211994Sjchandra 319211994Sjchandra /// bitsLE - Return true if this has no more bits than VT. 320211994Sjchandra bool bitsLE(MVT VT) const { 321211994Sjchandra return getSizeInBits() <= VT.getSizeInBits(); 322211994Sjchandra } 323212366Sjchandra 324211994Sjchandra 325211994Sjchandra /// getSimpleVT - Return the SimpleValueType held in the specified 326211994Sjchandra /// simple MVT. 327212366Sjchandra SimpleValueType getSimpleVT() const { 328211994Sjchandra assert(isSimple() && "Expected a SimpleValueType!"); 329211994Sjchandra return SimpleValueType(V); 330212366Sjchandra } 331212366Sjchandra 332211994Sjchandra /// getVectorElementType - Given a vector type, return the type of 333211994Sjchandra /// each element. 334212366Sjchandra MVT getVectorElementType() const { 335211994Sjchandra assert(isVector() && "Invalid vector type!"); 336211994Sjchandra switch (V) { 337212366Sjchandra default: 338212366Sjchandra return getExtendedVectorElementType(); 339211994Sjchandra case v2i8 : 340211994Sjchandra case v4i8 : 341212366Sjchandra case v8i8 : 342211994Sjchandra case v16i8: 343211994Sjchandra case v32i8: return i8; 344212366Sjchandra case v2i16: 345212366Sjchandra case v4i16: 346211994Sjchandra case v8i16: 347211994Sjchandra case v16i16: return i16; 348212366Sjchandra case v2i32: 349211994Sjchandra case v3i32: 350211994Sjchandra case v4i32: 351212758Sjchandra case v8i32: return i32; 352211994Sjchandra case v1i64: 353211994Sjchandra case v2i64: 354211994Sjchandra case v4i64: return i64; 355211994Sjchandra case v2f32: 356212366Sjchandra case v3f32: 357212366Sjchandra case v4f32: 358212366Sjchandra case v8f32: return f32; 359212366Sjchandra case v2f64: 360212366Sjchandra case v4f64: return f64; 361211994Sjchandra } 362212366Sjchandra } 363212366Sjchandra 364212366Sjchandra /// getVectorNumElements - Given a vector type, return the number of 365212366Sjchandra /// elements it contains. 366212366Sjchandra unsigned getVectorNumElements() const { 367212366Sjchandra assert(isVector() && "Invalid vector type!"); 368211994Sjchandra switch (V) { 369211994Sjchandra default: 370212758Sjchandra return getExtendedVectorNumElements(); 371211994Sjchandra case v32i8: return 32; 372211994Sjchandra case v16i8: 373212758Sjchandra case v16i16: return 16; 374211994Sjchandra case v8i8 : 375211994Sjchandra case v8i16: 376211994Sjchandra case v8i32: 377211994Sjchandra case v8f32: return 8; 378211994Sjchandra case v4i8: 379212366Sjchandra case v4i16: 380212366Sjchandra case v4i32: 381212366Sjchandra case v4i64: 382212366Sjchandra case v4f32: 383212366Sjchandra case v4f64: return 4; 384211994Sjchandra case v3i32: 385211994Sjchandra case v3f32: return 3; 386211994Sjchandra case v2i8: 387211994Sjchandra case v2i16: 388212758Sjchandra case v2i32: 389211994Sjchandra case v2i64: 390211994Sjchandra case v2f32: 391211994Sjchandra case v2f64: return 2; 392212366Sjchandra case v1i64: return 1; 393212366Sjchandra } 394212366Sjchandra } 395212366Sjchandra 396212366Sjchandra /// getSizeInBits - Return the size of the specified value type in bits. 397211994Sjchandra unsigned getSizeInBits() const { 398211994Sjchandra switch (V) { 399212758Sjchandra case iPTR: 400212758Sjchandra assert(0 && "Value type size is target-dependent. Ask TLI."); 401212758Sjchandra case iPTRAny: 402212758Sjchandra case iAny: 403212758Sjchandra case fAny: 404212758Sjchandra assert(0 && "Value type is overloaded."); 405212758Sjchandra default: 406212758Sjchandra return getExtendedSizeInBits(); 407212758Sjchandra case i1 : return 1; 408212758Sjchandra case i8 : return 8; 409212758Sjchandra case i16 : 410212758Sjchandra case v2i8: return 16; 411212758Sjchandra case f32 : 412212758Sjchandra case i32 : 413212758Sjchandra case v4i8: 414212758Sjchandra case v2i16: return 32; 415212758Sjchandra case f64 : 416212758Sjchandra case i64 : 417212758Sjchandra case v8i8: 418212758Sjchandra case v4i16: 419212758Sjchandra case v2i32: 420212366Sjchandra case v1i64: 421212896Sjchandra case v2f32: return 64; 422212896Sjchandra case f80 : return 80; 423212896Sjchandra case v3i32: 424212896Sjchandra case v3f32: return 96; 425212896Sjchandra case f128: 426212896Sjchandra case ppcf128: 427212896Sjchandra case i128: 428212896Sjchandra case v16i8: 429212758Sjchandra case v8i16: 430212758Sjchandra case v4i32: 431211994Sjchandra case v2i64: 432212366Sjchandra case v4f32: 433212366Sjchandra case v2f64: return 128; 434212758Sjchandra case v32i8: 435212366Sjchandra case v16i16: 436211994Sjchandra case v8i32: 437212366Sjchandra case v4i64: 438212896Sjchandra case v8f32: 439212957Sjchandra case v4f64: return 256; 440212896Sjchandra } 441212896Sjchandra } 442212896Sjchandra 443212896Sjchandra /// getStoreSizeInBits - Return the number of bits overwritten by a store 444212896Sjchandra /// of the specified value type. 445212896Sjchandra unsigned getStoreSizeInBits() const { 446212896Sjchandra return (getSizeInBits() + 7)/8*8; 447212896Sjchandra } 448212896Sjchandra 449212896Sjchandra /// getRoundIntegerType - Rounds the bit-width of the given integer MVT up 450212896Sjchandra /// to the nearest power of two (and at least to eight), and returns the 451212896Sjchandra /// integer MVT with that number of bits. 452212896Sjchandra MVT getRoundIntegerType() const { 453212896Sjchandra assert(isInteger() && !isVector() && "Invalid integer type!"); 454212896Sjchandra unsigned BitWidth = getSizeInBits(); 455212758Sjchandra if (BitWidth <= 8) 456212758Sjchandra return i8; 457212366Sjchandra else 458212758Sjchandra return getIntegerVT(1 << Log2_32_Ceil(BitWidth)); 459211994Sjchandra } 460212366Sjchandra 461212366Sjchandra /// isPow2VectorType - Retuns true if the given vector is a power of 2. 462212366Sjchandra bool isPow2VectorType() const { 463212366Sjchandra unsigned NElts = getVectorNumElements(); 464212758Sjchandra return !(NElts & (NElts - 1)); 465212366Sjchandra } 466212366Sjchandra 467212366Sjchandra /// getPow2VectorType - Widens the length of the given vector MVT up to 468211994Sjchandra /// the nearest power of 2 and returns that type. 469212366Sjchandra MVT getPow2VectorType() const { 470212366Sjchandra if (!isPow2VectorType()) { 471212896Sjchandra unsigned NElts = getVectorNumElements(); 472212896Sjchandra unsigned Pow2NElts = 1 << Log2_32_Ceil(NElts); 473212758Sjchandra return MVT::getVectorVT(getVectorElementType(), Pow2NElts); 474212896Sjchandra } 475212896Sjchandra else { 476212896Sjchandra return *this; 477212896Sjchandra } 478212896Sjchandra } 479212896Sjchandra 480212896Sjchandra /// getMVTString - This function returns value type as a string, 481212896Sjchandra /// e.g. "i32". 482212896Sjchandra std::string getMVTString() const; 483212896Sjchandra 484212896Sjchandra /// getTypeForMVT - This method returns an LLVM type corresponding to the 485212896Sjchandra /// specified MVT. For integer types, this returns an unsigned type. Note 486212896Sjchandra /// that this will abort for types that cannot be represented. 487212896Sjchandra const Type *getTypeForMVT() const; 488212896Sjchandra 489212896Sjchandra /// getMVT - Return the value type corresponding to the specified type. 490212896Sjchandra /// This returns all pointers as iPTR. If HandleUnknown is true, unknown 491212896Sjchandra /// types are returned as Other, otherwise they are invalid. 492212896Sjchandra static MVT getMVT(const Type *Ty, bool HandleUnknown = false); 493212896Sjchandra 494212896Sjchandra /// getRawBits - Represent the type as a bunch of bits. 495212896Sjchandra uintptr_t getRawBits() const { return V; } 496212896Sjchandra 497212896Sjchandra /// compareRawBits - A meaningless but well-behaved order, useful for 498212758Sjchandra /// constructing containers. 499212366Sjchandra struct compareRawBits { 500212758Sjchandra bool operator()(MVT L, MVT R) const { 501212758Sjchandra return L.getRawBits() < R.getRawBits(); 502212366Sjchandra } 503212758Sjchandra }; 504212758Sjchandra 505212366Sjchandra private: 506212366Sjchandra // Methods for handling the Extended-type case in functions above. 507212896Sjchandra // These are all out-of-line to prevent users of this header file 508212896Sjchandra // from having a dependency on Type.h. 509212896Sjchandra static MVT getExtendedIntegerVT(unsigned BitWidth); 510212896Sjchandra static MVT getExtendedVectorVT(MVT VT, unsigned NumElements); 511212896Sjchandra bool isExtendedFloatingPoint() const; 512212896Sjchandra bool isExtendedInteger() const; 513212896Sjchandra bool isExtendedVector() const; 514212896Sjchandra bool isExtended64BitVector() const; 515212896Sjchandra bool isExtended128BitVector() const; 516212758Sjchandra bool isExtended256BitVector() const; 517212758Sjchandra MVT getExtendedVectorElementType() const; 518212366Sjchandra unsigned getExtendedVectorNumElements() const; 519212758Sjchandra unsigned getExtendedSizeInBits() const; 520211994Sjchandra }; 521212366Sjchandra 522211994Sjchandra} // End llvm namespace 523212758Sjchandra 524212758Sjchandra#endif 525212758Sjchandra