File: struct-x86-darwin.c

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (70 lines) | stat: -rw-r--r-- 2,490 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// RUN: %clang_cc1 %s -emit-llvm -o /dev/null -triple=i686-apple-darwin9 -fdump-record-layouts-simple | FileCheck %s

// Test struct layout for x86-darwin target

struct STest1 {int x; short y[4]; double z; } st1;
struct STest2 {short a,b; int c,d; } st2;
struct STest3 {char a; short b; int c; } st3;

// Bitfields
struct STestB1 {char a; char b:2; } stb1;
struct STestB2 {char a; char b:5; char c:4; } stb2;
struct STestB3 {char a; char b:2; } stb3;
struct STestB4 {char a; short b:2; char c; } stb4;
struct STestB5 {char a; short b:10; char c; } stb5;
struct STestB6 {int a:1; char b; int c:13; } stb6;

// Packed struct STestP1 {char a; short b; int c; } __attribute__((__packed__)) stp1;

// CHECK-LABEL: LLVMType:%struct.STest1 =
// CHECK-SAME: type { i32, [4 x i16], double }
// CHECK: BitFields:[
// CHECK-NEXT: ]>

// CHECK-LABEL: LLVMType:%struct.STest2 =
// CHECK-SAME: type { i16, i16, i32, i32 }
// CHECK: BitFields:[
// CHECK-NEXT: ]>

// CHECK-LABEL: LLVMType:%struct.STest3 =
// CHECK-SAME: type { i8, i16, i32 }
// CHECK: BitFields:[
// CHECK-NEXT: ]>

// CHECK-LABEL: LLVMType:%struct.STestB1 =
// CHECK-SAME: type { i8, i8 }
// CHECK: BitFields:[
// CHECK-NEXT: <CGBitFieldInfo Offset:0 Size:2 IsSigned:1 StorageSize:8 StorageOffset:1
// CHECK-NEXT: ]>

// CHECK-LABEL: LLVMType:%struct.STestB2 =
// CHECK-SAME: type <{ i8, i16 }>
// CHECK: BitFields:[
// CHECK-NEXT: <CGBitFieldInfo Offset:0 Size:5 IsSigned:1 StorageSize:16 StorageOffset:1
// CHECK-NEXT: <CGBitFieldInfo Offset:8 Size:4 IsSigned:1 StorageSize:16 StorageOffset:1
// CHECK-NEXT: ]>

// CHECK-LABEL: LLVMType:%struct.STestB3 =
// CHECK-SAME: type { i8, i8 }
// CHECK: BitFields:[
// CHECK-NEXT: <CGBitFieldInfo Offset:0 Size:2 IsSigned:1 StorageSize:8 StorageOffset:1
// CHECK-NEXT: ]>

// CHECK-LABEL: LLVMType:%struct.STestB4 =
// CHECK-SAME: type { i8, i8, i8, i8 }
// CHECK: BitFields:[
// CHECK-NEXT: <CGBitFieldInfo Offset:0 Size:2 IsSigned:1 StorageSize:8 StorageOffset:1
// CHECK-NEXT: ]>

// CHECK-LABEL: LLVMType:%struct.STestB5 =
// CHECK-SAME: type { i8, i16, i8 }
// CHECK: BitFields:[
// CHECK-NEXT: <CGBitFieldInfo Offset:0 Size:10 IsSigned:1 StorageSize:16 StorageOffset:2
// CHECK-NEXT: ]>

// CHECK-LABEL: LLVMType:%struct.STestB6 =
// CHECK-SAME: type { i8, i8, i16 }
// CHECK: BitFields:[
// CHECK-NEXT: <CGBitFieldInfo Offset:0 Size:1 IsSigned:1 StorageSize:8 StorageOffset:0
// CHECK-NEXT: <CGBitFieldInfo Offset:0 Size:13 IsSigned:1 StorageSize:16 StorageOffset:2
// CHECK-NEXT: ]>