This is an archive of the discontinued LLVM Phabricator instance.

[mips] Teach the driver to accept -m(no-)gpopt.
ClosedPublic

Authored by sdardis on Jul 18 2017, 5:02 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

sdardis created this revision.Jul 18 2017, 5:02 AM
atanasyan added inline comments.Jul 18 2017, 5:33 AM
lib/Driver/ToolChains/Clang.cpp
1490 ↗(On Diff #107070)

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();
sdardis added inline comments.Jul 18 2017, 7:50 AM
lib/Driver/ToolChains/Clang.cpp
1490 ↗(On Diff #107070)

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.

sdardis updated this revision to Diff 107114.Jul 18 2017, 9:11 AM
sdardis marked an inline comment as done.

Addressed review comment, added warning when combining -mabicalls and -mgpopt.

This revision is now accepted and ready to land.Jul 18 2017, 2:42 PM
This revision was automatically updated to reflect the committed changes.