_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
// X86TargetMachine.cpp
cl::opt<bool>
MyOption("my new option", cl::init(true), cl::Hidden,
cl::desc("Enable my new option"));
// X86SomeOtherFile.cpp
extern cl::opt<bool> MyOption;
if (MyOption) {
// do something
@David, thanks for the advice, I'll check MCOptions again and look into LLVMContext.
@Craig, @Aaron, great suggestion, moving the option away from CommandFlags.inc to a more appropriate file and adding an extern declaration to the corresponding header gives me more flexibility and allows me to invoke the option by using -mllvm. From my current understanding, adding a function attribute would not be sufficient, since I need to query the option unrelated to functions, e.g. as early as when the X86RegisterInfo constructor is called. As of now, I'm not aware of any mechanism within the codebase that would allow me to do so, but perhaps you can point out something.
Thanks again
Oskar
> Aaron Smith <aaron.l...@gmail.com> hat am 6. Januar 2020 um 23:06 geschrieben:
Craig Topper <craig....@gmail.com> hat am 9. Januar 2020 um 23:31 geschrieben: