[llvm-commits] [SignlessTypes] CVS: llvm/lib/Bytecode/Reader/Reader.cpp
Reid Spencer
reid at x10sys.com
Wed Oct 18 20:59:01 PDT 2006
Changes in directory llvm/lib/Bytecode/Reader:
Reader.cpp updated: 1.198 -> 1.198.2.1
---
Log message:
For PR950: http://llvm.org/PR950 :
This commit (on SignlessTypes branch) provides the first Iteration for
moving LLVM away from Signed types. This patch removes the ConstantSInt
and ConstantUInt classes from Type.h and makes all necessary changes in
LLVM to compensate.
---
Diffs of the changes: (+10 -9)
Reader.cpp | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
Index: llvm/lib/Bytecode/Reader/Reader.cpp
diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.198 llvm/lib/Bytecode/Reader/Reader.cpp:1.198.2.1
--- llvm/lib/Bytecode/Reader/Reader.cpp:1.198 Thu Sep 14 13:23:26 2006
+++ llvm/lib/Bytecode/Reader/Reader.cpp Wed Oct 18 22:57:55 2006
@@ -1010,8 +1010,9 @@
// Convert ubyte struct indices into uint struct indices.
if (isa<StructType>(TopTy) && hasRestrictedGEPTypes)
- if (ConstantUInt *C = dyn_cast<ConstantUInt>(Idx.back()))
- Idx[Idx.size()-1] = ConstantExpr::getCast(C, Type::UIntTy);
+ if (ConstantInt *C = dyn_cast<ConstantInt>(Idx.back()))
+ if (C->getType() == Type::UByteTy)
+ Idx[Idx.size()-1] = ConstantExpr::getCast(C, Type::UIntTy);
NextTy = GetElementPtrInst::getIndexedType(InstTy, Idx, true);
}
@@ -1549,15 +1550,15 @@
case Type::UShortTyID:
case Type::UIntTyID: {
unsigned Val = read_vbr_uint();
- if (!ConstantUInt::isValueValidForType(Ty, Val))
+ if (!ConstantInt::isValueValidForType(Ty, uint64_t(Val)))
error("Invalid unsigned byte/short/int read.");
- Result = ConstantUInt::get(Ty, Val);
+ Result = ConstantInt::get(Ty, Val);
if (Handler) Handler->handleConstantValue(Result);
break;
}
case Type::ULongTyID:
- Result = ConstantUInt::get(Ty, read_vbr_uint64());
+ Result = ConstantInt::get(Ty, read_vbr_uint64());
if (Handler) Handler->handleConstantValue(Result);
break;
@@ -1566,9 +1567,9 @@
case Type::IntTyID:
case Type::LongTyID: {
int64_t Val = read_vbr_int64();
- if (!ConstantSInt::isValueValidForType(Ty, Val))
+ if (!ConstantInt::isValueValidForType(Ty, Val))
error("Invalid signed byte/short/int/long read.");
- Result = ConstantSInt::get(Ty, Val);
+ Result = ConstantInt::get(Ty, Val);
if (Handler) Handler->handleConstantValue(Result);
break;
}
@@ -1701,10 +1702,10 @@
std::vector<Constant*> Elements(ATy->getNumElements());
if (ATy->getElementType() == Type::SByteTy)
for (unsigned i = 0, e = ATy->getNumElements(); i != e; ++i)
- Elements[i] = ConstantSInt::get(Type::SByteTy, (signed char)Data[i]);
+ Elements[i] = ConstantInt::get(Type::SByteTy, (signed char)Data[i]);
else
for (unsigned i = 0, e = ATy->getNumElements(); i != e; ++i)
- Elements[i] = ConstantUInt::get(Type::UByteTy, (unsigned char)Data[i]);
+ Elements[i] = ConstantInt::get(Type::UByteTy, (unsigned char)Data[i]);
// Create the constant, inserting it as needed.
Constant *C = ConstantArray::get(ATy, Elements);
More information about the llvm-commits
mailing list