Changes in directory llvm/lib/Transforms/IPO:
DeadTypeElimination.cpp updated: 1.59 -> 1.60 SimplifyLibCalls.cpp updated: 1.84 -> 1.85 --- 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: (+16 -9) DeadTypeElimination.cpp | 7 +++++-- SimplifyLibCalls.cpp | 18 +++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) Index: llvm/lib/Transforms/IPO/DeadTypeElimination.cpp diff -u llvm/lib/Transforms/IPO/DeadTypeElimination.cpp:1.59 llvm/lib/Transforms/IPO/DeadTypeElimination.cpp:1.60 --- llvm/lib/Transforms/IPO/DeadTypeElimination.cpp:1.59 Sat Jan 6 01:24:43 2007 +++ llvm/lib/Transforms/IPO/DeadTypeElimination.cpp Fri Jan 12 01:05:14 2007 @@ -52,11 +52,14 @@ // static inline bool ShouldNukeSymtabEntry(const Type *Ty){ // Nuke all names for primitive types! - if (Ty->isPrimitiveType()) return true; + if (Ty->isPrimitiveType() || Ty->isIntegral()) + return true; // Nuke all pointers to primitive types as well... if (const PointerType *PT = dyn_cast<PointerType>(Ty)) - if (PT->getElementType()->isPrimitiveType()) return true; + if (PT->getElementType()->isPrimitiveType() || + PT->getElementType()->isIntegral()) + return true; return false; } Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.84 llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.85 --- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.84 Thu Jan 11 12:21:29 2007 +++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp Fri Jan 12 01:05:14 2007 @@ -1820,13 +1820,17 @@ // ffsll(x) -> x == 0 ? 0 : llvm.cttz(x)+1 const Type *ArgType = TheCall->getOperand(1)->getType(); const char *CTTZName; - switch (ArgType->getTypeID()) { - default: assert(0 && "Unknown unsigned type!"); - case Type::Int8TyID : CTTZName = "llvm.cttz.i8" ; break; - case Type::Int16TyID: CTTZName = "llvm.cttz.i16"; break; - case Type::Int32TyID : CTTZName = "llvm.cttz.i32"; break; - case Type::Int64TyID : CTTZName = "llvm.cttz.i64"; break; - } + assert(ArgType->getTypeID() == Type::IntegerTyID && + "llvm.cttz argument is not an integer?"); + unsigned BitWidth = cast<IntegerType>(ArgType)->getBitWidth(); + if (BitWidth <= 8) + CTTZName = "llvm.cttz.i8"; + else if (BitWidth <= 16) + CTTZName = "llvm.cttz.i16"; + else if (BitWidth <= 32) + CTTZName = "llvm.cttz.i32"; + else + CTTZName = "llvm.cttz.i64"; Constant *F = SLC.getModule()->getOrInsertFunction(CTTZName, ArgType, ArgType, NULL); _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits