<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br class=""><blockquote type="cite" class="">On Jan 6, 2017, at 2:25 AM, Hong Hu via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:<br class=""><br class="">Hi,<br class=""><br class="">Given one structure type, is there any method to get the metadata that describes the structure information?<br class=""><br class="">For example: <br class=""><br class="">%2 = getelementptr inbounds %"class.std::thread", %"class.std::thread"* %this, i64 0, i32 0, i32 0, !dbg !2748<br class=""></blockquote><br class=""><blockquote type="cite" class="">then I know the pointer operand type is class.std::thread. I want to find the associated metadata of this type:<br class=""><br class="">!217 = !DICompositeType(tag: DW_TAG_class_type, name: "thread", scope: !34, file: !218, line: 60, size: 64, align: 64, elements: !219, identifier: "_ZTSSt6thread")                                         <br class=""><br class="">The challenge is that the structure name is different in the IR instruction, from the one in the metadata. One is  class.std::thread, while another is _ZTSSt6thread. <br class=""><br class=""></blockquote><div class=""><br class=""></div><div class="">What you are describing is not really possible.</div><div class=""><br class=""></div><div class=""><div class="">- %"class.std::thread" is an LLVM type in the LLVM type system.</div><div class="">- !217 is an LLVM IR metadata node that describes a C++ type.</div><div class=""><br class=""></div><div class="">There exists no direct mapping between these two. The only link between the two is when there is a source variable of that type described by a llvm.dbg.value or llvm.dbg.declare intrinsic, such as a</div></div><div class="">- call @llvm.dbg.value(metadata %s, i64 0, metadata !217, metadata !DIExpression())</div><br class=""><div class="">Can you explain your use-case some more? Perhaps there exists a better solution to what you are trying to do.</div><div class=""><br class=""></div><div class="">-- adrian</div></body></html>