From bd25d4bff69e4775b7844d48630618b5ad8d3343 Mon Sep 17 00:00:00 2001 From: Razvan A Lupusoru Date: Wed, 2 Jul 2014 18:16:51 -0700 Subject: ART: Add capability for a pass to have options This patch adds capability to have pass options. These are needed when a pass has multiple flags that can be tweaked. The user is now allowed to pass those options via command line. Since passes are treated as singletons and they are immutable, the overridden options provided by user are set on the compilation unit. Doing this way also allows a selectivity system to tweak the option per compilation instead of doing it globally (due to the single pass existing). The following command line flags have been added: --print-pass-options - This prints all passes that have options along with their defaults. --pass-options= - This is used to pass the overridden options in format of PassName:PassOption:PassOptionSetting Change-Id: Ib5156f5d2ff51a0c64c4ea0fa050bd2170663417 Signed-off-by: Razvan A Lupusoru Signed-off-by: Jean Christophe Beyler --- dex2oat/dex2oat.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'dex2oat') diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc index 19b37af..aef235b 100644 --- a/dex2oat/dex2oat.cc +++ b/dex2oat/dex2oat.cc @@ -226,6 +226,15 @@ static void Usage(const char* fmt, ...) { UsageError(" --disable-passes=: disable one or more passes separated by comma."); UsageError(" Example: --disable-passes=UseCount,BBOptimizations"); UsageError(""); + UsageError(" --print-pass-options: print a list of passes that have configurable options along " + "with the setting."); + UsageError(" Will print default if no overridden setting exists."); + UsageError(""); + UsageError(" --pass-options=Pass1Name:Pass1OptionName:Pass1Option#," + "Pass2Name:Pass2OptionName:Pass2Option#"); + UsageError(" Used to specify a pass specific option. The setting itself must be integer."); + UsageError(" Separator used between options is a comma."); + UsageError(""); std::cerr << "See log for usage error information\n"; exit(EXIT_FAILURE); } @@ -847,6 +856,7 @@ static int dex2oat(int argc, char** argv) { bool dump_stats = false; bool dump_timing = false; bool dump_passes = false; + bool print_pass_options = false; bool include_patch_information = CompilerOptions::kDefaultIncludePatchInformation; bool include_debug_symbols = kIsDebugBuild; bool dump_slow_timing = kIsDebugBuild; @@ -1033,6 +1043,11 @@ static int dex2oat(int argc, char** argv) { } else if (option.starts_with("--dump-cfg-passes=")) { std::string dump_passes = option.substr(strlen("--dump-cfg-passes=")).data(); PassDriverMEOpts::SetDumpPassList(dump_passes); + } else if (option == "--print-pass-options") { + print_pass_options = true; + } else if (option.starts_with("--pass-options=")) { + std::string options = option.substr(strlen("--pass-options=")).data(); + PassDriverMEOpts::SetOverriddenPassOptions(options); } else if (option == "--include-patch-information") { include_patch_information = true; } else if (option == "--no-include-patch-information") { @@ -1179,6 +1194,10 @@ static int dex2oat(int argc, char** argv) { break; } + if (print_pass_options) { + PassDriverMEOpts::PrintPassOptions(); + } + std::unique_ptr compiler_options(new CompilerOptions(compiler_filter, huge_method_threshold, large_method_threshold, -- cgit v1.1