Bram Adams
2006-Sep-24 20:58 UTC
[LLVMdev] Name of Function's original module during link-time optimization
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.)? Kind regards, Bram Adams GH-SEL, INTEC, Ghent University (Belgium) -------------- next part -------------- A non-text attachment was scrubbed... Name: patch.modulename-1.8 Type: application/octet-stream Size: 2202 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20060924/5a3d40e1/attachment.obj>
Reid Spencer
2006-Sep-24 21:21 UTC
[LLVMdev] Name of Function's original module during link-time optimization
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.
Bram Adams
2006-Sep-25 12:24 UTC
[LLVMdev] Name of Function's original module during link-time optimization
Hi, Reid Spencer wrote:> Call getBytecodeModuleProvider (see Reader.h).The problem is that one needs to provide the filename of the original module as the argument of getBytecodeModuleProvider, whereas this is unknown (it's exactly what we're trying to find out). But, by looking where this method is called in the original bytecode loading process, I figured out a way to set the attribute I added when all Functions of a Module are linked into the sole link-time Module (see patch). The reason I pass an extra argument to so many methods (I let it default to ""), is that I'd like to have a full path name, not only the specific file name, of the original modules. As such, using someFunction->getParent()->getModuleIdentifier() in lib/Linker/LinkModules.cpp:650 did not suffice. However, I noticed that File.toString() in lib/Linker/LinkItems.cpp:150 does not yield the full path name. Could this patch (in a revised form) be added to LLVM? Kind regards, Bram Adams GH-SEL, INTEC, Ghent University (Belgium)> 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. > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: patch.modulename-1.8 URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20060925/2a6a42ea/attachment.ksh>
Seemingly Similar Threads
- [LLVMdev] Name of Function's original module during link-time optimization
- [LLVMdev] Name of Function's original module during link-time optimization
- [LLVMdev] Name of Function's original module during link-time optimization
- [LLVMdev] Name of Function's original module during link-time optimization
- [LLVMdev] Dropped support for IR-level extended linking support (archives, etc.)