[llvm-dev] Adding Flag Support in LLVM Backend

Grang, Mandeep Singh via llvm-dev llvm-dev at lists.llvm.org
Fri Jul 21 10:25:33 PDT 2017


Your cl::opt definition seems correct but the definition from llc.cpp is 
not visible in X86ISelLowring.cpp. The general practice is to define the 
cl::opt variable in the file you want to use it in. So you could try 
moving the definition to X86ISelLowering.cpp.

On 7/21/2017 10:17 AM, hameeza ahmed via llvm-dev wrote:
> Thank you.
> I want to define a flag -optt-enabled in llc so i wrote following line 
> in llc.cpp:
>
> static cl::opt<bool>
> OPPT("oppt-enabled", cl::desc("Enables Optimization"), cl::init(false));
>
> Now i want to check its value in x86isellwering.cpp
> there i wrote:
>
>  if (OPPT)
>     {addRegisterClass(.............)
> }
> but getting the error
>
>  use of undeclared identifier 'OPPT'
>
> Could someone tell me where i am mistaken? what else do i need to define.
>
>
>
>
>
> On Fri, Jul 21, 2017 at 2:33 PM, Diana Picus <diana.picus at linaro.org 
> <mailto:diana.picus at linaro.org>> wrote:
>
>     Hi,
>
>     You can find plenty of examples (including in the vectorizer) if you
>     grep for cl::opt.
>     The docs are here:
>     https://llvm.org/docs/CommandLine.html
>     <https://llvm.org/docs/CommandLine.html>
>
>     Hope that helps,
>     Diana
>
>     On 21 July 2017 at 10:47, hameeza ahmed via llvm-dev
>     <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote:
>     > Hello.
>     >
>     > I need to introduce a new flag in llc command like llc -mV to
>     control the
>     > vectorization. How can I achieve this??
>     >
>     >
>     > Please help.
>     >
>     > Thank You
>     >
>     > _______________________________________________
>     > LLVM Developers mailing list
>     > llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
>     > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>     <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev>
>     >
>
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170721/6616eb30/attachment.html>


More information about the llvm-dev mailing list