guyadini
2011-Jan-27 11:37 UTC
[LLVMdev] Passing command line arguments to optimization passes
A follow-up question: Is there a way to make different passes accept one command line option that will affect all of them? For example, I'd like to have a -optStrength parameter, that can be given to all of my passes simultaneously. Thanks a lot, Guy Arnaud Allard de Grandmaison wrote:> > Hi Harel, > > Several existing passes can take command line arguments. Have a look at > lib/Transforms/Scalar/LoopUnrollPass.cpp for example. Its command line > arguments are defined using the cl::opt objects. > > Best regards, > -- > Arnaud de Grandmaison > ________________________________ > From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On > Behalf Of Harel Cain > Sent: Thursday, January 27, 2011 10:05 AM > To: llvmdev at cs.uiuc.edu > Subject: [LLVMdev] Passing command line arguments to optimization passes > > Hi all, > > I was wondering if there's any way to pass command line arguments to LLVM > optimization passes when run through the opt tool. > > For example, suppose I register called MyPass, then I want to run > > opt -load libMyPass.so -MyPass 3 < input.bc > > and have "3" be available to MyPass as a kind of argv argumnet through > some method. > > > Or does it take a major rewrite of the opt tool command line parsing? > > > Thanks! > > Harel Cain > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-- View this message in context: http://old.nabble.com/Passing-command-line-arguments-to-optimization-passes-tp30775359p30776468.html Sent from the LLVM - Dev mailing list archive at Nabble.com.
Arnaud Allard de Grandmaison
2011-Jan-28 07:50 UTC
[LLVMdev] Passing command line arguments to optimization passes
You could make the cl:opt object visible outside one of your passes, and use it in your other passes : in other words, it is a global variable shared between several files. Best regards, -- Arnaud de Grandmaison -----Original Message----- From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of guyadini Sent: Thursday, January 27, 2011 12:38 PM To: llvmdev at cs.uiuc.edu Subject: Re: [LLVMdev] Passing command line arguments to optimization passes A follow-up question: Is there a way to make different passes accept one command line option that will affect all of them? For example, I'd like to have a -optStrength parameter, that can be given to all of my passes simultaneously. Thanks a lot, Guy Arnaud Allard de Grandmaison wrote:> > Hi Harel, > > Several existing passes can take command line arguments. Have a look at > lib/Transforms/Scalar/LoopUnrollPass.cpp for example. Its command line > arguments are defined using the cl::opt objects. > > Best regards, > -- > Arnaud de Grandmaison > ________________________________ > From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On > Behalf Of Harel Cain > Sent: Thursday, January 27, 2011 10:05 AM > To: llvmdev at cs.uiuc.edu > Subject: [LLVMdev] Passing command line arguments to optimization passes > > Hi all, > > I was wondering if there's any way to pass command line arguments to LLVM > optimization passes when run through the opt tool. > > For example, suppose I register called MyPass, then I want to run > > opt -load libMyPass.so -MyPass 3 < input.bc > > and have "3" be available to MyPass as a kind of argv argumnet through > some method. > > > Or does it take a major rewrite of the opt tool command line parsing? > > > Thanks! > > Harel Cain > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-- View this message in context: http://old.nabble.com/Passing-command-line-arguments-to-optimization-passes-tp30775359p30776468.html Sent from the LLVM - Dev mailing list archive at Nabble.com. _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Jim Grosbach
2011-Jan-28 21:13 UTC
[LLVMdev] Passing command line arguments to optimization passes
Yep. The ARM, X86 and PPC backends do this, for example. To find some examples, in <llvm>/lib/Target, run: grep -R "extern cl::opt" * -Jim On Jan 27, 2011, at 11:50 PM, Arnaud Allard de Grandmaison wrote:> You could make the cl:opt object visible outside one of your passes, and use it in your other passes : in other words, it is a global variable shared between several files. > > Best regards, > -- > Arnaud de Grandmaison > > -----Original Message----- > From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of guyadini > Sent: Thursday, January 27, 2011 12:38 PM > To: llvmdev at cs.uiuc.edu > Subject: Re: [LLVMdev] Passing command line arguments to optimization passes > > > A follow-up question: > Is there a way to make different passes accept one command line option that > will affect all of them? > > For example, I'd like to have a -optStrength parameter, that can be given to > all of my passes simultaneously. > > Thanks a lot, > Guy > > > Arnaud Allard de Grandmaison wrote: >> >> Hi Harel, >> >> Several existing passes can take command line arguments. Have a look at >> lib/Transforms/Scalar/LoopUnrollPass.cpp for example. Its command line >> arguments are defined using the cl::opt objects. >> >> Best regards, >> -- >> Arnaud de Grandmaison >> ________________________________ >> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On >> Behalf Of Harel Cain >> Sent: Thursday, January 27, 2011 10:05 AM >> To: llvmdev at cs.uiuc.edu >> Subject: [LLVMdev] Passing command line arguments to optimization passes >> >> Hi all, >> >> I was wondering if there's any way to pass command line arguments to LLVM >> optimization passes when run through the opt tool. >> >> For example, suppose I register called MyPass, then I want to run >> >> opt -load libMyPass.so -MyPass 3 < input.bc >> >> and have "3" be available to MyPass as a kind of argv argumnet through >> some method. >> >> >> Or does it take a major rewrite of the opt tool command line parsing? >> >> >> Thanks! >> >> Harel Cain >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> >> > > -- > View this message in context: http://old.nabble.com/Passing-command-line-arguments-to-optimization-passes-tp30775359p30776468.html > Sent from the LLVM - Dev mailing list archive at Nabble.com. > > _______________________________________________ > 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
Possibly Parallel Threads
- [LLVMdev] Passing command line arguments to optimization passes
- [LLVMdev] Passing command line arguments to optimization passes
- [LLVMdev] Passing command line arguments to optimization passes
- [LLVMdev] Optimized "opt" on Darwin fails to load dynamic libraries with passes
- [LLVMdev] Optimized "opt" on Darwin fails to load dynamic libraries with passes