brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 0a37ce9 Raw
34 lines · c
1/* RUN: %clang_cc1 %s -emit-llvm -triple x86_64-apple-darwin -o - | FileCheck %s2/* RUN: %clang_cc1 %s -emit-llvm -triple x86_64-apple-darwin -o - -fexperimental-new-constant-interpreter | FileCheck %s3 4The FE must generate padding here both at the end of each PyG_Head and5between array elements.  Reduced from Python. */6 7typedef union _gc_head {8  struct {9    union _gc_head *gc_next;10    union _gc_head *gc_prev;11    long gc_refs;12  } gc;13  int dummy __attribute__((aligned(16)));14} PyGC_Head;15 16struct gc_generation {17  PyGC_Head head;18  int threshold;19  int count;20};21 22#define GEN_HEAD(n) (&generations[n].head)23 24// The idea is that there are 6 zeroinitializers in this structure initializer to cover25// the padding between elements.26// 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] zeroinitializer }, i32 700, i32 0, [8 x i8] zeroinitializer }, %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] zeroinitializer }, i32 10, i32 0, [8 x i8] zeroinitializer }, %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] zeroinitializer }, i32 10, i32 0, [8 x i8] zeroinitializer }]27/* linked lists of container objects */28struct gc_generation generations[3] = {29        /* PyGC_Head,                           threshold,      count */30        {{{GEN_HEAD(0), GEN_HEAD(0), 0}},       700,            0},31        {{{GEN_HEAD(1), GEN_HEAD(1), 0}},       10,             0},32        {{{GEN_HEAD(2), GEN_HEAD(2), 0}},       10,             0},33};34