[llvm-commits] [126898] Use one i32 instead of four i8 while emitting
dpatel at apple.com
dpatel at apple.com
Fri May 4 14:44:40 PDT 2007
Revision: 126898
Author: dpatel
Date: 2007-05-04 14:44:39 -0700 (Fri, 04 May 2007)
Log Message:
-----------
Use one i32 instead of four i8 while emitting
tail padding.
This addresses first part of PR1278.
Modified Paths:
--------------
apple-local/branches/llvm/gcc/llvm-types.cpp
Modified: apple-local/branches/llvm/gcc/llvm-types.cpp
===================================================================
--- apple-local/branches/llvm/gcc/llvm-types.cpp 2007-05-04 21:04:24 UTC (rev 126897)
+++ apple-local/branches/llvm/gcc/llvm-types.cpp 2007-05-04 21:44:39 UTC (rev 126898)
@@ -1452,10 +1452,22 @@
"LLVM type size doesn't match GCC type size!");
uint64_t LLVMLastElementEnd = Info.getNewElementByteOffset(1);
const Type *PadTy = Type::Int8Ty;
- if (GCCTypeSize-LLVMLastElementEnd != 1)
- PadTy = ArrayType::get(PadTy, GCCTypeSize-LLVMStructSize);
- Info.addElement(PadTy, GCCTypeSize-LLVMLastElementEnd,
- GCCTypeSize-LLVMLastElementEnd);
+ if (GCCTypeSize-LLVMLastElementEnd != 1) {
+ unsigned Int32ArraySize = (GCCTypeSize-LLVMStructSize)/4;
+ unsigned Int8ArraySize = (GCCTypeSize-LLVMStructSize) % 4;
+ if (Int32ArraySize != 0) {
+ PadTy = ArrayType::get(Type::Int32Ty, Int32ArraySize);
+ Info.addElement(PadTy, GCCTypeSize - LLVMLastElementEnd,
+ Int32ArraySize);
+ }
+ if (Int8ArraySize != 0) {
+ PadTy = ArrayType::get(Type::Int8Ty, Int8ArraySize);
+ Info.addElement(PadTy, GCCTypeSize - Info.getNewElementByteOffset(1),
+ Int8ArraySize);
+ }
+ } else
+ Info.addElement(PadTy, GCCTypeSize - LLVMLastElementEnd,
+ GCCTypeSize - LLVMLastElementEnd);
}
}
More information about the llvm-commits
mailing list