r308619 - Reland "[mips] Teach the driver to accept -m(no-)gpopt."

Simon Dardis via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 4 07:48:19 PDT 2017



> -----Original Message-----
> From: Simon Atanasyan [mailto:simon at atanasyan.com]
> Sent: 04 August 2017 11:29
> To: Simon Dardis
> Cc: Clang Commits
> Subject: Re: r308619 - Reland "[mips] Teach the driver to accept -m(no-
> )gpopt."
> 
> On Thu, Jul 20, 2017 at 5:04 PM, Simon Dardis via cfe-commits <cfe-
> commits at lists.llvm.org> wrote:
> > Reland "[mips] Teach the driver to accept -m(no-)gpopt."
> >
> > This patch teaches the driver to pass -mgpopt by default to the
> > backend when it is supported, i.e. we are using -mno-abicalls.
> 
> [...]
> 
> > Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
> > URL:
> > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Cl
> > ang.cpp?rev=308619&r1=308618&r2=308619&view=diff
> >
> ==========================================================
> ============
> > ========
> > --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
> > +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Thu Jul 20 07:04:12 2017
> > @@ -1462,6 +1462,30 @@ void Clang::AddMIPSTargetArgs(const ArgL
> >      A->claim();
> >    }
> >
> > +  Arg *GPOpt = Args.getLastArg(options::OPT_mgpopt,
> > + options::OPT_mno_gpopt);  Arg *ABICalls =
> > +      Args.getLastArg(options::OPT_mabicalls,
> > + options::OPT_mno_abicalls);
> > +
> > +  // -mabicalls is the default for many MIPS environments, even with -fno-
> pic.
> > +  // -mgpopt is the default for static, -fno-pic environments but
> > + these two  // options conflict. We want to be certain that
> > + -mno-abicalls -mgpopt is  // the only case where -mllvm -mgpopt is
> passed.
> > +  // NOTE: We need a warning here or in the backend to warn when -
> mgpopt is
> > +  //       passed explicitly when compiling something with -mabicalls
> > +  //       (implictly) in affect. Currently the warning is in the backend.
> > +  bool NoABICalls =
> > +      ABICalls &&
> > + ABICalls->getOption().matches(options::OPT_mno_abicalls);
> 
> What about N64 ABI + non-PIC code? In that case we pass the `+noabicalls`
> feature flag to the backend by default regardless of -mabicalls / -mnoabicalls
> options. Should we assign `true` to the NoABICalls in that case too to be
> consistent?

Yes, I think we should. I'll write a patch for this.

Thanks,
Simon
> 
> --
> Simon Atanasyan


More information about the cfe-commits mailing list