Hi all, I'm using clang + LLVM 2.9. Let's consider following code sample: extern void bar(int x) ; void foo(int y) { bar(y) ; } When compiled with clang at -O2 -g I've got following LLVM file: ; ModuleID = 'localvar.c' target datalayout "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" target triple = "x86_64-unknown-linux-gnu" define void @foo(i32 %y) nounwind { tail call void @llvm.dbg.value(metadata !{i32 %y}, i64 0, metadata !5), !dbg !7 tail call void @bar(i32 %y) nounwind, !dbg !8 ret void, !dbg !10 } declare void @bar(i32) declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone !llvm.dbg.sp = !{!0} !llvm.dbg.lv.foo = !{!5} !0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"", metadata !1, i32 5, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 true, void (i32)* @foo} ; [ DW_TAG_subprogram ] !1 = metadata !{i32 589865, metadata !"localvar.c", metadata !"/home/deldon/Work/OpenCL/DEBUG", metadata !2} ; [ DW_TAG_file_type ] !2 = metadata !{i32 589841, i32 0, i32 12, metadata !"localvar.c", metadata !"/home/deldon/Work/OpenCL/DEBUG", metadata !"clang version 2.9 (tags/RELEASE_29/final)", i1 true, i1 true, metadata !"", i32 0} ; [ DW_TAG_compile_unit ] !3 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] !4 = metadata !{null} !5 = metadata !{i32 590081, metadata !0, metadata !"y", metadata !1, i32 16777220, metadata !6, i32 0} ; [ DW_TAG_arg_variable ] !6 = metadata !{i32 589860, metadata !2, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] !7 = metadata !{i32 4, i32 14, metadata !0, null} !8 = metadata !{i32 6, i32 5, metadata !9, null} !9 = metadata !{i32 589835, metadata !0, i32 5, i32 1, metadata !1, i32 0} ; [ DW_TAG_lexical_block ] !10 = metadata !{i32 7, i32 1, metadata !9, null} Can someone give me more information on llvm.dbg.value call because documentation is unclear to me ? Why is there an 'llvm.dbg.lv.foo' created ? This is also not documented. Thanks for your answers Seb -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120116/706d6d18/attachment.html>
Eric Christopher
2012-Jan-19 01:47 UTC
[LLVMdev] Need more information on llvm.dbg.value call
On Jan 16, 2012, at 1:35 AM, Seb wrote:> Can someone give me more information on llvm.dbg.value call because documentation is unclear to me ? > Why is there an 'llvm.dbg.lv.foo' created ? This is also not documented.Which documentation? The documentation is from current sources which you aren't using. I'd suggest you update to at least 3.0, preferably top of tree, and then use the docs on the web. -eric -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120118/021272f1/attachment.html>
On Jan 18, 2012, at 5:47 PM, Eric Christopher wrote:>> Why is there an 'llvm.dbg.lv.foo' created ?At optimization level -O0+ , llvm.dbg.lv.foo is created to collect info of local variables found in function foo. If any variables (or argument) is completely deleted by optimizer or code generator then dwarf writer can use this information to at least provide signature (type, name etc..) of the lost variable/argument. One of the DIBuider's createLocalVariable() parameter, AlwaysPreserve, enables this. - Devang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120120/ea77fde5/attachment.html>