[llvm-commits] [dragonegg] r94893 - /dragonegg/trunk/llvm-abi.h
Duncan Sands
baldrick at free.fr
Sat Jan 30 07:09:28 PST 2010
Author: baldrick
Date: Sat Jan 30 09:09:28 2010
New Revision: 94893
URL: http://llvm.org/viewvc/llvm-project?rev=94893&view=rev
Log:
Port commit 93674 (rafael) from llvm-gcc:
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:
dragonegg/trunk/llvm-abi.h
Modified: dragonegg/trunk/llvm-abi.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-abi.h?rev=94893&r1=94892&r2=94893&view=diff
==============================================================================
--- dragonegg/trunk/llvm-abi.h (original)
+++ dragonegg/trunk/llvm-abi.h Sat Jan 30 09:09:28 2010
@@ -618,11 +618,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;
@@ -635,7 +630,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.
@@ -651,11 +645,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