17e0afd9976b0c121d17a1f7b60837bd2be5d7cc5Eric Christopher/* RUN: %clang_cc1 %s -emit-llvm -triple x86_64-apple-darwin -o - | FileCheck %s
23883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christopher
33883e66cfd55de70d89831cf26f9ae53931d11d3Eric ChristopherThe FE must generate padding here both at the end of each PyG_Head and
43883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christopherbetween array elements.  Reduced from Python. */
53883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christopher
63883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christophertypedef union _gc_head {
73883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christopher  struct {
83883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christopher    union _gc_head *gc_next;
93883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christopher    union _gc_head *gc_prev;
103883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christopher    long gc_refs;
113883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christopher  } gc;
123883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christopher  int dummy __attribute__((aligned(16)));
133883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christopher} PyGC_Head;
143883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christopher
153883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christopherstruct gc_generation {
163883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christopher  PyGC_Head head;
173883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christopher  int threshold;
183883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christopher  int count;
193883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christopher};
203883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christopher
213883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christopher#define GEN_HEAD(n) (&generations[n].head)
223883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christopher
233883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christopher// The idea is that there are 6 undefs in this structure initializer to cover
243883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christopher// the padding between elements.
253ea9e33ea25e0c2b12db56418ba3f994eb662c04Pirama Arumuga Nainar// CHECK: @generations = global [3 x %struct.gc_generation] [%struct.gc_generation { %union._gc_head { %struct.anon { %union._gc_head* getelementptr inbounds ([3 x %struct.gc_generation], [3 x %struct.gc_generation]* @generations, i32 0, i32 0, i32 0), %union._gc_head* getelementptr inbounds ([3 x %struct.gc_generation], [3 x %struct.gc_generation]* @generations, i32 0, i32 0, i32 0), i64 0 }, [8 x i8] undef }, i32 700, i32 0, [8 x i8] undef }, %struct.gc_generation { %union._gc_head { %struct.anon { %union._gc_head* bitcast (i8* getelementptr (i8, i8* bitcast ([3 x %struct.gc_generation]* @generations to i8*), i64 48) to %union._gc_head*), %union._gc_head* bitcast (i8* getelementptr (i8, i8* bitcast ([3 x %struct.gc_generation]* @generations to i8*), i64 48) to %union._gc_head*), i64 0 }, [8 x i8] undef }, i32 10, i32 0, [8 x i8] undef }, %struct.gc_generation { %union._gc_head { %struct.anon { %union._gc_head* bitcast (i8* getelementptr (i8, i8* bitcast ([3 x %struct.gc_generation]* @generations to i8*), i64 96) to %union._gc_head*), %union._gc_head* bitcast (i8* getelementptr (i8, i8* bitcast ([3 x %struct.gc_generation]* @generations to i8*), i64 96) to %union._gc_head*), i64 0 }, [8 x i8] undef }, i32 10, i32 0, [8 x i8] undef }]
263883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christopher/* linked lists of container objects */
273883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christopherstruct gc_generation generations[3] = {
283883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christopher        /* PyGC_Head,                           threshold,      count */
293883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christopher        {{{GEN_HEAD(0), GEN_HEAD(0), 0}},       700,            0},
303883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christopher        {{{GEN_HEAD(1), GEN_HEAD(1), 0}},       10,             0},
313883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christopher        {{{GEN_HEAD(2), GEN_HEAD(2), 0}},       10,             0},
323883e66cfd55de70d89831cf26f9ae53931d11d3Eric Christopher};
33