Home | History | Annotate | Download | only in CodeGen
      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 { %union._gc_head* getelementptr inbounds ([3 x %struct.gc_generation]* @generations, i32 0, i32 0, i32 0), %union._gc_head* getelementptr inbounds ([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* bitcast ([3 x %struct.gc_generation]* @generations to i8*), i64 48) to %union._gc_head*), %union._gc_head* bitcast (i8* getelementptr (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* bitcast ([3 x %struct.gc_generation]* @generations to i8*), i64 96) to %union._gc_head*), %union._gc_head* bitcast (i8* getelementptr (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 }]
     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 };
     33