LLVM 2.9 metadata

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

LLVM 2.9 metadata

Seb-22
Hi all,

In LLVM documentation about source level debugging (http://www.llvm.org/releases/2.9/docs/SourceLevelDebugging.html)

Subprogram descriptor is defined as:

!2 = metadata !{
i32, ;; Tag = 46 + LLVMDebugVersion
;; (DW_TAG_subprogram)
i32, ;; Unused field.
metadata, ;; Reference to context descriptor
metadata, ;; Name
metadata, ;; Display name (fully qualified C++ name)
metadata, ;; MIPS linkage name (for C++)
metadata, ;; Reference to file where defined
i32, ;; Line number where defined
metadata, ;; Reference to type descriptor
i1, ;; True if the global is local to compile unit (static)
i1 ;; True if the global is defined in the compile unit (not extern)
i32 ;; Virtuality, e.g. dwarf::DW_VIRTUALITY__virtual
i32 ;; Index into a virtual function
metadata, ;; indicates which base type contains the vtable pointer for the
;; derived class
i1 ;; isArtificial
i1 ;; isOptimized
Function *;; Pointer to LLVM function

}

When I use clang 2.9 and emit-llvm code metadata generated for a routine foo is:

!0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"", metadata !1, i32 1, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 0, i1 false, void ()* @foo} ; [ DW_TAG_subprogram ]
!1 = metadata !{i32 589865, metadata !"foodbg.c", metadata !"/home/deldon/tmp", metadata !2} ; [ DW_TAG_file_type ]
!2 = metadata !{i32 589841, i32 0, i32 12, metadata !"foodbg.c", metadata !"/home/deldon/tmp", metadata !"clang version 2.9 (tags/RELEASE_29/final)", i1 true, i1 false, 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}
...

As you can see metadata definition !0 doesn't match documentation. What is the correct definition (CLANG or LLVM documentation ?).
Thanks for your answer
Seb




_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: LLVM 2.9 metadata

Devang Patel

On Dec 15, 2011, at 2:32 AM, Seb wrote:

Hi all,

In LLVM documentation about source level debugging (http://www.llvm.org/releases/2.9/docs/SourceLevelDebugging.html)

Subprogram descriptor is defined as:

!2 = metadata !{
i32, ;; Tag = 46 + LLVMDebugVersion
;; (DW_TAG_subprogram)
i32, ;; Unused field.
metadata, ;; Reference to context descriptor
metadata, ;; Name
metadata, ;; Display name (fully qualified C++ name)
metadata, ;; MIPS linkage name (for C++)
metadata, ;; Reference to file where defined
i32, ;; Line number where defined
metadata, ;; Reference to type descriptor
i1, ;; True if the global is local to compile unit (static)
i1 ;; True if the global is defined in the compile unit (not extern)
i32 ;; Virtuality, e.g. dwarf::DW_VIRTUALITY__virtual
i32 ;; Index into a virtual function
metadata, ;; indicates which base type contains the vtable pointer for the
;; derived class

If you're wondering about this field then it is unused in 'c' style functions so it does not matter. I fixed it in r146665. 
Thanks!
-
Devang

  i1        ;; isArtificial
i1 ;; isOptimized
Function *;; Pointer to LLVM function

}

When I use clang 2.9 and emit-llvm code metadata generated for a routine foo is:

!0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"", metadata !1, i32 1, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 0, i1 false, void ()* @foo} ; [ DW_TAG_subprogram ]
!1 = metadata !{i32 589865, metadata !"foodbg.c", metadata !"/home/deldon/tmp", metadata !2} ; [ DW_TAG_file_type ]
!2 = metadata !{i32 589841, i32 0, i32 12, metadata !"foodbg.c", metadata !"/home/deldon/tmp", metadata !"clang version 2.9 (tags/RELEASE_29/final)", i1 true, i1 false, 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}
...

As you can see metadata definition !0 doesn't match documentation. What is the correct definition (CLANG or LLVM documentation ?).
Thanks for your answer
Seb



_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: LLVM 2.9 metadata

Seb-22
Hi Devang,

Not only "vtable ptr" is a problem, for this field it seems that CLANG emits a NULL metadata node which is translated into 'i32 0'. The other problem is for 'isArtificial' field with is described as being of type i1 and CLANG emits i32. Looking at sources, it seems that it should be a i32 flag field.

Hope this helps,
Best Regards
Seb



2011/12/15 Devang Patel <[hidden email]>

On Dec 15, 2011, at 2:32 AM, Seb wrote:

Hi all,

