[llvm-commits] [llvm-gcc-4.2] r127940 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
Devang Patel
dpatel at apple.com
Fri Mar 18 18:40:19 PDT 2011
Author: dpatel
Date: Fri Mar 18 20:40:19 2011
New Revision: 127940
URL: http://llvm.org/viewvc/llvm-project?rev=127940&view=rev
Log:
Trust gcc tree nodes for struct size.
This fixes radar 9156771.
Modified:
llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=127940&r1=127939&r2=127940&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Fri Mar 18 20:40:19 2011
@@ -1539,7 +1539,7 @@
return Type::getInt8Ty(Context);
else if (Size == 2)
return Type::getInt16Ty(Context);
- else if (Size <= 4)
+ else if (Size == 4)
return Type::getInt32Ty(Context);
// Check if Ty should be returned using multiple value return instruction.
@@ -1565,14 +1565,17 @@
(int) GET_MODE_SIZE(Mode);
if (Bytes==8 && Class[0] == X86_64_POINTER_CLASS)
return Type::getInt8PtrTy(Context);
- if (Bytes>4)
- return Type::getInt64Ty(Context);
- else if (Bytes>2)
- return Type::getInt32Ty(Context);
- else if (Bytes>1)
- return Type::getInt16Ty(Context);
- else
- return Type::getInt8Ty(Context);
+ switch (Bytes) {
+ case 8: return Type::getInt64Ty(Context);
+ case 7: return Type::getIntNTy(Context, 7*8);
+ case 6: return Type::getIntNTy(Context, 6*8);
+ case 5: return Type::getIntNTy(Context, 5*8);
+ case 4: return Type::getInt32Ty(Context);
+ case 3: return Type::getIntNTy(Context, 3*8);
+ case 2: return Type::getInt16Ty(Context);
+ case 1: return Type::getInt8Ty(Context);
+ default: assert (0 && "Unexpected type!");
+ }
}
assert(0 && "Unexpected type!");
}
More information about the llvm-commits
mailing list