[llvm-dev] Wiring a function into a new DICompileUnit
Adrian Prantl via llvm-dev
llvm-dev at lists.llvm.org
Thu Jul 7 13:21:56 PDT 2016
You could try looking at the inliner as an example how to do this; it also has to create a deep (inlined) copy of all the scopes on the cloned instructions.
> On Jul 6, 2016, at 3:51 PM, Nathan Schagen via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> Hi llvm users,
> I'm using CloneFunctionInto() move a function to another module. This function is actually a different version of a function that already exists and I want to make it debuggable. It has all the metadata, but it needs to be rewired to make it easy to debug in gdb.
> I would like to make a fake compile unit and add the function (DISubprogram) to it. All scope references of the metadata (e.g local vars) must also point to the DIFile that is associated with the new compile unit. I have the source of the function so I can let the DIFile point to the actual file.
> I've been studying the llvm 3.7 sourcecode but it's not obvious to me how to do this. Creating a new DICompileUnit with a DIFile and adding the DISubprogram is easy, but how can I rewire all scope references in the function's metadata to the new DIFile entry? Can I use MapMetadata for this?
> I know it's a rather complicated scenario, but I hope someone can give me some pointers to look into.
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
More information about the llvm-dev