[LLVMdev] RFH: passing options from clang down to opt

Rafael EspĂ­ndola rafael.espindola at gmail.com
Tue Oct 1 12:42:12 PDT 2013


You are calling the option -auto-profile in some places and
-fauto-profile in others. Maybe it is just a typo?

On 1 October 2013 15:31, Diego Novillo <dnovillo at google.com> wrote:
> I'm trying to add a new option to clang to enable my auto profile
> pass.  I've added this to Options.td and Driver/Tools.cpp, but I'm not
> getting the option -auto-profile in cc1's invocation. I've checked
> that the code to push -auto-profile is executed, but if use -v, I
> don't see -auto-profile in the cc1 invocation.
>
> Can anyone point me to some document that explains how to pass clang's
> options down to opt?  Failing that, what option could I look at
> copying?  I've tried doing what the vectorizer flags do, but they are
> used to build the module pass manager, and my pass is just a function
> pass.
>
> Do I need to modify the pass manager as well?
>
> Thanks.  Diego.
>
> diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td
> index a2be903..da932e2 100644
> --- a/include/clang/Driver/Options.td
> +++ b/include/clang/Driver/Options.td
> @@ -351,6 +351,10 @@ def fno_autolink : Flag <["-"], "fno-autolink">,
> Group<f_Group>,
>    Flags<[DriverOption, CC1Option]>,
>    HelpText<"Disable generation of linker directives for automatic
> library linking">;
>
> +def fauto_profile : Flag<["-"], "fauto-profile">, Group<f_Group>,
> +    Flags<[DriverOption, CC1Option]>,
> +    HelpText<"Enable automatic profile guided optimizations">;
> +
>  def fblocks : Flag<["-"], "fblocks">, Group<f_Group>, Flags<[CC1Option]>,
>    HelpText<"Enable the 'blocks' language feature">;
>  def fbootclasspath_EQ : Joined<["-"], "fbootclasspath=">, Group<f_Group>;
> diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
> index dd48bc1..729da37 100644
> --- a/lib/Driver/Tools.cpp
> +++ b/lib/Driver/Tools.cpp
> @@ -3594,6 +3594,11 @@ void Clang::ConstructJob(Compilation &C, const
> JobAction &JA,
>        D.Diag(diag::err_drv_argument_not_allowed_with)
>          << "-fomit-frame-pointer" << A->getAsString(Args);
>
> +  if (Args.hasArg(options::OPT_fauto_profile)) {
> +    CmdArgs.push_back("-auto-profile");
> +  }
> +
>    // Claim some arguments which clang supports automatically.
>
>    // -fpch-preprocess is used with gcc to add a special marker in the output to
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev



More information about the llvm-dev mailing list