annotate clang/test/CodeGen/builtins-bpf-preserve-field-info-1.c @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents 1d019706d866
children 5f17cb93ff66
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // REQUIRES: bpf-registered-target
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
2 // RUN: %clang -target bpf -emit-llvm -S -g -Xclang -disable-llvm-passes %s -o - | FileCheck %s
150
anatofuz
parents:
diff changeset
3
anatofuz
parents:
diff changeset
4 #define _(x, y) (__builtin_preserve_field_info((x), (y)))
anatofuz
parents:
diff changeset
5
anatofuz
parents:
diff changeset
6 struct s1 {
anatofuz
parents:
diff changeset
7 char a;
anatofuz
parents:
diff changeset
8 char b:2;
anatofuz
parents:
diff changeset
9 };
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 union u1 {
anatofuz
parents:
diff changeset
12 char a;
anatofuz
parents:
diff changeset
13 char b:2;
anatofuz
parents:
diff changeset
14 };
anatofuz
parents:
diff changeset
15
anatofuz
parents:
diff changeset
16 unsigned unit1(struct s1 *arg) {
anatofuz
parents:
diff changeset
17 return _(arg->a, 10) + _(arg->b, 10);
anatofuz
parents:
diff changeset
18 }
anatofuz
parents:
diff changeset
19 // CHECK: define dso_local i32 @unit1
anatofuz
parents:
diff changeset
20 // CHECK: call i8* @llvm.preserve.struct.access.index.p0i8.p0s_struct.s1s(%struct.s1* %{{[0-9a-z]+}}, i32 0, i32 0), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[STRUCT_S1:[0-9]+]]
anatofuz
parents:
diff changeset
21 // CHECK: call i32 @llvm.bpf.preserve.field.info.p0i8(i8* %{{[0-9a-z]+}}, i64 10), !dbg !{{[0-9]+}}
anatofuz
parents:
diff changeset
22 // CHECK: call i8* @llvm.preserve.struct.access.index.p0i8.p0s_struct.s1s(%struct.s1* %{{[0-9a-z]+}}, i32 1, i32 1), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[STRUCT_S1:[0-9]+]]
anatofuz
parents:
diff changeset
23 // CHECK: call i32 @llvm.bpf.preserve.field.info.p0i8(i8* %{{[0-9a-z]+}}, i64 10), !dbg !{{[0-9]+}}
anatofuz
parents:
diff changeset
24
anatofuz
parents:
diff changeset
25 unsigned unit2(union u1 *arg) {
anatofuz
parents:
diff changeset
26 return _(arg->a, 10) + _(arg->b, 10);
anatofuz
parents:
diff changeset
27 }
anatofuz
parents:
diff changeset
28 // CHECK: define dso_local i32 @unit2
anatofuz
parents:
diff changeset
29 // CHECK: call %union.u1* @llvm.preserve.union.access.index.p0s_union.u1s.p0s_union.u1s(%union.u1* %{{[0-9a-z]+}}, i32 0), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[UNION_U1:[0-9]+]]
anatofuz
parents:
diff changeset
30 // CHECK: call i32 @llvm.bpf.preserve.field.info.p0i8(i8* %{{[0-9a-z]+}}, i64 10), !dbg !{{[0-9]+}}
anatofuz
parents:
diff changeset
31 // CHECK: call i8* @llvm.preserve.struct.access.index.p0i8.p0s_union.u1s(%union.u1* %{{[0-9a-z]+}}, i32 0, i32 1), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[UNION_U1:[0-9]+]]
anatofuz
parents:
diff changeset
32 // CHECK: call i32 @llvm.bpf.preserve.field.info.p0i8(i8* %{{[0-9a-z]+}}, i64 10), !dbg !{{[0-9]+}}
anatofuz
parents:
diff changeset
33
anatofuz
parents:
diff changeset
34 // CHECK: ![[STRUCT_S1]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "s1"
anatofuz
parents:
diff changeset
35 // CHECK: ![[UNION_U1]] = distinct !DICompositeType(tag: DW_TAG_union_type, name: "u1"