summaryrefslogtreecommitdiff
path: root/src/compiler_llvm/compilation_unit.cc
diff options
context:
space:
mode:
author Shih-wei Liao <sliao@google.com> 2012-08-23 13:20:00 -0700
committer Shih-wei Liao <sliao@google.com> 2012-09-15 04:51:24 -0700
commitbb33f2fa8e462937574a8cd1b744b86c2f762571 (patch)
tree45ac9bab7e86dc7533837e74bca37cdf0ab6141d /src/compiler_llvm/compilation_unit.cc
parentabc4c6bc6d5b54860810eb6e7205fd87cfa52636 (diff)
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
Diffstat (limited to 'src/compiler_llvm/compilation_unit.cc')
-rw-r--r--src/compiler_llvm/compilation_unit.cc24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/compiler_llvm/compilation_unit.cc b/src/compiler_llvm/compilation_unit.cc
index b5ff67cfff..eaa8be1d9d 100644
--- a/src/compiler_llvm/compilation_unit.cc
+++ b/src/compiler_llvm/compilation_unit.cc
@@ -150,10 +150,14 @@ llvm::RegisterPass<AddSuspendCheckToLoopLatchPass> reg_add_suspend_check_to_loop
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 @@ CompilationUnit::CompilationUnit(const CompilerLLVM* compiler_llvm,
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(const CompilerLLVM* compiler_llvm,
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 @@ bool CompilationUnit::MaterializeToRawOStream(llvm::raw_ostream& out_stream) {
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();