[llvm-commits] [llvm-gcc-4.2] r93674 - /llvm-gcc-4.2/trunk/gcc/llvm-abi.h
Rafael Espindola
rafael.espindola at gmail.com
Sat Jan 16 21:58:33 PST 2010
Author: rafael
Date: Sat Jan 16 23:58:33 2010
New Revision: 93674
URL: http://llvm.org/viewvc/llvm-project?rev=93674&view=rev
Log:
I wanted to removed the Elts std::vector, but we don't have an API to do that.
Just move it closer to its only use and make it clear that its maximum
size is 2!
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-abi.h
Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-abi.h?rev=93674&r1=93673&r2=93674&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Sat Jan 16 23:58:33 2010
@@ -614,11 +614,6 @@
bool UseInt64 = (getTargetData().isLegalInteger(64) &&
(DontCheckAlignment || Align >= Int64Align));
- // FIXME: In cases where we can, we should use the original struct.
- // Consider cases like { int, int } and {int, short} for example! This will
- // produce far better LLVM code!
- std::vector<const Type*> Elts;
-
unsigned ElementSize = UseInt64 ? 8:4;
unsigned ArraySize = Size / ElementSize;
@@ -631,7 +626,6 @@
Type::getInt64Ty(getGlobalContext()) :
Type::getInt32Ty(getGlobalContext()));
ATy = ArrayType::get(ArrayElementType, ArraySize);
- Elts.push_back(ATy);
}
// Pass any leftover bytes as a separate element following the array.
@@ -647,11 +641,15 @@
LastEltTy = Type::getInt8Ty(getGlobalContext());
}
if (LastEltTy) {
- Elts.push_back(LastEltTy);
if (Size != getTargetData().getTypeAllocSize(LastEltTy))
LastEltRealSize = Size;
}
+ std::vector<const Type*> Elts;
+ if (ATy)
+ Elts.push_back(ATy);
+ if (LastEltTy)
+ Elts.push_back(LastEltTy);
const StructType *STy = StructType::get(getGlobalContext(), Elts, false);
unsigned i = 0;
More information about the llvm-commits
mailing list