summaryrefslogtreecommitdiff
path: root/compiler/dex/quick/quick_compiler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/dex/quick/quick_compiler.cc')
-rw-r--r--compiler/dex/quick/quick_compiler.cc72
1 files changed, 29 insertions, 43 deletions
diff --git a/compiler/dex/quick/quick_compiler.cc b/compiler/dex/quick/quick_compiler.cc
index 3a34fcde94..909077eca2 100644
--- a/compiler/dex/quick/quick_compiler.cc
+++ b/compiler/dex/quick/quick_compiler.cc
@@ -29,6 +29,8 @@
#include "dex/dex_flags.h"
#include "dex/mir_graph.h"
#include "dex/pass_driver_me_opts.h"
+#include "dex/pass_driver_me_post_opt.h"
+#include "dex/pass_manager.h"
#include "dex/quick/mir_to_lir.h"
#include "driver/compiler_driver.h"
#include "driver/compiler_options.h"
@@ -47,48 +49,6 @@
namespace art {
-class QuickCompiler FINAL : public Compiler {
- public:
- explicit QuickCompiler(CompilerDriver* driver) : Compiler(driver, 100) {}
-
- void Init() OVERRIDE;
-
- void UnInit() const OVERRIDE;
-
- bool CanCompileMethod(uint32_t method_idx, const DexFile& dex_file, CompilationUnit* cu) const
- OVERRIDE;
-
- CompiledMethod* Compile(const DexFile::CodeItem* code_item,
- uint32_t access_flags,
- InvokeType invoke_type,
- uint16_t class_def_idx,
- uint32_t method_idx,
- jobject class_loader,
- const DexFile& dex_file) const OVERRIDE;
-
- CompiledMethod* JniCompile(uint32_t access_flags,
- uint32_t method_idx,
- const DexFile& dex_file) const OVERRIDE;
-
- uintptr_t GetEntryPointOf(mirror::ArtMethod* method) const OVERRIDE
- SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
-
- bool WriteElf(art::File* file,
- OatWriter* oat_writer,
- const std::vector<const art::DexFile*>& dex_files,
- const std::string& android_root,
- bool is_host) const
- OVERRIDE
- SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
-
- Mir2Lir* GetCodeGenerator(CompilationUnit* cu, void* compilation_unit) const;
-
- void InitCompilationUnit(CompilationUnit& cu) const OVERRIDE;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(QuickCompiler);
-};
-
static_assert(0U == static_cast<size_t>(kNone), "kNone not 0");
static_assert(1U == static_cast<size_t>(kArm), "kArm not 1");
static_assert(2U == static_cast<size_t>(kArm64), "kArm64 not 2");
@@ -730,7 +690,7 @@ CompiledMethod* QuickCompiler::Compile(const DexFile::CodeItem* code_item,
}
/* Create the pass driver and launch it */
- PassDriverMEOpts pass_driver(&cu);
+ PassDriverMEOpts pass_driver(GetPreOptPassManager(), &cu);
pass_driver.Launch();
/* For non-leaf methods check if we should skip compilation when the profiler is enabled. */
@@ -850,8 +810,34 @@ Mir2Lir* QuickCompiler::GetCodeGenerator(CompilationUnit* cu, void* compilation_
return mir_to_lir;
}
+QuickCompiler::QuickCompiler(CompilerDriver* driver) : Compiler(driver, 100) {
+ const auto& compiler_options = driver->GetCompilerOptions();
+ auto* pass_manager_options = compiler_options.GetPassManagerOptions();
+ pre_opt_pass_manager_.reset(new PassManager(*pass_manager_options));
+ CHECK(pre_opt_pass_manager_.get() != nullptr);
+ PassDriverMEOpts::SetupPasses(pre_opt_pass_manager_.get());
+ pre_opt_pass_manager_->CreateDefaultPassList();
+ if (pass_manager_options->GetPrintPassOptions()) {
+ PassDriverMEOpts::PrintPassOptions(pre_opt_pass_manager_.get());
+ }
+ // TODO: Different options for pre vs post opts?
+ post_opt_pass_manager_.reset(new PassManager(PassManagerOptions()));
+ CHECK(post_opt_pass_manager_.get() != nullptr);
+ PassDriverMEPostOpt::SetupPasses(post_opt_pass_manager_.get());
+ post_opt_pass_manager_->CreateDefaultPassList();
+ if (pass_manager_options->GetPrintPassOptions()) {
+ PassDriverMEPostOpt::PrintPassOptions(post_opt_pass_manager_.get());
+ }
+}
+
+QuickCompiler::~QuickCompiler() {
+}
Compiler* CreateQuickCompiler(CompilerDriver* driver) {
+ return QuickCompiler::Create(driver);
+}
+
+Compiler* QuickCompiler::Create(CompilerDriver* driver) {
return new QuickCompiler(driver);
}