summaryrefslogtreecommitdiffstats
path: root/compiler
diff options
context:
space:
mode:
authorVladimir Marko <vmarko@google.com>2014-03-13 12:10:49 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-03-13 12:10:51 +0000
commit0cecf494999cc35e13ff2104145c1d9229bf8776 (patch)
treef868bc46f369b463f95eea40b31c4c28c78f07af /compiler
parentb9d50a9829b795932eac4cc50a99b4ce80b0ecb4 (diff)
parentcd8ce66a83af05d5ecb59aa6a8aad89a29e0a844 (diff)
downloadart-0cecf494999cc35e13ff2104145c1d9229bf8776.zip
art-0cecf494999cc35e13ff2104145c1d9229bf8776.tar.gz
art-0cecf494999cc35e13ff2104145c1d9229bf8776.tar.bz2
Merge "Add dex2oat --print-pass-names and --disable-passes= options."
Diffstat (limited to 'compiler')
-rw-r--r--compiler/dex/pass_driver.cc67
-rw-r--r--compiler/dex/pass_driver.h3
2 files changed, 44 insertions, 26 deletions
diff --git a/compiler/dex/pass_driver.cc b/compiler/dex/pass_driver.cc
index 291012f..72d3ea6 100644
--- a/compiler/dex/pass_driver.cc
+++ b/compiler/dex/pass_driver.cc
@@ -82,31 +82,48 @@ void PassDriver::InsertPass(const Pass* new_pass) {
pass_list_.push_back(new_pass);
}
-void PassDriver::CreatePasses() {
- /*
- * Create the pass list. These passes are immutable and are shared across the threads.
- *
- * Advantage is that there will be no race conditions here.
- * Disadvantage is the passes can't change their internal states depending on CompilationUnit:
- * - This is not yet an issue: no current pass would require it.
- */
- static const Pass* const passes[] = {
- GetPassInstance<CacheFieldLoweringInfo>(),
- GetPassInstance<CacheMethodLoweringInfo>(),
- GetPassInstance<CodeLayout>(),
- GetPassInstance<SSATransformation>(),
- GetPassInstance<ConstantPropagation>(),
- GetPassInstance<InitRegLocations>(),
- GetPassInstance<MethodUseCount>(),
- GetPassInstance<NullCheckEliminationAndTypeInferenceInit>(),
- GetPassInstance<NullCheckEliminationAndTypeInference>(),
- GetPassInstance<BBCombine>(),
- GetPassInstance<BBOptimizations>(),
- };
+/*
+ * Create the pass list. These passes are immutable and are shared across the threads.
+ *
+ * Advantage is that there will be no race conditions here.
+ * Disadvantage is the passes can't change their internal states depending on CompilationUnit:
+ * - This is not yet an issue: no current pass would require it.
+ */
+static const Pass* const gPasses[] = {
+ GetPassInstance<CacheFieldLoweringInfo>(),
+ GetPassInstance<CacheMethodLoweringInfo>(),
+ GetPassInstance<CodeLayout>(),
+ GetPassInstance<SSATransformation>(),
+ GetPassInstance<ConstantPropagation>(),
+ GetPassInstance<InitRegLocations>(),
+ GetPassInstance<MethodUseCount>(),
+ GetPassInstance<NullCheckEliminationAndTypeInferenceInit>(),
+ GetPassInstance<NullCheckEliminationAndTypeInference>(),
+ GetPassInstance<BBCombine>(),
+ GetPassInstance<BBOptimizations>(),
+};
+
+// The default pass list is used by CreatePasses to initialize pass_list_.
+static std::vector<const Pass*> gDefaultPassList(gPasses, gPasses + arraysize(gPasses));
+
+void PassDriver::CreateDefaultPassList(const std::string& disable_passes) {
+ // Insert each pass from gPasses into gDefaultPassList.
+ gDefaultPassList.clear();
+ gDefaultPassList.reserve(arraysize(gPasses));
+ for (const Pass* pass : gPasses) {
+ // Check if we should disable this pass.
+ if (disable_passes.find(pass->GetName()) != std::string::npos) {
+ LOG(INFO) << "Skipping " << pass->GetName();
+ } else {
+ gDefaultPassList.push_back(pass);
+ }
+ }
+}
+void PassDriver::CreatePasses() {
// Insert each pass into the list via the InsertPass method.
- pass_list_.reserve(arraysize(passes));
- for (const Pass* pass : passes) {
+ pass_list_.reserve(gDefaultPassList.size());
+ for (const Pass* pass : gDefaultPassList) {
InsertPass(pass);
}
}
@@ -221,10 +238,10 @@ void PassDriver::Launch() {
}
}
-void PassDriver::PrintPassNames() const {
+void PassDriver::PrintPassNames() {
LOG(INFO) << "Loop Passes are:";
- for (const Pass* cur_pass : pass_list_) {
+ for (const Pass* cur_pass : gPasses) {
LOG(INFO) << "\t-" << cur_pass->GetName();
}
}
diff --git a/compiler/dex/pass_driver.h b/compiler/dex/pass_driver.h
index c734d3e..2b7196e 100644
--- a/compiler/dex/pass_driver.h
+++ b/compiler/dex/pass_driver.h
@@ -73,7 +73,8 @@ class PassDriver {
*/
void DispatchPass(CompilationUnit* c_unit, const Pass* pass);
- void PrintPassNames() const;
+ static void PrintPassNames();
+ static void CreateDefaultPassList(const std::string& disable_passes);
const Pass* GetPass(const char* name) const;