summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorDavid Chisnall <csdavec@swan.ac.uk>2011-10-25 10:12:21 +0000
committerDavid Chisnall <csdavec@swan.ac.uk>2011-10-25 10:12:21 +0000
commite89ac0666b090c63277e8dcf1d49bb7762da308b (patch)
treebbff49cf040ee8a216eba3a1a529d29b690c41d8 /clang/lib/CodeGen
parent32f46e7c0778230d84c55bdead0c0163531721ef (diff)
downloadbcm5719-llvm-e89ac0666b090c63277e8dcf1d49bb7762da308b.tar.gz
bcm5719-llvm-e89ac0666b090c63277e8dcf1d49bb7762da308b.zip
Change an int64_t to an intptr_t so that we don't end up with crashes in the back end on large classes on 32-bit.
llvm-svn: 142918
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGObjCGNU.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp
index ee43ccb43fc..042535f92f8 100644
--- a/clang/lib/CodeGen/CGObjCGNU.cpp
+++ b/clang/lib/CodeGen/CGObjCGNU.cpp
@@ -1381,8 +1381,8 @@ llvm::Constant *CGObjCGNU::GenerateClassStructure(
LongTy, // abi_version
IvarOffsets->getType(), // ivar_offsets
Properties->getType(), // properties
- Int64Ty, // strong_pointers
- Int64Ty, // weak_pointers
+ IntPtrTy, // strong_pointers
+ IntPtrTy, // weak_pointers
NULL);
llvm::Constant *Zero = llvm::ConstantInt::get(LongTy, 0);
// Fill in the structure
@@ -1743,12 +1743,14 @@ void CGObjCGNU::GenerateProtocolHolderCategory(void) {
/// bitfield / with the 63rd bit set will be 1<<64.
llvm::Constant *CGObjCGNU::MakeBitField(llvm::SmallVectorImpl<bool> &bits) {
int bitCount = bits.size();
- if (bitCount < 64) {
+ int ptrBits =
+ (TheModule.getPointerSize() == llvm::Module::Pointer32) ? 32 : 64;
+ if (bitCount < ptrBits) {
uint64_t val = 1;
for (int i=0 ; i<bitCount ; ++i) {
if (bits[i]) val |= 1ULL<<(i+1);
}
- return llvm::ConstantInt::get(Int64Ty, val);
+ return llvm::ConstantInt::get(IntPtrTy, val);
}
llvm::SmallVector<llvm::Constant*, 8> values;
int v=0;
@@ -1768,8 +1770,6 @@ llvm::Constant *CGObjCGNU::MakeBitField(llvm::SmallVectorImpl<bool> &bits) {
llvm::Constant *GS = MakeGlobal(llvm::StructType::get(Int32Ty, arrayTy,
NULL), fields);
llvm::Constant *ptr = llvm::ConstantExpr::getPtrToInt(GS, IntPtrTy);
- if (IntPtrTy != Int64Ty)
- ptr = llvm::ConstantExpr::getZExt(ptr, Int64Ty);
return ptr;
}
@@ -2093,12 +2093,12 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) {
}
++ivarIndex;
}
- llvm::Constant *Zero64 = llvm::ConstantInt::get(Int64Ty, 0);
+ llvm::Constant *ZeroPtr = llvm::ConstantInt::get(IntPtrTy, 0);
//Generate metaclass for class methods
llvm::Constant *MetaClassStruct = GenerateClassStructure(NULLPtr,
NULLPtr, 0x12L, ClassName.c_str(), 0, Zeros[0], GenerateIvarList(
empty, empty, empty), ClassMethodList, NULLPtr,
- NULLPtr, NULLPtr, Zero64, Zero64, true);
+ NULLPtr, NULLPtr, ZeroPtr, ZeroPtr, true);
// Generate the class structure
llvm::Constant *ClassStruct =
OpenPOWER on IntegriCloud