From e63b6518fa257f47f8b46c116ac683616d74cb36 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Sun, 31 Dec 2006 05:55:36 +0000 Subject: For PR950: Three changes: 1. Convert signed integer types to signless versions. 2. Implement the @sext and @zext parameter attributes. Previously the type of an function parameter was used to determine whether it should be sign extended or zero extended before the call. This information is now communicated via the function type's parameter attributes. 3. The interface to LowerCallTo had to be changed in order to accommodate the parameter attribute information. Although it would have been convenient to pass in the FunctionType itself, there isn't always one present in the caller. Consequently, a signedness indication for the result type and for each parameter was provided for in the interface to this method. All implementations were changed to make the adjustment necessary. llvm-svn: 32788 --- llvm/lib/Target/TargetData.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'llvm/lib/Target/TargetData.cpp') diff --git a/llvm/lib/Target/TargetData.cpp b/llvm/lib/Target/TargetData.cpp index 6dfeefde5f7..db0ea2cb4c6 100644 --- a/llvm/lib/Target/TargetData.cpp +++ b/llvm/lib/Target/TargetData.cpp @@ -243,14 +243,10 @@ static inline void getTypeInfo(const Type *Ty, const TargetData *TD, switch (Ty->getTypeID()) { case Type::BoolTyID: Size = 1; Alignment = TD->getBoolAlignment(); return; case Type::VoidTyID: - case Type::UByteTyID: - case Type::SByteTyID: Size = 1; Alignment = TD->getByteAlignment(); return; - case Type::UShortTyID: - case Type::ShortTyID: Size = 2; Alignment = TD->getShortAlignment(); return; - case Type::UIntTyID: - case Type::IntTyID: Size = 4; Alignment = TD->getIntAlignment(); return; - case Type::ULongTyID: - case Type::LongTyID: Size = 8; Alignment = TD->getLongAlignment(); return; + case Type::Int8TyID: Size = 1; Alignment = TD->getByteAlignment(); return; + case Type::Int16TyID: Size = 2; Alignment = TD->getShortAlignment(); return; + case Type::Int32TyID: Size = 4; Alignment = TD->getIntAlignment(); return; + case Type::Int64TyID: Size = 8; Alignment = TD->getLongAlignment(); return; case Type::FloatTyID: Size = 4; Alignment = TD->getFloatAlignment(); return; case Type::DoubleTyID: Size = 8; Alignment = TD->getDoubleAlignment(); return; case Type::LabelTyID: @@ -312,9 +308,9 @@ unsigned char TargetData::getTypeAlignmentShift(const Type *Ty) const { const Type *TargetData::getIntPtrType() const { switch (getPointerSize()) { default: assert(0 && "Unknown pointer size!"); - case 2: return Type::UShortTy; - case 4: return Type::UIntTy; - case 8: return Type::ULongTy; + case 2: return Type::Int16Ty; + case 4: return Type::Int32Ty; + case 8: return Type::Int64Ty; } } @@ -329,7 +325,7 @@ uint64_t TargetData::getIndexedOffset(const Type *ptrTy, TI = gep_type_begin(ptrTy, Idx.begin(), Idx.end()); for (unsigned CurIDX = 0; CurIDX != Idx.size(); ++CurIDX, ++TI) { if (const StructType *STy = dyn_cast(*TI)) { - assert(Idx[CurIDX]->getType() == Type::UIntTy && "Illegal struct idx"); + assert(Idx[CurIDX]->getType() == Type::Int32Ty && "Illegal struct idx"); unsigned FieldNo = cast(Idx[CurIDX])->getZExtValue(); // Get structure layout information... -- cgit v1.2.3