[LLVMdev] Name of Function's original module during link-time optimization

Reid Spencer rspencer at reidspencer.com
Sun Sep 24 14:21:13 PDT 2006


Hi Bram,

On Sun, 2006-09-24 at 22:58 +0200, Bram Adams wrote:
> Hi,
> 
> During link-time optimization using llvm-ld, I occasionally need to  
> find the name/ID of the original module/bytecode file a Function  
> belonged to. In order to do this I added a nameOfPreviousModule- 
> attribute to Function and some getters/setters (see attached patch).  
> However, I can't find out how to read in the ModuleID of a Module  
> during bytecode loading in lib/bytecode/Reader/Reader.cpp.
> 
> How can one do this? Is there another (better) way to accomplish what  
> I intend to do here (without extra attribute e.g.)?

Call getBytecodeModuleProvider (see Reader.h). This will return a
ModuleProvider. Ask it for the Module and then ask the Module for its
identifier. This approach avoids loading all the functions. 

Reid.





More information about the llvm-dev mailing list