Hi Jim,
Thanks for the advice. Since I'm using LLVM 2.9 style of debug information.
Will this code benefit from those improvement or should I generate LLVM 3.0
style of debug information ?
Best Regards
Seb
2012/3/6 Jim Grosbach <grosbach at apple.com>
>
> On Mar 6, 2012, at 5:31 AM, Seb <babslachem at gmail.com> wrote:
>
> Hi all,
>
> Anyone have ideas/info on this topic ?
> Thanks
> Seb
>
> 2012/3/2 Seb <babslachem at gmail.com>
>
>> Hi all,
>>
>> I'm using my own front-end to generate following code .ll file
targeting
>> x86 32-bit:
>>
>> ; ModuleID = 'check.c'
>> target datalayout >>
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"
>> target triple = "i386-pc-linux-gnu"
>> @.str581 = internal constant [52 x i8] c"---- test number %d
failed.
>> result %d expected %d\0a\00"
>> @.str584 = internal constant [61 x i8] c"---- %3d tests completed.
%d
>> tests PASSED. %d tests failed.\0a\00"
>> @.str587 = internal constant [61 x i8] c"---- %3d tests completed.
%d
>> tests passed. %d tests FAILED.\0a\00"
>> define void @check(i32* %result, i32* %expect, i32 %n) {
>> L.entry:
>> %tests_passed = alloca i32
>> %tests_failed = alloca i32
>> %i = alloca i32
>> call void @llvm.dbg.value (metadata !{i32* %result}, i64 0,
>> metadata !9), !dbg !4
>> call void @llvm.dbg.value (metadata !{i32* %expect}, i64 0,
>> metadata !10), !dbg !4
>> call void @llvm.dbg.value (metadata !{i32 %n}, i64 0, metadata
>> !11), !dbg !4
>> call void @llvm.dbg.declare (metadata !{i32* %tests_passed},
>> metadata !13), !dbg !4
>> store i32 0, i32* %tests_passed, !dbg !12
>> call void @llvm.dbg.declare (metadata !{i32* %tests_failed},
>> metadata !15), !dbg !4
>> store i32 0, i32* %tests_failed, !dbg !14
>> call void @llvm.dbg.declare (metadata !{i32* %i}, metadata
!17),
>> !dbg !4
>> store i32 0, i32* %i, !dbg !16
>> br label %L.B0000
>> L.B0000:
>> %0 = load i32* %i, !dbg !16
>> %1 = icmp sge i32 %0, %n, !dbg !16
>> br i1 %1, label %L.B0001, label %L.B0008, !dbg !16
>> L.B0008:
>> %2 = bitcast i32* %expect to i8*, !dbg !18
>> %3 = load i32* %i, !dbg !18
>> %4 = mul i32 %3, 4, !dbg !18
>> %5 = getelementptr i8* %2, i32 %4, !dbg !18
>> %6 = bitcast i8* %5 to i32*, !dbg !18
>> %7 = load i32* %6, !dbg !18
>> %8 = bitcast i32* %result to i8*, !dbg !18
>> %9 = load i32* %i, !dbg !18
>> %10 = mul i32 %9, 4, !dbg !18
>> %11 = getelementptr i8* %8, i32 %10, !dbg !18
>> %12 = bitcast i8* %11 to i32*, !dbg !18
>> %13 = load i32* %12, !dbg !18
>> %14 = icmp ne i32 %7, %13, !dbg !18
>> br i1 %14, label %L.B0003, label %L.B0009, !dbg !18
>> L.B0009:
>> %15 = load i32* %tests_passed, !dbg !18
>>
>> %16 = add i32 %15, 1, !dbg !18
>> store i32 %16, i32* %tests_passed, !dbg !18
>> br label %L.B0004, !dbg !19
>> L.B0003:
>> %17 = load i32* %tests_failed, !dbg !20
>>
>> %18 = add i32 %17, 1, !dbg !20
>> store i32 %18, i32* %tests_failed, !dbg !20
>> %19 = bitcast [52 x i8]* @.str581 to i8*, !dbg !21
>> %20 = load i32* %i, !dbg !21
>> %21 = bitcast i32* %result to i8*, !dbg !21
>> %22 = load i32* %i, !dbg !21
>> %23 = mul i32 %22, 4, !dbg !21
>> %24 = getelementptr i8* %21, i32 %23, !dbg !21
>> %25 = bitcast i8* %24 to i32*, !dbg !21
>> %26 = load i32* %25, !dbg !21
>> %27 = bitcast i32* %expect to i8*, !dbg !21
>> %28 = load i32* %i, !dbg !21
>> %29 = mul i32 %28, 4, !dbg !21
>> %30 = getelementptr i8* %27, i32 %29, !dbg !21
>> %31 = bitcast i8* %30 to i32*, !dbg !21
>> %32 = load i32* %31, !dbg !21
>> %33 = call i32 (i8*, ...)* @printf (i8* %19, i32 %20, i32 %26,
>> i32 %32), !dbg !21
>> br label %L.B0004
>> L.B0004:
>> %34 = load i32* %i, !dbg !22
>>
>> %35 = add i32 %34, 1, !dbg !22
>> store i32 %35, i32* %i, !dbg !22
>> br label %L.B0000, !dbg !22
>> L.B0001:
>> %36 = load i32* %tests_failed, !dbg !23
>> %37 = icmp ne i32 %36, 0, !dbg !23
>> br i1 %37, label %L.B0006, label %L.B0010, !dbg !23
>> L.B0010:
>> %38 = bitcast [61 x i8]* @.str584 to i8*, !dbg !24
>> %39 = load i32* %tests_passed, !dbg !24
>> %40 = load i32* %tests_failed, !dbg !24
>> %41 = call i32 (i8*, ...)* @printf (i8* %38, i32 %n, i32 %39,
>> i32 %40), !dbg !24
>> br label %L.B0007, !dbg !25
>> L.B0006:
>> %42 = bitcast [61 x i8]* @.str587 to i8*, !dbg !26
>> %43 = load i32* %tests_passed, !dbg !26
>> %44 = load i32* %tests_failed, !dbg !26
>> %45 = call i32 (i8*, ...)* @printf (i8* %42, i32 %n, i32 %43,
>> i32 %44), !dbg !26
>> br label %L.B0007
>> L.B0007:
>> ret void, !dbg !27
>> }
>>
>> declare void @llvm.dbg.value(metadata, i64, metadata)
>> declare void @llvm.dbg.declare(metadata, metadata)
>> declare i32 @printf(i8*,...)
>>
>> !llvm.dbg.sp = !{!3}
>>
>> !llvm.dbg.lv.check = !{!9, !10, !11}
>>
>> !0 = metadata !{i32 589841, i32 0, i32 2, metadata
!"check.c", metadata
>> !".", metadata !" Seb Rel Dev-r02.27", i1 1, i1 0,
metadata !"", i32 0} ;
>> DW_TAG_compile_unit
>> !1 = metadata !{i32 589865, metadata !"check.c", metadata
!".", metadata
>> !0} ; DW_TAG_file_type
>> !2 = metadata !{i32 589845, metadata !1, metadata !"",
metadata !1, i32
>> 0, i64 0, i64 0, i32 0, i32 0, i32 0, null, i32 0, i32 0} ;
>> DW_TAG_subroutine_type
>> !3 = metadata !{i32 589870, i32 0, metadata !1, metadata
!"check",
>> metadata !"check", metadata !"", metadata !1, i32
7, metadata !2, i1 0, i1
>> 1, i32 0, i32 0, i32 0, i32 0, i1 0, void (i32*, i32*, i32)* @check} ;
>> DW_TAG_subprogram
>> !4 = metadata !{i32 0, i32 0, metadata !3, null}
>> !5 = metadata !{i32 589835, metadata !3, i32 7, i32 0, metadata !1,
i32
>> 0} ; DW_TAG_lexical_block
>> !6 = metadata !{i32 0, i32 0, metadata !5, null}
>> !7 = metadata !{i32 589860, metadata !0, metadata !"int",
null, i32 0,
>> i64 32, i64 32, i64 0, i32 0, i32 5} ; DW_TAG_base_type
>> !8 = metadata !{i32 589839, metadata !0, metadata !"", null,
i32 0, i64
>> 32, i64 32, i64 0, i32 0, metadata !7} ; DW_TAG_pointer_type
>> !9 = metadata !{i32 590081, metadata !3, metadata !"result",
metadata
>> !1, i32 16777216, metadata !8, i32 0} ; DW_TAG_arg_variable
>> !10 = metadata !{i32 590081, metadata !3, metadata
!"expect", metadata
>> !1, i32 33554432, metadata !8, i32 0} ; DW_TAG_arg_variable
>> !11 = metadata !{i32 590081, metadata !3, metadata !"n",
metadata !1,
>> i32 50331648, metadata !7, i32 0} ; DW_TAG_arg_variable
>> !12 = metadata !{i32 9, i32 0, metadata !5, null}
>> !13 = metadata !{i32 590080, metadata !5, metadata
!"tests_passed",
>> metadata !1, i32 0, metadata !7, i32 0} ; DW_TAG_auto_variable
>> !14 = metadata !{i32 10, i32 0, metadata !5, null}
>> !15 = metadata !{i32 590080, metadata !5, metadata
!"tests_failed",
>> metadata !1, i32 0, metadata !7, i32 0} ; DW_TAG_auto_variable
>> !16 = metadata !{i32 12, i32 0, metadata !5, null}
>> !17 = metadata !{i32 590080, metadata !5, metadata !"i",
metadata !1,
>> i32 0, metadata !7, i32 0} ; DW_TAG_auto_variable
>> !18 = metadata !{i32 13, i32 0, metadata !5, null}
>> !19 = metadata !{i32 14, i32 0, metadata !5, null}
>> !20 = metadata !{i32 15, i32 0, metadata !5, null}
>> !21 = metadata !{i32 17, i32 0, metadata !5, null}
>> !22 = metadata !{i32 19, i32 0, metadata !5, null}
>> !23 = metadata !{i32 20, i32 0, metadata !5, null}
>> !24 = metadata !{i32 22, i32 0, metadata !5, null}
>> !25 = metadata !{i32 23, i32 0, metadata !5, null}
>> !26 = metadata !{i32 25, i32 0, metadata !5, null}
>> !27 = metadata !{i32 26, i32 0, metadata !5, null}
>>
>> When I use llc 2.9 as follows:
>>
>
> Try using current trunk LLVM. There have been a *lot* of debug info
> improvements since 2.9.
>
> -Jim
>
> llc check.ll -march=x86 -o check.s
>> and
>> gcc -m32 -c check.s
>>
>> I've got a check.o file generated that targets x86 32-bit.
>> Reading dwarf symbol using
>> readelf --debug-dump check.o
>>
>> I've got for 'n' parameter:
>>
>> <2><71>: Abbrev Number: 3 (DW_TAG_formal_parameter)
>> <72> DW_AT_name : n
>> <74> DW_AT_type : <0xb3>
>> <78> DW_AT_location : 0x0 (location list)
>>
>> I would have expected a DW_AT_location that is FP related and not 0x0.
>> Is my LL file incorrect ?
>> Is there something I can use in metadata to enforce a FP relative
>> DW_AT_location to be generated ?
>>
>> Thanks for your answers
>> Best Regards
>> Seb
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20120307/0cb8fbd3/attachment.html>