[LLVMdev] Filename in dynamically loaded function pass

Kodakara, Sreekumar V sreekumar.v.kodakara at intel.com
Wed Jul 6 17:27:39 PDT 2011

Hi All,

I would like to know if there is an API/method that I can use to get the name of the file being processed in a dynamically loaded function pass. In other words, if I invoke a pass as follows

opt  -load pass.so -hello  src.bc -o src.hello.bc

where pass.so is a functionpass, I would like to get the filename "src.bc", in the doInitialization/doFinalization method. My intent is to use the name to create another filename (say src.info) and store some other information generated by the pass.

Currently I am getting the filename by using the debug info of an instruction in the function (which actually returns the name of the source file, not the bc file being processed, which is fine for my use case). But sometimes, the instruction may refer to code from a system header file and hence will not return the name of the file that's currently being processed.

Is there a way to get this info?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110706/53632a4f/attachment.html>

More information about the llvm-dev mailing list