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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32788 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp
index 6dfeefd..db0ea2c 100644
--- a/lib/Target/TargetData.cpp
+++ b/lib/Target/TargetData.cpp
@@ -243,14 +243,10 @@
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 @@
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 @@
TI = gep_type_begin(ptrTy, Idx.begin(), Idx.end());
for (unsigned CurIDX = 0; CurIDX != Idx.size(); ++CurIDX, ++TI) {
if (const StructType *STy = dyn_cast<StructType>(*TI)) {
- assert(Idx[CurIDX]->getType() == Type::UIntTy && "Illegal struct idx");
+ assert(Idx[CurIDX]->getType() == Type::Int32Ty && "Illegal struct idx");
unsigned FieldNo = cast<ConstantInt>(Idx[CurIDX])->getZExtValue();
// Get structure layout information...