[PATCH] D35548: [mips] Teach the driver to accept -m(no-)gpopt.

Simon Dardis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 18 07:50:52 PDT 2017


sdardis added inline comments.


================
Comment at: lib/Driver/ToolChains/Clang.cpp:1490
+      GPOpt->claim();
+  }
+
----------------
atanasyan wrote:
> Could it be rewritten a bit shorter?
> 
> ```
> bool NoAbiCalls =
>     ABICalls && ABICalls->getOption().matches(options::OPT_mno_abicalls);
> bool WantGPOpt = GPOpt && GPOpt->getOption().matches(options::OPT_mgpopt);
> 
> if (NoAbiCalls && (!GPOpt || WantGPOpt)) {
>   CmdArgs.push_back("-mllvm");
>   CmdArgs.push_back("-mgpopt=1");
> } else {
>   CmdArgs.push_back("-mllvm");
>   CmdArgs.push_back("-mgpopt=0");
> }
> 
> if (GPOpt)
>   GPOpt->claim();
> ```
Yes, it can. I think I mis-handled the case where -mabicalls and -mgpopt are combined. I'll reflow the logic along the lines of your suggestion and add a warning.


https://reviews.llvm.org/D35548





More information about the cfe-commits mailing list