diff options
author | Francis Visoiu Mistrih <francisvm@yahoo.com> | 2019-06-17 16:06:00 +0000 |
---|---|---|
committer | Francis Visoiu Mistrih <francisvm@yahoo.com> | 2019-06-17 16:06:00 +0000 |
commit | 34667519dc199d58b4556cfdc4e3ecb04365e53e (patch) | |
tree | bdfc15117967634c7f53fce1020b3910baadfc40 /llvm/tools | |
parent | 77bc3b65424afc42031a0859c91154acdc54feaa (diff) | |
download | bcm5719-llvm-34667519dc199d58b4556cfdc4e3ecb04365e53e.tar.gz bcm5719-llvm-34667519dc199d58b4556cfdc4e3ecb04365e53e.zip |
[Remarks] Extend -fsave-optimization-record to specify the format
Use -fsave-optimization-record=<format> to specify a different format
than the default, which is YAML.
For now, only YAML is supported.
llvm-svn: 363573
Diffstat (limited to 'llvm/tools')
-rw-r--r-- | llvm/tools/gold/gold-plugin.cpp | 4 | ||||
-rw-r--r-- | llvm/tools/llc/llc.cpp | 8 | ||||
-rw-r--r-- | llvm/tools/llvm-lto2/llvm-lto2.cpp | 6 | ||||
-rw-r--r-- | llvm/tools/opt/opt.cpp | 8 |
4 files changed, 24 insertions, 2 deletions
diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp index 314d8637623..1cd287cb668 100644 --- a/llvm/tools/gold/gold-plugin.cpp +++ b/llvm/tools/gold/gold-plugin.cpp @@ -209,6 +209,7 @@ namespace options { static std::string RemarksFilename; static std::string RemarksPasses; static bool RemarksWithHotness = false; + static std::string RemarksFormat; // Context sensitive PGO options. static std::string cs_profile_path; @@ -290,6 +291,8 @@ namespace options { RemarksPasses = opt.substr(strlen("opt-remarks-passes=")); } else if (opt == "opt-remarks-with-hotness") { RemarksWithHotness = true; + } else if (opt.startswith("opt-remarks-format=")) { + RemarksFormat = opt.substr(strlen("opt-remarks-format=")); } else if (opt.startswith("stats-file=")) { stats_file = opt.substr(strlen("stats-file=")); } else { @@ -913,6 +916,7 @@ static std::unique_ptr<LTO> createLTO(IndexWriteCallback OnIndexWrite, Conf.RemarksFilename = options::RemarksFilename; Conf.RemarksPasses = options::RemarksPasses; Conf.RemarksWithHotness = options::RemarksWithHotness; + Conf.RemarksFormat = options::RemarksFormat; // Use new pass manager if set in driver Conf.UseNewPM = options::new_pass_manager; diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp index 48a810cf6eb..76da843f065 100644 --- a/llvm/tools/llc/llc.cpp +++ b/llvm/tools/llc/llc.cpp @@ -155,6 +155,11 @@ static cl::opt<std::string> "names match the given regular expression"), cl::value_desc("regex")); +static cl::opt<std::string> RemarksFormat( + "pass-remarks-format", + cl::desc("The format used for serializing remarks (default: YAML)"), + cl::value_desc("format"), cl::init("yaml")); + namespace { static ManagedStatic<std::vector<std::string>> RunPassNames; @@ -329,7 +334,8 @@ int main(int argc, char **argv) { Expected<std::unique_ptr<ToolOutputFile>> RemarksFileOrErr = setupOptimizationRemarks(Context, RemarksFilename, RemarksPasses, - RemarksWithHotness, RemarksHotnessThreshold); + RemarksFormat, RemarksWithHotness, + RemarksHotnessThreshold); if (Error E = RemarksFileOrErr.takeError()) { WithColor::error(errs(), argv[0]) << toString(std::move(E)) << '\n'; return 1; diff --git a/llvm/tools/llvm-lto2/llvm-lto2.cpp b/llvm/tools/llvm-lto2/llvm-lto2.cpp index 7f8b5beb716..0bd9289dc93 100644 --- a/llvm/tools/llvm-lto2/llvm-lto2.cpp +++ b/llvm/tools/llvm-lto2/llvm-lto2.cpp @@ -107,6 +107,11 @@ static cl::opt<std::string> "names match the given regular expression"), cl::value_desc("regex")); +static cl::opt<std::string> RemarksFormat( + "pass-remarks-format", + cl::desc("The format used for serializing remarks (default: YAML)"), + cl::value_desc("format"), cl::init("yaml")); + static cl::opt<std::string> SamplePGOFile("lto-sample-profile-file", cl::desc("Specify a SamplePGO profile file")); @@ -229,6 +234,7 @@ static int run(int argc, char **argv) { Conf.RemarksFilename = RemarksFilename; Conf.RemarksPasses = RemarksPasses; Conf.RemarksWithHotness = RemarksWithHotness; + Conf.RemarksFormat = RemarksFormat; Conf.SampleProfile = SamplePGOFile; Conf.CSIRProfile = CSPGOFile; diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp index dde1d776fef..ccf8b073b82 100644 --- a/llvm/tools/opt/opt.cpp +++ b/llvm/tools/opt/opt.cpp @@ -273,6 +273,11 @@ static cl::opt<std::string> "names match the given regular expression"), cl::value_desc("regex")); +static cl::opt<std::string> RemarksFormat( + "pass-remarks-format", + cl::desc("The format used for serializing remarks (default: YAML)"), + cl::value_desc("format"), cl::init("yaml")); + cl::opt<PGOKind> PGOKindFlag("pgo-kind", cl::init(NoPGO), cl::Hidden, cl::desc("The kind of profile guided optimization"), @@ -552,7 +557,8 @@ int main(int argc, char **argv) { Expected<std::unique_ptr<ToolOutputFile>> RemarksFileOrErr = setupOptimizationRemarks(Context, RemarksFilename, RemarksPasses, - RemarksWithHotness, RemarksHotnessThreshold); + RemarksFormat, RemarksWithHotness, + RemarksHotnessThreshold); if (Error E = RemarksFileOrErr.takeError()) { errs() << toString(std::move(E)) << '\n'; return 1; |