diff options
author | Rong Xu <xur@google.com> | 2016-02-04 18:39:09 +0000 |
---|---|---|
committer | Rong Xu <xur@google.com> | 2016-02-04 18:39:09 +0000 |
commit | 9837ef56b45486930a50f4c0b31c37d4f71be957 (patch) | |
tree | 7cc0d30c0332dc59fc670d3c7ca2c038c723f718 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 375882dddb92b4cf9fac72b3388b9c4af35d8ba6 (diff) | |
download | bcm5719-llvm-9837ef56b45486930a50f4c0b31c37d4f71be957.tar.gz bcm5719-llvm-9837ef56b45486930a50f4c0b31c37d4f71be957.zip |
[PGO] cc1 option name change for profile instrumentation
This patch changes cc1 option -fprofile-instr-generate to an enum option
-fprofile-instrument={clang|none}. It also changes cc1 options
-fprofile-instr-generate= to -fprofile-instrument-path=.
The driver level option -fprofile-instr-generate and -fprofile-instr-generate=
remain intact. This change will pave the way to integrate new PGO
instrumentation in IR level.
Review: http://reviews.llvm.org/D16730
llvm-svn: 259811
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 91d2ffbe1cb..f085af30865 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -477,9 +477,28 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK, Opts.DisableIntegratedAS = Args.hasArg(OPT_fno_integrated_as); Opts.Autolink = !Args.hasArg(OPT_fno_autolink); Opts.SampleProfileFile = Args.getLastArgValue(OPT_fprofile_sample_use_EQ); - Opts.ProfileInstrGenerate = Args.hasArg(OPT_fprofile_instr_generate) || - Args.hasArg(OPT_fprofile_instr_generate_EQ); - Opts.InstrProfileOutput = Args.getLastArgValue(OPT_fprofile_instr_generate_EQ); + + enum PGOInstrumentor { Unknown, None, Clang }; + if (Arg *A = Args.getLastArg(OPT_fprofile_instrument_EQ)) { + StringRef Value = A->getValue(); + PGOInstrumentor Method = llvm::StringSwitch<PGOInstrumentor>(Value) + .Case("clang", Clang) + .Case("none", None) + .Default(Unknown); + switch (Method) { + case Clang: + Opts.setProfileInstr(CodeGenOptions::ProfileClangInstr); + break; + case None: + break; + case Unknown: + Diags.Report(diag::err_drv_invalid_pgo_instrumentor) + << A->getAsString(Args) << Value; + break; + } + } + + Opts.InstrProfileOutput = Args.getLastArgValue(OPT_fprofile_instrument_path_EQ); Opts.InstrProfileInput = Args.getLastArgValue(OPT_fprofile_instr_use_EQ); Opts.CoverageMapping = Args.hasFlag(OPT_fcoverage_mapping, OPT_fno_coverage_mapping, false); |