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 <razvan.a.lupusoru@intel.com>
Signed-off-by: Jean Christophe Beyler <jean.christophe.beyler@intel.com>
diff --git a/compiler/dex/pass_driver.h b/compiler/dex/pass_driver.h
index bd8f53c..8a3eae1 100644
--- a/compiler/dex/pass_driver.h
+++ b/compiler/dex/pass_driver.h
@@ -161,6 +161,17 @@
print_pass_list_ = list;
}
+ /**
+ * @brief Used to set a string that contains the overridden pass options.
+ * @details An overridden pass option means that the pass uses this option
+ * instead of using its default option.
+ * @param s The string passed by user with overridden options. The string is in format
+ * Pass1Name:Pass1Option:Pass1Setting,Pass2Name:Pass2Option::Pass2Setting
+ */
+ static void SetOverriddenPassOptions(const std::string& s) {
+ overridden_pass_options_list_ = s;
+ }
+
void SetDefaultPasses() {
pass_list_ = PassDriver<PassDriverType>::g_default_pass_list;
}
@@ -206,6 +217,9 @@
/** @brief What are the passes we want to be dumping the CFG? */
static std::string dump_pass_list_;
+
+ /** @brief String of all options that should be overridden for selected passes */
+ static std::string overridden_pass_options_list_;
};
} // namespace art