Integrating portable path with the Frontend.
(1) Connect the new interface oatCompileMethodToGBC and gbc_expander.
(2) Need to fix Android.common.mk for fly2iceland: Portable path has
frontend: USE_QUICK_COMPILER and backend: USE_LLVM_COMPILER.
(3) Fix Android.libart-compiler-llvm.mk so we can call the new interface.
Change-Id: I7216f378bdb5e42a35fd6fa10c1d5d161a912401
diff --git a/src/compiler_llvm/compilation_unit.cc b/src/compiler_llvm/compilation_unit.cc
index b5ff67c..eaa8be1 100644
--- a/src/compiler_llvm/compilation_unit.cc
+++ b/src/compiler_llvm/compilation_unit.cc
@@ -150,10 +150,14 @@
namespace art {
namespace compiler_llvm {
-#ifdef ART_USE_DEXLANG_FRONTEND
+#if defined(ART_USE_DEXLANG_FRONTEND) || defined(ART_USE_QUICK_COMPILER)
llvm::FunctionPass*
CreateGBCExpanderPass(const greenland::IntrinsicHelper& intrinsic_helper,
IRBuilder& irb);
+
+llvm::FunctionPass*
+CreateGBCExpanderPass(const greenland::IntrinsicHelper& intrinsic_helper, IRBuilder& irb,
+ Compiler* compiler, OatCompilationUnit* oat_compilation_unit);
#endif
llvm::Module* makeLLVMModuleContents(llvm::Module* module);
@@ -168,9 +172,13 @@
module_ = new llvm::Module("art", *context_);
makeLLVMModuleContents(module_);
-#ifdef ART_USE_DEXLANG_FRONTEND
+#if defined(ART_USE_DEXLANG_FRONTEND) || defined(ART_USE_QUICK_COMPILER)
dex_lang_ctx_ = new greenland::DexLang::Context(*module_);
#endif
+#if defined(ART_USE_QUICK_COMPILER)
+ compiler_ = NULL;
+ oat_compilation_unit_ = NULL;
+#endif
// Create IRBuilder
irb_.reset(new IRBuilder(*context_, *module_));
@@ -196,7 +204,7 @@
CompilationUnit::~CompilationUnit() {
-#ifdef ART_USE_DEXLANG_FRONTEND
+#if defined(ART_USE_DEXLANG_FRONTEND) || defined(ART_USE_QUICK_COMPILER)
delete dex_lang_ctx_;
#endif
}
@@ -316,15 +324,21 @@
if (bitcode_filename_.empty()) {
// If we don't need write the bitcode to file, add the AddSuspendCheckToLoopLatchPass to the
// regular FunctionPass.
-#ifdef ART_USE_DEXLANG_FRONTEND
+#if defined(ART_USE_DEXLANG_FRONTEND)
fpm.add(CreateGBCExpanderPass(dex_lang_ctx_->GetIntrinsicHelper(), *irb_.get()));
+#elif defined(ART_USE_QUICK_COMPILER)
+ fpm.add(CreateGBCExpanderPass(dex_lang_ctx_->GetIntrinsicHelper(), *irb_.get(),
+ compiler_, oat_compilation_unit_));
#endif
fpm.add(new ::AddSuspendCheckToLoopLatchPass(irb_.get()));
} else {
// Run AddSuspendCheckToLoopLatchPass before we write the bitcode to file.
llvm::FunctionPassManager fpm2(module_);
-#ifdef ART_USE_DEXLANG_FRONTEND
+#if defined(ART_USE_DEXLANG_FRONTEND)
fpm2.add(CreateGBCExpanderPass(dex_lang_ctx_->GetIntrinsicHelper(), *irb_.get()));
+#elif defined(ART_USE_QUICK_COMPILER)
+ fpm2.add(CreateGBCExpanderPass(dex_lang_ctx_->GetIntrinsicHelper(), *irb_.get(),
+ compiler_, oat_compilation_unit_));
#endif
fpm2.add(new ::AddSuspendCheckToLoopLatchPass(irb_.get()));
fpm2.doInitialization();