From bb33f2fa8e462937574a8cd1b744b86c2f762571 Mon Sep 17 00:00:00 2001 From: Shih-wei Liao Date: Thu, 23 Aug 2012 13:20:00 -0700 Subject: 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 --- src/compiler_llvm/compilation_unit.cc | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'src/compiler_llvm/compilation_unit.cc') 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 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(); -- cgit v1.2.3-59-g8ed1b