diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-01-12 07:05:14 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-01-12 07:05:14 +0000 |
commit | 7a9c62baa66ae262755db0d3221ce095d48681d5 (patch) | |
tree | 4fee2892414be30e801ea1691ee9035b3c8f4341 /llvm/lib/VMCore/ConstantFolding.cpp | |
parent | 899a89b11b80ac3bda127de372a380162190a0c9 (diff) | |
download | bcm5719-llvm-7a9c62baa66ae262755db0d3221ce095d48681d5.tar.gz bcm5719-llvm-7a9c62baa66ae262755db0d3221ce095d48681d5.zip |
For 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.
llvm-svn: 33113
Diffstat (limited to 'llvm/lib/VMCore/ConstantFolding.cpp')
-rw-r--r-- | llvm/lib/VMCore/ConstantFolding.cpp | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/llvm/lib/VMCore/ConstantFolding.cpp b/llvm/lib/VMCore/ConstantFolding.cpp index 1f5aeb35caf..8aeca7b47a5 100644 --- a/llvm/lib/VMCore/ConstantFolding.cpp +++ b/llvm/lib/VMCore/ConstantFolding.cpp @@ -1364,22 +1364,6 @@ Constant *llvm::ConstantFoldGetElementPtr(const Constant *C, assert(Ty != 0 && "Invalid indices for GEP!"); return ConstantPointerNull::get(PointerType::get(Ty)); } - - if (IdxList.size() == 1) { - const Type *ElTy = cast<PointerType>(C->getType())->getElementType(); - if (uint32_t ElSize = ElTy->getPrimitiveSize()) { - // gep null, C is equal to C*sizeof(nullty). If nullty is a known llvm - // type, we can statically fold this. - Constant *R = ConstantInt::get(Type::Int32Ty, ElSize); - // We know R is unsigned, Idx0 is signed because it must be an index - // through a sequential type (gep pointer operand) which is always - // signed. - R = ConstantExpr::getSExtOrBitCast(R, Idx0->getType()); - R = ConstantExpr::getMul(R, Idx0); // signed multiply - // R is a signed integer, C is the GEP pointer so -> IntToPtr - return ConstantExpr::getIntToPtr(R, C->getType()); - } - } } if (ConstantExpr *CE = dyn_cast<ConstantExpr>(const_cast<Constant*>(C))) { |