Hi, I want to pass parameter to a analysis pass. My pass need to use some result from some other tools. I can hard code a file name into my pass, and let my pass read input there, but what if I do not want the file name to be hard coded? Is it possible to do that? If yes, where can I find some documentation about it? Thanks, Guoliang
You can use llvm::sys::Path::GetTemporaryDirectory() and put the inputs and outputs there. Reid On Wed, Jul 7, 2010 at 4:23 PM, Guoliang Jin <jingl1345 at gmail.com> wrote:> Hi, > > I want to pass parameter to a analysis pass. My pass need to use some > result from some other tools. I can hard code a file name into my pass, > and let my pass read input there, but what if I do not want the file > name to be hard coded? > > Is it possible to do that? If yes, where can I find some documentation > about it? > > Thanks, > Guoliang > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
If you think a commandline option is the way to go, LLVM makes it pretty easy to do so, see the documentation here: http://llvm.org/docs/CommandLine.html . Mostly you can just add an appropriate "cl::opt<string>" option (for your filename, for example) and you're on your way. ~Will On Wed, Jul 7, 2010 at 9:55 PM, Reid Kleckner <reid.kleckner at gmail.com> wrote:> You can use llvm::sys::Path::GetTemporaryDirectory() and put the > inputs and outputs there. > > Reid > > On Wed, Jul 7, 2010 at 4:23 PM, Guoliang Jin <jingl1345 at gmail.com> wrote: >> Hi, >> >> I want to pass parameter to a analysis pass. My pass need to use some >> result from some other tools. I can hard code a file name into my pass, >> and let my pass read input there, but what if I do not want the file >> name to be hard coded? >> >> Is it possible to do that? If yes, where can I find some documentation >> about it? >> >> Thanks, >> Guoliang >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
On Jul 7, 2010, at 4:23 PM, Guoliang Jin wrote:> I want to pass parameter to a analysis pass. My pass need to use some > result from some other tools.The getAnalysis function returns a reference to a pass. Once you have the reference you can call the pass's member functions or access its member variables to send/receive information. http://llvm.org/docs/WritingAnLLVMPass.html#getAnalysis Trevor