2009-10-19 05:34:14 +00:00
|
|
|
; RUN: llvm-as < %s | llvm-dis | grep " !dbg " | count 4
|
2009-09-17 23:05:07 +00:00
|
|
|
define i32 @foo() nounwind ssp {
|
|
|
|
entry:
|
|
|
|
%retval = alloca i32 ; <i32*> [#uses=2]
|
|
|
|
call void @llvm.dbg.func.start(metadata !0)
|
2009-09-29 00:01:14 +00:00
|
|
|
store i32 42, i32* %retval, !dbg !3
|
|
|
|
br label %0, !dbg !3
|
2009-09-17 23:05:07 +00:00
|
|
|
|
|
|
|
; <label>:0 ; preds = %entry
|
|
|
|
call void @llvm.dbg.region.end(metadata !0)
|
2015-02-27 21:17:42 +00:00
|
|
|
%1 = load i32, i32* %retval, !dbg !3 ; <i32> [#uses=1]
|
2009-09-29 00:01:14 +00:00
|
|
|
ret i32 %1, !dbg !3
|
2009-09-17 23:05:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
declare void @llvm.dbg.func.start(metadata) nounwind readnone
|
|
|
|
|
|
|
|
declare void @llvm.dbg.region.end(metadata) nounwind readnone
|
|
|
|
|
2013-11-23 01:16:29 +00:00
|
|
|
!llvm.module.flags = !{!6}
|
|
|
|
|
2015-03-03 17:24:31 +00:00
|
|
|
!0 = !MDSubprogram(name: "foo", linkageName: "foo", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scope: !1, type: !2)
|
|
|
|
!1 = !MDCompileUnit(language: DW_LANG_C99, producer: "clang 1.0", isOptimized: true, emissionKind: 0, file: !4, enums: !5, retainedTypes: !5, subprograms: !4)
|
|
|
|
!2 = !MDBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
2015-01-14 22:27:36 +00:00
|
|
|
!3 = !MDLocation(line: 1, column: 13, scope: !1, inlinedAt: !1)
|
2015-03-03 17:24:31 +00:00
|
|
|
!4 = !MDFile(filename: "foo.c", directory: "/tmp")
|
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224257 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-15 19:07:53 +00:00
|
|
|
!5 = !{i32 0}
|
2015-03-03 17:24:31 +00:00
|
|
|
!6 = !{i32 1, !"Debug Info Version", i32 3}
|