Changes in directory llvm/lib/Target/X86:
X86TargetAsmInfo.cpp updated: 1.18 -> 1.19 --- Log message: For PR1064: http://llvm.org/PR1064 : Implement the arbitrary bit-width integer feature. The feature allows integers of any bitwidth (up to 64) to be defined instead of just 1, 8, 16, 32, and 64 bit integers. This change does several things: 1. Introduces a new Derived Type, IntegerType, to represent the number of bits in an integer. The Type classes SubclassData field is used to store the number of bits. This allows 2^23 bits in an integer type. 2. Removes the five integer Type::TypeID values for the 1, 8, 16, 32 and 64-bit integers. These are replaced with just IntegerType which is not a primitive any more. 3. Adjust the rest of LLVM to account for this change. Note that while this incremental change lays the foundation for arbitrary bit-width integers, LLVM has not yet been converted to actually deal with them in any significant way. Most optimization passes, for example, will still only deal with the byte-width integer types. Future increments will rectify this situation. --- Diffs of the changes: (+12 -6) X86TargetAsmInfo.cpp | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) Index: llvm/lib/Target/X86/X86TargetAsmInfo.cpp diff -u llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.18 llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.19 --- llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.18 Sun Jan 7 01:24:32 2007 +++ llvm/lib/Target/X86/X86TargetAsmInfo.cpp Fri Jan 12 01:05:13 2007 @@ -176,12 +176,18 @@ const Type *Ty = CI->getType(); const char *IntName; - switch (Ty->getTypeID()) { - default: return false; - case Type::Int16TyID: IntName = "llvm.bswap.i16"; break; - case Type::Int32TyID: IntName = "llvm.bswap.i32"; break; - case Type::Int64TyID: IntName = "llvm.bswap.i64"; break; - } + if (const IntegerType *ITy = dyn_cast<IntegerType>(Ty)) { + unsigned BitWidth = ITy->getBitWidth(); + if (BitWidth > 8 && BitWidth <= 16) + IntName = "llvm.bswap.i16"; + else if (BitWidth > 24 && BitWidth <= 32) + IntName = "llvm.bswap.i32"; + else if (BitWidth > 56 && BitWidth <= 64) + IntName = "llvm.bswap.i64"; + else + return false; + } else + return false; // Okay, we can do this xform, do so now. Module *M = CI->getParent()->getParent()->getParent(); _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits