[llvm] r322789 - [MachineOutliner] Add DISubprograms to outlined functions.

Adrian Prantl via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 18 08:15:41 PST 2018



> On Jan 17, 2018, at 6:20 PM, David Blaikie <dblaikie at gmail.com> wrote:
> 
> Yeah +1 for not making a new CU if we can help it.
> 
> Also wondering about the name of this function - giving it the same name as the original seems like it'd create issues for debuggers?
> 
> What exactly is outlining - it's taking a chunk of a function and pulling it out into another function? I guess we already pick an interesting mangled name for it to be unique and should probably use that? (maybe only put the linkage name and not give it a non-linkage name? Since it doesn't have a name in the source... but not sure if LLVM really supports a nameless function (or if DWARF/debuggers are cool with that either?))

Somewhat off-topic, but this made me curious how LLVM represents a C++ lambda in DWARF:

$ cat /tmp/lambda.cpp
int f() {
  auto l = [](){return 0;};
  return l();
}

-->

0x00000059:       DW_TAG_subprogram
                    DW_AT_name	("operator()")
                    DW_AT_decl_file	("/tmp/lambda.cpp")
                    DW_AT_decl_line	(2)
                    DW_AT_type	(cu + 0x006d "int")
                    DW_AT_declaration	(true)
                    DW_AT_external	(true)
                    DW_AT_accessibility	(DW_ACCESS_public)

0x0000007e:   DW_TAG_subprogram
                DW_AT_low_pc	(0x0000000000000020)
                DW_AT_high_pc	(0x000000000000002c)
                DW_AT_frame_base	(DW_OP_reg6 RBP)
                DW_AT_object_pointer	(cu + 0x0099)
                DW_AT_linkage_name	("_ZZ1fvENK3$_0clEv")
                DW_AT_specification	(cu + 0x0059 "operator()")


On-topic: If an empty human-readable name does not work, just putting the linkage name there would be fine, I think.

-- adrian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180118/aae44cff/attachment.html>


More information about the llvm-commits mailing list