[llvm-commits] [llvm-gcc4] path for Constant[SU]Int -> ConstantInt
Jim Laskey
jlaskey at apple.com
Fri Oct 20 09:26:31 PDT 2006
In addition to build on PPC.
Index: gcc/config/rs6000/rs6000.h
===================================================================
--- gcc/config/rs6000/rs6000.h (revision 119086)
+++ gcc/config/rs6000/rs6000.h (working copy)
@@ -3812,7 +3812,7 @@
return
false; \
case
ALTIVEC_BUILTIN_VSPLTB: \
if (ConstantInt *Elt = dyn_cast<ConstantInt>(OPS[1]))
{ \
- int EV = Elt->getRawValue
(); \
+ int EV = Elt->getZExtValue
(); \
RESULT = BuildVectorShuffle(OPS[0], OPS
[0], \
EV, EV, EV, EV, EV, EV, EV,
EV, \
EV, EV, EV, EV, EV, EV, EV,
EV); \
@@ -3821,7 +3821,7 @@
return
false; \
case
ALTIVEC_BUILTIN_VSPLTH: \
if (ConstantInt *Elt = dyn_cast<ConstantInt>(OPS[1]))
{ \
- int EV = Elt->getRawValue
(); \
+ int EV = Elt->getZExtValue
(); \
RESULT = BuildVectorShuffle(OPS[0], OPS
[0], \
EV, EV, EV, EV, EV, EV, EV,
EV); \
return
true; \
@@ -3829,7 +3829,7 @@
return
false; \
case
ALTIVEC_BUILTIN_VSPLTW: \
if (ConstantInt *Elt = dyn_cast<ConstantInt>(OPS[1]))
{ \
- int EV = Elt->getRawValue
(); \
+ int EV = Elt->getZExtValue
(); \
RESULT = BuildVectorShuffle(OPS[0], OPS[0], EV, EV, EV,
EV); \
return
true; \
}
\
@@ -3840,7 +3840,7 @@
case
ALTIVEC_BUILTIN_VSLDOI_4SF: \
if (ConstantInt *Elt = dyn_cast<ConstantInt>(OPS[2]))
{ \
/* Map all of these to a shuffle.
*/ \
- unsigned Amt = Elt->getRawValue() &
15; \
+ unsigned Amt = Elt->getZExtValue() &
15; \
PackedType *v16i8 = PackedType::get(Type::SByteTy,
16); \
OPS[0] = CastToType(OPS[0],
v16i8); \
OPS[1] = CastToType(OPS[1],
v16i8); \
@@ -3890,7 +3890,7 @@
/* and out sign bits
*/ \
PackedType *v4i32 = PackedType::get(Type::IntTy,
4); \
OPS[0] = new CastInst(OPS[0], v4i32, OPS[0]->getName(),
CurBB); \
- Constant *C = ConstantSInt::get(Type::IntTy,
0x7FFFFFFF); \
+ Constant *C = ConstantInt::get(Type::IntTy,
0x7FFFFFFF); \
C = ConstantPacked::get(std::vector<Constant*>(4,
C)); \
RESULT = BinaryOperator::createAnd(OPS[0], C, "tmp",
CurBB); \
RESULT = new CastInst(RESULT, DESTTY, "tmp",
CurBB); \
On Oct 20, 2006, at 4:17 AM, Reid Spencer wrote:
> Index: llvm-abi.h
> ===================================================================
> --- llvm-abi.h (revision 184)
> +++ llvm-abi.h (working copy)
> @@ -199,7 +199,7 @@
> } else if (TREE_CODE(type) == RECORD_TYPE) {
> for (tree Field = TYPE_FIELDS(type); Field; Field =
> TREE_CHAIN(Field))
> if (TREE_CODE(Field) == FIELD_DECL) {
> - unsigned FNo =
> cast<ConstantUInt>(DECL_LLVM(Field))->getValue();
> + unsigned FNo =
> cast<ConstantInt>(DECL_LLVM(Field))->getZExtValue();
> assert(FNo != ~0U && "Case not handled yet!");
>
> C.EnterField(FNo, Ty);
> Index: llvm-backend.cpp
> ===================================================================
> --- llvm-backend.cpp (revision 184)
> +++ llvm-backend.cpp (working copy)
> @@ -333,7 +333,7 @@
> std::vector<Constant*> StructInit;
> StructInit.resize(2);
> for (unsigned i = 0, e = Tors.size(); i != e; ++i) {
> - StructInit[0] = ConstantSInt::get(Type::IntTy, Tors[i].second);
> + StructInit[0] = ConstantInt::get(Type::IntTy, Tors[i].second);
> StructInit[1] = Tors[i].first;
> InitList.push_back(ConstantStruct::get(StructInit));
> }
> Index: llvm-convert.cpp
> ===================================================================
> --- llvm-convert.cpp (revision 184)
> +++ llvm-convert.cpp (working copy)
> @@ -229,7 +229,7 @@
> NameStack.push_back(NameStack.back()+"."+utostr(FieldNo));
>
> Constant *Zero = Constant::getNullValue(Type::UIntTy);
> - Constant *FIdx = ConstantUInt::get(Type::UIntTy, FieldNo);
> + Constant *FIdx = ConstantInt::get(Type::UIntTy, FieldNo);
> Value *Loc = LocStack.back();
> if (cast<PointerType>(Loc->getType())->getElementType() !=
> StructTy)
> Loc = new CastInst(Loc, PointerType::get(StructTy), "tmp",
> CurBB);
> @@ -730,18 +730,18 @@
> Value *V = new LoadInst(SrcPtr, "tmp", isSrcVolatile, CurBB);
> new StoreInst(V, DestPtr, isDstVolatile, CurBB);
> } else if (const StructType *STy = dyn_cast<StructType>(ElTy)) {
> - Constant *Zero = ConstantUInt::get(Type::UIntTy, 0);
> + Constant *Zero = ConstantInt::get(Type::UIntTy, 0);
> for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
> - Constant *Idx = ConstantUInt::get(Type::UIntTy, i);
> + Constant *Idx = ConstantInt::get(Type::UIntTy, i);
> Value *DElPtr = new GetElementPtrInst(DestPtr, Zero, Idx,
> "tmp",
> CurBB);
> Value *SElPtr = new GetElementPtrInst(SrcPtr, Zero, Idx, "tmp",
> CurBB);
> CopyAggregate(DElPtr, SElPtr, isDstVolatile, isSrcVolatile,
> CurBB);
> }
> } else {
> const ArrayType *ATy = cast<ArrayType>(ElTy);
> - Constant *Zero = ConstantUInt::get(Type::UIntTy, 0);
> + Constant *Zero = ConstantInt::get(Type::UIntTy, 0);
> for (unsigned i = 0, e = ATy->getNumElements(); i != e; ++i) {
> - Constant *Idx = ConstantUInt::get(Type::UIntTy, i);
> + Constant *Idx = ConstantInt::get(Type::UIntTy, i);
> Value *DElPtr = new GetElementPtrInst(DestPtr, Zero, Idx,
> "tmp",
> CurBB);
> Value *SElPtr = new GetElementPtrInst(SrcPtr, Zero, Idx, "tmp",
> CurBB);
> CopyAggregate(DElPtr, SElPtr, isDstVolatile, isSrcVolatile,
> CurBB);
> @@ -800,17 +800,17 @@
> if (ElTy->isFirstClassType()) {
> new StoreInst(Constant::getNullValue(ElTy), DestPtr, CurBB);
> } else if (const StructType *STy = dyn_cast<StructType>(ElTy)) {
> - Constant *Zero = ConstantUInt::get(Type::UIntTy, 0);
> + Constant *Zero = ConstantInt::get(Type::UIntTy, 0);
> for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
> - Constant *Idx = ConstantUInt::get(Type::UIntTy, i);
> + Constant *Idx = ConstantInt::get(Type::UIntTy, i);
> Value *DElPtr = new GetElementPtrInst(DestPtr, Zero, Idx,
> "tmp",
> CurBB);
> ZeroAggregate(DElPtr, CurBB);
> }
> } else {
> const ArrayType *ATy = cast<ArrayType>(ElTy);
> - Constant *Zero = ConstantUInt::get(Type::UIntTy, 0);
> + Constant *Zero = ConstantInt::get(Type::UIntTy, 0);
> for (unsigned i = 0, e = ATy->getNumElements(); i != e; ++i) {
> - Constant *Idx = ConstantUInt::get(Type::UIntTy, i);
> + Constant *Idx = ConstantInt::get(Type::UIntTy, i);
> Value *DElPtr = new GetElementPtrInst(DestPtr, Zero, Idx,
> "tmp",
> CurBB);
> ZeroAggregate(DElPtr, CurBB);
> }
> @@ -834,7 +834,7 @@
> }
>
> unsigned Alignment = TYPE_ALIGN_OK(type) ? (TYPE_ALIGN_UNIT(type) &
> ~0U) : 0;
> - EmitMemSet(DestPtr, ConstantUInt::get(Type::UByteTy, 0),
> + EmitMemSet(DestPtr, ConstantInt::get(Type::UByteTy, 0),
> Emit(TYPE_SIZE_UNIT(type), 0), Alignment);
> }
>
> @@ -854,7 +854,7 @@
> Ops.push_back(CastToType(DestPtr, SBP));
> Ops.push_back(CastToType(SrcPtr, SBP));
> Ops.push_back(CastToType(Size, IntPtr));
> - Ops.push_back(ConstantUInt::get(Type::UIntTy, Align));
> + Ops.push_back(ConstantInt::get(Type::UIntTy, Align));
> new CallInst(MemCpy, Ops, "", CurBB);
> }
>
> @@ -873,7 +873,7 @@
> Ops.push_back(CastToType(DestPtr, SBP));
> Ops.push_back(CastToType(SrcPtr, SBP));
> Ops.push_back(CastToType(Size, IntPtr));
> - Ops.push_back(ConstantUInt::get(Type::UIntTy, Align));
> + Ops.push_back(ConstantInt::get(Type::UIntTy, Align));
> new CallInst(MemMove, Ops, "", CurBB);
> }
>
> @@ -893,7 +893,7 @@
> Ops.push_back(CastToType(DestPtr, SBP));
> Ops.push_back(CastToType(SrcVal, Type::UByteTy));
> Ops.push_back(CastToType(Size, IntPtr));
> - Ops.push_back(ConstantUInt::get(Type::UIntTy, Align));
> + Ops.push_back(ConstantInt::get(Type::UIntTy, Align));
> new CallInst(MemSet, Ops, "", CurBB);
> }
>
> @@ -1183,7 +1183,7 @@
> // Assign the new ID, update AddressTakenBBNumbers to remember it.
> uint64_t BlockNo = ++NumAddressTakenBlocks;
> BlockNo &= ~0ULL >> (64-TD.getPointerSizeInBits());
> - Val = ConstantUInt::get(TD.getIntPtrType(), BlockNo);
> + Val = ConstantInt::get(TD.getIntPtrType(), BlockNo);
>
> // Add it to the switch statement in the indirect goto block.
>
> cast<SwitchInst>(getIndirectGotoBlock()->getTerminator())->addCase
> (Val,
> BB);
> @@ -1689,7 +1689,7 @@
> LV.BitStart = ValSizeInBits-LV.BitStart-LV.BitSize;
>
> if (LV.BitStart+LV.BitSize != ValSizeInBits) {
> - Value *ShAmt = ConstantUInt::get(Type::UByteTy,
> + Value *ShAmt = ConstantInt::get(Type::UByteTy,
> ValSizeInBits-(LV.BitStart
> +LV.BitSize));
> Val = new ShiftInst(Instruction::Shl, Val, ShAmt, "tmp",
> CurBB);
> }
> @@ -1706,7 +1706,7 @@
> Val = CastToType(Val, Val->getType()->getSignedVersion());
> }
>
> - Value *ShAmt = ConstantUInt::get(Type::UByteTy,
> ValSizeInBits-LV.BitSize);
> + Value *ShAmt = ConstantInt::get(Type::UByteTy,
> ValSizeInBits-LV.BitSize);
> Val = new ShiftInst(Instruction::Shr, Val, ShAmt, "tmp",
> CurBB);
> }
>
> @@ -1844,7 +1844,7 @@
>
> void EnterField(unsigned FieldNo, const llvm::Type *StructTy) {
> Constant *Zero = Constant::getNullValue(Type::UIntTy);
> - Constant *FIdx = ConstantUInt::get(Type::UIntTy, FieldNo);
> + Constant *FIdx = ConstantInt::get(Type::UIntTy, FieldNo);
> Value *Loc = LocStack.back();
> if (cast<PointerType>(Loc->getType())->getElementType() !=
> StructTy)
> Loc = new CastInst(Loc, PointerType::get(StructTy), "tmp",
> CurBB);
> @@ -2085,12 +2085,12 @@
> RHS = CastToType(RHS, OldVal->getType());
> if (LV.BitStart)
> RHS = new ShiftInst(Instruction::Shl, RHS,
> - ConstantUInt::get(Type::UByteTy,
> LV.BitStart),
> + ConstantInt::get(Type::UByteTy, LV.BitStart),
> "tmp", CurBB);
> // Next, if this doesn't touch the top bit, mask out any bits that
> shouldn't
> // be set in the result.
> uint64_t MaskVal = ((1ULL << LV.BitSize)-1) << LV.BitStart;
> - Constant *Mask = ConstantUInt::get(Type::ULongTy, MaskVal);
> + Constant *Mask = ConstantInt::get(Type::ULongTy, MaskVal);
> Mask = ConstantExpr::getCast(Mask, RHS->getType());
> if (LV.BitStart+LV.BitSize != ValSizeInBits)
> RHS = BinaryOperator::createAnd(RHS, Mask, "tmp", CurBB);
> @@ -2296,7 +2296,7 @@
> // If this is a subtract, we want to step backwards.
> if (Opc == Instruction::Sub)
> EltOffset = -EltOffset;
> - Constant *C = ConstantSInt::get(Type::LongTy, EltOffset);
> + Constant *C = ConstantInt::get(Type::LongTy, EltOffset);
> Value *V = new GetElementPtrInst(LHS, C, "tmp", CurBB);
> return CastToType(V, TREE_TYPE(exp));
> }
> @@ -2357,7 +2357,7 @@
> In = CastToType(In, In->getType()->getUnsignedVersion());
>
> Value *TypeSize =
> - ConstantUInt::get(Type::UByteTy,
> In->getType()->getPrimitiveSizeInBits());
> + ConstantInt::get(Type::UByteTy,
> In->getType()->getPrimitiveSizeInBits());
>
> // Do the two shifts.
> Value *V1 = new ShiftInst((Instruction::OtherOps)Opc1, In, Amt,
> "tmp", CurBB);
> @@ -2830,7 +2830,7 @@
>
> for (unsigned i = 0, e = Ops.size(); i != e; ++i)
> Result = new InsertElementInst(Result, Ops[i],
> - ConstantUInt::get(Type::UIntTy,
> i),
> + ConstantInt::get(Type::UIntTy, i),
> "tmp", CurBB);
>
> return Result;
> @@ -2874,7 +2874,7 @@
> Idxs.push_back(UndefValue::get(Type::UIntTy));
> else {
> assert((unsigned)idx < 2*NumElements && "Element index out of
> range!");
> - Idxs.push_back(ConstantUInt::get(Type::UIntTy, idx));
> + Idxs.push_back(ConstantInt::get(Type::UIntTy, idx));
> }
> }
> va_end(VA);
> @@ -3503,8 +3503,8 @@
>
> void TreeToLLVM::EmitLoadFromComplex(Value *&Real, Value *&Imag,
> Value *SrcComplex, bool
> isVolatile) {
> - Value *I0 = ConstantUInt::get(Type::UIntTy, 0);
> - Value *I1 = ConstantUInt::get(Type::UIntTy, 1);
> + Value *I0 = ConstantInt::get(Type::UIntTy, 0);
> + Value *I1 = ConstantInt::get(Type::UIntTy, 1);
>
> Value *RealPtr = new GetElementPtrInst(SrcComplex, I0, I0, "real",
> CurBB);
> Real = new LoadInst(RealPtr, "real", isVolatile, CurBB);
> @@ -3515,8 +3515,8 @@
>
> void TreeToLLVM::EmitStoreToComplex(Value *DestComplex, Value *Real,
> Value *Imag, bool isVolatile) {
> - Value *I0 = ConstantUInt::get(Type::UIntTy, 0);
> - Value *I1 = ConstantUInt::get(Type::UIntTy, 1);
> + Value *I0 = ConstantInt::get(Type::UIntTy, 0);
> + Value *I1 = ConstantInt::get(Type::UIntTy, 1);
>
> Value *RealPtr = new GetElementPtrInst(DestComplex, I0, I0, "real",
> CurBB);
> new StoreInst(Real, RealPtr, isVolatile, CurBB);
> @@ -3782,13 +3782,15 @@
> // If this is a normal field at a fixed offset from the start,
> handle
> it.
> if (TREE_CODE(DECL_FIELD_OFFSET(FieldDecl)) == INTEGER_CST) {
> assert(DECL_LLVM_SET_P(FieldDecl) && "Struct not laid out for
> LLVM?");
> - ConstantUInt *CI = cast<ConstantUInt>(DECL_LLVM(FieldDecl));
> - if (CI->getValue() == ~0U) {
> + ConstantInt *CI = cast<ConstantInt>(DECL_LLVM(FieldDecl));
> + uint32_t MemberIndex = CI->getZExtValue();
> + if (MemberIndex == ~0U) {
> assert(isStructWithVarSizeArrayAtEnd(StructTy) &&
> "Isn't var sized array access!");
> - CI = ConstantUInt::get(Type::UIntTy,
> StructTy->getNumContainedTypes()-1);
> + CI = ConstantInt::get(Type::UIntTy,
> StructTy->getNumContainedTypes()-1);
> + MemberIndex = CI->getZExtValue();
> }
> - assert(CI->getValue() < StructTy->getNumContainedTypes() &&
> + assert(MemberIndex < StructTy->getNumContainedTypes() &&
> "Field Idx out of range!");
> FieldPtr = new GetElementPtrInst(StructAddrLV.Ptr,
>
> Constant::getNullValue(Type::IntTy), CI,
> @@ -3796,10 +3798,10 @@
>
> // Now that we did an offset from the start of the struct,
> subtract
> off
> // the offset from BitStart.
> - if (CI->getValue()) {
> + if (MemberIndex) {
> const StructLayout *SL =
> TD.getStructLayout(cast<StructType>(StructTy));
> - assert(CI->getValue() < SL->MemberOffsets.size() &&"Idx out of
> range!");
> - BitStart -= SL->MemberOffsets[CI->getValue()] * 8;
> + assert(MemberIndex < SL->MemberOffsets.size() &&"Idx out of
> range!");
> + BitStart -= SL->MemberOffsets[MemberIndex] * 8;
> }
>
> } else {
> @@ -3867,7 +3869,7 @@
> // Compute the byte offset, and add it to the pointer.
> unsigned ByteOffset = NumAlignmentUnits*ByteAlignment;
>
> - Constant *Offset = ConstantUInt::get(TD.getIntPtrType(),
> ByteOffset);
> + Constant *Offset = ConstantInt::get(TD.getIntPtrType(),
> ByteOffset);
> FieldPtr = CastToType(FieldPtr, Offset->getType());
> FieldPtr = BinaryOperator::createAdd(FieldPtr, Offset, "tmp",
> CurBB);
> FieldPtr = CastToType(FieldPtr, PointerType::get(FieldTy));
> @@ -3918,7 +3920,7 @@
> // than this. e.g. check out when compiling
> unwind-dw2-fde-darwin.c.
> Ptr.Ptr = CastToType(Ptr.Ptr, PointerType::get(ValTy));
> Ptr.Ptr = new GetElementPtrInst(Ptr.Ptr,
> - ConstantUInt::get(Type::UIntTy,
> UnitOffset),
> + ConstantInt::get(Type::UIntTy,
> UnitOffset),
> "tmp", CurBB);
> BitStart -= UnitOffset*ValueSizeInBits;
> }
> @@ -3936,8 +3938,8 @@
> assert(!Ptr.isBitfield() && "BIT_FIELD_REF operands cannot be
> bitfields!");
>
> return LValue(new GetElementPtrInst(Ptr.Ptr,
> - ConstantUInt::get(Type::UIntTy,
> 0),
> - ConstantUInt::get(Type::UIntTy,
> Idx),
> + ConstantInt::get(Type::UIntTy,
> 0),
> + ConstantInt::get(Type::UIntTy,
> Idx),
> "tmp", CurBB));
> }
>
> @@ -4046,7 +4048,7 @@
> // Build the value as a ulong constant, then constant fold it to
> the
> right
> // type. This handles overflow and other things appropriately.
> const Type *Ty = ConvertType(TREE_TYPE(exp));
> - return ConstantExpr::getCast(ConstantUInt::get(Type::ULongTy,
> IntValue), Ty);
> + return ConstantExpr::getCast(ConstantInt::get(Type::ULongTy,
> IntValue), Ty);
> }
>
> Constant *TreeConstantToLLVM::ConvertREAL_CST(tree exp) {
> @@ -4101,28 +4103,28 @@
> if (ElTy == Type::SByteTy) {
> const signed char *InStr = (const signed char
> *)TREE_STRING_POINTER(exp);
> for (unsigned i = 0; i != Len; ++i)
> - Elts.push_back(ConstantSInt::get(Type::SByteTy, InStr[i]));
> + Elts.push_back(ConstantInt::get(Type::SByteTy, InStr[i]));
> } else if (ElTy == Type::UByteTy) {
> const unsigned char *InStr =(const unsigned char
> *)TREE_STRING_POINTER(exp);
> for (unsigned i = 0; i != Len; ++i)
> - Elts.push_back(ConstantUInt::get(Type::UByteTy, InStr[i]));
> + Elts.push_back(ConstantInt::get(Type::UByteTy, InStr[i]));
> } else if (ElTy == Type::ShortTy) {
> const signed short *InStr = (const signed short
> *)TREE_STRING_POINTER(exp);
> for (unsigned i = 0; i != Len; ++i)
> - Elts.push_back(ConstantSInt::get(Type::ShortTy, InStr[i]));
> + Elts.push_back(ConstantInt::get(Type::ShortTy, InStr[i]));
> } else if (ElTy == Type::UByteTy) {
> const unsigned short *InStr =
> (const unsigned short *)TREE_STRING_POINTER(exp);
> for (unsigned i = 0; i != Len; ++i)
> - Elts.push_back(ConstantUInt::get(Type::UShortTy, InStr[i]));
> + Elts.push_back(ConstantInt::get(Type::UShortTy, InStr[i]));
> } else if (ElTy == Type::IntTy) {
> const signed *InStr = (const signed *)TREE_STRING_POINTER(exp);
> for (unsigned i = 0; i != Len; ++i)
> - Elts.push_back(ConstantSInt::get(Type::IntTy, InStr[i]));
> + Elts.push_back(ConstantInt::get(Type::IntTy, InStr[i]));
> } else if (ElTy == Type::UIntTy) {
> const unsigned *InStr = (const unsigned *)TREE_STRING_POINTER
> (exp);
> for (unsigned i = 0; i != Len; ++i)
> - Elts.push_back(ConstantUInt::get(Type::UIntTy, InStr[i]));
> + Elts.push_back(ConstantInt::get(Type::UIntTy, InStr[i]));
> } else {
> assert(0 && "Unknown character type!");
> }
> @@ -4327,7 +4329,7 @@
>
> // Insert the new value into the field and return it.
> uint64_t NewVal = (ExistingVal & ~FieldMask) | ValToInsert;
> - return ConstantExpr::getCast(ConstantUInt::get(Type::ULongTy,
> NewVal),
> + return ConstantExpr::getCast(ConstantInt::get(Type::ULongTy,
> NewVal),
> FieldTy);
> } else {
> // Otherwise, this is initializing part of an array of bytes.
> Recursively
> @@ -4416,7 +4418,7 @@
> // that contains bits from the bitfield overlayed with the declared
> type of
> // the bitfield. This bitfield value may be spread across multiple
> fields, or
> // it may be just this field, or it may just be a small part of
> this
> field.
> - unsigned FieldNo = cast<ConstantUInt>(DECL_LLVM(Field))->getValue
> ();
> + unsigned FieldNo =
> cast<ConstantInt>(DECL_LLVM(Field))->getZExtValue();
> assert(FieldNo < ResultElts.size() && "Invalid struct field
> number!");
>
> // Get the offset and size of the LLVM field.
> @@ -4508,7 +4510,7 @@
> EltVal = (Val >> 8*(e-i-1)) & 0xFF;
> }
>
> - ArrayElts.push_back(ConstantUInt::get(Type::UByteTy,
> EltVal));
> + ArrayElts.push_back(ConstantInt::get(Type::UByteTy,
> EltVal));
> }
>
> return ConstantArray::get(ATy, ArrayElts);
> @@ -4551,7 +4553,7 @@
> ProcessBitFieldInitialization(Field, Val, STy, ResultElts);
> } else {
> // If not, things are much simpler.
> - unsigned FieldNo =
> cast<ConstantUInt>(DECL_LLVM(Field))->getValue();
> + unsigned FieldNo =
> cast<ConstantInt>(DECL_LLVM(Field))->getZExtValue();
>
> // If this is an initialization of a global that ends with a
> variable
> // sized array at its end, and the initializer has a non-zero
> number of
> @@ -4775,9 +4777,10 @@
> // If this is a normal field at a fixed offset from the start,
> handle
> it.
> if (TREE_CODE(DECL_FIELD_OFFSET(FieldDecl)) == INTEGER_CST) {
> assert(DECL_LLVM_SET_P(FieldDecl) && "Struct not laid out for
> LLVM?");
> - ConstantUInt *CI = cast<ConstantUInt>(DECL_LLVM(FieldDecl));
> + ConstantInt *CI = cast<ConstantInt>(DECL_LLVM(FieldDecl));
> + uint64_t MemberIndex = CI->getZExtValue();
>
> - if (CI->getValue() != ~0U) {
> + if (MemberIndex != ~0U) {
> std::vector<Value*> Idxs;
> Idxs.push_back(Constant::getNullValue(Type::IntTy));
> Idxs.push_back(CI);
> @@ -4785,10 +4788,10 @@
>
> // Now that we did an offset from the start of the struct,
> subtract off
> // the offset from BitStart.
> - if (CI->getValue()) {
> + if (MemberIndex) {
> const StructLayout *SL =
> TD.getStructLayout(cast<StructType>(StructTy));
> - assert(CI->getValue() < SL->MemberOffsets.size() &&"Idx
> out of
> range!");
> - BitStart -= SL->MemberOffsets[CI->getValue()] * 8;
> + assert(MemberIndex < SL->MemberOffsets.size() &&"Idx out of
> range!");
> + BitStart -= SL->MemberOffsets[MemberIndex] * 8;
> }
> } else {
> // We were unable to make a nice offset, emit an ugly one.
> Index: llvm-debug.cpp
> ===================================================================
> --- llvm-debug.cpp (revision 184)
> +++ llvm-debug.cpp (working copy)
> @@ -389,8 +389,8 @@
>
> // Invoke llvm.dbg.stoppoint
> std::vector<Value*> Args;
> - Args.push_back(ConstantUInt::get(Type::UIntTy, CurLineNo));
> - Args.push_back(ConstantUInt::get(Type::UIntTy, 0));
> + Args.push_back(ConstantInt::get(Type::UIntTy, CurLineNo));
> + Args.push_back(ConstantInt::get(Type::UIntTy, 0));
> Args.push_back(getCastValueFor(Unit));
> new CallInst(StopPointFn, Args, "", CurBB);
> }
> Index: llvm-types.cpp
> ===================================================================
> --- llvm-types.cpp (revision 184)
> +++ llvm-types.cpp (working copy)
> @@ -987,7 +987,7 @@
>
> unsigned FieldNo =
> Info.getLLVMFieldFor(FieldOffsetInBits, CurFieldNo,
> isZeroSizeField);
> - SET_DECL_LLVM(Field, ConstantUInt::get(Type::UIntTy, FieldNo));
> + SET_DECL_LLVM(Field, ConstantInt::get(Type::UIntTy, FieldNo));
> }
>
> const Type *ResultTy = Info.getLLVMType();
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2417 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20061020/fc1d76b3/attachment.bin>
More information about the llvm-commits
mailing list