ART: Print and dump functionalities per pass
LOG is a great logging tool but sometimes a pass has some debugging text it
want to be able to turn on/off easily.
By going via a print_pass flag, we can actually turn it on/off easily per pass
when debugging/instrumenting.
- Added a pass printer to help debug messages for future passes.
- Added a print_pass flag in CompilationUnit to filter out messages.
At the same time, did a similar system for dumping the CFG.
- Also moved some API into public from protected.
Change-Id: Ie0e89a8fc773e8583f3e4ffd6e4bd2eebdbb2bf4
Signed-off-by: Jean Christophe Beyler <jean.christophe.beyler@intel.com>
Signed-off-by: Razvan A Lupusoru <razvan.a.lupusoru@intel.com>
Signed-off-by: Yixin Shou <yixin.shou@intel.com>
Signed-off-by: Chao-ying Fu <chao-ying.fu@intel.com>
Signed-off-by: Udayan Banerji <udayan.banerji@intel.com>
diff --git a/compiler/dex/pass_driver.h b/compiler/dex/pass_driver.h
index aa0d1ae..788f24b 100644
--- a/compiler/dex/pass_driver.h
+++ b/compiler/dex/pass_driver.h
@@ -141,7 +141,6 @@
}
}
- protected:
/**
* @brief Gets the list of passes currently schedule to execute.
* @return pass_list_
@@ -150,14 +149,27 @@
return pass_list_;
}
- virtual void InitializePasses() {
- SetDefaultPasses();
+ static void SetPrintAllPasses() {
+ default_print_passes_ = true;
+ }
+
+ static void SetDumpPassList(const char* list) {
+ dump_pass_list_.reset(list);
+ }
+
+ static void SetPrintPassList(const char* list) {
+ print_pass_list_.reset(list);
}
void SetDefaultPasses() {
pass_list_ = PassDriver<PassDriverType>::g_default_pass_list;
}
+ protected:
+ virtual void InitializePasses() {
+ SetDefaultPasses();
+ }
+
/**
* @brief Apply a patch: perform start/work/end functions.
*/
@@ -185,6 +197,15 @@
/** @brief The default pass list is used to initialize pass_list_. */
static std::vector<const Pass*> g_default_pass_list;
+
+ /** @brief Do we, by default, want to be printing the log messages? */
+ static bool default_print_passes_;
+
+ /** @brief What are the passes we want to be printing the log messages? */
+ static std::unique_ptr<const char> print_pass_list_;
+
+ /** @brief What are the passes we want to be dumping the CFG? */
+ static std::unique_ptr<const char> dump_pass_list_;
};
} // namespace art