| 1 |
/* RUN: %clang_cc1 %s -emit-llvm -triple x86_64-apple-darwin -o - | FileCheck %s |
| 2 |
|
| 3 |
The FE must generate padding here both at the end of each PyG_Head and |
| 4 |
between array elements. Reduced from Python. */ |
| 5 |
|
| 6 |
typedef union _gc_head { |
| 7 |
struct { |
| 8 |
union _gc_head *gc_next; |
| 9 |
union _gc_head *gc_prev; |
| 10 |
long gc_refs; |
| 11 |
} gc; |
| 12 |
int dummy __attribute__((aligned(16))); |
| 13 |
} PyGC_Head; |
| 14 |
|
| 15 |
struct gc_generation { |
| 16 |
PyGC_Head head; |
| 17 |
int threshold; |
| 18 |
int count; |
| 19 |
}; |
| 20 |
|
| 21 |
#define GEN_HEAD(n) (&generations[n].head) |
| 22 |
|
| 23 |
// The idea is that there are 6 undefs in this structure initializer to cover |
| 24 |
// the padding between elements. |
| 25 |
// CHECK: @generations ={{.*}} global [3 x %struct.gc_generation] [%struct.gc_generation { %union._gc_head { %struct.anon { ptr @generations, ptr @generations, i64 0 }, [8 x i8] undef }, i32 700, i32 0, [8 x i8] undef }, %struct.gc_generation { %union._gc_head { %struct.anon { ptr getelementptr (i8, ptr @generations, i64 48), ptr getelementptr (i8, ptr @generations, i64 48), i64 0 }, [8 x i8] undef }, i32 10, i32 0, [8 x i8] undef }, %struct.gc_generation { %union._gc_head { %struct.anon { ptr getelementptr (i8, ptr @generations, i64 96), ptr getelementptr (i8, ptr @generations, i64 96), i64 0 }, [8 x i8] undef }, i32 10, i32 0, [8 x i8] undef }] |
| 26 |
/* linked lists of container objects */ |
| 27 |
struct gc_generation generations[3] = { |
| 28 |
/* PyGC_Head, threshold, count */ |
| 29 |
{{{GEN_HEAD(0), GEN_HEAD(0), 0}}, 700, 0}, |
| 30 |
{{{GEN_HEAD(1), GEN_HEAD(1), 0}}, 10, 0}, |
| 31 |
{{{GEN_HEAD(2), GEN_HEAD(2), 0}}, 10, 0}, |
| 32 |
}; |