File: align_c11.ll

package info (click to toggle)
llvm-toolchain-16 1%3A16.0.6-15~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,634,792 kB
  • sloc: cpp: 6,179,261; ansic: 1,216,205; asm: 741,319; python: 196,614; objc: 75,325; f90: 49,640; lisp: 32,396; pascal: 12,286; sh: 9,394; perl: 7,442; ml: 5,494; awk: 3,523; makefile: 2,723; javascript: 1,206; xml: 886; fortran: 581; cs: 573
file content (81 lines) | stat: -rw-r--r-- 3,235 bytes parent folder | download | duplicates (12)
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
71
72
73
74
75
76
77
78
79
80
81
; RUN: llc -filetype=obj < %s | llvm-dwarfdump -debug-info --name=data --name=d -c - \
; RUN:   | FileCheck %s --implicit-check-not=DW_TAG

; Generated by clang -c -g -std=c11 -S -emit-llvm from the following C11 source
;
; // every object of type struct data will be aligned to 128-byte boundary
; struct data {
;   char x;
;   _Alignas(128) char arr[2];
; };
;
; _Alignas(2048) struct data d; // this instance of data is aligned even stricter
; int foo(void)
; {
;     struct data local_data;
;     return 0;
; }

; CHECK:   DW_TAG_variable
; CHECK:     DW_AT_name{{.*}}"d"
; CHECK:     DW_AT_alignment{{.*}}2048

; CHECK:   DW_TAG_structure_type
; CHECK:     DW_TAG_member
; CHECK:     DW_TAG_member
; CHECK:       DW_AT_name{{.*}}"arr"
; CHECK:       DW_AT_alignment{{.*}}128

; ModuleID = 'test.c'
source_filename = "test.c"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.data = type { i8, [127 x i8], [2 x i8], [126 x i8] }

@d = common global %struct.data zeroinitializer, align 2048, !dbg !0

; Function Attrs: nounwind uwtable
define i32 @foo() #0 !dbg !17 {
entry:
  %local_data = alloca %struct.data, align 128
  call void @llvm.dbg.declare(metadata ptr %local_data, metadata !21, metadata !22), !dbg !23
  ret i32 0, !dbg !24
}

; Function Attrs: nounwind readnone
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1

attributes #0 = { nounwind uwtable }
attributes #1 = { nounwind readnone }

!llvm.dbg.cu = !{!2}
!llvm.module.flags = !{!14, !15}
!llvm.ident = !{!16}

!0 = distinct !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
!1 = !DIGlobalVariable(name: "d", scope: !2, file: !3, line: 7, type: !6, isLocal: false, isDefinition: true, align: 16384)
!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 4.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)
!3 = !DIFile(filename: "test.c", directory: "/tmp")
!4 = !{}
!5 = !{!0}
!6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "data", file: !3, line: 2, size: 2048, elements: !7)
!7 = !{!8, !10}
!8 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !6, file: !3, line: 3, baseType: !9, size: 8)
!9 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
!10 = !DIDerivedType(tag: DW_TAG_member, name: "arr", scope: !6, file: !3, line: 4, baseType: !11, size: 16, align: 1024, offset: 1024)
!11 = !DICompositeType(tag: DW_TAG_array_type, baseType: !9, size: 16, elements: !12)
!12 = !{!13}
!13 = !DISubrange(count: 2)
!14 = !{i32 2, !"Dwarf Version", i32 4}
!15 = !{i32 2, !"Debug Info Version", i32 3}
!16 = !{!"clang version 4.0.0"}
!17 = distinct !DISubprogram(name: "foo", scope: !3, file: !3, line: 8, type: !18, isLocal: false, isDefinition: true, scopeLine: 9, flags: DIFlagPrototyped, isOptimized: false, unit: !2, retainedNodes: !4)
!18 = !DISubroutineType(types: !19)
!19 = !{!20}
!20 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!21 = !DILocalVariable(name: "local_data", scope: !17, file: !3, line: 10, type: !6)
!22 = !DIExpression()
!23 = !DILocation(line: 10, column: 17, scope: !17)
!24 = !DILocation(line: 11, column: 5, scope: !17)