[llvm-commits] [llvm] r39752 - in /llvm/trunk: lib/Target/CBackend/CBackend.cpp test/CodeGen/CBackend/2007-07-11-PackedStruct.ll
Lauro Ramos Venancio
lauro.venancio at gmail.com
Wed Jul 11 12:56:53 PDT 2007
Author: laurov
Date: Wed Jul 11 14:56:53 2007
New Revision: 39752
URL: http://llvm.org/viewvc/llvm-project?rev=39752&view=rev
Log:
Handle packed structs in the CBackend.
Added:
llvm/trunk/test/CodeGen/CBackend/2007-07-11-PackedStruct.ll
Modified:
llvm/trunk/lib/Target/CBackend/CBackend.cpp
Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=39752&r1=39751&r2=39752&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original)
+++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Wed Jul 11 14:56:53 2007
@@ -466,7 +466,10 @@
printType(Out, *I, false, "field" + utostr(Idx++));
Out << ";\n";
}
- return Out << '}';
+ Out << '}';
+ if (STy->isPacked())
+ Out << " __attribute__ ((packed))";
+ return Out;
}
case Type::PointerTyID: {
Added: llvm/trunk/test/CodeGen/CBackend/2007-07-11-PackedStruct.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CBackend/2007-07-11-PackedStruct.ll?rev=39752&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/CBackend/2007-07-11-PackedStruct.ll (added)
+++ llvm/trunk/test/CodeGen/CBackend/2007-07-11-PackedStruct.ll Wed Jul 11 14:56:53 2007
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | llc -march=c | grep {packed}
+
+ %struct.p = type <{ i16 }>
+
+define i32 @main() {
+entry:
+ %t = alloca %struct.p, align 2
+ ret i32 5
+}
More information about the llvm-commits
mailing list