<div dir="ltr">CommandFlags.inc is only included by llc and opt. I think it mostly just sets things on TargetMachine and TargetOptions and connects them to command line options. Clang has its own code for setting up TargetMachine and TargetOptions.<div><br></div><div>I think a lot of configuration things these days tend to be done with function attributes in IR. You can just query the function attribute wherever without any need to have a centralized option. They also probably works better with LTO since the option is stored for each function so different source files can have different settings.<br><div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">~Craig</div></div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 6, 2020 at 1:12 PM David Blaikie via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Mostly I've only worked with debug info - so anything that I need passed down to the backend goes into MCOptions, MCAsmInfo, and things like that.<br><br>If you want to affect the way LLVM middle end optimization passes behave, that may require a different channel (might find some options on the LLVMContext? Maybe, but maybe not - perhaps those sort of parameters get passed straight to the passes in some way)</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 6, 2020 at 12:20 PM Oskar Szakinnis via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>

  
   
 
 <div>
  <div>
   Hello everyone,
   <br>
  </div>
  <div>
   <br>
  </div>
  <div>
   I'm currently working on a project that required me to fundamentally modify certain mechanisms of the x86 backend, as well as certain functions within PrologEpilogInserter (so my changes are not confined to a single pass - e.g. they include changes to the x86RegisterInfo constructor).
  </div>
  <div>
   In my current solution, I have added an option within llvm/include/llvm/CodeGen/CommandFlags.inc to enable my modifications (the modifications are placed within if-conditions in multiple segments of the code).
   <br>This requires me to compile test code in two steps (first run clang with -emit-llvm, then run llc with my option enabled in the command line).
   <br>
  </div>
  <div>
   <br>
  </div>
  <div>
   Now I would like to be able to enable my modification through a clang command line option. What would be the canonical way to do so and which steps do I have to take? I already looked into the dev guide, but perhaps I missed something.
   <br>
  </div>
  <div>
   <br>
  </div>
  <div>
   I already tried using -mllvm as a workaround, but for some reason my option is not being recognized. Ultimately, I'd prefer not to rely on -mllvm anyway.
   <br>
  </div>
  <div>
   <br>
  </div>
  <div>
    To sum up my question: I want to be able to pass a boolean command line parameter to clang and use it within certain conditional statements within multiple files of the backend.
   <br>
  </div>
  <div>
   <br>
  </div>
  <div>
   Thank you for your help and let me know if my intent is unclear.
   <br>
  </div>
  <div>
   <br>
  </div>
  <div>
   Oskar
   <br>
  </div> 
 </div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>