2014-02-14 09:26:55 +08:00
; RUN: llc -generate-arange-section < %s | FileCheck %s
2013-09-20 07:21:01 +08:00
; -- header --
2013-10-04 06:07:08 +08:00
; CHECK: .short 2 # DWARF Arange version number
2015-03-10 11:58:36 +08:00
; CHECK-NEXT: .long .Lcu_begin0
2013-10-04 06:07:08 +08:00
; CHECK-NEXT: .byte 8 # Address Size (in bytes)
; CHECK-NEXT: .byte 0 # Segment Size (in bytes)
2013-09-20 07:21:01 +08:00
; -- alignment --
2014-01-08 03:28:14 +08:00
; CHECK-NEXT: .zero 4,255
2013-09-20 07:21:01 +08:00
2015-03-10 06:08:37 +08:00
; <data section> - it should have made one span covering all vars in this CU.
; CHECK-NEXT: .quad some_data
2015-03-24 05:22:04 +08:00
; CHECK-NEXT: .quad .Lsec_end0-some_data
2015-03-10 06:08:37 +08:00
; <other sections> - it should have made one span covering all vars in this CU.
; CHECK-NEXT: .quad some_other
2015-03-24 05:22:04 +08:00
; CHECK-NEXT: .quad .Lsec_end1-some_other
2015-03-10 06:08:37 +08:00
2013-10-04 06:07:08 +08:00
; <common symbols> - it should have made one span for each symbol.
; CHECK-NEXT: .quad some_bss
; CHECK-NEXT: .quad 4
2013-09-20 07:21:01 +08:00
2013-10-04 06:07:08 +08:00
; <text section> - it should have made one span covering all functions in this CU.
; CHECK-NEXT: .quad .Lfunc_begin0
2015-03-24 05:22:04 +08:00
; CHECK-NEXT: .quad .Lsec_end2-.Lfunc_begin0
2013-09-20 07:21:01 +08:00
2013-10-04 06:07:08 +08:00
; -- finish --
; CHECK-NEXT: # ARange terminator
2013-09-20 07:21:01 +08:00
; -- source code --
; Generated from: "clang -c -g -emit-llvm"
;
; int some_data = 4;
; int some_bss;
2013-10-04 06:07:08 +08:00
; int some_other __attribute__ ((section ("strange+section"))) = 5;
2013-09-20 07:21:01 +08:00
;
; void some_code()
; {
; some_bss += some_data + some_other;
; }
target triple = "x86_64-unknown-linux-gnu"
@some_data = global i32 4 , align 4
2013-10-04 06:07:08 +08:00
@some_other = global i32 5 , section "strange+section" , align 4
2013-09-20 07:21:01 +08:00
@some_bss = common global i32 0 , align 4
define void @some_code ( ) {
entry:
2015-02-28 05:17:42 +08:00
%0 = load i32 , i32 * @some_data , align 4 , !dbg !14
%1 = load i32 , i32 * @some_other , align 4 , !dbg !14
2013-09-20 07:21:01 +08:00
%add = add nsw i32 %0 , %1 , !dbg !14
2015-02-28 05:17:42 +08:00
%2 = load i32 , i32 * @some_bss , align 4 , !dbg !14
2013-09-20 07:21:01 +08:00
%add1 = add nsw i32 %2 , %add , !dbg !14
store i32 %add1 , i32 * @some_bss , align 4 , !dbg !14
ret void , !dbg !15
}
!llvm.dbg.cu = ! { !0 }
2013-11-23 05:49:45 +08:00
!llvm.module.flags = ! { !13 , !16 }
2013-09-20 07:21:01 +08:00
2015-08-04 01:26:41 +08:00
!0 = distinct !DICompileUnit ( language: D W _ L A N G _ C 99 , producer: "clang version 3.4 " , isOptimized: false , emissionKind: 0 , file: !1 , enums: !2 , retainedTypes: !2 , subprograms: !3 , globals: !8 , imports: !2 )
2015-04-30 00:38:44 +08:00
!1 = !DIFile ( filename: "test.c" , directory: "/home/kayamon" )
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
llvm-svn: 224257
2014-12-16 03:07:53 +08:00
!2 = ! { }
!3 = ! { !4 }
2015-04-30 00:38:44 +08:00
!4 = !DISubprogram ( name: "some_code" , line: 5 , isLocal: false , isDefinition: true , virtualIndex: 6 , isOptimized: false , scopeLine: 6 , file: !1 , scope: !5 , type: !6 , function: void ( ) * @some_code , variables: !2 )
!5 = !DIFile ( filename: "test.c" , directory: "/home/kayamon" )
!6 = !DISubroutineType ( types: !7 )
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
llvm-svn: 224257
2014-12-16 03:07:53 +08:00
!7 = ! { null }
!8 = ! { !9 , !11 , !12 }
2015-04-30 00:38:44 +08:00
!9 = !DIGlobalVariable ( name: "some_data" , line: 1 , isLocal: false , isDefinition: true , scope: null , file: !5 , type: !10 , variable: i32 * @some_data )
!10 = !DIBasicType ( tag: D W _ T A G _ b a s e _ type , name: "int" , size: 32 , align: 32 , encoding: D W _ A T E _ s i g n e d )
!11 = !DIGlobalVariable ( name: "some_other" , line: 3 , isLocal: false , isDefinition: true , scope: null , file: !5 , type: !10 , variable: i32 * @some_other )
!12 = !DIGlobalVariable ( name: "some_bss" , line: 2 , isLocal: false , isDefinition: true , scope: null , file: !5 , type: !10 , variable: i32 * @some_bss )
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
llvm-svn: 224257
2014-12-16 03:07:53 +08:00
!13 = ! { i32 2 , !"Dwarf Version" , i32 4 }
2015-04-30 00:38:44 +08:00
!14 = !DILocation ( line: 7 , scope: !4 )
!15 = !DILocation ( line: 8 , scope: !4 )
2015-03-04 01:24:31 +08:00
!16 = ! { i32 1 , !"Debug Info Version" , i32 3 }