In LLVM documentation about source level debugging (http://www.llvm.org/releases/2.9/docs/SourceLevelDebugging.html)

Subprogram descriptor is defined as:

!2 = metadata !{
i32, ;; Tag = 46 + LLVMDebugVersion
;; (DW_TAG_subprogram)
i32, ;; Unused field.
metadata, ;; Reference to context descriptor
metadata, ;; Name
metadata, ;; Display name (fully qualified C++ name)
metadata, ;; MIPS linkage name (for C++)
metadata, ;; Reference to file where defined
i32, ;; Line number where defined
metadata, ;; Reference to type descriptor
i1, ;; True if the global is local to compile unit (static)
i1 ;; True if the global is defined in the compile unit (not extern)
i32 ;; Virtuality, e.g. dwarf::DW_VIRTUALITY__virtual
i32 ;; Index into a virtual function
metadata, ;; indicates which base type contains the vtable pointer for the
;; derived class

If you're wondering about this field then it is unused in 'c' style functions so it does not matter. I fixed it in r146665. 
Thanks!
-
Devang

  i1        ;; isArtificial
i1 ;; isOptimized
Function *;; Pointer to LLVM function

}

When I use clang 2.9 and emit-llvm code metadata generated for a routine foo is:

!0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"", metadata !1, i32 1, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 0, i1 false, void ()* @foo} ; [ DW_TAG_subprogram ]
!1 = metadata !{i32 589865, metadata !"foodbg.c", metadata !"/home/deldon/tmp", metadata !2} ; [ DW_TAG_file_type ]
!2 = metadata !{i32 589841, i32 0, i32 12, metadata !"foodbg.c", metadata !"/home/deldon/tmp", metadata !"clang version 2.9 (tags/RELEASE_29/final)", i1 true, i1 false, 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}
...

As you can see metadata definition !0 doesn't match documentation. What is the correct definition (CLANG or LLVM documentation ?).
Thanks for your answer
Seb



_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev



_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: LLVM 2.9 metadata

Seb-22
Hi Devang,

In addition, metadata node definition with tag 'DW_TAG_subroutine_type' doesn't match what's described in documentation for composite type descriptor.

Best Regards
Seb


2011/12/16 Seb <[hidden email]>
Hi Devang,

Not only "vtable ptr" is a problem, for this field it seems that CLANG emits a NULL metadata node which is translated into 'i32 0'. The other problem is for 'isArtificial' field with is described as being of type i1 and CLANG emits i32. Looking at sources, it seems that it should be a i32 flag field.

Hope this helps,
Best Regards
Seb




2011/12/15 Devang Patel <[hidden email]>

On Dec 15, 2011, at 2:32 AM, Seb wrote:

Hi all,

In LLVM documentation about source level debugging (http://www.llvm.org/releases/2.9/docs/SourceLevelDebugging.html)

Subprogram descriptor is defined as:

!2 = metadata !{
i32, ;; Tag = 46 + LLVMDebugVersion
;; (DW_TAG_subprogram)
i32, ;; Unused field.
metadata, ;; Reference to context descriptor
metadata, ;; Name
metadata, ;; Display name (fully qualified C++ name)
metadata, ;; MIPS linkage name (for C++)
metadata, ;; Reference to file where defined
i32, ;; Line number where defined
metadata, ;; Reference to type descriptor
i1, ;; True if the global is local to compile unit (static)
i1 ;; True if the global is defined in the compile unit (not extern)
i32 ;; Virtuality, e.g. dwarf::DW_VIRTUALITY__virtual
i32 ;; Index into a virtual function
metadata, ;; indicates which base type contains the vtable pointer for the
;; derived class

If you're wondering about this field then it is unused in 'c' style functions so it does not matter. I fixed it in r146665. 
Thanks!
-
Devang

  i1        ;; isArtificial
i1 ;; isOptimized
Function *;; Pointer to LLVM function

}

When I use clang 2.9 and emit-llvm code metadata generated for a routine foo is:

!0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"", metadata !1, i32 1, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 0, i1 false, void ()* @foo} ; [ DW_TAG_subprogram ]
!1 = metadata !{i32 589865, metadata !"foodbg.c", metadata !"/home/deldon/tmp", metadata !2} ; [ DW_TAG_file_type ]
!2 = metadata !{i32 589841, i32 0, i32 12, metadata !"foodbg.c", metadata !"/home/deldon/tmp", metadata !"clang version 2.9 (tags/RELEASE_29/final)", i1 true, i1 false, 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}
...

As you can see metadata definition !0 doesn't match documentation. What is the correct definition (CLANG or LLVM documentation ?).
Thanks for your answer
Seb



_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: LLVM 2.9 metadata

Devang Patel
In reply to this post by Seb-22
I fixed these in r146743 & r146744.

Thanks!
-
Devang


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev